biopipen 0.32.3__py3-none-any.whl → 0.33.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 +6 -0
- biopipen/core/filters.py +35 -23
- biopipen/core/testing.py +6 -1
- biopipen/ns/bam.py +39 -0
- biopipen/ns/cellranger.py +5 -0
- biopipen/ns/cellranger_pipeline.py +2 -2
- biopipen/ns/cnvkit_pipeline.py +4 -1
- biopipen/ns/delim.py +33 -27
- biopipen/ns/protein.py +99 -0
- biopipen/ns/scrna.py +411 -250
- biopipen/ns/snp.py +16 -3
- biopipen/ns/tcr.py +125 -1
- biopipen/ns/vcf.py +34 -0
- biopipen/ns/web.py +5 -1
- biopipen/reports/scrna/SeuratClusterStats.svelte +1 -1
- biopipen/reports/scrna/SeuratMap2Ref.svelte +15 -2
- biopipen/reports/tcr/ClonalStats.svelte +15 -0
- biopipen/reports/utils/misc.liq +20 -7
- biopipen/scripts/bam/BamMerge.py +2 -2
- biopipen/scripts/bam/BamSampling.py +4 -4
- biopipen/scripts/bam/BamSort.py +141 -0
- biopipen/scripts/bam/BamSplitChroms.py +10 -10
- biopipen/scripts/bam/BamSubsetByBed.py +3 -3
- biopipen/scripts/bam/CNVpytor.py +10 -10
- biopipen/scripts/bam/ControlFREEC.py +11 -11
- biopipen/scripts/bed/Bed2Vcf.py +5 -5
- biopipen/scripts/bed/BedConsensus.py +5 -5
- biopipen/scripts/bed/BedLiftOver.sh +6 -4
- biopipen/scripts/bed/BedtoolsIntersect.py +4 -4
- biopipen/scripts/bed/BedtoolsMakeWindows.py +3 -3
- biopipen/scripts/bed/BedtoolsMerge.py +4 -4
- biopipen/scripts/cellranger/CellRangerCount.py +20 -9
- biopipen/scripts/cellranger/CellRangerSummary.R +20 -29
- biopipen/scripts/cellranger/CellRangerVdj.py +8 -8
- biopipen/scripts/cnvkit/CNVkitAccess.py +6 -6
- biopipen/scripts/cnvkit/CNVkitAutobin.py +25 -18
- biopipen/scripts/cnvkit/CNVkitBatch.py +5 -5
- biopipen/scripts/cnvkit/CNVkitCall.py +3 -3
- biopipen/scripts/cnvkit/CNVkitCoverage.py +2 -2
- biopipen/scripts/cnvkit/CNVkitDiagram.py +5 -5
- biopipen/scripts/cnvkit/CNVkitFix.py +3 -3
- biopipen/scripts/cnvkit/CNVkitGuessBaits.py +9 -5
- biopipen/scripts/cnvkit/CNVkitHeatmap.py +4 -4
- biopipen/scripts/cnvkit/CNVkitReference.py +2 -2
- biopipen/scripts/cnvkit/CNVkitScatter.py +5 -5
- biopipen/scripts/cnvkit/CNVkitSegment.py +5 -5
- biopipen/scripts/cnvkit/guess_baits.py +166 -93
- biopipen/scripts/delim/SampleInfo.R +85 -148
- biopipen/scripts/misc/Config2File.py +2 -2
- biopipen/scripts/misc/Str2File.py +2 -2
- biopipen/scripts/protein/MMCIF2PDB.py +33 -0
- biopipen/scripts/protein/PDB2Fasta.py +60 -0
- biopipen/scripts/protein/Prodigy.py +4 -4
- biopipen/scripts/protein/RMSD.py +178 -0
- biopipen/scripts/regulatory/MotifScan.py +8 -8
- biopipen/scripts/scrna/CellCellCommunication.py +59 -22
- biopipen/scripts/scrna/MarkersFinder.R +273 -654
- biopipen/scripts/scrna/RadarPlots.R +73 -53
- biopipen/scripts/scrna/SCP-plot.R +15202 -0
- biopipen/scripts/scrna/ScVelo.py +0 -0
- biopipen/scripts/scrna/SeuratClusterStats-clustree.R +23 -31
- biopipen/scripts/scrna/SeuratClusterStats-dimplots.R +26 -54
- biopipen/scripts/scrna/SeuratClusterStats-features.R +85 -403
- biopipen/scripts/scrna/SeuratClusterStats-ngenes.R +32 -17
- biopipen/scripts/scrna/SeuratClusterStats-stats.R +45 -239
- biopipen/scripts/scrna/SeuratClusterStats.R +13 -19
- biopipen/scripts/scrna/SeuratMap2Ref.R +16 -12
- biopipen/scripts/scrna/SeuratPreparing.R +138 -81
- biopipen/scripts/scrna/SlingShot.R +71 -0
- biopipen/scripts/scrna/celltypist-wrapper.py +7 -6
- biopipen/scripts/snp/Plink2GTMat.py +26 -11
- biopipen/scripts/snp/PlinkFilter.py +7 -7
- biopipen/scripts/snp/PlinkFromVcf.py +8 -5
- biopipen/scripts/snp/PlinkSimulation.py +4 -4
- biopipen/scripts/snp/PlinkUpdateName.py +4 -4
- biopipen/scripts/stats/ChowTest.R +48 -22
- biopipen/scripts/tcgamaf/Maf2Vcf.py +2 -2
- biopipen/scripts/tcgamaf/MafAddChr.py +2 -2
- biopipen/scripts/tcr/ClonalStats.R +484 -0
- biopipen/scripts/tcr/ScRepLoading.R +127 -0
- biopipen/scripts/tcr/TCRDock.py +10 -6
- biopipen/scripts/tcr/vdjtools-patch.sh +1 -1
- biopipen/scripts/vcf/BcftoolsAnnotate.py +8 -8
- biopipen/scripts/vcf/BcftoolsFilter.py +3 -3
- biopipen/scripts/vcf/BcftoolsMerge.py +31 -0
- biopipen/scripts/vcf/BcftoolsSort.py +4 -4
- biopipen/scripts/vcf/BcftoolsView.py +5 -5
- biopipen/scripts/vcf/Vcf2Bed.py +2 -2
- biopipen/scripts/vcf/VcfAnno.py +11 -11
- biopipen/scripts/vcf/VcfDownSample.sh +22 -10
- biopipen/scripts/vcf/VcfFilter.py +5 -5
- biopipen/scripts/vcf/VcfFix.py +7 -7
- biopipen/scripts/vcf/VcfFix_utils.py +12 -3
- biopipen/scripts/vcf/VcfIndex.py +3 -3
- biopipen/scripts/vcf/VcfIntersect.py +3 -3
- biopipen/scripts/vcf/VcfLiftOver.sh +5 -0
- biopipen/scripts/vcf/VcfSplitSamples.py +4 -4
- biopipen/scripts/vcf/bcftools_utils.py +3 -3
- biopipen/scripts/web/Download.py +8 -4
- biopipen/scripts/web/DownloadList.py +5 -5
- biopipen/scripts/web/GCloudStorageDownloadBucket.py +5 -5
- biopipen/scripts/web/GCloudStorageDownloadFile.py +3 -3
- biopipen/scripts/web/gcloud_common.py +1 -1
- biopipen/utils/gsea.R +75 -35
- biopipen/utils/misc.R +205 -7
- biopipen/utils/misc.py +17 -8
- biopipen/utils/reference.py +11 -11
- biopipen/utils/repr.R +146 -0
- biopipen/utils/vcf.py +1 -1
- {biopipen-0.32.3.dist-info → biopipen-0.33.0.dist-info}/METADATA +8 -8
- {biopipen-0.32.3.dist-info → biopipen-0.33.0.dist-info}/RECORD +114 -105
- {biopipen-0.32.3.dist-info → biopipen-0.33.0.dist-info}/WHEEL +1 -1
- biopipen/scripts/scrna/SeuratClusterStats-hists.R +0 -144
- biopipen/scripts/scrna/SeuratPreparing-common.R +0 -467
- biopipen/scripts/scrna/SeuratPreparing-doublet_detection.R +0 -204
- {biopipen-0.32.3.dist-info → biopipen-0.33.0.dist-info}/entry_points.txt +0 -0
|
File without changes
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
# srtobj, clustrees_defaults, clustrees
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
log$info("clustrees:")
|
|
4
|
+
|
|
3
5
|
if (
|
|
4
6
|
(is.null(clustrees) || length(clustrees) == 0) &&
|
|
5
|
-
(is.null(clustrees_defaults$prefix) || clustrees_defaults$prefix
|
|
6
|
-
|
|
7
|
+
(is.null(clustrees_defaults$prefix) || isFALSE(clustrees_defaults$prefix))) {
|
|
8
|
+
log$warn("- no case specified, skipping ...")
|
|
7
9
|
} else { # clustrees set or prefix is not empty
|
|
8
|
-
library(clustree)
|
|
9
10
|
odir = file.path(outdir, "clustrees")
|
|
10
11
|
dir.create(odir, recursive=TRUE, showWarnings=FALSE)
|
|
11
12
|
|
|
12
|
-
if ((is.null(clustrees) || length(clustrees) == 0) && clustrees_defaults$prefix
|
|
13
|
+
if ((is.null(clustrees) || length(clustrees) == 0) && isTRUE(clustrees_defaults$prefix)) {
|
|
13
14
|
clustrees <- list()
|
|
14
15
|
for (key in names(srtobj@commands)) {
|
|
15
16
|
if (startsWith(key, "FindClusters") && length(srtobj@commands[[key]]$resolution) > 1) {
|
|
@@ -23,40 +24,24 @@ if (
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
if (length(clustrees) == 0) {
|
|
26
|
-
|
|
27
|
+
log$warn("- no case found, skipping ...")
|
|
27
28
|
} else {
|
|
28
29
|
reports <- list()
|
|
29
30
|
for (name in names(clustrees)) {
|
|
30
31
|
if (is.null(clustrees[[name]]$prefix)) {
|
|
31
32
|
stop(paste0("clustrees: prefix is required for case: ", name))
|
|
32
33
|
}
|
|
34
|
+
log$info("- Case: {name} ...")
|
|
33
35
|
case <- list_update(clustrees_defaults, clustrees[[name]])
|
|
36
|
+
extract_vars(case, "devpars", "more_formats", "save_code")
|
|
34
37
|
|
|
35
|
-
devpars <- case$devpars
|
|
36
|
-
devpars$width <- devpars$width %||% clustrees_defaults$devpars$width %||% 800
|
|
37
|
-
devpars$height <- devpars$height %||% clustrees_defaults$devpars$height %||% 1000
|
|
38
|
-
devpars$res <- devpars$res %||% clustrees_defaults$devpars$res %||% 100
|
|
39
|
-
case$devpars <- NULL
|
|
40
38
|
prefix <- sub("\\.$", "", case$prefix)
|
|
41
|
-
log_info("- Case: {name} ...")
|
|
42
39
|
case$prefix <- paste0(prefix, ".")
|
|
43
|
-
case$
|
|
44
|
-
case$x <- case$x[complete.cases(case$x), , drop = FALSE]
|
|
40
|
+
case$object <- srtobj
|
|
45
41
|
|
|
46
42
|
command <- srtobj@commands[[paste0("FindClusters.", prefix)]] %||%
|
|
47
43
|
(if(prefix == "seurat_clusters") srtobj@commands$FindClusters else NULL)
|
|
48
44
|
|
|
49
|
-
p <- do_call(clustree, case)
|
|
50
|
-
clustree_file <- file.path(odir, paste0(prefix, ".clustree.png"))
|
|
51
|
-
png(clustree_file, width = devpars$width, height = devpars$height, res = devpars$res)
|
|
52
|
-
print(p)
|
|
53
|
-
dev.off()
|
|
54
|
-
|
|
55
|
-
clustree_file_pdf <- file.path(odir, paste0(prefix, ".clustree.pdf"))
|
|
56
|
-
pdf(clustree_file_pdf, width = devpars$width / devpars$res, height = devpars$height / devpars$res)
|
|
57
|
-
print(p)
|
|
58
|
-
dev.off()
|
|
59
|
-
|
|
60
45
|
if (is.null(command)) {
|
|
61
46
|
resolution <- substring(colnames(case$x), nchar(case$prefix) + 1)
|
|
62
47
|
} else {
|
|
@@ -64,16 +49,23 @@ if (
|
|
|
64
49
|
}
|
|
65
50
|
resolution_used <- resolution[length(resolution)]
|
|
66
51
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
52
|
+
plot_prefix <- file.path(odir, paste0(slugify(prefix), ".clustree"))
|
|
53
|
+
p <- do_call(gglogger::register(ClustreePlot), case)
|
|
54
|
+
save_plot(p, plot_prefix, devpars, formats = c("png", more_formats))
|
|
55
|
+
|
|
56
|
+
if (save_code) {
|
|
57
|
+
save_plotcode(p, plot_prefix,
|
|
58
|
+
setup = c("library(scplotter)", "load('data.RData')", "invisible(list2env('case'))"),
|
|
59
|
+
"case",
|
|
60
|
+
auto_data_setup = FALSE)
|
|
61
|
+
}
|
|
62
|
+
reports[[length(reports) + 1]] <- reporter$image(
|
|
63
|
+
plot_prefix, more_formats, save_code, kind = "image",
|
|
72
64
|
descr = paste0("Resolutions: ", paste(resolution, collapse = ", "), "; resolution used: ", resolution_used)
|
|
73
65
|
)
|
|
74
66
|
}
|
|
75
67
|
reports$h1 <- "Clustree plots"
|
|
76
68
|
reports$ui <- "table_of_images"
|
|
77
|
-
|
|
69
|
+
do_call(reporter$add, reports)
|
|
78
70
|
}
|
|
79
71
|
}
|
|
@@ -2,75 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
# dimplots_defaults = {{envs.dimplots_defaults | r: todot="-"}}
|
|
4
4
|
# dimplots = {{envs.dimplots | r: todot="-", skip=1}}
|
|
5
|
-
|
|
5
|
+
log$info("dimplots:")
|
|
6
6
|
|
|
7
|
-
odir
|
|
7
|
+
odir <- file.path(outdir, "dimplots")
|
|
8
8
|
dir.create(odir, recursive=TRUE, showWarnings=FALSE)
|
|
9
9
|
|
|
10
10
|
do_one_dimplot = function(name) {
|
|
11
|
-
|
|
11
|
+
log$info("- Case: {name}")
|
|
12
12
|
|
|
13
|
-
case
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
case <- list_update(dimplots_defaults, dimplots[[name]])
|
|
14
|
+
|
|
15
|
+
# Get functional arguments and inconsistent arguments
|
|
16
|
+
subset <- case$subset; case$subset <- NULL
|
|
17
|
+
reduction <- case$reduction; case$reduction <- NULL
|
|
18
|
+
devpars <- case$devpars; case$devpars <- NULL
|
|
19
|
+
|
|
20
|
+
# Normalize arguments
|
|
21
|
+
reduction <- if (reduction %in% c("dim", "auto")) DefaultDimReduc(srtobj) else reduction
|
|
22
|
+
devpars <- list_update(dimplots_defaults$devpars, devpars)
|
|
23
|
+
key <- paste0("sub_umap_", case$group_by)
|
|
24
|
+
|
|
25
|
+
if (!is.null(subset)) {
|
|
26
|
+
case$object <- srtobj %>% filter(!!parse_expr(subset))
|
|
17
27
|
} else {
|
|
18
|
-
case$object
|
|
28
|
+
case$object <- srtobj
|
|
19
29
|
}
|
|
20
|
-
|
|
21
|
-
if (is.null(case$group.by)) { case$group.by = case$ident }
|
|
22
|
-
key <- paste0("sub_umap_", case$ident)
|
|
23
|
-
if (
|
|
24
|
-
key %in% names(case$object@reductions) &&
|
|
25
|
-
(is.null(case$reduction) || case$reduction %in% c("dim", "auto"))) {
|
|
30
|
+
if (key %in% names(case$object@reductions) && is.null(reduction)) {
|
|
26
31
|
case$reduction = key
|
|
32
|
+
} else {
|
|
33
|
+
case$reduction = reduction
|
|
27
34
|
}
|
|
28
|
-
if (is.null(case$na_group)) {
|
|
29
|
-
case$object = filter(case$object, !is.na(!!sym(case$group.by)))
|
|
30
|
-
} else if (is.null(case$order)) {
|
|
31
|
-
case$order = case$object@meta.data[[case$group.by]] %>%
|
|
32
|
-
unique() %>% na.omit() %>% as.character() %>% sort()
|
|
33
|
-
case$object@meta.data = replace_na(
|
|
34
|
-
case$object@meta.data,
|
|
35
|
-
setNames(list(case$na_group), case$group.by)
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
case$cols = case$cols %||% pal_biopipen()(length(unique(case$object@meta.data[[case$group.by]])))
|
|
39
|
-
if (!is.null(case$na_group)) {
|
|
40
|
-
# Is the NA value in the first position?
|
|
41
|
-
case$cols = c("lightgrey", case$cols[1:(length(case$cols) - 1)])
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
excluded_args = c("devpars", "ident", "subset")
|
|
45
|
-
for (arg in excluded_args) {
|
|
46
|
-
assign(arg, case[[arg]])
|
|
47
|
-
case[[arg]] = NULL
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (case$reduction %in% c("dim", "auto")) { case$reduction = NULL }
|
|
51
|
-
case$na_group <- NULL
|
|
52
35
|
|
|
53
|
-
p
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
print(p)
|
|
57
|
-
dev.off()
|
|
36
|
+
p <- do_call(CellDimPlot, case)
|
|
37
|
+
prefix <- file.path(odir, paste0(slugify(name), ".dim"))
|
|
38
|
+
save_plot(p, prefix, devpars)
|
|
58
39
|
|
|
59
|
-
|
|
60
|
-
pdf(figfile_pdf, width=devpars$width / devpars$res, height=devpars$height / devpars$res)
|
|
61
|
-
print(p)
|
|
62
|
-
dev.off()
|
|
63
|
-
|
|
64
|
-
add_report(
|
|
40
|
+
reporter$add(
|
|
65
41
|
list(
|
|
66
42
|
kind = "descr",
|
|
67
43
|
content = paste0("Dimensionality reduction plot for ", case$group.by)
|
|
68
44
|
),
|
|
69
|
-
|
|
70
|
-
kind = "image",
|
|
71
|
-
src = figfile,
|
|
72
|
-
download = figfile_pdf
|
|
73
|
-
),
|
|
45
|
+
reporter$image(prefix, "pdf", FALSE),
|
|
74
46
|
h1 = name
|
|
75
47
|
)
|
|
76
48
|
}
|