Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

110 lines
5.0KB

  1. task benchmark {
  2. File vcf
  3. File benchmarking_dir
  4. File contig
  5. File sdf
  6. File ref_dir
  7. File fasta
  8. String sample = basename(vcf,".vcf.gz")
  9. String file_type = basename(vcf)
  10. String docker
  11. String cluster_config
  12. String disk_size
  13. command <<<
  14. nt=$(nproc)
  15. mkdir -p /cromwell_root/tmp
  16. cp -r ${ref_dir} /cromwell_root/tmp/
  17. cp -r ${benchmarking_dir} /cromwell_root/tmp/
  18. export HGREF=/cromwell_root/tmp/reference_data/GRCh38.d1.vd1.fa
  19. if [[ ${file_type} =~ "gz" ]];then
  20. gunzip ${vcf} -c > unzip.vcf
  21. else
  22. cp ${vcf} unzip.vcf
  23. fi
  24. cat unzip.vcf | grep '#CHROM' > name
  25. cat unzip.vcf | grep -v '#' > body
  26. 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
  27. if grep -q PASS "body.filtered"; then
  28. cat body.filtered | grep -v '0/0' | grep 'PASS' > body.filtered.gt
  29. cat unzip.vcf | grep '##' | grep -v 'contig' | cat - ${contig} name body.filtered.gt > filtered.vcf
  30. else
  31. cat body.filtered | grep -v '0/0' > body.filtered.gt
  32. cat unzip.vcf | grep '##' | grep -v 'contig' | cat - ${contig} name body.filtered.gt > filtered.vcf
  33. fi
  34. echo -e "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tLCL5" > LCL5_name
  35. echo -e "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tLCL6" > LCL6_name
  36. echo -e "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tLCL7" > LCL7_name
  37. echo -e "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tLCL8" > LCL8_name
  38. ls > filelist
  39. if [[ ${sample} =~ "LCL5" ]];then
  40. /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}
  41. cat filtered.vcf | grep '##' > header
  42. cat filtered.vcf | grep -v '#' > body
  43. cat header LCL5_name body > LCL5.vcf
  44. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg bgzip LCL5.vcf -c > ${sample}.reformed.vcf.gz
  45. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg index -f vcf ${sample}.reformed.vcf.gz
  46. elif [[ ${sample} =~ "LCL6" ]]; then
  47. /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}
  48. cat filtered.vcf | grep '##' > header
  49. cat filtered.vcf | grep -v '#' > body
  50. cat header LCL6_name body > LCL6.vcf
  51. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg bgzip LCL6.vcf -c > ${sample}.reformed.vcf.gz
  52. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg index -f vcf ${sample}.reformed.vcf.gz
  53. elif [[ ${sample} =~ "LCL7" ]]; then
  54. /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}
  55. cat filtered.vcf | grep '##' > header
  56. cat filtered.vcf | grep -v '#' > body
  57. cat header LCL7_name body > LCL7.vcf
  58. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg bgzip LCL7.vcf -c > ${sample}.reformed.vcf.gz
  59. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg index -f vcf ${sample}.reformed.vcf.gz
  60. elif [[ ${sample} =~ "LCL8" ]]; then
  61. /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}
  62. cat filtered.vcf | grep '##' > header
  63. cat filtered.vcf | grep -v '#' > body
  64. cat header LCL8_name body > LCL8.vcf
  65. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg bgzip LCL8.vcf -c > ${sample}.reformed.vcf.gz
  66. /opt/rtg-tools/dist/rtg-tools-3.10.1-4d58ead/rtg index -f vcf ${sample}.reformed.vcf.gz
  67. else
  68. echo "only for quartet samples"
  69. fi
  70. >>>
  71. runtime {
  72. docker:docker
  73. cluster:cluster_config
  74. systemDisk:"cloud_ssd 40"
  75. dataDisk:"cloud_ssd " + disk_size + " /cromwell_root/"
  76. }
  77. output {
  78. File rtg_vcf = "${sample}.reformed.vcf.gz"
  79. File rtg_vcf_index = "${sample}.reformed.vcf.gz.tbi"
  80. File gzip_vcf = "${sample}.vcf.gz"
  81. File gzip_vcf_index = "${sample}.vcf.gz.tbi"
  82. File roc_all_csv = "${sample}.roc.all.csv.gz"
  83. File roc_indel = "${sample}.roc.Locations.INDEL.csv.gz"
  84. File roc_indel_pass = "${sample}.roc.Locations.INDEL.PASS.csv.gz"
  85. File roc_snp = "${sample}.roc.Locations.SNP.csv.gz"
  86. File roc_snp_pass = "${sample}.roc.Locations.SNP.PASS.csv.gz"
  87. File summary = "${sample}.summary.csv"
  88. File extended = "${sample}.extended.csv"
  89. File metrics = "${sample}.metrics.json.gz"
  90. File out_file = "filelist"
  91. File filtered_vcf = "filtered.vcf"
  92. File unzip_vcf = "unzip.vcf"
  93. File body_filter = "body.filtered"
  94. File body_filtered_gt = "body.filtered.gt"
  95. File name = "name"
  96. File body = "body"
  97. }
  98. }