|
|
|
|
|
|
|
|
task CNVkit { |
|
|
task CNVkit { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String sample |
|
|
String sample |
|
|
File ref_dir |
|
|
File ref_dir |
|
|
String fasta |
|
|
String fasta |
|
|
|
|
|
|
|
|
# Derive each segment's absolute integer copy number, ploidy must be int value |
|
|
# Derive each segment's absolute integer copy number, ploidy must be int value |
|
|
PURITY=`awk -F'\t' '{print $6}' ${hrd} | sed -n '2p'` |
|
|
PURITY=`awk -F'\t' '{print $6}' ${hrd} | sed -n '2p'` |
|
|
cnvkit.py call ${sample}.cns -y -m clonal --purity $PURITY -o ${sample}.call.cns |
|
|
cnvkit.py call ${sample}.cns -y -m clonal --purity $PURITY -o ${sample}.call.cns |
|
|
|
|
|
|
|
|
|
|
|
cnvkit.py call ${sample}.cnr -y -m clonal --purity $PURITY -o ${sample}.call.cnr |
|
|
|
|
|
|
|
|
# Plot the results |
|
|
# Plot the results |
|
|
cnvkit.py scatter ${sample}.cnr -s ${sample}.call.cns -o ${sample}.scatter.pdf |
|
|
cnvkit.py scatter ${sample}.cnr -s ${sample}.call.cns -o ${sample}.scatter.pdf |
|
|
cnvkit.py diagram ${sample}.cnr -s ${sample}.call.cns -o ${sample}.diagram.pdf |
|
|
cnvkit.py diagram ${sample}.cnr -s ${sample}.call.cns -o ${sample}.diagram.pdf |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Genemetrics |
|
|
# Genemetrics |
|
|
mkdir gainloss |
|
|
mkdir gainloss |
|
|
cnvkit.py genemetrics ${sample}.cnr -s ${sample}.call.cns -t 0 -m 0 -o ${sample}.cnv.txt |
|
|
|
|
|
|
|
|
cnvkit.py genemetrics ${sample}.call.cnr -t 0.2 -m 3 -o ${sample}.ratio_cnv.txt |
|
|
|
|
|
cnvkit.py genemetrics ${sample}.call.cnr -s ${sample}.call.cns -t 0.2 -m 3 -o ${sample}.segment_cnv.txt |
|
|
# Filter genes |
|
|
# Filter genes |
|
|
cnvkit.py genemetrics ${sample}.cnr -t 0.2 -m 3 -o ${sample}.ratio-genes.txt |
|
|
|
|
|
cnvkit.py genemetrics ${sample}.cnr -s ${sample}.call.cns -t 0.2 -m 3 -o ${sample}.segment-genes.txt |
|
|
|
|
|
cat ${sample}.ratio-genes.txt | tail -n+2 | cut -f1 | sort | uniq > ratio-genes.txt |
|
|
|
|
|
cat ${sample}.segment-genes.txt | tail -n+2 | cut -f1 | sort | uniq > segment-genes.txt |
|
|
|
|
|
comm -12 ratio-genes.txt segment-genes.txt > ${sample}.trusted_cnv_genes.txt |
|
|
|
|
|
for gene in `cat ${sample}.trusted_cnv_genes.txt` |
|
|
|
|
|
|
|
|
cat ${sample}.ratio_cnv.txt | tail -n+2 | cut -f1 | sort | uniq > ratio_cnv.txt |
|
|
|
|
|
cat ${sample}.segment_cnv.txt | tail -n+2 | cut -f1 | sort | uniq > segment_cnv.txt |
|
|
|
|
|
comm -12 ratio_cnv.txt segment_cnv.txt > ${sample}.trusted_genes.txt |
|
|
|
|
|
for gene in `cat ${sample}.trusted_genes.txt` |
|
|
do |
|
|
do |
|
|
cnvkit.py scatter ${sample}.cnr -s ${sample}.call.cns -g $gene -o ./gainloss/${sample}.$gene.scatter.pdf |
|
|
|
|
|
|
|
|
cnvkit.py scatter ${sample}.call.cnr -s ${sample}.call.cns -g $gene -o ./gainloss/${sample}.$gene.scatter.pdf |
|
|
done |
|
|
done |
|
|
>>> |
|
|
>>> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
File cnr = "${sample}.cnr" |
|
|
File cnr = "${sample}.cnr" |
|
|
File cns = "${sample}.cns" |
|
|
File cns = "${sample}.cns" |
|
|
File stats = "${sample}.stats" |
|
|
File stats = "${sample}.stats" |
|
|
|
|
|
File call_cnr = "${sample}.call.cnr" |
|
|
File call_cns = "${sample}.call.cns" |
|
|
File call_cns = "${sample}.call.cns" |
|
|
File genemetrics = "${sample}.cnv.txt" |
|
|
|
|
|
File gainloss_genes = "${sample}.trusted_cnv_genes.txt" |
|
|
|
|
|
|
|
|
File ratio_cnv = "${sample}.ratio_cnv.txt" |
|
|
|
|
|
File segment_cnv = "${sample}.segment_cnv.txt" |
|
|
|
|
|
File gainloss_genes = "${sample}.trusted_genes.txt" |
|
|
Array[File] gainloss = glob("./gainloss/*") |
|
|
Array[File] gainloss = glob("./gainloss/*") |
|
|
} |
|
|
} |
|
|
} |
|
|
} |