-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnakefile_multiome
executable file
·77 lines (64 loc) · 2.82 KB
/
Snakefile_multiome
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from snakemake.utils import R
import glob
import os
import itertools
include: "rules/singlecell_import.smk"
include: "rules/singlecell_multiome_import.smk"
## if there is only one sample, there is no need to run cellrange aggr
aggregate = getattr(config, "aggregate", True)
aggr_output4ruleall = ["aggregate.complete"] if aggregate else []
## only one sample or Multiplexing Capture
if len(samples) == 1 or hasattr(config, "cmo"):
aggregate = False
aggr_output4ruleall = []
include: "rules/singlecell_rules_common.smk"
copy_complete = 'copy.complete'
if external == True:
wreport_result = []
xreport_result = []
copy_complete = []
rule all:
input:
expand("run_{sample}_10x_cellranger_count.err", sample=samples),
"finalreport/metric_summary.xlsx",
expand("finalreport/summaries/{sample}_web_summary.html", sample=samples),
aggr_output4ruleall,
xreport_result,
wreport_result,
copy_complete,
rule_all_append
rule librariesCSV:
output: expand("{sample}_libraries.csv", sample=samples)
params: fastq = ",".join(config.unaligned)
shell: "python {analysis}/workflow/scripts/fb/create_library_files.py {config.libraries} {params.fastq}"
include_introns = getattr(config, "include_introns", True)
def count_premrna(wildcards):
if include_introns is False:
return('--gex-exclude-introns')
else:
return(' ')
rule arc_count:
input: "{sample}_libraries.csv"
output: "{sample}/outs/web_summary.html"
log: err = "run_{sample}_10x_cellranger_count.err", log ="run_{sample}_10x_cellranger_count.log"
params: prefix = "{sample}", prefix2 = filterFastq,count_intronic = count_premrna
container: program.cellranger_arc
shell:
"""
rm -r {params.prefix}; cellranger-arc count {params.count_intronic} --id={params.prefix} --reference={reference.arc_reference} --libraries={input} 2>{log.err} 1>{log.log}
"""
rule summaryFiles:
input: expand("{sample}/outs/web_summary.html", sample=samples)
output: "finalreport/metric_summary.xlsx", expand("finalreport/summaries/{sample}_web_summary.html", sample=samples)
shell: "python {analysis}/workflow/scripts/multiome/generateSummaryFiles.py"
if aggregate == True:
rule aggregateCSV:
input: expand("{sample}/outs/web_summary.html", sample=samples)
output: "AggregatedDatasets.csv"
shell: "python {analysis}/workflow/scripts/multiome/generateAggregateCSV.py {analysis}"
rule aggregate:
input: csv="AggregatedDatasets.csv"
output: touch('aggregate.complete')
log: err="run_10x_aggregate.err", log="run_10x_aggregate.log"
container: program.cellranger_arc
shell: "cellranger-arc aggr --id=AggregatedDatasets --csv={input.csv} --reference={reference.arc_reference} --normalize=depth 2>{log.err} 1>{log.log}"