s2_noUMI_sv_calling_vardict_pair_20220901.pbs 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/sh
  2. #PBS -N noUMI_varscan_pair
  3. #PBS -j oe
  4. #PBS -l ncpus=12
  5. #PBS -l nodes=1
  6. #PBS -l mem=20G
  7. #inputpath=$1
  8. #sample=$2
  9. source /home/liuxiangqiong/miniconda3/bin/activate base
  10. hg19=/cgdata/Database/GATK/b37/human_g1k_v37_decoy.fasta
  11. target=/cgdata/liuxiangqiong/work62pancancer/pipeline/v0/refdata/NanOnco_Plus_Panel_v2.0_Covered_b37_cg.parY2X.sort
  12. #min_af=0.001
  13. Vardict_Dir=/cgdata/liuxiangqiong/software/VarDict-1.5.7
  14. outputdir=${inputpath}/1SV_vardict_pair
  15. tumorbam=${bam_dir}/${tumor}_clean.bam
  16. normalbam=${bam_dir}/${normal}_clean.bam
  17. #pair
  18. for i in `seq 1 8`
  19. do
  20. ${Vardict_Dir}/vardict -G ${hg19} -f ${min_af} -N ${sample} -b "${tumorbam}|${normalbam}" -c 1 -S 2 -E 3 -g 4 ${target}-$i.bed |${Vardict_Dir}/testsomatic.R|${Vardict_Dir}/var2vcf_paired.pl -N "${tumor}|${normal}" -f ${min_af} > ${outputdir}/${sample}_pair.vd_$i.vcf&
  21. done
  22. wait
  23. #bgzip
  24. bcftools view ${outputdir}/${sample}_pair.vd_1.vcf -Oz -o ${outputdir}/${sample}_pair.vd_1.vcf.gz
  25. bcftools view ${outputdir}/${sample}_pair.vd_2.vcf -Oz -o ${outputdir}/${sample}_pair.vd_2.vcf.gz
  26. bcftools view ${outputdir}/${sample}_pair.vd_3.vcf -Oz -o ${outputdir}/${sample}_pair.vd_3.vcf.gz
  27. bcftools view ${outputdir}/${sample}_pair.vd_4.vcf -Oz -o ${outputdir}/${sample}_pair.vd_4.vcf.gz
  28. bcftools view ${outputdir}/${sample}_pair.vd_5.vcf -Oz -o ${outputdir}/${sample}_pair.vd_5.vcf.gz
  29. bcftools view ${outputdir}/${sample}_pair.vd_6.vcf -Oz -o ${outputdir}/${sample}_pair.vd_6.vcf.gz
  30. bcftools view ${outputdir}/${sample}_pair.vd_7.vcf -Oz -o ${outputdir}/${sample}_pair.vd_7.vcf.gz
  31. bcftools view ${outputdir}/${sample}_pair.vd_8.vcf -Oz -o ${outputdir}/${sample}_pair.vd_8.vcf.gz
  32. #index
  33. bcftools index ${outputdir}/${sample}_pair.vd_1.vcf.gz
  34. bcftools index ${outputdir}/${sample}_pair.vd_2.vcf.gz
  35. bcftools index ${outputdir}/${sample}_pair.vd_3.vcf.gz
  36. bcftools index ${outputdir}/${sample}_pair.vd_4.vcf.gz
  37. bcftools index ${outputdir}/${sample}_pair.vd_5.vcf.gz
  38. bcftools index ${outputdir}/${sample}_pair.vd_6.vcf.gz
  39. bcftools index ${outputdir}/${sample}_pair.vd_7.vcf.gz
  40. bcftools index ${outputdir}/${sample}_pair.vd_8.vcf.gz
  41. #
  42. bcftools concat -a ${outputdir}/${sample}_pair.vd_1.vcf.gz ${outputdir}/${sample}_pair.vd_2.vcf.gz ${outputdir}/${sample}_pair.vd_3.vcf.gz ${outputdir}/${sample}_pair.vd_4.vcf.gz ${outputdir}/${sample}_pair.vd_5.vcf.gz ${outputdir}/${sample}_pair.vd_6.vcf.gz ${outputdir}/${sample}_pair.vd_7.vcf.gz ${outputdir}/${sample}_pair.vd_8.vcf.gz | bcftools sort - -O z -o ${outputdir}/${sample}_pair.vd.vcf
  43. #标准化对齐
  44. vt decompose ${outputdir}/${sample}_pair.vd.vcf |vt normalize - -r ${hg19} -o ${outputdir}/${sample}_pair.vd.normalized.vcf
  45. #less ${outputdir}/${sample}_pair.vd.normalized.vcf | grep -vE "^#" > ${outputdir}/${sample}_pair.vd.normalized.nohead.vcf
  46. #3.3 将邻近的位点进行合并#3.3 将邻近的位点进行合并
  47. #python3 /cgdata/liuxiangqiong/work62pancancer/Client/v0/script/complex_variant_new.py -i ${outputdir}/${sample}_pair.vd.normalized.nohead.vcf -b ${bam_dir}/${tumor}_clean.bam -f ${hg19} -mode 2 -n 10 -p 0.5 -o ${outputdir}/${sample}_pair.vd.normalized.nohead.combind.vcf
  48. #grep "^#" ${outputdir}/${sample}_pair.vd.normalized.vcf >${outputdir}/${sample}_pair.vd.normalized.head.combind.vcf
  49. #less ${outputdir}/${sample}_pair.vd.normalized.nohead.combind.vcf >>${outputdir}/${sample}_pair.vd.normalized.head.combind.vcf
  50. conda deactivate
  51. #5.3对经过标准化的进行vep注释
  52. source /home/liuxiangqiong/miniconda3/bin/activate ensemble-vep
  53. PERL5LIB=/home/liuxiangqiong/miniconda3/envs/ensemble-vep/share/ensembl-vep-105.0-1/Bio/EnsEMBL/Variation/Utils/DB/HTS/Faidx
  54. export PERL5LIB=$PERL5LIB
  55. inputdir=${outputdir}/${sample}_pair.vd.normalized.vcf
  56. outdir1=${outputdir}/${sample}_pair.vd.normalized.vepanno.vcf
  57. vep --cache --fork 16 \
  58. -i ${inputdir} \
  59. -o ${outdir1} \
  60. --assembly GRCh37 \
  61. --cache_version 104 \
  62. --dir_cache /home/liuxiangqiong/miniconda3/share/ensembl-vep-88.9-0/hg19 \
  63. --refseq \
  64. --canonical \
  65. --offline \
  66. --hgvs \
  67. --fasta /cgdata/Database/GATK/b37/human_g1k_v37_decoy.fasta \
  68. --hgvsg \
  69. --max_af \
  70. --check_existing \
  71. --numbers \
  72. --symbol \
  73. --canonical \
  74. --offline \
  75. -vcf \
  76. --use_given_ref \
  77. --af_gnomad \
  78. --check_existing
  79. #5.4对vep的再进行annovar注释
  80. outdir2=${outputdir}/${sample}_pair.vd.normalized.vepanno.annovar
  81. perl /cgdata/CGTools/soft/src/annovar_20200608/table_annovar.pl ${outdir1} /cgdata/soft/src/annovar.archive/DB/ -buildver hg19 -out ${outdir2} -remove -protocol refGene,popfreq_max_20150413,gnomad_genome,avsnp150,snp138NonFlagged,dbnsfp33a,cosmic94,clinvar_20220829,intervar_20170202,icgc28 -operation g,f,f,f,f,f,f,f,f,f -nastring . -vcfinput --thread 40
  82. #remove
  83. rm ${outputdir}/${sample}_pair.vd_?.vcf*