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

120 行
4.2KB

  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. /root/miniconda2/bin/cnvkit.py target ${bed_file} --annotate ${ref_flat} --split --short-names -o my_baits.bed
  30. /root/miniconda2/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. /root/miniconda2/bin/cnvkit.py access ${ref_dir} -o access.bed
  40. # Prepare the target bed
  41. /root/miniconda2/bin/cnvkit.py target ${bed_file} --annotate ${ref_flat} --split --short-names -o my_baits.bed
  42. /root/miniconda2/bin/cnvkit.py autobin ${tumor_bam} -t my_baits.bed -g access.bed
  43. /root/miniconda2/bin/cnvkit.py coverage ${tumor_bam} my_baits.target.bed -o ${sample}.T.targetcoverage.cnn
  44. /root/miniconda2/bin/cnvkit.py coverage ${tumor_bam} my_baits.antitarget.bed -o ${sample}.T.antitargetcoverage.cnn
  45. /root/miniconda2/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. /root/miniconda2/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. /root/miniconda2/bin/cnvkit.py access ${ref_dir} -o access.bed
  62. # Prepare the target bed
  63. #/root/miniconda2/bin/cnvkit.py --annotate ${ref_flat} --split --short-names -o my_baits.bed
  64. /root/miniconda2/bin/cnvkit.py autobin ${tumor_bam} --method wgs -g access.bed
  65. /root/miniconda2/bin/cnvkit.py coverage ${tumor_bam} ${sample}.target.bed -o ${sample}.T.targetcoverage.cnn
  66. /root/miniconda2/bin/cnvkit.py coverage ${tumor_bam} ${sample}.antitarget.bed -o ${sample}.T.antitargetcoverage.cnn
  67. /root/miniconda2/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. /root/miniconda2/bin/cnvkit.py batch ${tumor_bam} \
  72. -r ${sample}.reference.cnn/reference.cnn \
  73. --output-dir ${sample}.cns \
  74. -p $nt
  75. ls ./
  76. /root/miniconda2/bin/cnvkit.py call ${sample}.cns/${sample}.cns --center-at $center \
  77. -o ${sample}.call.cns
  78. ls ./
  79. tar cvf ${sample}.tar ${sample}*
  80. >>>
  81. runtime{
  82. docker:docker
  83. cluster:cluster_config
  84. systemDisk:"cloud_ssd 40"
  85. dataDisk:"cloud_ssd " + disk_size + " /cromwell_root/"
  86. timeout:259200
  87. }
  88. output{
  89. File out_file = "${sample}.tar"
  90. #File cnv_bed = "${sample}.ratio_cnv.call.filter.bed"
  91. }
  92. }