-
Notifications
You must be signed in to change notification settings - Fork 37
/
ichorCNA.snakefile
70 lines (67 loc) · 3.25 KB
/
ichorCNA.snakefile
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
configfile: "config/config.yaml"
configfile: "config/samples.yaml"
rule correctDepth:
input:
expand("results/ichorCNA/{tumor}/{tumor}.cna.seg", tumor=config["pairings"]),
expand("results/ichorCNA/{tumor}/{tumor}.seg.txt", tumor=config["pairings"]),
expand("results/ichorCNA/{tumor}/{tumor}.params.txt", tumor=config["pairings"]),
expand("results/ichorCNA/{tumor}/{tumor}.correctedDepth.txt", tumor=config["pairings"]),
expand("results/readDepth/{samples}.bin{binSize}.wig", samples=config["samples"], binSize=str(config["binSize"]))
rule read_counter:
input:
lambda wildcards: config["samples"][wildcards.samples]
output:
"results/readDepth/{samples}.bin{binSize}.wig"
params:
readCounter=config["readCounterScript"],
binSize=config["binSize"],
qual="20",
chrs=config["chrs"]
resources:
mem=4
log:
"logs/readDepth/{samples}.bin{binSize}.log"
shell:
"{params.readCounter} {input} -c {params.chrs} -w {params.binSize} -q {params.qual} > {output} 2> {log}"
rule ichorCNA:
input:
tum="results/readDepth/{tumor}.bin" + str(config["binSize"]) + ".wig",
norm=lambda wildcards: "results/readDepth/" + config["pairings"][wildcards.tumor] + ".bin" + str(config["binSize"]) + ".wig"
output:
corrDepth="results/ichorCNA/{tumor}/{tumor}.correctedDepth.txt",
param="results/ichorCNA/{tumor}/{tumor}.params.txt",
cna="results/ichorCNA/{tumor}/{tumor}.cna.seg",
segTxt="results/ichorCNA/{tumor}/{tumor}.seg.txt",
#seg="results/ichorCNA/{tumor}/{tumor}.seg",
#rdata="results/ichorCNA/{tumor}/{tumor}.RData",
params:
outDir="results/ichorCNA/{tumor}/",
rscript=config["ichorCNA_rscript"],
libdir=config["ichorCNA_libdir"],
id="{tumor}",
ploidy=config["ichorCNA_ploidy"],
normal=config["ichorCNA_normal"],
genomeStyle=config["genomeStyle"],
gcwig=config["ichorCNA_gcWig"],
mapwig=config["ichorCNA_mapWig"],
estimateNormal=config["ichorCNA_estimateNormal"],
estimatePloidy=config["ichorCNA_estimatePloidy"],
estimateClonality=config["ichorCNA_estimateClonality"],
scStates=config["ichorCNA_scStates"],
maxCN=config["ichorCNA_maxCN"],
includeHOMD=config["ichorCNA_includeHOMD"],
chrs=config["ichorCNA_chrs"],
#chrTrain=config["ichorCNA_chrTrain"],
centromere=config["centromere"],
exons=config["ichorCNA_exons"],
txnE=config["ichorCNA_txnE"],
txnStrength=config["ichorCNA_txnStrength"],
fracReadsChrYMale="0.001",
plotFileType=config["ichorCNA_plotFileType"],
plotYlim=config["ichorCNA_plotYlim"]
resources:
mem=4
log:
"logs/ichorCNA/{tumor}.log"
shell:
"Rscript {params.rscript} --libdir {params.libdir} --id {params.id} --WIG {input.tum} --gcWig {params.gcwig} --mapWig {params.mapwig} --NORMWIG {input.norm} --ploidy \"{params.ploidy}\" --normal \"{params.normal}\" --maxCN {params.maxCN} --includeHOMD {params.includeHOMD} --genomeStyle {params.genomeStyle} --chrs \"{params.chrs}\" --estimateNormal {params.estimateNormal} --estimatePloidy {params.estimatePloidy} --estimateScPrevalence {params.estimateClonality} --scStates \"{params.scStates}\" --centromere {params.centromere} --exons.bed {params.exons} --txnE {params.txnE} --txnStrength {params.txnStrength} --fracReadsInChrYForMale {params.fracReadsChrYMale} --plotFileType {params.plotFileType} --plotYLim \"{params.plotYlim}\" --outDir {params.outDir} > {log} 2> {log}"