You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
4.6KB

  1. task benchmark {
  2. File vcf
  3. File benchmarking_dir
  4. File contig
  5. File sdf
  6. String project
  7. String sample = basename(vcf,".vcf.gz")
  8. String docker
  9. String cluster_config
  10. String disk_size
  11. command <<<
  12. set -o pipefail
  13. set -e
  14. nt=$(nproc)
  15. mkdir -p /cromwell_root/tmp
  16. cp -r ${benchmarking_dir} /cromwell_root/tmp/
  17. if [[ ${sample} =~ "gz" ]];then
  18. gunzip ${vcf} -c > unzip.vcf
  19. else
  20. cp ${vcf} unzip.vcf
  21. fi
  22. cat unzip.vcf | grep '#CHROM' > name
  23. cat unzip.vcf | grep -v '#' > body
  24. cat body | grep -w '^chr1\|^chr2\|^chr3\|^chr4\|^chr5\|^chr6\|^chr7\|^chr8\|^chr9\|^chr10\|^chr11\|^chr12\|^chr13\|^chr14\|^chr15\|^chr16\|^chr17\|^chr18\|^chr19\|^chr20\|^chr21\|^chr22\|^chrX' > body.filtered
  25. if grep -q PASS "body.filtered"; then
  26. cat body.filtered | grep -v '0/0' | grep 'PASS' > body.filtered.gt
  27. cat unzip.vcf | grep '##' | grep -v 'contig' | cat - ${contig} name body.filtered.gt > filtered.vcf
  28. else
  29. cat body.filtered | grep -v '0/0' > body.filtered.gt
  30. cat unzip.vcf | grep '##' | grep -v 'contig' | cat - ${contig} name body.filtered.gt > filtered.vcf
  31. fi
  32. echo -e "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tLCL5" > LCL5_name
  33. echo -e "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tLCL6" > LCL6_name
  34. echo -e "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tLCL7" > LCL7_name
  35. echo -e "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tLCL8" > LCL8_name
  36. if [[ ${sample} =~ "LCL5" ]];then
  37. /opt/hap.py/bin/hap.py /cromwell_root/tmp/reference_datasets_v202103/LCL5.high.confidence.calls.vcf filtered.vcf -f /cromwell_root/tmp/reference_datasets_v202103/Quartet.high.confidence.region.v202103.bed --threads $nt -o ${sample} -r ${ref_dir}/${fasta}
  38. cat filtered.vcf | grep '##' > header
  39. cat filtered.vcf | grep -v '#' > body
  40. cat header LCL5_name body > LCL5.vcf
  41. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg bgzip LCL5.vcf -c > ${sample}.reformed.vcf.gz
  42. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg index -f vcf ${sample}.reformed.vcf.gz
  43. elif [[ ${sample} =~ "LCL6" ]]; then
  44. /opt/hap.py/bin/hap.py /cromwell_root/tmp/reference_datasets_v202103/LCL6.high.confidence.calls.vcf filtered.vcf -f /cromwell_root/tmp/reference_datasets_v202103/Quartet.high.confidence.region.v202103.bed --threads $nt -o ${sample} -r ${ref_dir}/${fasta}
  45. cat filtered.vcf | grep '##' > header
  46. cat filtered.vcf | grep -v '#' > body
  47. cat header LCL6_name body > LCL6.vcf
  48. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg bgzip LCL6.vcf -c > ${sample}.reformed.vcf.gz
  49. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg index -f vcf ${sample}.reformed.vcf.gz
  50. elif [[ ${sample} =~ "LCL7" ]]; then
  51. /opt/hap.py/bin/hap.py /cromwell_root/tmp/reference_datasets_v202103/LCL7.high.confidence.calls.vcf filtered.vcf -f /cromwell_root/tmp/reference_datasets_v202103/Quartet.high.confidence.region.v202103.bed --threads $nt -o ${sample} -r ${ref_dir}/${fasta}
  52. cat filtered.vcf | grep '##' > header
  53. cat filtered.vcf | grep -v '#' > body
  54. cat header LCL7_name body > LCL7.vcf
  55. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg bgzip LCL7.vcf -c > ${sample}.reformed.vcf.gz
  56. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg index -f vcf ${sample}.reformed.vcf.gz
  57. elif [[ ${sample} =~ "LCL8" ]]; then
  58. /opt/hap.py/bin/hap.py /cromwell_root/tmp/reference_datasets_v202103/LCL8.high.confidence.calls.vcf filtered.vcf -f /cromwell_root/tmp/reference_datasets_v202103/Quartet.high.confidence.region.v202103.bed --threads $nt -o ${sample} -r ${ref_dir}/${fasta}
  59. cat filtered.vcf | grep '##' > header
  60. cat filtered.vcf | grep -v '#' > body
  61. cat header LCL8_name body > LCL8.vcf
  62. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg bgzip LCL8.vcf -c > ${sample}.reformed.vcf.gz
  63. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg index -f vcf ${sample}.reformed.vcf.gz
  64. else
  65. echo "only for quartet samples"
  66. fi
  67. >>>
  68. runtime {
  69. docker:docker
  70. cluster:cluster_config
  71. systemDisk:"cloud_ssd 40"
  72. dataDisk:"cloud_ssd " + disk_size + " /cromwell_root/"
  73. }
  74. output {
  75. File rtg_vcf = "${sample}.reformed.vcf.gz"
  76. File rtg_vcf_index = "${sample}.reformed.vcf.gz.tbi"
  77. File gzip_vcf = "${sample}.vcf.gz"
  78. File gzip_vcf_index = "${sample}.vcf.gz.tbi"
  79. File roc_all_csv = "${sample}.roc.all.csv.gz"
  80. File roc_indel = "${sample}.roc.Locations.INDEL.csv.gz"
  81. File roc_indel_pass = "${sample}.roc.Locations.INDEL.PASS.csv.gz"
  82. File roc_snp = "${sample}.roc.Locations.SNP.csv.gz"
  83. File roc_snp_pass = "${sample}.roc.Locations.SNP.PASS.csv.gz"
  84. File summary = "${sample}.summary.csv"
  85. File extended = "${sample}.extended.csv"
  86. File metrics = "${sample}.metrics.json.gz"
  87. }
  88. }