biopipen 0.29.1__py3-none-any.whl → 0.29.2__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.29.1"
1
+ __version__ = "0.29.2"
@@ -70,7 +70,8 @@ if (defassay == "SCT" && !"PrepSCTFindMarkers" %in% names(srtobj@commands)) {
70
70
 
71
71
  srtobj <- PrepSCTFindMarkers(srtobj)
72
72
  # compose a new SeuratCommand to record it to srtobj@commands
73
- scommand <- srtobj@commands$FindClusters
73
+ commands <- names(srtobj@commands)
74
+ scommand <- srtobj@commands[[commands[length(commands)]]]
74
75
  scommand@name <- "PrepSCTFindMarkers"
75
76
  scommand@time.stamp <- Sys.time()
76
77
  scommand@assay.used <- "SCT"
@@ -36,6 +36,20 @@ set.seed(8525)
36
36
 
37
37
  log_info("- Reading Seurat object ...")
38
38
  srtobj <- readRDS(srtfile)
39
+ if (DefaultAssay(srtobj) == "SCT" && !"PrepSCTFindMarkers" %in% names(srtobj@commands)) {
40
+ log_warn("- SCTransform used but PrepSCTFindMarkers not applied, running ...")
41
+
42
+ srtobj <- PrepSCTFindMarkers(srtobj)
43
+ # compose a new SeuratCommand to record it to srtobj@commands
44
+ commands <- names(srtobj@commands)
45
+ scommand <- srtobj@commands[[commands[length(commands)]]]
46
+ scommand@name <- "PrepSCTFindMarkers"
47
+ scommand@time.stamp <- Sys.time()
48
+ scommand@assay.used <- "SCT"
49
+ scommand@call.string <- "PrepSCTFindMarkers(object = srtobj)"
50
+ scommand@params <- list()
51
+ srtobj@commands$PrepSCTFindMarkers <- scommand
52
+ }
39
53
 
40
54
  log_info("- Mutate meta data if needed ...")
41
55
  if (!is.null(mutaters) && length(mutaters)) {
@@ -79,13 +93,13 @@ expand_each <- function(name, case) {
79
93
  by = make.names(paste0("..", name, "_", case$each, "_", each))
80
94
  idents <- case$idents
81
95
  if (is.null(idents) || length(idents) == 0) {
82
- srtobj@meta.data = srtobj@meta.data %>%
96
+ srtobj@meta.data <<- srtobj@meta.data %>%
83
97
  mutate(
84
98
  !!sym(by) := if_else(!!sym(case$each) == each, !!sym(case$group_by), NA)
85
99
  )
86
100
  idents <- srtobj@meta.data %>% pull(case$group_by) %>% unique() %>% na.omit()
87
101
  } else {
88
- srtobj@meta.data = srtobj@meta.data %>%
102
+ srtobj@meta.data <<- srtobj@meta.data %>%
89
103
  mutate(
90
104
  !!sym(by) := if_else(
91
105
  !!sym(case$each) == each & !!sym(case$group_by) %in% case$idents,
@@ -204,6 +218,10 @@ do_case <- function(casename) {
204
218
  if (is.null(df)) {
205
219
  msg <- "No markers found. May be due to too few cells or features."
206
220
  } else {
221
+ df <- df[
222
+ apply(df, 1, function(x) !all(is.na(x)) && !all(x == x[1])), ,
223
+ drop = FALSE
224
+ ]
207
225
  genes <- rownames(df)
208
226
  # rows: cells, cols: genes
209
227
  df <- cbind(as.data.frame(scale(Matrix::t(df))), sobj@meta.data[, case$group_by])
@@ -75,6 +75,7 @@ do_one_features = function(name) {
75
75
  Idents(case$object) = case$ident
76
76
  }
77
77
  n_uidents = length(unique(Idents(case$object)))
78
+ max_nchar_idents = max(nchar(unique(as.character(Idents(case$object)))))
78
79
 
79
80
  fn = NULL
80
81
  default_devpars = NULL
@@ -97,13 +98,14 @@ do_one_features = function(name) {
97
98
  case$kind = "violin"
98
99
  if (is.null(case$cols)) { case$cols = pal_biopipen()(n_uidents) }
99
100
  if (is.null(case$pt.size)) { case$pt.size = 0 }
101
+
100
102
  excluded_args = c(excluded_args, "reduction")
101
103
  fn = VlnPlot
102
104
  default_devpars = function(features, ncol) {
103
105
  if (is.null(ncol)) { ncol = 1 }
104
106
  list(
105
107
  width = 400 * ncol,
106
- height = ceiling(length(features) / ncol) * 200,
108
+ height = ceiling(length(features) / ncol + max_nchar_idents * .05) * 150,
107
109
  res = 100
108
110
  )
109
111
  }
@@ -139,8 +139,11 @@ do_one_subset <- function(s, subset_col, subset_prefix) {
139
139
  if (any(unlist(lapply(x, class)) == "try-error")) {
140
140
  stop("mclapply error")
141
141
  }
142
-
143
- for (r in x) { do.call(add_report, r) }
142
+ for (r in x) {
143
+ if (!is.null(r)) {
144
+ do.call(add_report, r)
145
+ }
146
+ }
144
147
  }
145
148
 
146
149
  do_one_subset_col <- function(subset_col, subset_prefix) {
@@ -184,6 +184,10 @@ if (ncores == 1) {
184
184
  }
185
185
  }
186
186
  report = unlist(x, recursive = FALSE)
187
- for (r in report) { do.call(add_report, r) }
187
+ for (r in report) {
188
+ if (!is.null(r)) {
189
+ do.call(add_report, r)
190
+ }
191
+ }
188
192
 
189
193
  save_report(joboutdir)
@@ -35,9 +35,20 @@ if (!is.null(fmlfile)) {
35
35
 
36
36
  args <- args %||% list()
37
37
 
38
- medanalysis = function(casename) {
38
+ medanalysis <- function(i, total) {
39
+ casename <- names(cases)[i]
39
40
  case <- cases[[casename]]
40
- log_info("- Case:", casename)
41
+ if (total < 50) {
42
+ log_info("- Case: ", casename)
43
+ } else if (total < 500) {
44
+ if (i %% 10 == 0) {
45
+ log_info("- Processing case {i}/{total} ...")
46
+ }
47
+ } else {
48
+ if (i %% 100 == 0) {
49
+ log_info("- Processing case {i}/{total} ...")
50
+ }
51
+ }
41
52
  M <- case$M
42
53
  Y <- case$Y
43
54
  X <- case$X
@@ -85,7 +96,8 @@ medanalysis = function(casename) {
85
96
  }
86
97
  }
87
98
 
88
- out <- do_call(rbind, mclapply(names(cases), medanalysis, mc.cores = ncores))
99
+ total <- length(cases)
100
+ out <- do_call(rbind, mclapply(1:total, medanalysis, total = total, mc.cores = ncores))
89
101
 
90
102
  if (padj != "none") {
91
103
  out$Padj <- p.adjust(out$Pval, method = padj)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: biopipen
3
- Version: 0.29.1
3
+ Version: 0.29.2
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=QTaZs8dGSlxK5ryfzkJ2KhyNkszMPGsEYfsjGAbckck,23
1
+ biopipen/__init__.py,sha256=f5--I8wu8KDVcUAUM1dKof58bj59kV6atq2ccm3sqPs,23
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=IL31RfhuF-6V46lvLs1F-Z4SPmUuTvWzk5PN37Xjrqc,1907
@@ -143,15 +143,15 @@ biopipen/scripts/scrna/ExprImputation-alra.R,sha256=w3W1txJcdWg52-SETY2Z0lO7maDN
143
143
  biopipen/scripts/scrna/ExprImputation-rmagic.R,sha256=jYIfqZpnvjKJkvItLnemPVtUApHBYQi1_L8rHVbEe1M,735
144
144
  biopipen/scripts/scrna/ExprImputation-scimpute.R,sha256=mg40qCUW7-nP5oHPvARq7dmtoahM0GRFWXQpum0BXVk,1082
145
145
  biopipen/scripts/scrna/ExprImputation.R,sha256=GcdZJpkDpq88hRQjtLZY5-byp8V43stEFm5T-pQbU6A,319
146
- biopipen/scripts/scrna/MarkersFinder.R,sha256=WN3YRaU5g58JNN8LB8BLonQg4YAVzxEBpCXNLbtkngs,22894
147
- biopipen/scripts/scrna/MetaMarkers.R,sha256=9ve1X0TrDzS_ZEW6HtU3n8R-uPx7q-hYMMNFVDSE8wQ,11272
146
+ biopipen/scripts/scrna/MarkersFinder.R,sha256=6CjciBZsVUIjsEe_xpO0s5K-uy2kKa1c76Ks_lndX-g,22950
147
+ biopipen/scripts/scrna/MetaMarkers.R,sha256=xb1dt4N-ra26l6pWmL4Ieix0MB6QOU7CDcxufMZE3Xk,12064
148
148
  biopipen/scripts/scrna/ModuleScoreCalculator.R,sha256=JSHd-_-KiFqW8avCGxgU4T-C5BtDr2u0kwIvEu2lFIg,4188
149
149
  biopipen/scripts/scrna/RadarPlots.R,sha256=TGPUTUcHOHgd9rsNtLYT-N6WHiFNDBZsiIoqkyAJh0A,13020
150
150
  biopipen/scripts/scrna/SCImpute.R,sha256=dSJOHhmJ3x_72LBRXT72dbCti5oiB85CJ-OjWtqONbk,2958
151
151
  biopipen/scripts/scrna/ScFGSEA.R,sha256=2UCTCIydVkPGvn7WP-_fcE7857iKKDxY56-j-ruyO8o,6254
152
152
  biopipen/scripts/scrna/Seurat2AnnData.R,sha256=qz4u-B5J3GMwttubnNnByJXreziFbrP5Mak0L0q7eG0,1557
153
153
  biopipen/scripts/scrna/SeuratClusterStats-dimplots.R,sha256=gViDgQ8NorYD64iK0FgcODOrDOw0tExZmhuPRuLNp4g,2354
154
- biopipen/scripts/scrna/SeuratClusterStats-features.R,sha256=W7iYhaFsC5EMZLO50QukYPLYGK4bq9kQc1VT5FwvI68,15496
154
+ biopipen/scripts/scrna/SeuratClusterStats-features.R,sha256=Cg7fVdDnapS98ak9z2Ha77CLqBkNJ4IYX1q1ssfGNeU,15599
155
155
  biopipen/scripts/scrna/SeuratClusterStats-hists.R,sha256=YhuD-GePjJPSkR0iLRgV_hiGHD_bnOIKp-LB6GCwquo,5037
156
156
  biopipen/scripts/scrna/SeuratClusterStats-ngenes.R,sha256=GVKIXFNS_syCuSN8oxoBkjxxAeI5LdSxh-qLVkUsbDA,2146
157
157
  biopipen/scripts/scrna/SeuratClusterStats-stats.R,sha256=bBbvNCvV6dZLg9zvhh2nR48_53md5A5UEqrPXD00MZU,9263
@@ -170,8 +170,8 @@ biopipen/scripts/scrna/Subset10X.R,sha256=T2nJBTwOe12AIKC2FZsMSv6xx3s-67CYZokpz5
170
170
  biopipen/scripts/scrna/TopExpressingGenes.R,sha256=kXMCYHVytgVgO_Uq66fKKFCFV2PPXE8VREy_0yYPLpU,7475
171
171
  biopipen/scripts/scrna/celltypist-wrapper.py,sha256=f5M8f4rU5nC7l17RS0YVmUPpLLz4D6PIcgWtA77UExM,1722
172
172
  biopipen/scripts/scrna/sctype.R,sha256=NaUJkABwF5G1UVm1CCtcMbwLSj94Mo24mbYCKFqo1Bw,6524
173
- biopipen/scripts/scrna_metabolic_landscape/MetabolicFeatures.R,sha256=sOnHSH0Ld-tXSIXJPnXLYgRtEru5M0g3HRxbrHWQ_0U,5170
174
- biopipen/scripts/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.R,sha256=RPSxEHWk50Fyw5YPBVVGeWwd55Hi0zjbipLuM5O4tjs,5465
173
+ biopipen/scripts/scrna_metabolic_landscape/MetabolicFeatures.R,sha256=EFUhI65cPEktZnZquzfVoJcBd_pNcT5jag5XOWHj-Os,5222
174
+ biopipen/scripts/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.R,sha256=jeTuhWEn2ajL1ZmGpCBy7cBSd1d387P-YetnB6qjhxc,5502
175
175
  biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayActivity.R,sha256=95DLX1Rz0tobOuDZ8V9YdGgO0KiNthhccoeeOK21tno,16216
176
176
  biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.R,sha256=rQ9iwGh9FNRZlJJzM4QItdyXmebfzLAq05ZAjb1kGUw,9831
177
177
  biopipen/scripts/snp/MatrixEQTL.R,sha256=QPnUW7Rk5UrAQLiBg9FdCItUC26RDBHf7UrfL66dMto,7202
@@ -188,7 +188,7 @@ biopipen/scripts/snp/PlinkUpdateName.py,sha256=sYyb0ek46wRQfclFfoJEhQyQ-zWsFd2xp
188
188
  biopipen/scripts/stats/ChowTest.R,sha256=4p7NULmfOZSfeBSQ04els0h3cXOK5yeCJJ4-gEBPOGk,3617
189
189
  biopipen/scripts/stats/DiffCoexpr.R,sha256=5hQDV2_7bKdKUsOGMZUa0GS5rc7kFspxonNyFEPmtbc,4516
190
190
  biopipen/scripts/stats/LiquidAssoc.R,sha256=s-XJbFoOfH4eWSkxbbOSHZ1x16lY0Sdod_V1KvSkM8k,3727
191
- biopipen/scripts/stats/Mediation.R,sha256=lqMOrIxRqbEhQipZJ-VE8qQSJn0MI910Vl6DIVyHyNE,2825
191
+ biopipen/scripts/stats/Mediation.R,sha256=jf7ORVbbd9wtEOEJRLowKexQCkOhFmc4v5kkPsNqWpY,3160
192
192
  biopipen/scripts/stats/MetaPvalue.R,sha256=fnqayZeHd61cP9PxZZAebg5lE7JQgFG5MElCct43S1M,4012
193
193
  biopipen/scripts/stats/MetaPvalue1.R,sha256=falhaOeoa8E7ZbddXfGsSdim5P7eQvA7RFGD7XSrBUk,1733
194
194
  biopipen/scripts/tcgamaf/Maf2Vcf.py,sha256=Cxh7fiSNCxWDTfIJqZDOOnaSrw-85S_fH2U-PWY03hc,704
@@ -269,7 +269,7 @@ biopipen/utils/reference.py,sha256=oi5evicLwHxF0KAIPNZohBeHJLJQNWFJH0cr2y5pgcg,5
269
269
  biopipen/utils/rnaseq.R,sha256=Ro2B2dG-Z2oVaT5tkwp9RHBz4dp_RF-JcizlM5GYXFs,1298
270
270
  biopipen/utils/single_cell.R,sha256=pJjYP8bIZpNAtTQ32rOXhZxaM1Y-6D-xUcK3pql9tbk,4316
271
271
  biopipen/utils/vcf.py,sha256=ajXs0M_QghEctlvUlSRjWQIABVF02wPdYd-0LP4mIsU,9377
272
- biopipen-0.29.1.dist-info/METADATA,sha256=62K0OT3uiUi6Gnt0WGHGaox3WNV7hsbUsg60iPCc4nU,882
273
- biopipen-0.29.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
274
- biopipen-0.29.1.dist-info/entry_points.txt,sha256=69SbeMaF47Z2DS40yo-qDyoBKmMmumrNnsjEZMOioCE,625
275
- biopipen-0.29.1.dist-info/RECORD,,
272
+ biopipen-0.29.2.dist-info/METADATA,sha256=9tT8IW-AiQXwRLIzbARle_vaYVL7h5f_wyEwq8ZAHA8,882
273
+ biopipen-0.29.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
274
+ biopipen-0.29.2.dist-info/entry_points.txt,sha256=69SbeMaF47Z2DS40yo-qDyoBKmMmumrNnsjEZMOioCE,625
275
+ biopipen-0.29.2.dist-info/RECORD,,