VEP (Variant Effect Predictor) predicts the functional effects of genomic variants. The annotated VCF will be converted into MAF based on vcf2maf.
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.

104 lines
2.9KB

  1. task VEP {
  2. File vcf
  3. String sample_id
  4. String basename = basename(vcf,".vcf")
  5. File ref_dir
  6. String fasta
  7. String vep_path
  8. File cache
  9. String ncbi_build
  10. String species
  11. String vcf2maf_path
  12. String docker
  13. String cluster_config
  14. String disk_size
  15. command <<<
  16. set -o pipefail
  17. set -e
  18. nt=$(nproc)
  19. source /etc/profile
  20. #awk -F'\t' '{if(($1~"^#")||($1!~"^#" && $7=="PASS")){print $0}}' ${vcf} > ${sample_id}.vcf
  21. # Set the buffer_size based on the data size
  22. nrow=`awk -F'\t' '{if($1~"^chr"){print $0}}' ${vcf} | wc -l`
  23. if [ $nrow -lt 5000 ]; then
  24. buffer_size="--buffer_size 5000"
  25. else
  26. buffer_size="--buffer_size 50"
  27. fi
  28. # Judge the SAMPLE info of vcf file
  29. sample_col_1=`awk -F'\t' '{if($1~"^#CHROM"){print $10}}' ${vcf}`
  30. sample_col_2=`awk -F'\t' '{if($1~"^#CHROM"){print $11}}' ${vcf}`
  31. if [ $sample_col_2 ]; then # This situation means there are pairs
  32. SAMPLE_vcf2maf="--tumor-id $sample_col_2 --normal-id $sample_col_1"
  33. SAMPLE_vcf2vcf="--vcf-tumor-id $sample_col_2 --vcf-normal-id $sample_col_1"
  34. cp ${vcf} ${sample_id}.tmp1.vcf
  35. else # Tumor-only or normal-only
  36. SAMPLE_vcf2maf="--tumor-id $sample_col_1"
  37. # Add a column and remove it after vcf2vcf
  38. SAMPLE_vcf2vcf="--vcf-tumor-id $sample_col_1 --vcf-normal-id $sample_col_1"
  39. awk -F'\t' 'OFS="\t" {if($1!~"^##" && length($11)==0) $11=$10; print $0}' ${vcf} > ${sample_id}.tmp1.vcf
  40. fi
  41. # vcf2vcf: transfer into a standardized format
  42. echo "Transfer the VCF file into a standardized format..."
  43. perl ${vcf2maf_path}/vcf2vcf.pl \
  44. --input-vcf ${sample_id}.tmp1.vcf --output-vcf ${sample_id}.tmp2.vcf \
  45. $SAMPLE_vcf2vcf \
  46. --ref-fasta ${ref_dir}/${fasta}
  47. if [ $sample_col_2 ]; then
  48. cp ${sample_id}.tmp2.vcf ${basename}.norm.vcf
  49. else
  50. cut -f 1,2,3,4,5,6,7,8,9,10 ${sample_id}.tmp2.vcf > ${basename}.norm.vcf
  51. fi
  52. # VEP annotation
  53. echo "VEP annotation..."
  54. perl ${vep_path}/vep --format vcf --vcf \
  55. --input_file ${basename}.norm.vcf --output_file ${basename}.vep.vcf \
  56. --assembly ${ncbi_build} \
  57. --species ${species} \
  58. --everything --af_exac \
  59. --offline \
  60. --cache --dir_cache ${cache} \
  61. --fasta ${ref_dir}/${fasta} \
  62. $buffer_size \
  63. --fork $nt
  64. # vcf2maf
  65. echo "vcf2maf..."
  66. perl ${vcf2maf_path}/vcf2maf.pl \
  67. --inhibit-vep \
  68. --input-vcf ${basename}.vep.vcf --output-maf ${basename}.maf \
  69. $SAMPLE_vcf2maf \
  70. --ref-fasta ${ref_dir}/${fasta} \
  71. --ncbi-build ${ncbi_build} \
  72. --species ${species}
  73. >>>
  74. runtime {
  75. docker: docker
  76. cluster: cluster_config
  77. systemDisk: "cloud_ssd 40"
  78. dataDisk: "cloud_ssd " + disk_size + " /cromwell_root/"
  79. }
  80. output {
  81. File norm_vcf = "${basename}.norm.vcf"
  82. File vep_vcf = "${basename}.vep.vcf"
  83. File vep_vcf_summary = "${basename}.vep.vcf_summary.html"
  84. File maf = "${basename}.maf"
  85. }
  86. }