Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

115 lines
4.0KB

  1. task cnvkit{
  2. String sample_id
  3. File ref_dir
  4. String? fasta
  5. File ref_flat
  6. File? bed_file
  7. String? Polidy
  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. if [ ${normal_bam} ]; then
  27. /root/miniconda2/bin/cnvkit.py target ${bed_file} --annotate ${ref_flat} --split --short-names -o my_baits.bed
  28. /root/miniconda2/bin/cnvkit.py batch ${tumor_bam} \
  29. --normal ${normal_bam} \
  30. --targets my_baits.bed \
  31. --fasta ${ref_dir} \
  32. --annotate ${ref_flat} -p $nt \
  33. --drop-low-coverage \
  34. --output-dir ${sample}.reference.cnn
  35. else
  36. /root/miniconda2/bin/cnvkit.py access ${ref_dir} -o access.bed
  37. # Prepare the target bed
  38. /root/miniconda2/bin/cnvkit.py target ${bed_file} --annotate ${ref_flat} --split --short-names -o my_baits.bed
  39. /root/miniconda2/bin/cnvkit.py autobin ${tumor_bam} -t my_baits.bed -g access.bed
  40. /root/miniconda2/bin/cnvkit.py coverage ${tumor_bam} ${sample}.target.bed -o ${sample}.T.targetcoverage.cnn
  41. /root/miniconda2/bin/cnvkit.py coverage ${tumor_bam} ${sample}.antitarget.bed -o ${sample}.T.antitargetcoverage.cnn
  42. /root/miniconda2/bin/cnvkit.py reference -o ${sample}.reference.cnn/reference.cnn -f ${ref_dir} -t ${sample}.target.bed -a ${sample}.antitarget.bed
  43. fi
  44. #WGS
  45. else:
  46. if [ ${normal_bam} ]; then
  47. /root/miniconda2/bin/cnvkit.py batch ${tumor_bam} \
  48. --normal ${normal_bam} \
  49. --method wgs \
  50. --fasta ${ref_dir} \
  51. --annotate ${ref_flat} -p $nt \
  52. --drop-low-coverage \
  53. --output-dir ${sample}.reference.cnn
  54. else
  55. /root/miniconda2/bin/cnvkit.py access ${ref_dir} -o access.bed
  56. # Prepare the target bed
  57. #/root/miniconda2/bin/cnvkit.py --annotate ${ref_flat} --split --short-names -o my_baits.bed
  58. /root/miniconda2/bin/cnvkit.py autobin ${tumor_bam} --method wgs -g access.bed
  59. /root/miniconda2/bin/cnvkit.py coverage ${tumor_bam} ${sample}.target.bed -o ${sample}.T.targetcoverage.cnn
  60. /root/miniconda2/bin/cnvkit.py coverage ${tumor_bam} ${sample}.antitarget.bed -o ${sample}.T.antitargetcoverage.cnn
  61. /root/miniconda2/bin/cnvkit.py reference -o ${sample}.reference.cnn/reference.cnn -f ${ref_dir} -t ${sample}.target.bed -a ${sample}.antitarget.bed
  62. fi
  63. fi
  64. ls ./
  65. /root/miniconda2/bin/cnvkit.py batch ${tumor_bam} \
  66. -r ${sample}.reference.cnn/reference.cnn \
  67. --output-dir ${sample}.cns \
  68. -p $nt
  69. ls ./
  70. /root/miniconda2/bin/cnvkit.py call ${sample}.cns/${sample}.cns --center-at $center \
  71. -o ${sample}.call.cns
  72. ls ./
  73. tar cvf ${sample}.tar ${sample}*
  74. >>>
  75. runtime{
  76. docker:docker
  77. cluster:cluster_config
  78. systemDisk:"cloud_ssd 40"
  79. dataDisk:"cloud_ssd " + disk_size + " /cromwell_root/"
  80. timeout:259200
  81. }
  82. output{
  83. File out_file = "${sample}.tar"
  84. #File cnv_bed = "${sample}.ratio_cnv.call.filter.bed"
  85. }
  86. }