您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

127 行
4.6KB

  1. task cnvkit{
  2. String sample_id
  3. File ref_dir
  4. String? fasta
  5. File ref_flat
  6. File? bed_file
  7. String? Ploidy
  8. File tumor_bam
  9. File tumor_bam_index
  10. File? normal_bam
  11. File? normal_bam_index
  12. String docker
  13. String cluster_config
  14. String disk_size
  15. String sample=basename(tumor_bam,".bam")
  16. command <<<
  17. set -o pipefail
  18. set -e
  19. nt=$(nproc)
  20. echo ${sample}
  21. echo ${Ploidy}
  22. center=`awk -v vv=${Ploidy} 'BEGIN {print log(2/vv)/log(2)}'`
  23. echo $center
  24. #WES
  25. if [ ${bed_file} ]; then
  26. echo "WES"
  27. if [ ${normal_bam} ]; then
  28. echo "WES with normal"
  29. /usr/local/bin/cnvkit.py target ${bed_file} --annotate ${ref_flat} --split --short-names -o my_baits.bed
  30. /usr/local/bin/cnvkit.py batch ${tumor_bam} \
  31. --normal ${normal_bam} \
  32. --targets my_baits.bed \
  33. --fasta ${ref_dir} \
  34. --annotate ${ref_flat} -p $nt \
  35. --drop-low-coverage \
  36. --output-dir ${sample}.reference.cnn
  37. else
  38. echo "WES no normal"
  39. /usr/local/bin/cnvkit.py access ${ref_dir} -o access.bed
  40. # Prepare the target bed
  41. /usr/local/bin/cnvkit.py target ${bed_file} --annotate ${ref_flat} --split --short-names -o my_baits.bed
  42. /usr/local/bin/cnvkit.py autobin ${tumor_bam} -t my_baits.bed -g access.bed
  43. /usr/local/bin/cnvkit.py coverage ${tumor_bam} my_baits.target.bed -o ${sample}.T.targetcoverage.cnn
  44. /usr/local/bin/cnvkit.py coverage ${tumor_bam} my_baits.antitarget.bed -o ${sample}.T.antitargetcoverage.cnn
  45. /usr/local/bin/cnvkit.py reference -o ${sample}.reference.cnn/reference.cnn -f ${ref_dir} -t my_baits.target.bed -a my_baits.antitarget.bed
  46. fi
  47. #WGS
  48. else
  49. echo "WGS"
  50. if [ ${normal_bam} ]; then
  51. echo "WGS with normal"
  52. /usr/local/bin/cnvkit.py batch ${tumor_bam} \
  53. --normal ${normal_bam} \
  54. --method wgs \
  55. --fasta ${ref_dir} \
  56. --annotate ${ref_flat} -p $nt \
  57. --drop-low-coverage \
  58. --output-dir ${sample}.reference.cnn
  59. else
  60. echo "WGS no normal"
  61. /usr/local/bin/cnvkit.py access ${ref_dir} -o access.bed
  62. # Prepare the target bed
  63. #/usr/local/bin/cnvkit.py --annotate ${ref_flat} --split --short-names -o my_baits.bed
  64. /usr/local/bin/cnvkit.py autobin ${tumor_bam} --method wgs -g access.bed
  65. /usr/local/bin/cnvkit.py coverage ${tumor_bam} ${sample}.target.bed -o ${sample}.T.targetcoverage.cnn
  66. /usr/local/bin/cnvkit.py coverage ${tumor_bam} ${sample}.antitarget.bed -o ${sample}.T.antitargetcoverage.cnn
  67. /usr/local/bin/cnvkit.py reference -o ${sample}.reference.cnn/reference.cnn -f ${ref_dir} -t ${sample}.target.bed -a ${sample}.antitarget.bed
  68. fi
  69. fi
  70. ls ./
  71. /usr/local/bin/cnvkit.py batch ${tumor_bam} \
  72. -r ${sample}.reference.cnn/reference.cnn \
  73. --output-dir ${sample}.cns \
  74. -p $nt
  75. ls ./
  76. /usr/local/bin/cnvkit.py call ${sample}.cns/${sample}.cns --center-at $center \
  77. -o ${sample}.call.cns
  78. # Plot the results
  79. /usr/local/bin/cnvkit.py scatter ${sample}.cns/${sample}.cnr -s ${sample}.call.cns -o ${sample}.scatter.pdf
  80. /usr/local/bin/cnvkit.py diagram ${sample}.cns/${sample}.cnr -s ${sample}.call.cns -o ${sample}.diagram.pdf
  81. /usr/local/bin/cnvkit.py heatmap ${sample}.cns/${sample}.cnr ${sample}.call.cns -o ${sample}.heatmap.pdf
  82. #gain and loss
  83. /usr/local/bin/cnvkit.py export vcf ${sample}.call.cns -y -i "${sample}" -o ${sample}.call.cns.vcf
  84. tar cvf ${sample}.tar ${sample}*
  85. >>>
  86. runtime{
  87. docker:docker
  88. cluster:cluster_config
  89. systemDisk:"cloud_ssd 40"
  90. dataDisk:"cloud_ssd " + disk_size + " /cromwell_root/"
  91. timeout:259200
  92. }
  93. output{
  94. File out_file = "${sample}.tar"
  95. File cnv_bed = "${sample}.call.cns.vcf"
  96. }
  97. }