biopipen 0.29.2__py3-none-any.whl → 0.31.0__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 +1 -1
- biopipen/core/config.toml +2 -0
- biopipen/core/filters.py +21 -0
- biopipen/ns/plot.py +55 -0
- biopipen/ns/scrna.py +110 -21
- biopipen/ns/web.py +87 -5
- biopipen/scripts/bam/CNAClinic.R +2 -1
- biopipen/scripts/cellranger/CellRangerCount.py +3 -3
- biopipen/scripts/cellranger/CellRangerSummary.R +2 -1
- biopipen/scripts/cnv/AneuploidyScore.R +1 -1
- biopipen/scripts/cnv/AneuploidyScoreSummary.R +2 -2
- biopipen/scripts/delim/RowsBinder.R +1 -1
- biopipen/scripts/delim/SampleInfo.R +3 -2
- biopipen/scripts/gene/GeneNameConversion.R +2 -2
- biopipen/scripts/gsea/Enrichr.R +3 -3
- biopipen/scripts/gsea/FGSEA.R +2 -2
- biopipen/scripts/gsea/GSEA.R +2 -2
- biopipen/scripts/gsea/PreRank.R +2 -2
- biopipen/scripts/plot/Heatmap.R +3 -3
- biopipen/scripts/plot/Manhattan.R +2 -1
- biopipen/scripts/plot/QQPlot.R +1 -1
- biopipen/scripts/plot/ROC.R +1 -1
- biopipen/scripts/plot/Scatter.R +112 -0
- biopipen/scripts/plot/VennDiagram.R +3 -3
- biopipen/scripts/regulatory/MotifAffinityTest.R +3 -7
- biopipen/scripts/rnaseq/Simulation.R +1 -1
- biopipen/scripts/rnaseq/UnitConversion.R +2 -1
- biopipen/scripts/scrna/AnnData2Seurat.R +1 -1
- biopipen/scripts/scrna/CellTypeAnnotation-celltypist.R +24 -8
- biopipen/scripts/scrna/CellTypeAnnotation-common.R +10 -0
- biopipen/scripts/scrna/CellTypeAnnotation-direct.R +9 -1
- biopipen/scripts/scrna/CellTypeAnnotation-hitype.R +12 -8
- biopipen/scripts/scrna/CellTypeAnnotation-sccatch.R +15 -2
- biopipen/scripts/scrna/CellTypeAnnotation-sctype.R +38 -15
- biopipen/scripts/scrna/CellTypeAnnotation.R +3 -0
- biopipen/scripts/scrna/CellsDistribution.R +4 -3
- biopipen/scripts/scrna/DimPlots.R +1 -1
- biopipen/scripts/scrna/ExprImputation-alra.R +1 -1
- biopipen/scripts/scrna/MarkersFinder.R +5 -5
- biopipen/scripts/scrna/MetaMarkers.R +4 -4
- biopipen/scripts/scrna/ModuleScoreCalculator.R +2 -1
- biopipen/scripts/scrna/RadarPlots.R +1 -1
- biopipen/scripts/scrna/ScFGSEA.R +4 -3
- biopipen/scripts/scrna/ScSimulation.R +64 -0
- biopipen/scripts/scrna/Seurat2AnnData.R +1 -1
- biopipen/scripts/scrna/SeuratClusterStats-clustree.R +73 -0
- biopipen/scripts/scrna/SeuratClusterStats-dimplots.R +4 -3
- biopipen/scripts/scrna/SeuratClusterStats-features.R +6 -5
- biopipen/scripts/scrna/SeuratClusterStats-hists.R +6 -5
- biopipen/scripts/scrna/SeuratClusterStats-ngenes.R +4 -3
- biopipen/scripts/scrna/SeuratClusterStats-stats.R +20 -25
- biopipen/scripts/scrna/SeuratClusterStats.R +24 -8
- biopipen/scripts/scrna/SeuratClustering-common.R +213 -0
- biopipen/scripts/scrna/SeuratClustering.R +10 -170
- biopipen/scripts/scrna/SeuratMap2Ref.R +98 -54
- biopipen/scripts/scrna/SeuratMetadataMutater.R +2 -2
- biopipen/scripts/scrna/SeuratPreparing-common.R +452 -0
- biopipen/scripts/scrna/SeuratPreparing-doublet_detection.R +201 -0
- biopipen/scripts/scrna/SeuratPreparing.R +22 -562
- biopipen/scripts/scrna/SeuratSubClustering.R +24 -39
- biopipen/scripts/scrna/TopExpressingGenes.R +1 -1
- biopipen/scripts/scrna_metabolic_landscape/MetabolicFeatures.R +2 -2
- biopipen/scripts/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.R +2 -2
- biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayActivity.R +3 -3
- biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.R +3 -3
- biopipen/scripts/snp/MatrixEQTL.R +1 -1
- biopipen/scripts/snp/PlinkCallRate.R +2 -2
- biopipen/scripts/snp/PlinkFreq.R +2 -2
- biopipen/scripts/snp/PlinkHWE.R +2 -2
- biopipen/scripts/snp/PlinkHet.R +2 -2
- biopipen/scripts/snp/PlinkIBD.R +2 -2
- biopipen/scripts/stats/ChowTest.R +1 -1
- biopipen/scripts/stats/DiffCoexpr.R +1 -1
- biopipen/scripts/stats/LiquidAssoc.R +1 -1
- biopipen/scripts/stats/Mediation.R +11 -9
- biopipen/scripts/stats/MetaPvalue.R +4 -1
- biopipen/scripts/stats/MetaPvalue1.R +4 -1
- biopipen/scripts/tcr/Attach2Seurat.R +1 -1
- biopipen/scripts/tcr/CDR3AAPhyschem.R +1 -1
- biopipen/scripts/tcr/CloneResidency.R +2 -2
- biopipen/scripts/tcr/CloneSizeQQPlot.R +2 -2
- biopipen/scripts/tcr/Immunarch-basic.R +0 -4
- biopipen/scripts/tcr/Immunarch-clonality.R +0 -4
- biopipen/scripts/tcr/Immunarch-diversity.R +2 -24
- biopipen/scripts/tcr/Immunarch-geneusage.R +0 -2
- biopipen/scripts/tcr/Immunarch-kmer.R +0 -2
- biopipen/scripts/tcr/Immunarch-overlap.R +0 -2
- biopipen/scripts/tcr/Immunarch-spectratyping.R +0 -2
- biopipen/scripts/tcr/Immunarch-tracking.R +0 -2
- biopipen/scripts/tcr/Immunarch-vjjunc.R +0 -2
- biopipen/scripts/tcr/Immunarch.R +43 -11
- biopipen/scripts/tcr/ImmunarchFilter.R +1 -1
- biopipen/scripts/tcr/ImmunarchLoading.R +2 -2
- biopipen/scripts/tcr/SampleDiversity.R +1 -1
- biopipen/scripts/tcr/TCRClusterStats.R +2 -2
- biopipen/scripts/tcr/TCRClustering.R +2 -2
- biopipen/scripts/tcr/TESSA.R +2 -2
- biopipen/scripts/vcf/TruvariBenchSummary.R +2 -2
- biopipen/scripts/vcf/TruvariConsistency.R +1 -1
- biopipen/scripts/web/GCloudStorageDownloadBucket.py +82 -0
- biopipen/scripts/web/GCloudStorageDownloadFile.py +23 -0
- biopipen/scripts/web/gcloud_common.py +49 -0
- {biopipen-0.29.2.dist-info → biopipen-0.31.0.dist-info}/METADATA +7 -7
- {biopipen-0.29.2.dist-info → biopipen-0.31.0.dist-info}/RECORD +106 -96
- {biopipen-0.29.2.dist-info → biopipen-0.31.0.dist-info}/WHEEL +0 -0
- {biopipen-0.29.2.dist-info → biopipen-0.31.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
2
|
+
{{ biopipen_dir | joinpaths: "utils", "caching.R" | source_r }}
|
|
3
3
|
|
|
4
4
|
library(Seurat)
|
|
5
5
|
library(future)
|
|
@@ -8,7 +8,6 @@ library(tidyr)
|
|
|
8
8
|
library(dplyr)
|
|
9
9
|
library(tidyseurat)
|
|
10
10
|
library(digest)
|
|
11
|
-
library(clustree)
|
|
12
11
|
|
|
13
12
|
set.seed(8525)
|
|
14
13
|
|
|
@@ -39,13 +38,13 @@ plan(strategy = "multicore", workers = envs$ncores)
|
|
|
39
38
|
parts <- trimws(unlist(strsplit(res, ",")))
|
|
40
39
|
for (part in parts) {
|
|
41
40
|
if (grepl(":", part)) {
|
|
42
|
-
|
|
43
|
-
if (length(
|
|
44
|
-
if (length(
|
|
41
|
+
ps <- trimws(unlist(strsplit(part, ":")))
|
|
42
|
+
if (length(ps) == 2) { ps <- c(ps, 0.1) }
|
|
43
|
+
if (length(ps) != 3) {
|
|
45
44
|
stop("Invalid resolution format: {part}. Expected 2 or 3 parts separated by ':' for a range.")
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
expanded_res <- c(expanded_res, seq(
|
|
46
|
+
ps <- as.numeric(ps)
|
|
47
|
+
expanded_res <- c(expanded_res, seq(ps[1], ps[2], by = ps[3]))
|
|
49
48
|
} else {
|
|
50
49
|
expanded_res <- c(expanded_res, as.numeric(part))
|
|
51
50
|
}
|
|
@@ -53,7 +52,7 @@ plan(strategy = "multicore", workers = envs$ncores)
|
|
|
53
52
|
}
|
|
54
53
|
}
|
|
55
54
|
# keep the last resolution at last
|
|
56
|
-
rev(unique(rev(expanded_res)))
|
|
55
|
+
rev(unique(rev(round(expanded_res, 2))))
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
# recode clusters from 0, 1, 2, ... to s1, s2, s3, ...
|
|
@@ -98,8 +97,7 @@ for (key in names(envs$cases)) {
|
|
|
98
97
|
subset = envs$subset,
|
|
99
98
|
RunUMAP = envs$RunUMAP,
|
|
100
99
|
FindNeighbors = envs$FindNeighbors,
|
|
101
|
-
FindClusters = envs$FindClusters
|
|
102
|
-
clustree_devpars = envs$clustree_devpars
|
|
100
|
+
FindClusters = envs$FindClusters
|
|
103
101
|
),
|
|
104
102
|
case
|
|
105
103
|
)
|
|
@@ -169,49 +167,36 @@ for (key in names(envs$cases)) {
|
|
|
169
167
|
|
|
170
168
|
case$FindClusters$random.seed <- case$FindClusters$random.seed %||% 8525
|
|
171
169
|
resolution <- case$FindClusters$resolution <- .expand_resolution(case$FindClusters$resolution %||% 0.8)
|
|
172
|
-
cached <- get_cached(case$FindClusters, "
|
|
170
|
+
cached <- get_cached(case$FindClusters, "SubClustering", cache_dir)
|
|
173
171
|
if (is.null(cached$data)) {
|
|
174
172
|
log_info("- Running FindClusters at resolution: {paste(resolution, collapse = ',')} ...")
|
|
175
173
|
case$FindClusters$object <- sobj
|
|
176
|
-
|
|
174
|
+
case$FindClusters$cluster.name <- paste0(key, ".", resolution)
|
|
175
|
+
# use sobj1 to avoid overwriting the previous clustering results (as they have the same graph name
|
|
177
176
|
sobj1 <- do_call(FindClusters, case$FindClusters)
|
|
178
|
-
graph_name <- case$FindClusters$graph.name %||% paste0(DefaultAssay(sobj), "_snn_res.")
|
|
179
|
-
for (res in resolution) {
|
|
180
|
-
cluster_name <- paste0(graph_name, res)
|
|
181
|
-
new_cluster_name <- paste0(key, ".", res)
|
|
182
|
-
sobj1@meta.data[[new_cluster_name]] <- .recode_clusters(sobj1@meta.data[[cluster_name]])
|
|
183
|
-
}
|
|
184
177
|
sobj1@meta.data[[key]] <- .recode_clusters(sobj1@meta.data$seurat_clusters)
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
178
|
+
for (clname in case$FindClusters$cluster.name) {
|
|
179
|
+
sobj1@meta.data[[clname]] <- .recode_clusters(sobj1@meta.data[[clname]])
|
|
180
|
+
}
|
|
181
|
+
cached$data <- list(
|
|
182
|
+
clusters = sobj1@meta.data[, c(case$FindClusters$cluster.name, key), drop = FALSE],
|
|
183
|
+
command = sobj1@commands$FindClusters
|
|
184
|
+
)
|
|
185
|
+
save_to_cache(cached, "SubClustering", cache_dir)
|
|
189
186
|
rm(sobj1)
|
|
190
187
|
} else {
|
|
191
188
|
log_info("- Using cached FindClusters at resolution: {paste(resolution, collapse = ',')} ...")
|
|
192
189
|
}
|
|
193
190
|
|
|
194
|
-
ident_table <- table(cached$data[[key]])
|
|
195
|
-
log_info(" Found {length(ident_table)} clusters")
|
|
191
|
+
ident_table <- table(cached$data$clusters[[key]])
|
|
192
|
+
log_info(" Found {length(ident_table)} clusters at resolution: {resolution[length(resolution)]}")
|
|
196
193
|
print(ident_table)
|
|
197
194
|
cat("\n")
|
|
198
195
|
|
|
199
|
-
if (length(resolution) > 1) {
|
|
200
|
-
log_info("- Plotting clustree ...")
|
|
201
|
-
png(
|
|
202
|
-
file.path(joboutdir, paste0(key, ".clustree.png")),
|
|
203
|
-
res = case$clustree_devpars$res,
|
|
204
|
-
width = case$clustree_devpars$width,
|
|
205
|
-
height = case$clustree_devpars$height
|
|
206
|
-
)
|
|
207
|
-
p <- clustree(cached$data, prefix = paste0(key, "."))
|
|
208
|
-
print(p)
|
|
209
|
-
dev.off()
|
|
210
|
-
}
|
|
211
|
-
|
|
212
196
|
log_info("- Updating meta.data with subclusters...")
|
|
213
|
-
srtobj <- AddMetaData(srtobj, metadata = cached$data)
|
|
197
|
+
srtobj <- AddMetaData(srtobj, metadata = cached$data$clusters)
|
|
214
198
|
srtobj[[paste0("sub_umap_", key)]] <- reduc
|
|
199
|
+
srtobj@commands[[paste0("FindClusters.", key)]] <- cached$data$command
|
|
215
200
|
}
|
|
216
201
|
|
|
217
202
|
log_info("Saving results ...")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
2
|
+
{{ biopipen_dir | joinpaths: "utils", "gsea.R" | source_r }}
|
|
3
|
+
{{ biopipen_dir | joinpaths: "utils", "plot.R" | source_r }}
|
|
4
4
|
|
|
5
5
|
library(scater)
|
|
6
6
|
library(reshape2)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
2
|
+
{{ biopipen_dir | joinpaths: "utils", "gsea.R" | source_r }}
|
|
3
|
+
{{ biopipen_dir | joinpaths: "utils", "plot.R" | source_r }}
|
|
4
4
|
|
|
5
5
|
library(gtools)
|
|
6
6
|
library(parallel)
|
biopipen/scripts/snp/PlinkFreq.R
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
2
|
+
{{ biopipen_dir | joinpaths: "utils", "plot.R" | source_r }}
|
|
3
3
|
library(rlang)
|
|
4
4
|
library(ggprism)
|
|
5
5
|
theme_set(theme_prism())
|
biopipen/scripts/snp/PlinkHWE.R
CHANGED
biopipen/scripts/snp/PlinkHet.R
CHANGED
biopipen/scripts/snp/PlinkIBD.R
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
2
|
+
{{ biopipen_dir | joinpaths: "utils", "plot.R" | source_r }}
|
|
3
3
|
suppressPackageStartupMessages({
|
|
4
4
|
library(dplyr)
|
|
5
5
|
library(tidyr)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
2
2
|
|
|
3
3
|
library(rlang)
|
|
4
4
|
library(parallel)
|
|
@@ -66,17 +66,19 @@ medanalysis <- function(i, total) {
|
|
|
66
66
|
fmly <- update.formula(fmly, cov_fml)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
data <- indata[, c(M, X, Y, covs), drop = FALSE]
|
|
70
|
+
data <- data[complete.cases(data), , drop = FALSE]
|
|
69
71
|
margs <- args
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
margs$sims <- sims
|
|
73
|
+
margs$model.m <- modelm(fmlm, data = data)
|
|
74
|
+
margs$model.y <- modely(fmly, data = data)
|
|
75
|
+
margs$treat <- X
|
|
76
|
+
margs$mediator <- M
|
|
77
|
+
margs$outcome <- Y
|
|
76
78
|
if (!is.null(covs)) {
|
|
77
|
-
|
|
79
|
+
margs$covariates <- data[, covs, drop = FALSE]
|
|
78
80
|
}
|
|
79
|
-
med <- do_call(mediate,
|
|
81
|
+
med <- do_call(mediate, margs)
|
|
80
82
|
if (is.na(med$d1.p) || is.na(med$n1)) {
|
|
81
83
|
NULL
|
|
82
84
|
} else {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
2
2
|
|
|
3
3
|
library(metap)
|
|
4
4
|
library(rlang)
|
|
@@ -106,6 +106,9 @@ if (length(infiles) == 1 && padj == "none") {
|
|
|
106
106
|
} else if (length(ps) == 1 && keep_single) {
|
|
107
107
|
metaps <- c(metaps, ps)
|
|
108
108
|
ns <- c(ns, 1)
|
|
109
|
+
} else if (any(ps == 0)) {
|
|
110
|
+
metaps <- c(metaps, 0)
|
|
111
|
+
ns <- c(ns, length(ps))
|
|
109
112
|
} else {
|
|
110
113
|
metaps <- c(metaps, do.call(method, list(ps))$p)
|
|
111
114
|
ns <- c(ns, length(ps))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
2
2
|
|
|
3
3
|
library(metap)
|
|
4
4
|
library(rlang)
|
|
@@ -50,6 +50,9 @@ for (ps in outdata$.pvals) {
|
|
|
50
50
|
} else if (length(ps) == 1 && keep_single) {
|
|
51
51
|
metaps <- c(metaps, ps)
|
|
52
52
|
ns <- c(ns, 1)
|
|
53
|
+
} else if (any(ps == 0)) {
|
|
54
|
+
metaps <- c(metaps, 0)
|
|
55
|
+
ns <- c(ns, length(ps))
|
|
53
56
|
} else {
|
|
54
57
|
metaps <- c(metaps, do.call(method, list(ps))$p)
|
|
55
58
|
ns <- c(ns, length(ps))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
2
2
|
|
|
3
3
|
library(rlang)
|
|
4
4
|
library(dplyr)
|
|
@@ -414,7 +414,7 @@ handle_subject <- function(i, subjects, casename, case) {
|
|
|
414
414
|
mutate(across(everything(), as.character)) %>%
|
|
415
415
|
paste(collapse = "-")
|
|
416
416
|
|
|
417
|
-
log_info(" Handling {
|
|
417
|
+
log_info(" Handling {i}/{nrow(subjects)}: {subject} ...")
|
|
418
418
|
|
|
419
419
|
if (!is.null(case$subset)) {
|
|
420
420
|
counts <- cldata %>% filter(!!parse_expr(case$subset))
|
|
@@ -5,10 +5,6 @@ log_info("")
|
|
|
5
5
|
log_info("# Basic analysis")
|
|
6
6
|
log_info("-----------------------------------")
|
|
7
7
|
|
|
8
|
-
volumes = {{envs.volumes | r}}
|
|
9
|
-
lens = {{envs.lens | r}}
|
|
10
|
-
counts = {{envs.counts | r}}
|
|
11
|
-
|
|
12
8
|
# Fill up cases
|
|
13
9
|
fill_up_cases_basic = function(config) {
|
|
14
10
|
log_debug("Filling up cases ...")
|
|
@@ -5,10 +5,6 @@ log_info("")
|
|
|
5
5
|
log_info("# Clonality analysis")
|
|
6
6
|
log_info("-----------------------------------")
|
|
7
7
|
|
|
8
|
-
top_clones = {{envs.top_clones | r}}
|
|
9
|
-
rare_clones = {{envs.rare_clones | r}}
|
|
10
|
-
hom_clones = {{envs.hom_clones | r}}
|
|
11
|
-
|
|
12
8
|
# Fill up cases
|
|
13
9
|
fill_up_cases_clonality = function(config) {
|
|
14
10
|
cases = config$cases
|
|
@@ -1,32 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
source("{{biopipen_dir}}/scripts/tcr/immunarch-patched.R")
|
|
1
|
+
|
|
3
2
|
# https://immunarch.com/articles/web_only/v6_diversity.html
|
|
4
3
|
|
|
5
4
|
log_info("")
|
|
6
5
|
log_info("# Diversity estimation")
|
|
7
6
|
log_info("-----------------------------------")
|
|
8
7
|
|
|
9
|
-
# Other variables are loaded in the parent template
|
|
10
|
-
# immdata is already loaded, meta is mutated
|
|
11
|
-
div_method = {{envs.divs.method | default: "gini" | r}}
|
|
12
|
-
div_by = {{envs.divs.by | default: None | r}}
|
|
13
|
-
div_plot_type = {{envs.divs.plot_type | default: "bar" | r}}
|
|
14
|
-
div_order = {{envs.divs.order | default: [] | r}}
|
|
15
|
-
div_args = {{envs.divs.args | default: {} | r: todot="-"}}
|
|
16
|
-
div_test = {{envs.divs.test | default: None | r}}
|
|
17
|
-
div_cases = {{envs.divs.cases | default: {} | r: todot="-"}}
|
|
18
|
-
div_devpars = {{envs.divs.devpars | default: None | r}}
|
|
19
|
-
div_separate_by = {{envs.divs.separate_by | default: None | r}}
|
|
20
|
-
div_split_by = {{envs.divs.split_by | default: None | r}}
|
|
21
|
-
div_split_order = {{envs.divs.split_order | default: None | r}}
|
|
22
|
-
div_align_x = {{envs.divs.align_x | default: False | r}}
|
|
23
|
-
div_align_y = {{envs.divs.align_y | default: False | r}}
|
|
24
|
-
div_subset = {{envs.divs.subset | default: None | r}}
|
|
25
|
-
div_log = {{envs.divs.log | default: False | r}}
|
|
26
|
-
div_ncol = {{envs.divs.ncol | default: 2 | r}}
|
|
27
|
-
div_ymin = {{envs.divs.ymin | default: None | r}}
|
|
28
|
-
div_ymax = {{envs.divs.ymax | default: None | r}}
|
|
29
|
-
|
|
30
8
|
div_test = div_test %||% list(method = "none", padjust = "none")
|
|
31
9
|
div_devpars = div_devpars %||% list(res = 100, width = 800, height = 800)
|
|
32
10
|
|
|
@@ -77,7 +55,7 @@ update_case = function(case, name) {
|
|
|
77
55
|
if (!is.null(case$args) && length(case$args) > 0) {
|
|
78
56
|
names(case$args) = paste0(".", names(case$args))
|
|
79
57
|
}
|
|
80
|
-
if (!is.null(case$test) && case$test != "none" && (is.null(case$by) || length(case$by) == 0)) {
|
|
58
|
+
if (!is.null(case$test) && case$test$method != "none" && (is.null(case$by) || length(case$by) == 0)) {
|
|
81
59
|
stop("For diversity estimation, `test` is only supported when `by` is specified")
|
|
82
60
|
}
|
|
83
61
|
# Just ignore them for rarefraction
|
biopipen/scripts/tcr/Immunarch.R
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
2
|
+
{{ biopipen_dir | joinpaths: "utils", "single_cell.R" | source_r }}
|
|
3
3
|
# Basic analysis and clonality
|
|
4
4
|
# TODO: How about TRA chain?
|
|
5
5
|
library(rlang)
|
|
@@ -65,46 +65,78 @@ n_samples = length(immdata$data)
|
|
|
65
65
|
##################
|
|
66
66
|
# Basic analysis #
|
|
67
67
|
##################
|
|
68
|
-
|
|
68
|
+
volumes = {{envs.volumes | r}}
|
|
69
|
+
lens = {{envs.lens | r}}
|
|
70
|
+
counts = {{envs.counts | r}}
|
|
71
|
+
{{ biopipen_dir | joinpaths: "scripts", "tcr", "Immunarch-basic.R" | source_r }}
|
|
69
72
|
|
|
70
73
|
##################
|
|
71
74
|
# Clonality #
|
|
72
75
|
##################
|
|
73
|
-
|
|
76
|
+
top_clones = {{envs.top_clones | r}}
|
|
77
|
+
rare_clones = {{envs.rare_clones | r}}
|
|
78
|
+
hom_clones = {{envs.hom_clones | r}}
|
|
79
|
+
{{ biopipen_dir | joinpaths: "scripts", "tcr", "Immunarch-clonality.R" | source_r }}
|
|
74
80
|
|
|
75
81
|
##################
|
|
76
82
|
# Overlap #
|
|
77
83
|
##################
|
|
78
|
-
{
|
|
84
|
+
overlaps = {{ envs.overlaps | r: todot="-" }}
|
|
85
|
+
{{ biopipen_dir | joinpaths: "scripts", "tcr", "Immunarch-overlap.R" | source_r }}
|
|
79
86
|
|
|
80
87
|
##################
|
|
81
88
|
# Gene usage #
|
|
82
89
|
##################
|
|
83
|
-
{
|
|
90
|
+
gene_usages = {{ envs.gene_usages | r: todot="-" }}
|
|
91
|
+
{{ biopipen_dir | joinpaths: "scripts", "tcr", "Immunarch-geneusage.R" | source_r }}
|
|
84
92
|
|
|
85
93
|
##################
|
|
86
94
|
# Spectratyping #
|
|
87
95
|
##################
|
|
88
|
-
{
|
|
96
|
+
spects = {{ envs.spects | r }}
|
|
97
|
+
{{ biopipen_dir | joinpaths: "scripts", "tcr", "Immunarch-spectratyping.R" | source_r }}
|
|
89
98
|
|
|
90
99
|
########################
|
|
91
100
|
# Diversity estimation #
|
|
92
101
|
########################
|
|
93
|
-
{
|
|
102
|
+
div_method = {{envs.divs.method | default: "gini" | r}}
|
|
103
|
+
div_by = {{envs.divs.by | default: None | r}}
|
|
104
|
+
div_plot_type = {{envs.divs.plot_type | default: "bar" | r}}
|
|
105
|
+
div_order = {{envs.divs.order | default: [] | r}}
|
|
106
|
+
div_args = {{envs.divs.args | default: {} | r: todot="-"}}
|
|
107
|
+
div_test = {{envs.divs.test | default: None | r}}
|
|
108
|
+
div_cases = {{envs.divs.cases | default: {} | r: todot="-"}}
|
|
109
|
+
div_devpars = {{envs.divs.devpars | default: None | r}}
|
|
110
|
+
div_separate_by = {{envs.divs.separate_by | default: None | r}}
|
|
111
|
+
div_split_by = {{envs.divs.split_by | default: None | r}}
|
|
112
|
+
div_split_order = {{envs.divs.split_order | default: None | r}}
|
|
113
|
+
div_align_x = {{envs.divs.align_x | default: False | r}}
|
|
114
|
+
div_align_y = {{envs.divs.align_y | default: False | r}}
|
|
115
|
+
div_subset = {{envs.divs.subset | default: None | r}}
|
|
116
|
+
div_log = {{envs.divs.log | default: False | r}}
|
|
117
|
+
div_ncol = {{envs.divs.ncol | default: 2 | r}}
|
|
118
|
+
div_ymin = {{envs.divs.ymin | default: None | r}}
|
|
119
|
+
div_ymax = {{envs.divs.ymax | default: None | r}}
|
|
120
|
+
|
|
121
|
+
{{ biopipen_dir | joinpaths: "scripts", "tcr", "immunarch-patched.R" | source_r }}
|
|
122
|
+
{{ biopipen_dir | joinpaths: "scripts", "tcr", "Immunarch-diversity.R" | source_r }}
|
|
94
123
|
|
|
95
124
|
######################
|
|
96
125
|
# Clonotype tracking #
|
|
97
126
|
######################
|
|
98
|
-
{
|
|
127
|
+
trackings = {{ envs.trackings | r }}
|
|
128
|
+
{{ biopipen_dir | joinpaths: "scripts", "tcr", "Immunarch-tracking.R" | source_r }}
|
|
99
129
|
|
|
100
130
|
######################
|
|
101
131
|
# K-mer analysis #
|
|
102
132
|
######################
|
|
103
|
-
{
|
|
133
|
+
kmers = {{ envs.kmers | r: todot="-" }}
|
|
134
|
+
{{ biopipen_dir | joinpaths: "scripts", "tcr", "Immunarch-kmer.R" | source_r }}
|
|
104
135
|
|
|
105
136
|
######################
|
|
106
137
|
# VJ junction #
|
|
107
138
|
######################
|
|
108
|
-
|
|
139
|
+
vj_juncs <- {{envs.vj_junc | r}}
|
|
140
|
+
{{ biopipen_dir | joinpaths: "scripts", "tcr", "Immunarch-vjjunc.R" | source_r }}
|
|
109
141
|
|
|
110
142
|
save_report(joboutdir)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
2
|
+
{{ biopipen_dir | joinpaths: "utils", "single_cell.R" | source_r }}
|
|
3
3
|
|
|
4
4
|
# Loading 10x data into immunarch
|
|
5
5
|
library(immunarch)
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
# python = Sys.which({{envs.python | r}})
|
|
4
4
|
# Sys.setenv(RETICULATE_PYTHON = python)
|
|
5
5
|
# library(reticulate)
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
7
|
+
{{ biopipen_dir | joinpaths: "utils", "single_cell.R" | source_r }}
|
|
8
8
|
|
|
9
9
|
library(immunarch)
|
|
10
10
|
library(dplyr)
|
biopipen/scripts/tcr/TESSA.R
CHANGED