diff --git a/Rules/freec_wgs_somatic_pass1.rl b/Rules/freec_wgs_somatic_pass1.rl index 22b3499..8a3857b 100644 --- a/Rules/freec_wgs_somatic_pass1.rl +++ b/Rules/freec_wgs_somatic_pass1.rl @@ -8,7 +8,7 @@ if config['project']['annotation'] == "hg19": params: dir=config['project']['workpath'],fasta=config['references'][pfamily]['FREECFASTA'],tumorsample=lambda wildcards: config['project']['pairs'][wildcards.x][1],normalsample=lambda wildcards: config['project']['pairs'][wildcards.x][0],lengths=config['references'][pfamily]['FREECLENGTHS'],chroms=config['references'][pfamily]['FREECCHROMS'],pile=config['references'][pfamily]['FREECPILEUP'],snps=config['references'][pfamily]['FREECSNPS'],rname="pl:freec" shell: "mkdir -p freec_out; mkdir -p freec_out/pass1; mkdir -p freec_out/pass1/{params.tumorsample}; module load samtools/1.9; samtools view -H {input.normal} | sed -e 's/SN:1/SN:chr1/' | sed -e 's/SN:2/SN:chr2/' | sed -e 's/SN:3/SN:chr3/' | sed -e 's/SN:4/SN:chr4/' | sed -e 's/SN:5/SN:chr5/' | sed -e 's/SN:6/SN:chr6/' | sed -e 's/SN:7/SN:chr7/' | sed -e 's/SN:8/SN:chr8/' | sed -e 's/SN:9/SN:chr9/' | sed -e 's/SN:10/SN:chr10/' | sed -e 's/SN:11/SN:chr11/' | sed -e 's/SN:12/SN:chr12/' | sed -e 's/SN:13/SN:chr13/' | sed -e 's/SN:14/SN:chr14/' | sed -e 's/SN:15/SN:chr15/' | sed -e 's/SN:16/SN:chr16/' | sed -e 's/SN:17/SN:chr17/' | sed -e 's/SN:18/SN:chr18/' | sed -e 's/SN:19/SN:chr19/' | sed -e 's/SN:20/SN:chr20/' | sed -e 's/SN:21/SN:chr21/' | sed -e 's/SN:22/SN:chr22/' | sed -e 's/SN:X/SN:chrX/' | sed -e 's/SN:Y/SN:chrY/' | sed -e 's/SN:MT/SN:chrM/' | samtools reheader - {input.normal} > freec_out/{input.normal}; samtools view -H {input.tumor} | sed -e 's/SN:1/SN:chr1/' | sed -e 's/SN:2/SN:chr2/' | sed -e 's/SN:3/SN:chr3/' | sed -e 's/SN:4/SN:chr4/' | sed -e 's/SN:5/SN:chr5/' | sed -e 's/SN:6/SN:chr6/' | sed -e 's/SN:7/SN:chr7/' | sed -e 's/SN:8/SN:chr8/' | sed -e 's/SN:9/SN:chr9/' | sed -e 's/SN:10/SN:chr10/' | sed -e 's/SN:11/SN:chr11/' | sed -e 's/SN:12/SN:chr12/' | sed -e 's/SN:13/SN:chr13/' | sed -e 's/SN:14/SN:chr14/' | sed -e 's/SN:15/SN:chr15/' | sed -e 's/SN:16/SN:chr16/' | sed -e 's/SN:17/SN:chr17/' | sed -e 's/SN:18/SN:chr18/' | sed -e 's/SN:19/SN:chr19/' | sed -e 's/SN:20/SN:chr20/' | sed -e 's/SN:21/SN:chr21/' | sed -e 's/SN:22/SN:chr22/' | sed -e 's/SN:X/SN:chrX/' | sed -e 's/SN:Y/SN:chrY/' | sed -e 's/SN:MT/SN:chrM/' | samtools reheader - {input.tumor} > freec_out/{input.tumor}; module load perl/5.18.4; perl Scripts/make_freec_pass1_wgs_tn_config.pl {params.dir}/freec_out/pass1/{params.tumorsample} {params.lengths} {params.chroms} {params.dir}/freec_out/{input.tumor} {params.dir}/freec_out/{input.normal} {params.pile} {params.fasta} {params.snps}; module load freec/11.5; module load bedtools/2.27.1; freec -conf {params.dir}/freec_out/pass1/{params.tumorsample}/freec_wgs_config.txt; module load R; cat /data/CCBR_Pipeliner/db/PipeDB/bin/FREEC/scripts/assess_significance.R | R --slave --args {params.dir}/freec_out/pass1/{params.tumorsample}/{params.tumorsample}.recal.bam_CNVs {params.dir}/freec_out/pass1/{params.tumorsample}/{params.tumorsample}.recal.bam_ratio.txt; mv {params.dir}/freec_out/pass1/{params.tumorsample}/{params.tumorsample}.recal.bam_CNVs.p.value.txt {output.cnvs}; cat /data/CCBR_Pipeliner/db/PipeDB/bin/FREEC/scripts/makeGraph.R | R --slave --args 2 {params.dir}/freec_out/pass1/{params.tumorsample}/{params.tumorsample}.recal.bam_ratio.txt {params.dir}/freec_out/pass1/{params.tumorsample}/{params.tumorsample}.recal.bam_BAF.txt" -else: +elif config['project']['annotation'] == "hg38": rule freec_wgs_somatic_pass1: input: normal=lambda wildcards: config['project']['pairs'][wildcards.x][0]+".recal.bam", tumor=lambda wildcards: config['project']['pairs'][wildcards.x][1]+".recal.bam", diff --git a/Rules/freec_wgs_somatic_pass2.rl b/Rules/freec_wgs_somatic_pass2.rl index 38c64bd..8389225 100644 --- a/Rules/freec_wgs_somatic_pass2.rl +++ b/Rules/freec_wgs_somatic_pass2.rl @@ -7,7 +7,7 @@ if config['project']['annotation'] == "hg19": params: dir=config['project']['workpath'],fasta=config['references'][pfamily]['FREECFASTA'],tumorsample=lambda wildcards: config['project']['pairs'][wildcards.x][1],normalsample=lambda wildcards: config['project']['pairs'][wildcards.x][0],lengths=config['references'][pfamily]['FREECLENGTHS'],chroms=config['references'][pfamily]['FREECCHROMS'],pile=config['references'][pfamily]['FREECPILEUP'],snps=config['references'][pfamily]['FREECSNPS'],rname="pl:freec" shell: "module load samtools/1.9; mkdir -p freec_out; mkdir -p freec_out/pass2; mkdir -p freec_out/pass2/{params.tumorsample}; module load perl/5.18.4; perl Scripts/make_freec_pass2_wgs_tn_config.pl {params.dir}/freec_out/pass2/{params.tumorsample} {params.lengths} {params.chroms} {params.dir}/freec_out/{input.tumor} {params.dir}/freec_out/{input.normal} {params.pile} {params.fasta} {params.snps} {input.fit}; module load freec/11.5; module load bedtools/2.27.1; freec -conf {params.dir}/freec_out/pass2/{params.tumorsample}/freec_wgs_config.txt; module load R; cat /data/CCBR_Pipeliner/db/PipeDB/bin/FREEC/scripts/assess_significance.R | R --slave --args {params.dir}/freec_out/pass2/{params.tumorsample}/{params.tumorsample}.recal.bam_CNVs {params.dir}/freec_out/pass2/{params.tumorsample}/{params.tumorsample}.recal.bam_ratio.txt; mv {params.dir}/freec_out/pass2/{params.tumorsample}/{params.tumorsample}.recal.bam_CNVs.p.value.txt {output.cnvs}; cat /data/CCBR_Pipeliner/db/PipeDB/bin/FREEC/scripts/makeGraph.R | R --slave --args 2 {params.dir}/freec_out/pass2/{params.tumorsample}/{params.tumorsample}.recal.bam_ratio.txt {params.dir}/freec_out/pass2/{params.tumorsample}/{params.tumorsample}.recal.bam_BAF.txt" -else: +elif config['project']['annotation'] == "hg38": rule freec_wgs_somatic_pass2: input: normal=lambda wildcards: config['project']['pairs'][wildcards.x][0]+".recal.bam", tumor=lambda wildcards: config['project']['pairs'][wildcards.x][1]+".recal.bam", diff --git a/Rules/freec_wgs_tumoronly.rl b/Rules/freec_wgs_tumoronly.rl index 5cee121..c52bc42 100644 --- a/Rules/freec_wgs_tumoronly.rl +++ b/Rules/freec_wgs_tumoronly.rl @@ -9,7 +9,7 @@ if config['project']['annotation'] == "hg19": params: dir=config['project']['workpath'],fasta=config['references'][pfamily]['FREECFASTA'],tumorsample=lambda wildcards: config['project']['units'][wildcards.x],lengths=config['references'][pfamily]['FREECLENGTHS'],chroms=config['references'][pfamily]['FREECCHROMS'],pile=config['references'][pfamily]['FREECPILEUP'],snps=config['references'][pfamily]['FREECSNPS'],rname="pl:freec" shell: "module load samtools/1.9; samtools view -H {input.tumor} | sed -e 's/SN:1/SN:chr1/' | sed -e 's/SN:2/SN:chr2/' | sed -e 's/SN:3/SN:chr3/' | sed -e 's/SN:4/SN:chr4/' | sed -e 's/SN:5/SN:chr5/' | sed -e 's/SN:6/SN:chr6/' | sed -e 's/SN:7/SN:chr7/' | sed -e 's/SN:8/SN:chr8/' | sed -e 's/SN:9/SN:chr9/' | sed -e 's/SN:10/SN:chr10/' | sed -e 's/SN:11/SN:chr11/' | sed -e 's/SN:12/SN:chr12/' | sed -e 's/SN:13/SN:chr13/' | sed -e 's/SN:14/SN:chr14/' | sed -e 's/SN:15/SN:chr15/' | sed -e 's/SN:16/SN:chr16/' | sed -e 's/SN:17/SN:chr17/' | sed -e 's/SN:18/SN:chr18/' | sed -e 's/SN:19/SN:chr19/' | sed -e 's/SN:20/SN:chr20/' | sed -e 's/SN:21/SN:chr21/' | sed -e 's/SN:22/SN:chr22/' | sed -e 's/SN:X/SN:chrX/' | sed -e 's/SN:Y/SN:chrY/' | sed -e 's/SN:MT/SN:chrM/' | samtools reheader - {input.tumor} > {output.newtumorbam}; mkdir -p freec_out; mkdir -p freec_out/{params.tumorsample}; module load perl/5.18.4; perl Scripts/make_freec_wgs_tumoronly_config.pl {params.dir}/freec_out/{params.tumorsample} {params.lengths} {params.chroms} {params.dir}/freec_out/{output.newtumorbam} {params.pile} {params.fasta} {params.snps} {input.canvasvcf}; module load freec/11.5; module load bedtools/2.27.1; freec -conf {params.dir}/freec_out/{params.tumorsample}/freec_wgs_config.txt; module load R; cat /data/CCBR_Pipeliner/db/PipeDB/bin/FREEC/scripts/assess_significance.R | R --slave --args {params.dir}/freec_out/{params.tumorsample}/{params.tumorsample}.recal.bam_CNVs {params.dir}/freec_out/{params.tumorsample}/{params.tumorsample}.recal.bam_ratio.txt; mv {params.dir}/freec_out/{params.tumorsample}/{params.tumorsample}.recal.bam_CNVs.p.value.txt {output.cnvs}; cat /data/CCBR_Pipeliner/db/PipeDB/bin/FREEC/scripts/makeGraph.R | R --slave --args 2 {params.dir}/freec_out/{params.tumorsample}/{params.tumorsample}.recal.bam_ratio.txt {params.dir}/freec_out/{params.tumorsample}/{params.tumorsample}.recal.bam_BAF.txt" -else: +elif config['project']['annotation'] == "hg38": rule freec_wgs_tumoronly: input: tumor=lambda wildcards: config['project']['units'][wildcards.x]+".recal.bam", index1="{x}.recal.bam.bai",