biopipen 0.31.0__py3-none-any.whl → 0.31.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.31.0"
1
+ __version__ = "0.31.2"
@@ -45,6 +45,10 @@ if (is.null(split_by)) {
45
45
  future::plan(strategy = "multicore", workers = ncores)
46
46
  }
47
47
 
48
+ .is_sct <- function(x) {
49
+ return(Seurat:::IsSCT(assay = x@assays[[DefaultAssay(x)]]))
50
+ }
51
+
48
52
  .expand_dims = function(args, name = "dims") {
49
53
  # Expand dims from 30 to 1:30
50
54
  if (is.numeric(args[[name]]) && length(args[[name]] == 1)) {
@@ -63,6 +67,8 @@ if (endsWith(ref, ".rds") || endsWith(ref, ".RDS")) {
63
67
  } else {
64
68
  reference = LoadH5Seurat(ref)
65
69
  }
70
+ reference = UpdateSeuratObject(reference)
71
+ reference = UpdateSCTAssays(reference)
66
72
 
67
73
  # check if refdata exists in the reference
68
74
  for (rname in names(mapquery_args$refdata)) {
@@ -84,9 +90,20 @@ for (rname in names(mapquery_args$refdata)) {
84
90
  }
85
91
  }
86
92
 
87
- if (refnorm == "auto" && DefaultAssay(reference) == "SCT") {
93
+ if (refnorm == "auto" && .is_sct(reference)) {
88
94
  refnorm = "SCTransform"
89
95
  }
96
+ if (refnorm == "SCTransform") {
97
+ # Check if the reference is SCTransform'ed
98
+ if (!.is_sct(reference)) {
99
+ stop("Reference is not SCTransform'ed")
100
+ }
101
+ n_models = length(x = slot(object = reference[[DefaultAssay(reference)]], name = "SCTModel.list"))
102
+ if (n_models == 0) {
103
+ stop("Reference doesn't contain SCTModel.")
104
+ }
105
+ }
106
+
90
107
  log_info(" Normalization method used: {refnorm}")
91
108
  if (refnorm == "SCTransform") {
92
109
  findtransferanchors_args$normalization.method = "SCT"
@@ -307,14 +324,14 @@ sobj@meta.data = sobj@meta.data %>% mutate(
307
324
  Idents(sobj) = ident
308
325
 
309
326
  # Check if PrepSCTFindMarkers is done
310
- if (DefaultAssay(sobj) == "SCT") {
327
+ if (.is_sct(sobj) && is.null(sobj@commands$PrepSCTFindMarkers)) {
311
328
  log_info("- Running PrepSCTFindMarkers ...")
312
329
  sobj <- PrepSCTFindMarkers(sobj)
313
330
  # compose a new SeuratCommand to record it to sobj@commands
314
331
  commands <- names(pbmc_small@commands)
315
332
  scommand <- pbmc_small@commands[[commands[length(commands)]]]
316
333
  scommand@time.stamp <- Sys.time()
317
- scommand@assay.used <- "SCT"
334
+ scommand@assay.used <- DefaultAssay(sobj)
318
335
  scommand@call.string <- "PrepSCTFindMarkers(object = sobj)"
319
336
  scommand@params <- list()
320
337
  sobj@commands$PrepSCTFindMarkers <- scommand
@@ -170,6 +170,8 @@ immdata = readRDS(immdatafile)
170
170
  merge_data = function(sam) {
171
171
  # Merge the data for one sample from immdata and metadata
172
172
  out = immdata$data[[sam]] %>%
173
+ separate_rows(chain, CDR3.aa, V.name, J.name, sep = ";") %>%
174
+ filter(chain == "TRB") %>%
173
175
  mutate(
174
176
  Sample = sam,
175
177
  locus = "TCRB",
@@ -34,9 +34,17 @@ if (is.null(prefix)) { prefix = immdata$prefix }
34
34
  if (is.null(prefix)) { prefix = "" }
35
35
 
36
36
  get_cdr3aa_df = function() {
37
- expand_immdata(immdata, cell_id = "Barcode") %>%
37
+ out = expand_immdata(immdata, cell_id = "Barcode") %>%
38
38
  mutate(Barcode = glue(paste0(prefix, "{Barcode}"))) %>%
39
- select(Barcode, CDR3.aa)
39
+ select(Barcode, CDR3.aa, chain)
40
+
41
+ if (on_multi) {
42
+ out$CDR3.aa = sub(";", "", out$CDR3.aa)
43
+ } else {
44
+ out = out %>% separate_rows(chain, CDR3.aa, sep = ";") %>%
45
+ filter(chain == "TRB")
46
+ }
47
+ out %>% select(Barcode, CDR3.aa)
40
48
  }
41
49
  cdr3aa_df = get_cdr3aa_df()
42
50
 
@@ -159,12 +167,14 @@ prepare_input = function() {
159
167
  # cdr3col = if (!on_multi) "cdr3" else "CDR3.aa"
160
168
  cdr3col = "CDR3.aa"
161
169
  for (sample in names(seqdata)) {
162
- # cdr3 = bind_rows(cdr3, seqdata[[sample]] %>%
163
- # transmute(aminoAcid=CDR3.aa, vMaxResolved=paste0(V.name, "*01"), Sample=sample))
164
- cdr3 = union(
165
- cdr3,
166
- seqdata[[sample]] %>% pull(cdr3col) %>% unique()
167
- )
170
+ sdata = seqdata[[sample]]
171
+ if (on_multi) {
172
+ sdata[[cdr3col]] = sub(";", "", sdata[[cdr3col]])
173
+ } else {
174
+ sdata = sdata %>% separate_rows(chain, cdr3col, sep = ";") %>%
175
+ filter(chain == "TRB")
176
+ }
177
+ cdr3 = union(cdr3, unique(sdata[[cdr3col]]))
168
178
  }
169
179
  cdr3 = unique(cdr3)
170
180
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: biopipen
3
- Version: 0.31.0
3
+ Version: 0.31.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=TJt1pYzTJuPE6GzDP1gxaeeVQlzcoUyEmSVSUPgYnIA,23
1
+ biopipen/__init__.py,sha256=Me03yXizCG2hXimVttvq6I-XoZSxSRE2J-NrK4My4cU,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=7IXvviRicZ2D1h6x3BVgbLJ96nsh-ikvZ0sVlQepqFE,1944
@@ -164,7 +164,7 @@ biopipen/scripts/scrna/SeuratClustering-common.R,sha256=JX4Cn2FC6GOcBqaVyGDD3MM5
164
164
  biopipen/scripts/scrna/SeuratClustering.R,sha256=0OKRBQ5rFuupK7c03_sSt2HMwMdMnCYFqTvkRXFKchs,1706
165
165
  biopipen/scripts/scrna/SeuratFilter.R,sha256=BrYK0MLdaTtQvInMaQsmOt7oH_hlks0M1zykkJtg2lM,509
166
166
  biopipen/scripts/scrna/SeuratLoading.R,sha256=ekWKnHIqtQb3kHVQiVymAHXXqiUxs6KKefjZKjaykmk,900
167
- biopipen/scripts/scrna/SeuratMap2Ref.R,sha256=-Jyd9O4IkVxZJRlskuaP_tOrI7Q1wwkot-YdmzRbLws,11452
167
+ biopipen/scripts/scrna/SeuratMap2Ref.R,sha256=KARt5IVBDYpNhLZ7_j0FEi1u5S8PxU_mB4THH26s7AM,12008
168
168
  biopipen/scripts/scrna/SeuratMetadataMutater.R,sha256=PMwG0Xvl_EEVKkicfrIi4arEqpY948PkYLkb59kTAXI,1135
169
169
  biopipen/scripts/scrna/SeuratPreparing-common.R,sha256=WuD7lGS17eAUQWSiIdAoV0EIeqS3Tnkkx-7PbP6Q3tc,16279
170
170
  biopipen/scripts/scrna/SeuratPreparing-doublet_detection.R,sha256=TNN2lfFjpnnO0rguMsG38JYCP1nFUhcPLJ1LqGj-Sc8,6674
@@ -202,7 +202,7 @@ biopipen/scripts/tcgamaf/Maf2Vcf.py,sha256=Cxh7fiSNCxWDTfIJqZDOOnaSrw-85S_fH2U-P
202
202
  biopipen/scripts/tcgamaf/MafAddChr.py,sha256=V10HMisl12O3ZfXuRmFNdy5p-3mr43WCvy0GHxSpwfA,494
203
203
  biopipen/scripts/tcgamaf/maf2vcf.pl,sha256=hJKcH-NbgWK6fmK7f3qex7ozJJl-PqCNPXqpwfcHwJg,22707
204
204
  biopipen/scripts/tcr/Attach2Seurat.R,sha256=0KZaBkuPvqOBXq4ZG3pzIIua5HL-161K5dVXRoCysy4,1366
205
- biopipen/scripts/tcr/CDR3AAPhyschem.R,sha256=3fWmoTwxVHM3CNnwxdKxy6-7Jul1UltoN4ic39aGTH0,16649
205
+ biopipen/scripts/tcr/CDR3AAPhyschem.R,sha256=_eg5Ep-Zt-J-VklYrklDPYAvZTBH_RIxbLTPJDqS4KE,16753
206
206
  biopipen/scripts/tcr/CloneResidency.R,sha256=KAcFB39vTYsk8IEj44s8oSFVhKjpAdJ8hkpKxtdWzRA,21540
207
207
  biopipen/scripts/tcr/CloneSizeQQPlot.R,sha256=hds1C80Q_W40Ikp-BrFfvh_aBf_V61lz-1YAvkDESyk,4569
208
208
  biopipen/scripts/tcr/GIANA/GIANA.py,sha256=0qLhgCWxT8K-4JvORA03CzBPTT5pd4Di5B_DgrHXbFA,47198
@@ -225,7 +225,7 @@ biopipen/scripts/tcr/ImmunarchLoading.R,sha256=Vw2oIza3mDJzg9kuo-w5jvwdivk4AtDA6
225
225
  biopipen/scripts/tcr/ImmunarchSplitIdents.R,sha256=FGCeGV0uSmFU91lKkldUAeV4A2m3hHw5X4GNi8ffGzI,1873
226
226
  biopipen/scripts/tcr/SampleDiversity.R,sha256=oipN4-2nQZe8bYjI0lZ0SvZ7T8GZ_FWkpkobi1cwmWE,2664
227
227
  biopipen/scripts/tcr/TCRClusterStats.R,sha256=QhXgfKSh27VHO901hDizyGYTXMYFJxW22StchQUq3uE,12906
228
- biopipen/scripts/tcr/TCRClustering.R,sha256=LOdq6NjKcRydGSSoYehILgH4vPCeHIbVpSEYev05578,9278
228
+ biopipen/scripts/tcr/TCRClustering.R,sha256=J3cBAK3PRN54iQHMISVSbldhVDWPIWfeO8Vrjr9qwyE,9571
229
229
  biopipen/scripts/tcr/TCRDock.py,sha256=jjzxMWp-hs0LDtA1mVbiWDvUieSO7X-F9yeKGy1LSTM,3026
230
230
  biopipen/scripts/tcr/TESSA.R,sha256=XFC2P_e_Gm83jG5EjzVIW6KcyG5IieAaK7sXDA3_oZ0,6864
231
231
  biopipen/scripts/tcr/TESSA_source/Atchley_factors.csv,sha256=SumqDOqP67P54uM7Cuc5_O_rySTWcGo7eX3psMSPX9s,763
@@ -279,7 +279,7 @@ biopipen/utils/reference.py,sha256=oi5evicLwHxF0KAIPNZohBeHJLJQNWFJH0cr2y5pgcg,5
279
279
  biopipen/utils/rnaseq.R,sha256=Ro2B2dG-Z2oVaT5tkwp9RHBz4dp_RF-JcizlM5GYXFs,1298
280
280
  biopipen/utils/single_cell.R,sha256=pJjYP8bIZpNAtTQ32rOXhZxaM1Y-6D-xUcK3pql9tbk,4316
281
281
  biopipen/utils/vcf.py,sha256=ajXs0M_QghEctlvUlSRjWQIABVF02wPdYd-0LP4mIsU,9377
282
- biopipen-0.31.0.dist-info/METADATA,sha256=OtaZr2FTKCeaK9H-yBmssBT6848_F1j1wa2e8D3wraE,882
283
- biopipen-0.31.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
284
- biopipen-0.31.0.dist-info/entry_points.txt,sha256=69SbeMaF47Z2DS40yo-qDyoBKmMmumrNnsjEZMOioCE,625
285
- biopipen-0.31.0.dist-info/RECORD,,
282
+ biopipen-0.31.2.dist-info/METADATA,sha256=3C7vpZEWG0ySF1H298xWctBRl77fl7NZluVa7Q65jUc,882
283
+ biopipen-0.31.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
284
+ biopipen-0.31.2.dist-info/entry_points.txt,sha256=69SbeMaF47Z2DS40yo-qDyoBKmMmumrNnsjEZMOioCE,625
285
+ biopipen-0.31.2.dist-info/RECORD,,