Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

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