No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

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