biopipen 0.33.1__py3-none-any.whl → 0.34.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/filters.py +10 -183
- biopipen/core/proc.py +5 -3
- biopipen/core/testing.py +8 -1
- biopipen/ns/bam.py +40 -4
- biopipen/ns/cnv.py +1 -1
- biopipen/ns/cnvkit.py +1 -1
- biopipen/ns/delim.py +1 -1
- biopipen/ns/gsea.py +63 -37
- biopipen/ns/misc.py +38 -0
- biopipen/ns/plot.py +8 -0
- biopipen/ns/scrna.py +290 -288
- biopipen/ns/scrna_metabolic_landscape.py +207 -366
- biopipen/ns/tcr.py +165 -97
- biopipen/reports/bam/CNVpytor.svelte +4 -9
- biopipen/reports/cnvkit/CNVkitDiagram.svelte +1 -1
- biopipen/reports/cnvkit/CNVkitHeatmap.svelte +1 -1
- biopipen/reports/cnvkit/CNVkitScatter.svelte +1 -1
- biopipen/reports/{delim/SampleInfo.svelte → common.svelte} +2 -3
- biopipen/reports/scrna/DimPlots.svelte +1 -1
- biopipen/reports/scrna_metabolic_landscape/MetabolicFeatures.svelte +51 -22
- biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayActivity.svelte +46 -42
- biopipen/reports/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.svelte +63 -6
- biopipen/reports/snp/PlinkCallRate.svelte +2 -2
- biopipen/reports/snp/PlinkFreq.svelte +1 -1
- biopipen/reports/snp/PlinkHWE.svelte +1 -1
- biopipen/reports/snp/PlinkHet.svelte +1 -1
- biopipen/reports/snp/PlinkIBD.svelte +1 -1
- biopipen/reports/tcr/CDR3AAPhyschem.svelte +1 -1
- biopipen/scripts/bam/CNAClinic.R +41 -6
- biopipen/scripts/bam/CNVpytor.py +2 -1
- biopipen/scripts/bam/ControlFREEC.py +2 -3
- biopipen/scripts/bam/SamtoolsView.py +33 -0
- biopipen/scripts/cnv/AneuploidyScore.R +25 -13
- biopipen/scripts/cnv/AneuploidyScoreSummary.R +218 -163
- biopipen/scripts/cnv/TMADScore.R +4 -4
- biopipen/scripts/cnv/TMADScoreSummary.R +51 -84
- biopipen/scripts/cnvkit/CNVkitGuessBaits.py +3 -3
- biopipen/scripts/cnvkit/CNVkitHeatmap.py +3 -3
- biopipen/scripts/cnvkit/CNVkitReference.py +3 -3
- biopipen/scripts/delim/RowsBinder.R +1 -1
- biopipen/scripts/delim/SampleInfo.R +4 -1
- biopipen/scripts/gene/GeneNameConversion.R +14 -12
- biopipen/scripts/gsea/Enrichr.R +2 -2
- biopipen/scripts/gsea/FGSEA.R +184 -50
- biopipen/scripts/gsea/PreRank.R +3 -3
- biopipen/scripts/misc/Plot.R +80 -0
- biopipen/scripts/plot/VennDiagram.R +2 -2
- biopipen/scripts/protein/ProdigySummary.R +34 -27
- biopipen/scripts/regulatory/MotifAffinityTest.R +11 -9
- biopipen/scripts/regulatory/MotifAffinityTest_AtSNP.R +5 -5
- biopipen/scripts/regulatory/MotifAffinityTest_MotifBreakR.R +4 -4
- biopipen/scripts/regulatory/VariantMotifPlot.R +10 -8
- biopipen/scripts/regulatory/motifs-common.R +10 -9
- biopipen/scripts/rnaseq/Simulation-ESCO.R +14 -11
- biopipen/scripts/rnaseq/Simulation-RUVcorr.R +7 -4
- biopipen/scripts/rnaseq/Simulation.R +0 -2
- biopipen/scripts/rnaseq/UnitConversion.R +6 -5
- biopipen/scripts/scrna/AnnData2Seurat.R +25 -73
- biopipen/scripts/scrna/CellCellCommunication.py +1 -1
- biopipen/scripts/scrna/CellCellCommunicationPlots.R +51 -168
- biopipen/scripts/scrna/CellTypeAnnotation-celltypist.R +99 -150
- biopipen/scripts/scrna/CellTypeAnnotation-direct.R +11 -9
- biopipen/scripts/scrna/CellTypeAnnotation-hitype.R +12 -9
- biopipen/scripts/scrna/CellTypeAnnotation-sccatch.R +14 -11
- biopipen/scripts/scrna/CellTypeAnnotation-sctype.R +19 -16
- biopipen/scripts/scrna/CellTypeAnnotation.R +10 -2
- biopipen/scripts/scrna/CellsDistribution.R +1 -1
- biopipen/scripts/scrna/ExprImputation-alra.R +87 -11
- biopipen/scripts/scrna/ExprImputation-rmagic.R +247 -21
- biopipen/scripts/scrna/ExprImputation-scimpute.R +8 -5
- biopipen/scripts/scrna/MarkersFinder.R +348 -217
- biopipen/scripts/scrna/MetaMarkers.R +3 -3
- biopipen/scripts/scrna/ModuleScoreCalculator.R +14 -13
- biopipen/scripts/scrna/RadarPlots.R +1 -1
- biopipen/scripts/scrna/ScFGSEA.R +157 -75
- biopipen/scripts/scrna/ScSimulation.R +11 -10
- biopipen/scripts/scrna/ScVelo.py +605 -0
- biopipen/scripts/scrna/Seurat2AnnData.R +2 -3
- biopipen/scripts/scrna/SeuratClusterStats-clustree.R +1 -1
- biopipen/scripts/scrna/SeuratClusterStats-features.R +39 -30
- biopipen/scripts/scrna/SeuratClusterStats-ngenes.R +56 -65
- biopipen/scripts/scrna/SeuratClusterStats-stats.R +4 -4
- biopipen/scripts/scrna/SeuratClusterStats.R +9 -6
- biopipen/scripts/scrna/SeuratClustering.R +31 -48
- biopipen/scripts/scrna/SeuratLoading.R +2 -2
- biopipen/scripts/scrna/SeuratMap2Ref.R +66 -367
- biopipen/scripts/scrna/SeuratMetadataMutater.R +5 -7
- biopipen/scripts/scrna/SeuratPreparing.R +76 -24
- biopipen/scripts/scrna/SeuratSubClustering.R +46 -185
- biopipen/scripts/scrna/{SlingShot.R → Slingshot.R} +12 -16
- biopipen/scripts/scrna/Subset10X.R +2 -2
- biopipen/scripts/scrna/TopExpressingGenes.R +141 -184
- biopipen/scripts/scrna/celltypist-wrapper.py +6 -4
- biopipen/scripts/scrna/seurat_anndata_conversion.py +81 -0
- biopipen/scripts/scrna_metabolic_landscape/MetabolicFeatures.R +429 -123
- biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayActivity.R +346 -245
- biopipen/scripts/scrna_metabolic_landscape/MetabolicPathwayHeterogeneity.R +182 -173
- biopipen/scripts/snp/MatrixEQTL.R +39 -20
- biopipen/scripts/snp/PlinkCallRate.R +43 -34
- biopipen/scripts/snp/PlinkFreq.R +34 -41
- biopipen/scripts/snp/PlinkHWE.R +23 -18
- biopipen/scripts/snp/PlinkHet.R +26 -22
- biopipen/scripts/snp/PlinkIBD.R +30 -34
- biopipen/scripts/stats/ChowTest.R +9 -8
- biopipen/scripts/stats/DiffCoexpr.R +13 -11
- biopipen/scripts/stats/LiquidAssoc.R +7 -8
- biopipen/scripts/stats/Mediation.R +8 -8
- biopipen/scripts/stats/MetaPvalue.R +11 -13
- biopipen/scripts/stats/MetaPvalue1.R +6 -5
- biopipen/scripts/tcr/CDR3AAPhyschem.R +105 -164
- biopipen/scripts/tcr/ClonalStats.R +5 -4
- biopipen/scripts/tcr/CloneResidency.R +3 -3
- biopipen/scripts/tcr/CloneSizeQQPlot.R +2 -2
- biopipen/scripts/tcr/Immunarch2VDJtools.R +2 -2
- biopipen/scripts/tcr/ImmunarchFilter.R +3 -3
- biopipen/scripts/tcr/ImmunarchLoading.R +5 -5
- biopipen/scripts/tcr/ScRepCombiningExpression.R +39 -0
- biopipen/scripts/tcr/ScRepLoading.R +114 -92
- biopipen/scripts/tcr/TCRClusterStats.R +2 -2
- biopipen/scripts/tcr/TCRClustering.R +86 -97
- biopipen/scripts/tcr/TESSA.R +65 -115
- biopipen/scripts/tcr/VJUsage.R +5 -5
- biopipen/scripts/vcf/TruvariBenchSummary.R +15 -11
- biopipen/utils/common_docstrs.py +66 -63
- biopipen/utils/reporter.py +177 -0
- {biopipen-0.33.1.dist-info → biopipen-0.34.0.dist-info}/METADATA +2 -1
- {biopipen-0.33.1.dist-info → biopipen-0.34.0.dist-info}/RECORD +130 -144
- {biopipen-0.33.1.dist-info → biopipen-0.34.0.dist-info}/WHEEL +1 -1
- biopipen/reports/scrna/CellCellCommunicationPlots.svelte +0 -14
- biopipen/reports/scrna/SeuratClusterStats.svelte +0 -16
- biopipen/reports/scrna/SeuratMap2Ref.svelte +0 -37
- biopipen/reports/scrna/SeuratPreparing.svelte +0 -15
- biopipen/reports/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.svelte +0 -28
- biopipen/reports/utils/gsea.liq +0 -110
- biopipen/scripts/scrna/CellTypeAnnotation-common.R +0 -10
- biopipen/scripts/scrna/SeuratClustering-common.R +0 -213
- biopipen/scripts/scrna_metabolic_landscape/MetabolicFeaturesIntraSubset.R +0 -193
- biopipen/utils/caching.R +0 -44
- biopipen/utils/gene.R +0 -95
- biopipen/utils/gsea.R +0 -329
- biopipen/utils/io.R +0 -20
- biopipen/utils/misc.R +0 -602
- biopipen/utils/mutate_helpers.R +0 -581
- biopipen/utils/plot.R +0 -209
- biopipen/utils/repr.R +0 -146
- biopipen/utils/rnaseq.R +0 -48
- biopipen/utils/single_cell.R +0 -207
- {biopipen-0.33.1.dist-info → biopipen-0.34.0.dist-info}/entry_points.txt +0 -0
|
@@ -60,6 +60,7 @@ do_one_features <- function(name) {
|
|
|
60
60
|
log$info("- Case: {name}")
|
|
61
61
|
|
|
62
62
|
case <- list_update(features_defaults, features[[name]])
|
|
63
|
+
case$descr <- case$descr %||% ""
|
|
63
64
|
case <- extract_vars(
|
|
64
65
|
case,
|
|
65
66
|
"devpars", "more_formats", "save_code", "save_data", "order_by",
|
|
@@ -87,50 +88,58 @@ do_one_features <- function(name) {
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
info <- case_info(name, odir, is_dir = FALSE, create = TRUE)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
|
|
92
|
+
caching <- Cache$new(
|
|
93
|
+
c(case, list(devpars, more_formats, save_code, save_data, order_by, subset, features, descr)),
|
|
94
|
+
prefix = "biopipen.scrna.SeuratClusterStats.features",
|
|
95
|
+
cache_dir = cache,
|
|
96
|
+
kind = "prefix",
|
|
97
|
+
path = info$prefix
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
if (caching$is_cached()) {
|
|
101
|
+
log$info(" plots are cached, restoring ...")
|
|
102
|
+
caching$restore()
|
|
103
|
+
} else {
|
|
104
|
+
case$features <- .get_features(features, case$object)
|
|
105
|
+
p <- do_call(gglogger::register(FeatureStatPlot), case)
|
|
106
|
+
save_plot(p, info$prefix, devpars, formats = c("png", more_formats))
|
|
107
|
+
if (save_code) {
|
|
108
|
+
save_plotcode(p, info$prefix,
|
|
109
|
+
setup = c("library(scplotter)", "load('data.RData')", "invisible(list2env(case, envir = .GlobalEnv))"),
|
|
110
|
+
"case",
|
|
111
|
+
auto_data_setup = FALSE)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (save_data) {
|
|
115
|
+
pdata <- attr(p, "data") %||% p$data
|
|
116
|
+
if (!inherits(pdata, "data.frame") && !inherits(pdata, "matrix")) {
|
|
117
|
+
stop("'save_data = TRUE' is not supported for plot_type: ", case$plot_type)
|
|
118
|
+
}
|
|
119
|
+
write.table(pdata, paste0(info$prefix, ".data.txt"), sep="\t", quote=FALSE, row.names=FALSE)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
caching$save(info$prefix)
|
|
98
123
|
}
|
|
99
|
-
|
|
124
|
+
# add reports
|
|
125
|
+
if (!is.null(descr) && nchar(descr) > 0) {
|
|
100
126
|
reporter$add2(
|
|
101
|
-
list(
|
|
102
|
-
kind = "descr",
|
|
103
|
-
content = descr
|
|
104
|
-
),
|
|
127
|
+
list(kind = "descr", content = descr),
|
|
105
128
|
hs = c(info$section, info$name)
|
|
106
129
|
)
|
|
107
130
|
}
|
|
108
131
|
|
|
109
132
|
if (save_data) {
|
|
110
|
-
if (!inherits(p$data, "data.frame") && !inherits(p$data, "matrix")) {
|
|
111
|
-
stop("'save_data = TRUE' is not supported for plot_type: ", case$plot_type)
|
|
112
|
-
}
|
|
113
|
-
write.table(p$data, paste0(info$prefix, ".data.txt"), sep="\t", quote=FALSE, row.names=FALSE)
|
|
114
133
|
reporter$add2(
|
|
115
134
|
list(
|
|
116
135
|
name = "Plot",
|
|
117
|
-
contents = list(
|
|
118
|
-
reporter$image(
|
|
119
|
-
info$prefix, more_formats, save_code, kind = "image")
|
|
120
|
-
)
|
|
136
|
+
contents = list(reporter$image(info$prefix, more_formats, save_code, kind = "image"))
|
|
121
137
|
),
|
|
122
138
|
list(
|
|
123
139
|
name = "Data",
|
|
124
140
|
contents = list(
|
|
125
|
-
list(
|
|
126
|
-
|
|
127
|
-
content = "Data used directly for the plot"
|
|
128
|
-
),
|
|
129
|
-
list(
|
|
130
|
-
kind = "table",
|
|
131
|
-
src = paste0(info$prefix, ".data.txt"),
|
|
132
|
-
data = list(nrows = 100)
|
|
133
|
-
)
|
|
141
|
+
list(kind = "descr", content = "Data used directly for the plot"),
|
|
142
|
+
list(kind = "table", src = paste0(info$prefix, ".data.txt"), data = list(nrows = 100))
|
|
134
143
|
)
|
|
135
144
|
),
|
|
136
145
|
hs = c(info$section, info$name),
|
|
@@ -12,79 +12,70 @@ do_one_ngenes <- function(name) {
|
|
|
12
12
|
|
|
13
13
|
case <- list_update(ngenes_defaults, ngenes[[name]])
|
|
14
14
|
case$devpars <- list_update(ngenes_defaults$devpars, case$devpars)
|
|
15
|
+
case$more_formats <- case$more_formats %||% character(0)
|
|
16
|
+
case$save_code <- case$save_code %||% FALSE
|
|
17
|
+
case$descr <- case$descr %||% name
|
|
18
|
+
case$save_data <- case$save_data %||% FALSE
|
|
19
|
+
case$ylab <- case$ylab %||% "Number of expressed genes"
|
|
20
|
+
case$features <- "Number of expressed genes"
|
|
21
|
+
extract_vars(case, "devpars", "more_formats", "descr", "save_code", "save_data", subset_ = "subset")
|
|
15
22
|
|
|
16
23
|
if (!is.null(case$subset)) {
|
|
17
|
-
|
|
24
|
+
case$object <- srtobj %>% filter(!!rlang::parse_expr(subset_))
|
|
18
25
|
} else {
|
|
19
|
-
|
|
26
|
+
case$object <- srtobj
|
|
20
27
|
}
|
|
21
|
-
|
|
28
|
+
case$object <- AddMetaData(case$object, Matrix::colSums(GetAssayData(case$object) > 0), col.name = "Number of expressed genes")
|
|
22
29
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
)
|
|
32
|
-
geom_violin(alpha = 0.6, position = ifelse(is.null(case$group.by), "identity", "dodge")) +
|
|
33
|
-
geom_boxplot(
|
|
34
|
-
position = ifelse(is.null(case$group.by), "identity", "dodge"),
|
|
35
|
-
width = .1,
|
|
36
|
-
fill = "white"
|
|
37
|
-
) +
|
|
38
|
-
plotthis::theme_this() +
|
|
39
|
-
# scale_fill_biopipen() +
|
|
40
|
-
ylab("Number of genes expressed")
|
|
41
|
-
|
|
42
|
-
if (!is.null(case$split.by)) {
|
|
43
|
-
p = p + facet_wrap(case$split.by)
|
|
30
|
+
info <- case_info(name, odir, is_dir = FALSE, create = TRUE)
|
|
31
|
+
p <- do_call(gglogger::register(FeatureStatPlot), case)
|
|
32
|
+
save_plot(p, info$prefix, case$devpars, formats = c("png", more_formats))
|
|
33
|
+
if (save_code) {
|
|
34
|
+
save_plotcode(p, info$prefix,
|
|
35
|
+
setup = c("library(scplotter)", "load('data.RData')", "invisible(list2env(case, envir = .GlobalEnv))"),
|
|
36
|
+
"case",
|
|
37
|
+
auto_data_setup = FALSE
|
|
38
|
+
)
|
|
44
39
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
'load("data.RData")'
|
|
58
|
-
),
|
|
59
|
-
"df_cells", "case"
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
reporter$add(
|
|
63
|
-
list(
|
|
64
|
-
kind = "descr",
|
|
65
|
-
content = paste0(
|
|
66
|
-
"Plots showing the number of genes expressed in each ",
|
|
67
|
-
case$ident,
|
|
68
|
-
ifelse(
|
|
69
|
-
is.null(case$group.by),
|
|
70
|
-
"",
|
|
71
|
-
paste0(", by ", paste0(case$group.by, collapse = ", "))
|
|
40
|
+
if (save_data) {
|
|
41
|
+
pdata <- attr(p, "data") %||% p$data
|
|
42
|
+
if (!inherits(pdata, "data.frame") && !inherits(pdata, "matrix")) {
|
|
43
|
+
stop("'save_data = TRUE' is not supported for plot_type: ", case$plot_type)
|
|
44
|
+
}
|
|
45
|
+
write.table(pdata, paste0(info$prefix, ".data.txt"), sep = "\t", quote = FALSE, row.names = FALSE)
|
|
46
|
+
reporter$add2(
|
|
47
|
+
list(
|
|
48
|
+
name = "Plot",
|
|
49
|
+
contents = list(
|
|
50
|
+
list(kind = "descr", content = case$descr),
|
|
51
|
+
reporter$image(info$prefix, more_formats, save_code, kind = "image")
|
|
72
52
|
)
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
53
|
+
),
|
|
54
|
+
list(
|
|
55
|
+
name = "Data",
|
|
56
|
+
contents = list(
|
|
57
|
+
list(
|
|
58
|
+
kind = "descr",
|
|
59
|
+
content = "Data used directly for the plot"
|
|
60
|
+
),
|
|
61
|
+
list(
|
|
62
|
+
kind = "table",
|
|
63
|
+
src = paste0(info$prefix, ".data.txt"),
|
|
64
|
+
data = list(nrows = 100)
|
|
65
|
+
)
|
|
84
66
|
)
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
|
|
67
|
+
),
|
|
68
|
+
hs = c(info$section, info$name),
|
|
69
|
+
ui = "tabs"
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
reporter$add2(
|
|
74
|
+
list(kind = "descr", content = case$descr),
|
|
75
|
+
reporter$image(info$prefix, more_formats, save_code, kind = "image"),
|
|
76
|
+
hs = c(info$section, info$name)
|
|
77
|
+
)
|
|
78
|
+
}
|
|
88
79
|
}
|
|
89
80
|
|
|
90
81
|
sapply(names(ngenes), do_one_ngenes)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# Loaded variables: srtfile, outdir, srtobj
|
|
2
|
-
library(circlize)
|
|
3
2
|
|
|
4
3
|
log$info("stats:")
|
|
5
4
|
|
|
@@ -23,16 +22,17 @@ do_one_stats <- function(name) {
|
|
|
23
22
|
save_plot(p, info$prefix, devpars, formats = c("png", more_formats))
|
|
24
23
|
if (save_code) {
|
|
25
24
|
save_plotcode(p, info$prefix,
|
|
26
|
-
setup = c("library(scplotter)", "load('data.RData')", "invisible(list2env(
|
|
25
|
+
setup = c("library(scplotter)", "load('data.RData')", "invisible(list2env(case, envir = .GlobalEnv))"),
|
|
27
26
|
"case",
|
|
28
27
|
auto_data_setup = FALSE)
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
if (save_data) {
|
|
32
|
-
|
|
31
|
+
pdata <- attr(p, "data") %||% p$data
|
|
32
|
+
if (!inherits(pdata, "data.frame") && !inherits(pdata, "matrix")) {
|
|
33
33
|
stop("'save_data = TRUE' is not supported for plot_type: ", case$plot_type)
|
|
34
34
|
}
|
|
35
|
-
write.table(
|
|
35
|
+
write.table(pdata, paste0(info$prefix, ".data.txt"), sep="\t", quote=FALSE, row.names=FALSE)
|
|
36
36
|
reporter$add2(
|
|
37
37
|
list(
|
|
38
38
|
name = "Plot",
|
|
@@ -16,9 +16,12 @@ srtfile <- {{in.srtobj | r}}
|
|
|
16
16
|
outdir <- {{out.outdir | r}}
|
|
17
17
|
joboutdir <- {{job.outdir | r}}
|
|
18
18
|
mutaters <- {{envs.mutaters | r}}
|
|
19
|
+
cache <- {{envs.cache | r}}
|
|
20
|
+
|
|
21
|
+
if (isTRUE(cache)) { cache = joboutdir }
|
|
19
22
|
|
|
20
23
|
log$info("Loading Seurat object ...")
|
|
21
|
-
srtobj =
|
|
24
|
+
srtobj = read_obj(srtfile)
|
|
22
25
|
|
|
23
26
|
log$info("Applying mutaters if any ...")
|
|
24
27
|
if (!is.null(mutaters) && length(mutaters) > 0) {
|
|
@@ -29,26 +32,26 @@ if (!is.null(mutaters) && length(mutaters) > 0) {
|
|
|
29
32
|
############## clustree ##############
|
|
30
33
|
clustrees_defaults <- {{envs.clustrees_defaults | r: todot="-"}}
|
|
31
34
|
clustrees <- {{envs.clustrees | r: todot="-", skip=1}}
|
|
32
|
-
{
|
|
35
|
+
{% include biopipen_dir + "/scripts/scrna/SeuratClusterStats-clustree.R" %}
|
|
33
36
|
|
|
34
37
|
############## stats ##############
|
|
35
38
|
stats_defaults = {{envs.stats_defaults | r: todot="-"}}
|
|
36
39
|
stats = {{envs.stats | r: todot="-", skip=1}}
|
|
37
|
-
{
|
|
40
|
+
{% include biopipen_dir + "/scripts/scrna/SeuratClusterStats-stats.R" %}
|
|
38
41
|
|
|
39
42
|
############## ngenes ##############
|
|
40
43
|
ngenes_defaults <- {{envs.ngenes_defaults | r: todot="-"}}
|
|
41
44
|
ngenes <- {{envs.ngenes | r: todot="-", skip=1}}
|
|
42
|
-
{
|
|
45
|
+
{% include biopipen_dir + "/scripts/scrna/SeuratClusterStats-ngenes.R" %}
|
|
43
46
|
|
|
44
47
|
############## features ##############
|
|
45
48
|
features_defaults = {{envs.features_defaults | r: todot="-"}}
|
|
46
49
|
features = {{envs.features | r: todot="-", skip=1}}
|
|
47
|
-
{
|
|
50
|
+
{% include biopipen_dir + "/scripts/scrna/SeuratClusterStats-features.R" %}
|
|
48
51
|
|
|
49
52
|
############## dimplots ##############
|
|
50
53
|
dimplots_defaults = {{envs.dimplots_defaults | r: todot="-"}}
|
|
51
54
|
dimplots = {{envs.dimplots | r: todot="-", skip=1}}
|
|
52
|
-
{
|
|
55
|
+
{% include biopipen_dir + "/scripts/scrna/SeuratClusterStats-dimplots.R" %}
|
|
53
56
|
|
|
54
57
|
reporter$save(joboutdir)
|
|
@@ -1,56 +1,39 @@
|
|
|
1
|
-
{{ biopipen_dir | joinpaths: "utils", "misc.R" | source_r }}
|
|
2
|
-
{{ biopipen_dir | joinpaths: "utils", "caching.R" | source_r }}
|
|
3
1
|
|
|
4
2
|
library(Seurat)
|
|
5
|
-
library(
|
|
6
|
-
library(rlang)
|
|
7
|
-
library(tidyr)
|
|
8
|
-
library(dplyr)
|
|
9
|
-
library(digest)
|
|
3
|
+
library(biopipen.utils)
|
|
10
4
|
|
|
11
5
|
set.seed(8525)
|
|
12
6
|
|
|
13
|
-
srtfile <- {{in.srtobj |
|
|
14
|
-
|
|
15
|
-
joboutdir <- {{job.outdir |
|
|
16
|
-
|
|
7
|
+
srtfile <- {{in.srtobj | r}}
|
|
8
|
+
outfile <- {{out.outfile | r}}
|
|
9
|
+
joboutdir <- {{job.outdir | r}}
|
|
10
|
+
RunPCAArgs <- {{envs.RunPCA | r: todot="-"}}
|
|
11
|
+
FindNeighborsArgs <- {{envs.FindNeighbors | r: todot="-"}}
|
|
12
|
+
FindClustersArgs <- {{envs.FindClusters | r: todot="-"}}
|
|
13
|
+
RunUMAPArgs <- {{envs.RunUMAP | r: todot="-"}}
|
|
14
|
+
cache <- {{envs.cache | r}}
|
|
15
|
+
ncores <- {{envs.ncores | r}}
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
stop("Cannot specify both ScaleData and SCTransform")
|
|
20
|
-
}
|
|
17
|
+
log <- get_logger()
|
|
21
18
|
|
|
22
|
-
options(str = strOptions(vec.len = 5, digits.d = 5))
|
|
19
|
+
# options(str = strOptions(vec.len = 5, digits.d = 5))
|
|
23
20
|
options(future.globals.maxSize = 80000 * 1024^2)
|
|
24
|
-
plan(strategy = "multicore", workers =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
sobj
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (is.character(envs$cache)) {
|
|
44
|
-
cache_dir <- file.path(envs$cache, paste0(dig_sig, ".seurat_cache"))
|
|
45
|
-
dir.create(cache_dir, recursive = TRUE, showWarnings = FALSE)
|
|
46
|
-
writeLines(sobj_sig, file.path(cache_dir, "signature.txt"))
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
sobj <- run_transformation(sobj)
|
|
50
|
-
sobj <- run_umap(sobj)
|
|
51
|
-
sobj <- run_findneighbors(sobj)
|
|
52
|
-
sobj <- run_findclusters(sobj)
|
|
53
|
-
sobj <- run_prepsctfindmarkers(sobj)
|
|
54
|
-
|
|
55
|
-
log_info("Saving results ...")
|
|
56
|
-
saveRDS(sobj, file = rdsfile)
|
|
21
|
+
plan(strategy = "multicore", workers = ncores)
|
|
22
|
+
|
|
23
|
+
log$info("Reading Seurat object ...")
|
|
24
|
+
sobj <- read_obj(srtfile)
|
|
25
|
+
|
|
26
|
+
if (isTRUE(cache)) { cache <- joboutdir }
|
|
27
|
+
|
|
28
|
+
sobj <- RunSeuratClustering(
|
|
29
|
+
sobj,
|
|
30
|
+
RunPCAArgs = RunPCAArgs,
|
|
31
|
+
RunUMAPArgs = RunUMAPArgs,
|
|
32
|
+
FindNeighborsArgs = FindNeighborsArgs,
|
|
33
|
+
FindClustersArgs = FindClustersArgs,
|
|
34
|
+
log = log,
|
|
35
|
+
cache = cache
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
log$info("Saving results ...")
|
|
39
|
+
save_obj(sobj, file = outfile)
|