biopipen 0.23.7__py3-none-any.whl → 0.23.8__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.23.7"
1
+ __version__ = "0.23.8"
biopipen/ns/scrna.py CHANGED
@@ -1463,6 +1463,7 @@ class ScFGSEA(Proc):
1463
1463
  ident-1: The first group of cells to compare
1464
1464
  ident-2: The second group of cells to compare, if not provided, the rest of the cells that are not `NA`s in `group-by` column are used for `ident-2`.
1465
1465
  each: The column name in metadata to separate the cells into different subsets to do the analysis.
1466
+ subset: An expression to subset the cells.
1466
1467
  section: The section name for the report. Worked only when `each` is not specified. Otherwise, the section name will be constructed from `each` and its value.
1467
1468
  This allows different cases to be put into the same section in the report.
1468
1469
  gmtfile: The pathways in GMT format, with the gene names/ids in the same format as the seurat object.
@@ -1513,6 +1514,7 @@ class ScFGSEA(Proc):
1513
1514
  "ident-1": None,
1514
1515
  "ident-2": None,
1515
1516
  "each": None,
1517
+ "subset": None,
1516
1518
  "section": "DEFAULT",
1517
1519
  "gmtfile": "",
1518
1520
  "method": "s2n",
@@ -14,6 +14,7 @@ group.by <- {{envs["group-by"] | r}} # nolint
14
14
  ident.1 <- {{envs["ident-1"] | r}} # nolint
15
15
  ident.2 <- {{envs["ident-2"] | r}} # nolint
16
16
  each <- {{envs.each | r}} # nolint
17
+ subset <- {{envs.subset | r}} # nolint
17
18
  section <- {{envs.section | r}} # nolint
18
19
  gmtfile <- {{envs.gmtfile | r}} # nolint
19
20
  method <- {{envs.method | r}} # nolint
@@ -43,6 +44,7 @@ expand_cases <- function() {
43
44
  ident.1 = ident.1,
44
45
  ident.2 = ident.2,
45
46
  each = each,
47
+ subset = subset,
46
48
  section = section,
47
49
  gmtfile = gmtfile,
48
50
  method = method,
@@ -63,6 +65,7 @@ expand_cases <- function() {
63
65
  ident.1 = ident.1,
64
66
  ident.2 = ident.2,
65
67
  each = each,
68
+ subset = subset,
66
69
  section = section,
67
70
  gmtfile = gmtfile,
68
71
  method = method,
@@ -136,6 +139,9 @@ do_case <- function(name, case) {
136
139
  # prepare expression matrix
137
140
  log_info(" Preparing expression matrix...")
138
141
  sobj <- srtobj %>% filter(!is.na(!!sym(case$group.by)))
142
+ if (!is.null(case$subset)) {
143
+ sobj <- sobj %>% filter(!!!parse_exprs(case$subset))
144
+ }
139
145
  if (!is.null(case$ident.2)) {
140
146
  sobj <- sobj %>% filter(!!sym(case$group.by) %in% c(case$ident.1, case$ident.2))
141
147
  }
@@ -99,8 +99,8 @@ load_sample = function(sample) {
99
99
  }
100
100
  obj <- CreateSeuratObject(exprs, project=sample)
101
101
  # filter the cells that don't have any gene expressions
102
- cell_exprs = colSums(obj@assays$RNA)
103
- obj = subset(obj, cells = names(cell_exprs[cell_exprs > 0]))
102
+ # cell_exprs = colSums(obj@assays$RNA)
103
+ # obj = subset(obj, cells = names(cell_exprs[cell_exprs > 0]))
104
104
  obj = RenameCells(obj, add.cell.id = sample)
105
105
  # Attach meta data
106
106
  for (mname in names(mdata)) {
@@ -128,13 +128,7 @@ log_info("Reading samples individually ...")
128
128
  obj_list = lapply(samples, load_sample)
129
129
 
130
130
  log_info("Merging samples ...")
131
- if (length(obj_list) >= 2) {
132
- y = c()
133
- for (i in 2:length(obj_list)) y = c(y, obj_list[[i]])
134
- sobj = merge(obj_list[[1]], y)
135
- } else {
136
- sobj = obj_list[[1]]
137
- }
131
+ sobj = Reduce(merge, obj_list)
138
132
 
139
133
  log_info("Adding metadata for QC ...")
140
134
  sobj$percent.mt = PercentageFeatureSet(sobj, pattern = "^MT-")
@@ -297,28 +291,36 @@ add_report(
297
291
  h1 = "Filters and QC"
298
292
  )
299
293
 
294
+ .formatArgs <- function(args) {
295
+ paste(capture.output(str(args)), collapse = ", ")
296
+ }
297
+
300
298
  log_info("Performing transformation/scaling ...")
301
299
  # Not joined yet
302
300
  # sobj[["RNA"]] <- split(sobj[["RNA"]], f = sobj$Sample)
303
301
  if (envs$use_sct) {
304
302
  log_info("- Running SCTransform ...")
305
303
  SCTransformArgs <- envs$SCTransform
304
+ log_info(" SCTransform: {.formatArgs(SCTransformArgs)}")
306
305
  SCTransformArgs$object <- sobj
307
306
  sobj <- do_call(SCTransform, SCTransformArgs)
308
307
  # Default is to use the SCT assay
309
308
  } else {
310
309
  log_info("- Running NormalizeData ...")
311
310
  NormalizeDataArgs <- envs$NormalizeData
311
+ log_info(" NormalizeData: {.formatArgs(NormalizeDataArgs)}")
312
312
  NormalizeDataArgs$object <- sobj
313
313
  sobj <- do_call(NormalizeData, NormalizeDataArgs)
314
314
 
315
315
  log_info("- Running FindVariableFeatures ...")
316
316
  FindVariableFeaturesArgs <- envs$FindVariableFeatures
317
+ log_info(" FindVariableFeatures: {.formatArgs(FindVariableFeaturesArgs)}")
317
318
  FindVariableFeaturesArgs$object <- sobj
318
319
  sobj <- do_call(FindVariableFeatures, FindVariableFeaturesArgs)
319
320
 
320
321
  log_info("- Running ScaleData ...")
321
322
  ScaleDataArgs <- envs$ScaleData
323
+ log_info(" ScaleData: {.formatArgs(ScaleDataArgs)}")
322
324
  ScaleDataArgs$object <- sobj
323
325
  sobj <- do_call(ScaleData, ScaleDataArgs)
324
326
  }
@@ -326,13 +328,13 @@ if (envs$use_sct) {
326
328
  log_info("- Running RunPCA ...")
327
329
  RunPCAArgs <- envs$RunPCA
328
330
  RunPCAArgs$npcs <- if (is.null(RunPCAArgs$npcs)) { 50 } else { min(RunPCAArgs$npcs, ncol(sobj) - 1) }
331
+ log_info(" RunPCA: {.formatArgs(RunPCAArgs)}")
329
332
  RunPCAArgs$object <- sobj
330
333
  sobj <- do_call(RunPCA, RunPCAArgs)
331
334
 
332
335
  if (!envs$no_integration) {
333
336
  log_info("- Running IntegrateLayers ...")
334
337
  IntegrateLayersArgs <- envs$IntegrateLayers
335
- IntegrateLayersArgs$object <- sobj
336
338
  method <- IntegrateLayersArgs$method
337
339
  if (!is.null(IntegrateLayersArgs$reference) && is.character(IntegrateLayersArgs$reference)) {
338
340
  log_info(" Using reference samples: {paste(IntegrateLayersArgs$reference, collapse = ', ')}")
@@ -359,6 +361,8 @@ if (!envs$no_integration) {
359
361
  if (is.null(IntegrateLayersArgs$new.reduction)) {
360
362
  IntegrateLayersArgs$new.reduction <- new_reductions[[method]]
361
363
  }
364
+ log_info(" IntegrateLayers: {.formatArgs(IntegrateLayersArgs)}")
365
+ IntegrateLayersArgs$object <- sobj
362
366
  sobj <- do_call(IntegrateLayers, IntegrateLayersArgs)
363
367
  # Save it for dimension reduction plots
364
368
  sobj@misc$integrated_new_reduction <- IntegrateLayersArgs$new.reduction
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: biopipen
3
- Version: 0.23.7
3
+ Version: 0.23.8
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=cC_HEsX6d06QmpjNLfRezzJvL501PPwiQYXWDM2_2UI,23
1
+ biopipen/__init__.py,sha256=gx1o8BSQCB5X7Zn8JZ7cxhUiCNJydk8QQUY_fY1zEC8,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=Rn7Cta7WsMtmQkKGC4h9d5dU_STaIVBgR8UliiGgL6o,1757
@@ -20,7 +20,7 @@ biopipen/ns/gsea.py,sha256=EsNRAPYsagaV2KYgr4Jv0KCnZGqayM209v4yOGGTIOI,7423
20
20
  biopipen/ns/misc.py,sha256=fzn0pXvdghMkQhu-e3MMapPNMyO6IAJbtTzVU3GbFa0,3246
21
21
  biopipen/ns/plot.py,sha256=yguxmErUOH-hOM10JfuI_sXw2p49XF8yGR_gXfbd5yQ,4066
22
22
  biopipen/ns/rnaseq.py,sha256=l4vFeRasGhkexopGTM_VfSyIFewOxg-9L5niFzhWUNA,565
23
- biopipen/ns/scrna.py,sha256=42cM6n7rNy8sze9Lhl90RNkpxWT5w6LKPDrGsAK_Y7U,95808
23
+ biopipen/ns/scrna.py,sha256=aV5HNM2TJW2LRAhE5ekEm4114rIeHXBio_nwI-bSPpQ,95883
24
24
  biopipen/ns/scrna_metabolic_landscape.py,sha256=9s1NvH3aMaNDXyfwy9TdzGcSP_lIW4JqhLgknNZcIKE,28313
25
25
  biopipen/ns/tcgamaf.py,sha256=AFbUJIxiMSvsVY3RcHgjRFuMnNh2DG3Mr5slLNEyz6o,1455
26
26
  biopipen/ns/tcr.py,sha256=IcP1uD8U9XD6UbOgdjA_Lk5PK6r4R84Gi7511uvXoy8,84411
@@ -124,7 +124,7 @@ biopipen/scripts/scrna/MetaMarkers.R,sha256=kgjk65EmewZ1uh8AoiENDLmNFe4lzmYvssJe
124
124
  biopipen/scripts/scrna/ModuleScoreCalculator.R,sha256=JSHd-_-KiFqW8avCGxgU4T-C5BtDr2u0kwIvEu2lFIg,4188
125
125
  biopipen/scripts/scrna/RadarPlots.R,sha256=iR4JKtO2b3hGfqv_KAI7BR9tq02EAYfKeqp7tzAicKs,14808
126
126
  biopipen/scripts/scrna/SCImpute.R,sha256=dSJOHhmJ3x_72LBRXT72dbCti5oiB85CJ-OjWtqONbk,2958
127
- biopipen/scripts/scrna/ScFGSEA.R,sha256=2nJN1AAe55SyR-jwVj5ds2pyt32fTIn548zjvEB4Jt0,7332
127
+ biopipen/scripts/scrna/ScFGSEA.R,sha256=E6Rx-0TjplP_nptDCE-LqMyipsOFaMU3hM7FjjFFFDY,7538
128
128
  biopipen/scripts/scrna/SeuratClusterStats-dimplots.R,sha256=pZKv1SnSNEGXDeE0_2VYp0GAikYitohW2FR5YGKjs8Q,2351
129
129
  biopipen/scripts/scrna/SeuratClusterStats-features.R,sha256=SaKTJloP1fttRXZQeb2ApX0ej7al13wOoEYkthSk13k,15489
130
130
  biopipen/scripts/scrna/SeuratClusterStats-hists.R,sha256=GTZfs1yOkuoMUM1Zb19i_My8B8b1Qtve8je55pU_w-g,5054
@@ -136,7 +136,7 @@ biopipen/scripts/scrna/SeuratFilter.R,sha256=BrYK0MLdaTtQvInMaQsmOt7oH_hlks0M1zy
136
136
  biopipen/scripts/scrna/SeuratLoading.R,sha256=ekWKnHIqtQb3kHVQiVymAHXXqiUxs6KKefjZKjaykmk,900
137
137
  biopipen/scripts/scrna/SeuratMap2Ref.R,sha256=tisYmoSaCX8Kl8y6euuuUroWdDsJ2NGI27J5AWr9Niw,4392
138
138
  biopipen/scripts/scrna/SeuratMetadataMutater.R,sha256=Pp4GsF3hZ6ZC2vroC3LSBmVa4B1p2L3hbh981yaAIeQ,1093
139
- biopipen/scripts/scrna/SeuratPreparing.R,sha256=3X2-yCjNdYVMFNozRU38RxhNBOL-lPo9Za1qUT7V5wI,12227
139
+ biopipen/scripts/scrna/SeuratPreparing.R,sha256=plg8hn6lvVC630iXohTDiuszOuISQM44eQI5kWS3CP8,12565
140
140
  biopipen/scripts/scrna/SeuratSplit.R,sha256=vdK11V39_Uo_NaOh76QWCtxObGaEr5Ynxqq0hTiSvsU,754
141
141
  biopipen/scripts/scrna/SeuratSubClustering.R,sha256=6b1J98YYK2gwJ_qkpuvYIdlj6uWxJA8IpUXvaCjgC_U,6334
142
142
  biopipen/scripts/scrna/SeuratSubset.R,sha256=yVA11NVE2FSSw-DhxQcJRapns0tNNHdyDYi5epO6SKM,1776
@@ -218,7 +218,7 @@ biopipen/utils/reference.py,sha256=6bPSwQa-GiDfr7xLR9a5T64Ey40y24yn3QfQ5wDFZkU,4
218
218
  biopipen/utils/rnaseq.R,sha256=Ro2B2dG-Z2oVaT5tkwp9RHBz4dp_RF-JcizlM5GYXFs,1298
219
219
  biopipen/utils/single_cell.R,sha256=bKduqOQjSC8BtZJuwfUShR49omoEMbB57n3Gi6dYlqA,4147
220
220
  biopipen/utils/vcf.py,sha256=ajXs0M_QghEctlvUlSRjWQIABVF02wPdYd-0LP4mIsU,9377
221
- biopipen-0.23.7.dist-info/METADATA,sha256=3y-jNYKvsvX_BQuJEnxQ1nhoCvl0L3KwfLI3ll-fHbI,886
222
- biopipen-0.23.7.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
223
- biopipen-0.23.7.dist-info/entry_points.txt,sha256=16Apdku3RFwghe1nb0JR7eVo4IzLae6hCWjU1VxYUn0,525
224
- biopipen-0.23.7.dist-info/RECORD,,
221
+ biopipen-0.23.8.dist-info/METADATA,sha256=NDuFljfwMBKGx9__4fsjm2ZN7yAuW49L04kzmbxblmc,886
222
+ biopipen-0.23.8.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
223
+ biopipen-0.23.8.dist-info/entry_points.txt,sha256=16Apdku3RFwghe1nb0JR7eVo4IzLae6hCWjU1VxYUn0,525
224
+ biopipen-0.23.8.dist-info/RECORD,,