biopipen 0.34.12__py3-none-any.whl → 0.34.14__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.14"
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"},
@@ -111,7 +111,8 @@ if (file.exists(celltypist_outfile) &&
111
111
  command <- paste(command, "-v")
112
112
  }
113
113
  log$info("Running celltypist:")
114
- print("- {command}")
114
+ # print("- {command}")
115
+ log$debug(" {command}")
115
116
  rc <- system(command)
116
117
  if (rc != 0) {
117
118
  stop("Failed to run celltypist. Check the job.stderr file to see the error message.")
@@ -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,11 +607,15 @@ run_case <- function(name) {
598
607
  return(invisible())
599
608
  }
600
609
 
610
+ # Let RunSeuratDEAnalysis handle the subset
611
+ case$subset <- subset_
601
612
  case$object <- srtobj
602
613
  markers <- do_call(RunSeuratDEAnalysis, case)
603
- case$object <- NULL
614
+ case$object <- NULL # Release memory
604
615
  gc()
605
616
 
617
+ subobj <- if (is.null(subset_)) srtobj else filter(srtobj, !!parse_expr(subset_))
618
+
606
619
  if (is.null(case$ident_1)) {
607
620
  all_idents <- unique(as.character(markers[[case$group_by]]))
608
621
  enriches <- list()
@@ -614,7 +627,9 @@ run_case <- function(name) {
614
627
 
615
628
  attr(ident_markers, "ident_1") <- ident
616
629
  enrich <- process_markers(ident_markers, info = info, case = list(
630
+ object = subobj,
617
631
  dbs = dbs,
632
+ group_by = case$group_by,
618
633
  sigmarkers = sigmarkers,
619
634
  enrich_style = enrich_style,
620
635
  marker_plots = marker_plots,
@@ -627,7 +642,14 @@ run_case <- function(name) {
627
642
 
628
643
  if (length(allmarker_plots) > 0) {
629
644
  log$info("- Visualizing all markers together ...")
630
- process_allmarkers(markers, allmarker_plots, name, case$group_by)
645
+ process_allmarkers(
646
+ markers,
647
+ object = subobj,
648
+ comparison_by = case$group_by,
649
+ plotcases = allmarker_plots,
650
+ casename = name,
651
+ groupname = case$group_by,
652
+ subset_by_group = FALSE)
631
653
  }
632
654
 
633
655
  if (length(overlaps) > 0) {
@@ -642,7 +664,9 @@ run_case <- function(name) {
642
664
  } else {
643
665
  info <- case_info(name, outdir, create = TRUE)
644
666
  enrich <- process_markers(markers, info = info, case = list(
667
+ object = subobj,
645
668
  dbs = dbs,
669
+ group_by = case$group_by,
646
670
  sigmarkers = sigmarkers,
647
671
  enrich_style = enrich_style,
648
672
  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.14
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=EumHAzPCe3UipaK_9iqfQf47_8LP5jWSnXBVUZmzQTA,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
@@ -142,7 +142,7 @@ biopipen/scripts/scrna/AnnData2Seurat.R,sha256=wc5PDbK9TkuJtoXXxF4W1ODylWhyfKWd3
142
142
  biopipen/scripts/scrna/CCPlotR-patch.R,sha256=KpB8fwacBaWaUNjIidcLUkMShLjS4Gq9UY8LUgIITB0,8369
143
143
  biopipen/scripts/scrna/CellCellCommunication.py,sha256=LnEuV8YHOJSYM7Tb_jwLbTQdMSpJw5ChRIiLktcJzSQ,4471
144
144
  biopipen/scripts/scrna/CellCellCommunicationPlots.R,sha256=IcqqhVWasSE54PDWaw85u5_yup_YHVNNwZI7oOy9250,2456
145
- biopipen/scripts/scrna/CellTypeAnnotation-celltypist.R,sha256=CwYR8WWQMf8r7V2CTalG4kxdKnYMtyhpJBe9zP2sQWA,6964
145
+ biopipen/scripts/scrna/CellTypeAnnotation-celltypist.R,sha256=FqxVHFNUC7tcOeA5I_IcxzxU0WDLKZrKObgq2PwaVS8,6995
146
146
  biopipen/scripts/scrna/CellTypeAnnotation-direct.R,sha256=jwjSBql66ku11b4O_7bIs9zuwbqHiGgrAFDk1tSbwg4,3111
147
147
  biopipen/scripts/scrna/CellTypeAnnotation-hitype.R,sha256=vvjhxin4aoA9heecey0dpr6ofirybygY3ApjgtQW89Y,2094
148
148
  biopipen/scripts/scrna/CellTypeAnnotation-sccatch.R,sha256=xxB4K1MzBSNQnDxa44s5ExeU67MbncOBf8lGFr7RvwQ,1870
@@ -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=nz18T_70ni9sfoFYp8weQMCiojphF61l5yHe9f_gOSM,26320
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.14.dist-info/METADATA,sha256=uIS3ZdJr3bVM1TspZIe2NmoVavOa_XGKe4qsuRk7gdw,1027
288
+ biopipen-0.34.14.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
289
+ biopipen-0.34.14.dist-info/entry_points.txt,sha256=BYqHGBQJxyFDNLYqgH64ycI5PYwnlqwYcCFsMvJgzAU,653
290
+ biopipen-0.34.14.dist-info/RECORD,,