|
|
@@ -0,0 +1,84 @@ |
|
|
|
task cnvkit{ |
|
|
|
String sample_id |
|
|
|
File ref_dir |
|
|
|
String? fasta |
|
|
|
File ref_flat |
|
|
|
File? bed_file |
|
|
|
String? Ploidy |
|
|
|
File tumor_bam |
|
|
|
File tumor_bam_index |
|
|
|
Array[File]? normal_bams |
|
|
|
Array[File]? normal_bam_indexs |
|
|
|
String docker |
|
|
|
String cluster_config |
|
|
|
String disk_size |
|
|
|
String sample=basename(tumor_bam,".bam") |
|
|
|
|
|
|
|
command <<< |
|
|
|
|
|
|
|
set -o pipefail |
|
|
|
set -e |
|
|
|
nt=$(nproc) |
|
|
|
|
|
|
|
echo ${sample} |
|
|
|
|
|
|
|
echo ${sep=" " normal_bams} |
|
|
|
|
|
|
|
|
|
|
|
echo ${Ploidy} |
|
|
|
|
|
|
|
center=`awk -v vv=${Ploidy} 'BEGIN {print log(2/vv)/log(2)}'` |
|
|
|
|
|
|
|
echo $center |
|
|
|
|
|
|
|
/usr/local/bin/cnvkit.py target ${bed_file} --annotate ${ref_flat} --split --short-names -o my_baits.bed |
|
|
|
/usr/local/bin/cnvkit.py batch ${tumor_bam} \ |
|
|
|
--normal ${sep=" " normal_bams} \ |
|
|
|
--targets my_baits.bed \ |
|
|
|
--fasta ${ref_dir} \ |
|
|
|
--annotate ${ref_flat} -p $nt \ |
|
|
|
--drop-low-coverage \ |
|
|
|
--output-dir ${sample}.reference.cnn |
|
|
|
|
|
|
|
|
|
|
|
ls ./ |
|
|
|
|
|
|
|
|
|
|
|
/usr/local/bin/cnvkit.py batch ${tumor_bam} \ |
|
|
|
-r ${sample}.reference.cnn/reference.cnn \ |
|
|
|
--output-dir ${sample}.cns \ |
|
|
|
-p $nt |
|
|
|
|
|
|
|
ls ./ |
|
|
|
/usr/local/bin/cnvkit.py call ${sample}.cns/${sample}.cns --center-at $center \ |
|
|
|
-o ${sample}.call.cns |
|
|
|
|
|
|
|
|
|
|
|
# Plot the results |
|
|
|
/usr/local/bin/cnvkit.py scatter ${sample}.cns/${sample}.cnr -s ${sample}.call.cns -o ${sample}.scatter.pdf |
|
|
|
/usr/local/bin/cnvkit.py diagram ${sample}.cns/${sample}.cnr -s ${sample}.call.cns -o ${sample}.diagram.pdf |
|
|
|
/usr/local/bin/cnvkit.py heatmap ${sample}.cns/${sample}.cnr ${sample}.call.cns -o ${sample}.heatmap.pdf |
|
|
|
|
|
|
|
|
|
|
|
#gain and loss |
|
|
|
/usr/local/bin/cnvkit.py export vcf ${sample}.call.cns -y -i "${sample}" -o ${sample}.call.cns.vcf |
|
|
|
|
|
|
|
|
|
|
|
tar cvf ${sample}.tar ${sample}* |
|
|
|
|
|
|
|
>>> |
|
|
|
|
|
|
|
runtime{ |
|
|
|
docker:docker |
|
|
|
cluster:cluster_config |
|
|
|
systemDisk:"cloud_ssd 40" |
|
|
|
dataDisk:"cloud_ssd " + disk_size + " /cromwell_root/" |
|
|
|
timeout:259200 |
|
|
|
} |
|
|
|
|
|
|
|
output{ |
|
|
|
File out_file = "${sample}.tar" |
|
|
|
File cnv_bed = "${sample}.call.cns.vcf" |
|
|
|
} |
|
|
|
|
|
|
|
} |