biopipen 0.34.13__py3-none-any.whl → 0.34.15__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.13"
1
+ __version__ = "0.34.15"
@@ -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.")
@@ -600,6 +600,28 @@ run_case <- function(name) {
600
600
 
601
601
  if (length(allenrich_plots) > 0 && !is.null(enriches) && nrow(enriches) > 0) {
602
602
  log$info("- Visualizing all enrichments together ...")
603
+ # add other metadata columns if any by mapping groupname
604
+ # only add the metadata columns from object if there is a single value mapped
605
+ metacols <- srtobj@meta.data %>% group_by(!!sym(each)) %>%
606
+ summarize(across(everything(), ~ n_distinct(.) == 1), .groups = "keep") %>%
607
+ select(where(~ all(. == TRUE))) %>%
608
+ colnames()
609
+
610
+ if (length(metacols) > 1) {
611
+ metadf <- srtobj@meta.data[, metacols, drop = FALSE] %>%
612
+ distinct(!!sym(each), .keep_all = TRUE)
613
+
614
+ for (col in setdiff(metacols, each)) {
615
+ if (col %in% colnames(enriches)) {
616
+ warning("Column name conflict: {col}, adding with suffix '_meta'", immediate. = TRUE)
617
+ metadf[[paste0(col, "_meta")]] <- metadf[[col]]
618
+ metadf[[col]] <- NULL
619
+ }
620
+ }
621
+
622
+ enriches <- left_join(enriches, metadf, by = each)
623
+ }
624
+
603
625
  process_allenriches(enriches, allenrich_plots, name, each)
604
626
  }
605
627
  }
@@ -607,8 +629,14 @@ run_case <- function(name) {
607
629
  return(invisible())
608
630
  }
609
631
 
610
- case$object <- if (is.null(subset_)) srtobj else filter(srtobj, !!parse_expr(subset_))
632
+ # Let RunSeuratDEAnalysis handle the subset
633
+ case$subset <- subset_
634
+ case$object <- srtobj
611
635
  markers <- do_call(RunSeuratDEAnalysis, case)
636
+ case$object <- NULL # Release memory
637
+ gc()
638
+
639
+ subobj <- if (is.null(subset_)) srtobj else filter(srtobj, !!parse_expr(subset_))
612
640
 
613
641
  if (is.null(case$ident_1)) {
614
642
  all_idents <- unique(as.character(markers[[case$group_by]]))
@@ -621,7 +649,7 @@ run_case <- function(name) {
621
649
 
622
650
  attr(ident_markers, "ident_1") <- ident
623
651
  enrich <- process_markers(ident_markers, info = info, case = list(
624
- object = case$object,
652
+ object = subobj,
625
653
  dbs = dbs,
626
654
  group_by = case$group_by,
627
655
  sigmarkers = sigmarkers,
@@ -638,7 +666,7 @@ run_case <- function(name) {
638
666
  log$info("- Visualizing all markers together ...")
639
667
  process_allmarkers(
640
668
  markers,
641
- object = case$object,
669
+ object = subobj,
642
670
  comparison_by = case$group_by,
643
671
  plotcases = allmarker_plots,
644
672
  casename = name,
@@ -653,12 +681,35 @@ run_case <- function(name) {
653
681
 
654
682
  if (length(allenrich_plots) > 0) {
655
683
  log$info("- Visualizing all enrichments together ...")
684
+ # add other metadata columns if any by mapping groupname
685
+ # only add the metadata columns from object if there is a single value mapped
686
+ metacols <- subobj@meta.data %>% group_by(!!sym(case$group_by)) %>%
687
+ summarize(across(everything(), ~ n_distinct(.) == 1), .groups = "keep") %>%
688
+ select(where(~ all(. == TRUE))) %>%
689
+ colnames()
690
+
691
+ if (length(metacols) > 1) {
692
+ metadf <- subobj@meta.data[, metacols, drop = FALSE] %>%
693
+ distinct(!!sym(case$group_by), .keep_all = TRUE)
694
+
695
+ for (col in setdiff(metacols, case$group_by)) {
696
+ if (col %in% colnames(enriches[[1]])) {
697
+ warning("Column name conflict: {col}, adding with suffix '_meta'", immediate. = TRUE)
698
+ metadf[[paste0(col, "_meta")]] <- metadf[[col]]
699
+ metadf[[col]] <- NULL
700
+ }
701
+ }
702
+
703
+ for (ne in names(enriches)) {
704
+ enriches[[ne]] <- left_join(enriches[[ne]], metadf, by = case$group_by)
705
+ }
706
+ }
656
707
  process_allenriches(enriches, allenrich_plots, name, case$group_by)
657
708
  }
658
709
  } else {
659
710
  info <- case_info(name, outdir, create = TRUE)
660
711
  enrich <- process_markers(markers, info = info, case = list(
661
- object = case$object,
712
+ object = subobj,
662
713
  dbs = dbs,
663
714
  group_by = case$group_by,
664
715
  sigmarkers = sigmarkers,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: biopipen
3
- Version: 0.34.13
3
+ Version: 0.34.15
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=wgMjsjpJp94VKXjF2z1Lam_lUNV2X8aqhQOuo-pcpZg,24
1
+ biopipen/__init__.py,sha256=Rz3xEpDF80HTbA8ImEKPXgpJjUW3trCJqVbTVpBlx44,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
@@ -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=4SVcjG9GjR_WvKjkbOsu0GBDUkFTIqo2z45_gqUhqog,26187
158
+ biopipen/scripts/scrna/MarkersFinder.R,sha256=SBh3cA2WZQIlZTysAlU-U9knzO9gU0XW-yi8mk2iJG4,28588
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
@@ -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.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,,
287
+ biopipen-0.34.15.dist-info/METADATA,sha256=ArJuTPoapr8eXqqyw0QMZkzalGdJLJED0QpmttmNSA0,1027
288
+ biopipen-0.34.15.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
289
+ biopipen-0.34.15.dist-info/entry_points.txt,sha256=BYqHGBQJxyFDNLYqgH64ycI5PYwnlqwYcCFsMvJgzAU,653
290
+ biopipen-0.34.15.dist-info/RECORD,,