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

144 行
5.3KB

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