biopipen 0.34.12__py3-none-any.whl → 0.34.13__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of biopipen might be problematic. Click here for more details.

biopipen/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.34.12"
1
+ __version__ = "0.34.13"
biopipen/ns/scrna.py CHANGED
@@ -1097,8 +1097,6 @@ class MarkersFinder(Proc):
1097
1097
  - res (type=int): The resolution of the plots.
1098
1098
  - height (type=int): The height of the plots.
1099
1099
  - width (type=int): The width of the plots.
1100
- - order_by: an expression to order the markers, passed by `dplyr::arrange()`.
1101
- - genes: The number of top genes to show or an expression passed to `dplyr::filter()` to filter the genes.
1102
1100
  - <more>: Other arguments passed to [`biopipen.utils::VizDEGs()`](https://pwwang.github.io/biopipen.utils.R/reference/VizDEGs.html).
1103
1101
  allmarker_plots (type=json): All marker plot cases.
1104
1102
  The keys are the names of the cases and the values are the dicts inherited from `allmarker_plots_defaults`.
@@ -1123,8 +1121,6 @@ class MarkersFinder(Proc):
1123
1121
  - res (type=int): The resolution of the plots.
1124
1122
  - height (type=int): The height of the plots.
1125
1123
  - width (type=int): The width of the plots.
1126
- - order_by: an expression to order the markers, passed by `dplyr::arrange()`.
1127
- - genes: The number of top genes to show or an expression passed to `dplyr::filter()` to filter the genes.
1128
1124
  - <more>: Other arguments passed to [`biopipen.utils::VizDEGs()`](https://pwwang.github.io/biopipen.utils.R/reference/VizDEGs.html).
1129
1125
  If `plot_type` is `volcano_pct` or `volcano_log2fc`, they will be passed to
1130
1126
  [`scplotter::VolcanoPlot()`](https://pwwang.github.io/plotthis/reference/VolcanoPlot.html).
@@ -1196,8 +1192,6 @@ class MarkersFinder(Proc):
1196
1192
  "more_formats": [],
1197
1193
  "save_code": False,
1198
1194
  "devpars": {"res": 100},
1199
- "order_by": "desc(abs(avg_log2FC))",
1200
- "genes": 10,
1201
1195
  },
1202
1196
  "allmarker_plots": {},
1203
1197
  "allenrich_plots_defaults": {
@@ -1210,8 +1204,6 @@ class MarkersFinder(Proc):
1210
1204
  "more_formats": [],
1211
1205
  "save_code": False,
1212
1206
  "devpars": {"res": 100},
1213
- "order_by": "desc(abs(avg_log2FC))",
1214
- "genes": 10,
1215
1207
  },
1216
1208
  "marker_plots": {
1217
1209
  "Volcano Plot (diff_pct)": {"plot_type": "volcano_pct"},
@@ -271,8 +271,9 @@ process_markers <- function(markers, info, case) {
271
271
  if (nrow(markers) > 0) {
272
272
  for (plotname in names(case$marker_plots)) {
273
273
  plotargs <- case$marker_plots[[plotname]]
274
- plotargs$degs <- markers
275
- rownames(plotargs$degs) <- make.unique(markers$gene)
274
+ plotargs$markers <- markers
275
+ plotargs$object <- case$object
276
+ plotargs$comparison_by <- case$group_by
276
277
  plotargs$outprefix <- file.path(info$prefix, paste0("markers.", slugify(plotname)))
277
278
  do_call(VizDEGs, plotargs)
278
279
  reporter$add2(
@@ -401,18 +402,18 @@ process_markers <- function(markers, info, case) {
401
402
  }
402
403
  }
403
404
 
404
- process_allmarkers <- function(markers, plotcases, casename, groupname) {
405
+ process_allmarkers <- function(markers, object, comparison_by, plotcases, casename, groupname, subset_by_group = TRUE) {
405
406
  name <- paste0(casename, "::", paste0(groupname, " (All Markers)"))
406
407
  info <- case_info(name, outdir, create = TRUE)
407
408
 
408
409
  for (plotname in names(plotcases)) {
409
410
  plotargs <- plotcases[[plotname]]
410
- plotargs$degs <- markers
411
+ plotargs$markers <- markers
412
+ plotargs$object <- object
413
+ plotargs$comparison_by <- comparison_by
414
+ if (subset_by_group)
415
+ plotargs$subset_by <- groupname
411
416
  plotargs$outprefix <- file.path(info$prefix, slugify(plotname))
412
- if (identical(plotargs$plot_type, "heatmap")) {
413
- plotargs$show_row_names = plotargs$show_row_names %||% TRUE
414
- plotargs$show_column_names = plotargs$show_column_names %||% TRUE
415
- }
416
417
  do_call(VizDEGs, plotargs)
417
418
  reporter$add2(
418
419
  list(
@@ -529,6 +530,7 @@ run_case <- function(name) {
529
530
  case,
530
531
  "dbs", "sigmarkers", "allmarker_plots", "allenrich_plots", "marker_plots", "enrich_plots",
531
532
  "overlaps", "original_case", "markers", "enriches", "each_name", "each", "enrich_style", "original_subset",
533
+ subset_ = "subset",
532
534
  allow_nonexisting = TRUE
533
535
  )
534
536
 
@@ -562,7 +564,14 @@ run_case <- function(name) {
562
564
  attr(markers, "ident_1") <- NULL
563
565
  attr(markers, "ident_2") <- NULL
564
566
  if (!is.null(markers) && nrow(markers) > 0) {
565
- process_allmarkers(markers, allmarker_plots, name, each)
567
+ process_allmarkers(
568
+ markers,
569
+ object = if (is.null(original_subset)) srtobj else filter(srtobj, !!parse_expr(original_subset)),
570
+ comparison_by = group_by,
571
+ allmarker_plots,
572
+ name,
573
+ each
574
+ )
566
575
  }
567
576
  }
568
577
 
@@ -598,10 +607,8 @@ run_case <- function(name) {
598
607
  return(invisible())
599
608
  }
600
609
 
601
- case$object <- srtobj
610
+ case$object <- if (is.null(subset_)) srtobj else filter(srtobj, !!parse_expr(subset_))
602
611
  markers <- do_call(RunSeuratDEAnalysis, case)
603
- case$object <- NULL
604
- gc()
605
612
 
606
613
  if (is.null(case$ident_1)) {
607
614
  all_idents <- unique(as.character(markers[[case$group_by]]))
@@ -614,7 +621,9 @@ run_case <- function(name) {
614
621
 
615
622
  attr(ident_markers, "ident_1") <- ident
616
623
  enrich <- process_markers(ident_markers, info = info, case = list(
624
+ object = case$object,
617
625
  dbs = dbs,
626
+ group_by = case$group_by,
618
627
  sigmarkers = sigmarkers,
619
628
  enrich_style = enrich_style,
620
629
  marker_plots = marker_plots,
@@ -627,7 +636,14 @@ run_case <- function(name) {
627
636
 
628
637
  if (length(allmarker_plots) > 0) {
629
638
  log$info("- Visualizing all markers together ...")
630
- process_allmarkers(markers, allmarker_plots, name, case$group_by)
639
+ process_allmarkers(
640
+ markers,
641
+ object = case$object,
642
+ comparison_by = case$group_by,
643
+ plotcases = allmarker_plots,
644
+ casename = name,
645
+ groupname = case$group_by,
646
+ subset_by_group = FALSE)
631
647
  }
632
648
 
633
649
  if (length(overlaps) > 0) {
@@ -642,7 +658,9 @@ run_case <- function(name) {
642
658
  } else {
643
659
  info <- case_info(name, outdir, create = TRUE)
644
660
  enrich <- process_markers(markers, info = info, case = list(
661
+ object = case$object,
645
662
  dbs = dbs,
663
+ group_by = case$group_by,
646
664
  sigmarkers = sigmarkers,
647
665
  enrich_style = enrich_style,
648
666
  marker_plots = marker_plots,
@@ -107,7 +107,12 @@ do_one_features <- function(name) {
107
107
  caching$restore()
108
108
  } else {
109
109
  case$features <- .get_features(features, case$object)
110
- p <- do_call(gglogger::register(FeatureStatPlot), case)
110
+ p <- tryCatch({
111
+ do_call(gglogger::register(FeatureStatPlot), case)
112
+ }, error = function(e) {
113
+ if (save_code) { stop(e) }
114
+ do_call(FeatureStatPlot, case)
115
+ })
111
116
  save_plot(p, info$prefix, devpars, formats = c("png", more_formats))
112
117
  if (save_code) {
113
118
  save_plotcode(p, info$prefix,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: biopipen
3
- Version: 0.34.12
3
+ Version: 0.34.13
4
4
  Summary: Bioinformatics processes/pipelines that can be run from `pipen run`
5
5
  License: MIT
6
6
  Author: pwwang
@@ -1,4 +1,4 @@
1
- biopipen/__init__.py,sha256=HrphpHL7XwXAzTz1RdzYzTTXdA0Tl5ZtQnsmI6sI8bo,24
1
+ biopipen/__init__.py,sha256=wgMjsjpJp94VKXjF2z1Lam_lUNV2X8aqhQOuo-pcpZg,24
2
2
  biopipen/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  biopipen/core/config.py,sha256=edK5xnDhM8j27srDzsxubi934NMrglLoKrdcC8qsEPk,1069
4
4
  biopipen/core/config.toml,sha256=lZV_vbYWk6uqm19ZWJcsZCcSNqAdIfN2fOfamzxZpg4,2148
@@ -22,7 +22,7 @@ biopipen/ns/plot.py,sha256=N41_izb6zi-XArUly5WhLebapNXbTNSgGlOCCwtrDlY,18282
22
22
  biopipen/ns/protein.py,sha256=YJtlKoHI2p5yHdxKeQnNtm5QrbxDGOq1UXOdt_7tlTs,6391
23
23
  biopipen/ns/regulatory.py,sha256=WlnX_R8jEFyxCjk8mru5Qu5iCQJLzjMWiWGoc3gygzc,16221
24
24
  biopipen/ns/rnaseq.py,sha256=bKAa6friFWof4yDTWZQahm1MS-lrdetO1GqDKdfxXYc,7708
25
- biopipen/ns/scrna.py,sha256=i3LNPJtr3qZeweMnp7Z4x31oRYwkp6KsQrst4epOWEU,146288
25
+ biopipen/ns/scrna.py,sha256=yWG6oQ1XXzhr-GYOouiC_4aEwmi7XS8RW265XWsoqhw,145722
26
26
  biopipen/ns/scrna_metabolic_landscape.py,sha256=EwLMrsj_pTqvyAgtHLoishjQxCg_j8n5OofuTofUph0,22096
27
27
  biopipen/ns/snp.py,sha256=iXWrw7Lmhf4_ct57HGT7JGTClCXUD4sZ2FzOgsC2pTg,28123
28
28
  biopipen/ns/stats.py,sha256=DlPyK5Vsg6ZEkV9SDS3aAw21eXzvOHgqeZDkXPhg7go,20509
@@ -155,7 +155,7 @@ biopipen/scripts/scrna/ExprImputation-rmagic.R,sha256=ePgbMZ_3bKbeUrjsMdkdtBM_MS
155
155
  biopipen/scripts/scrna/ExprImputation-scimpute.R,sha256=MI_bYfvCDKJsuGntUxfx_-NdrssBoQgL95-DGwJVE5s,1191
156
156
  biopipen/scripts/scrna/ExprImputation.R,sha256=GcdZJpkDpq88hRQjtLZY5-byp8V43stEFm5T-pQbU6A,319
157
157
  biopipen/scripts/scrna/LoomTo10X.R,sha256=c6F0p1udsL5UOlb84-53K5BsjSDWkdFyYTt5NQmlIec,1059
158
- biopipen/scripts/scrna/MarkersFinder.R,sha256=qBVdxO8cKTJMtGyJLl2QGRrtdiXOJSLXu6rpZUPkDZk,25437
158
+ biopipen/scripts/scrna/MarkersFinder.R,sha256=4SVcjG9GjR_WvKjkbOsu0GBDUkFTIqo2z45_gqUhqog,26187
159
159
  biopipen/scripts/scrna/MetaMarkers.R,sha256=BgYaWYEj6obwqaZaDWqNPtxb1IEEAnXAeBE0Ji9PvBA,12426
160
160
  biopipen/scripts/scrna/ModuleScoreCalculator.R,sha256=_mvo35a-wk5miUb_kMIVwvKK0b6InRa1NKtN8zznGwk,4457
161
161
  biopipen/scripts/scrna/PseudoBulkDEG.R,sha256=IuM4hl-KHZ5aaaTqZeylw4b1ZenMZaY4qobD5qxAlHs,25199
@@ -167,7 +167,7 @@ biopipen/scripts/scrna/ScVelo.py,sha256=SPUZFgZW1Zhw-bnjJo98RK0vpuNFODQ8Q3eTguNc
167
167
  biopipen/scripts/scrna/Seurat2AnnData.R,sha256=F8g5n2CqX4-KBggxd8ittz8TejYuqqNLMudAHdFt1QM,184
168
168
  biopipen/scripts/scrna/SeuratClusterStats-clustree.R,sha256=K2pRNe3qFjTJY3VL4EQFxoU1Lzp5DUavhcfx6HZk2J8,3954
169
169
  biopipen/scripts/scrna/SeuratClusterStats-dimplots.R,sha256=2YNUxPz1xwND9yrOtBZ75u-wwnmkJUkoUyeBlJvBWKQ,1541
170
- biopipen/scripts/scrna/SeuratClusterStats-features.R,sha256=G-4wNGGZPCEXup1u9dQwSQ6P-oZVRU_faFMoXfAn6i8,7320
170
+ biopipen/scripts/scrna/SeuratClusterStats-features.R,sha256=8GtL7ysCacCpnt2vrkAfC47k1N-x3jhUSf-ZxOFIf60,7469
171
171
  biopipen/scripts/scrna/SeuratClusterStats-ngenes.R,sha256=BN8HSl1HoZp8ibESaCVEJPCBWzmu1AFLMgW5ZeZphS0,3077
172
172
  biopipen/scripts/scrna/SeuratClusterStats-stats.R,sha256=xu256GS80jV8kZePn7qFncK58dYSHzaQY3_SDnuxv6E,3598
173
173
  biopipen/scripts/scrna/SeuratClusterStats.R,sha256=ITFqh7p1ggtDXzVxbBEO2TcdOw4dA6oGhL5m7hFAQmU,1838
@@ -284,7 +284,7 @@ biopipen/utils/misc.py,sha256=pDZ-INWVNqHuXYvcjmu8KqNAigkh2lsHy0BxX44CPvc,4048
284
284
  biopipen/utils/reference.py,sha256=Oc6IlA1giLxymAuI7DO-IQLHQ7-DbsWzOQE86oTDfMU,5955
285
285
  biopipen/utils/reporter.py,sha256=VwLl6xyVDWnGY7NEXyqBlkW8expKJoNQ5iTyZSELf5c,4922
286
286
  biopipen/utils/vcf.py,sha256=MmMbAtLUcKPp02jUdk9TzuET2gWSeoWn7xgoOXFysK0,9393
287
- biopipen-0.34.12.dist-info/METADATA,sha256=r62XsxYiMKsDivaqL_tamLQ5GRnOrI_-3ssfjg9ugcA,1027
288
- biopipen-0.34.12.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
289
- biopipen-0.34.12.dist-info/entry_points.txt,sha256=BYqHGBQJxyFDNLYqgH64ycI5PYwnlqwYcCFsMvJgzAU,653
290
- biopipen-0.34.12.dist-info/RECORD,,
287
+ biopipen-0.34.13.dist-info/METADATA,sha256=0G3Xs0cXYh9cnRf4y8g7rjznqdxB_VxqfZUEiEK3bfo,1027
288
+ biopipen-0.34.13.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
289
+ biopipen-0.34.13.dist-info/entry_points.txt,sha256=BYqHGBQJxyFDNLYqgH64ycI5PYwnlqwYcCFsMvJgzAU,653
290
+ biopipen-0.34.13.dist-info/RECORD,,