####下载GRCm38 snp和indel vcf文件 ####
ftp://ftp-mouse.sanger.ac.uk/REL-1303-SNPs_Indels-GRCm38/
###hisat比对,samtools sort生成bam文件###
./gatk AddOrReplaceReadGroups -I /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158.bam -O /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-addhead.bam -LB mm10ID -PL illumina -PU mm10PU -SM mm10
./gatk MarkDuplicates -I /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-addhead.bam -O /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-addhead-dedup.bam -M /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-addhead-dedup.Metrics
./gatk BaseRecalibrator -R /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/reference/mm10/Mus_musculus.GRCm38.dna.chromosome.1.fa -I /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-addhead-dedup.bam -O /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158.recal.table --known-sites /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/reference/mm10/snp/mgp.v3.snps.rsIDdbSNPv137.vcf --known-sites /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/reference/mm10/snp/mgp.v3.indels.rsIDdbSNPv137.vcf
./gatk ApplyBQSR -R /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/reference/mm10/Mus_musculus.GRCm38.dna.chromosome.1.fa -I /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-addhead-dedup.bam -bqsr /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158.recal.table -O /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-addhead-dedup-BQSR.bam
./gatk HaplotypeCaller -R /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/reference/mm10/Mus_musculus.GRCm38.dna.chromosome.1.fa -I /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-addhead-dedup-BQSR.bam -D /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/reference/mm10/snp/Mus_musculus.vcf -O /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-rawGATK.vcf
./gatk SelectVariants -select-type SNP -V /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-rawGATK.vcf -O /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-rawGATK-snp.vcf
./gatk SelectVariants -select-type INDEL -V /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-rawGATK.vcf -O /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-rawGATK-indel.vcf
./gatk VariantFiltration -V /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-rawGATK-snp.vcf --filter-expression "QD<2.0 || MQ<40.0 || FS >60.0 || SOR >3.0 || MQRankSum < -12.5 || ReadPosRankSum < -8.0" --filter-name "PASS" -O /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-rawGATK-snp-filter.vcf
./gatk VariantFiltration -V /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-rawGATK-indel.vcf --filter-expression "QD<2.0 || FS >200.0 || SOR >10.0 || MQRankSum < -12.5 || ReadPosRankSum < -8.0" --filter-name "PASS" -O /media/pc/6a524d78-97d1-481c-b068-8116a4d007f8/jjc/gjy/小鼠/Het-158-rawGATK-indel-filter.vcf
for i in *.bam ; do i=${i%.bam*} ; ./gatk AddOrReplaceReadGroups -I ${i}.bam -O ${i}.addhead.bam -LB mm10ID -PL illumina -PU mm10PU -SM mm10 ; done ; for i in *.addhead.bam ; do i=${i%.addhead.bam*} ; ./gatk MarkDuplicates -I ${i}.addhead.bam -O ${i}.addhead.dedup.bam -M ${i}.addhead.dedup.Metrics ; done ; for i in *.addhead.dedup.bam ; do i=${i%.addhead.dedup.bam*} ; ./gatk BaseRecalibrator -R /media/shen/disk1/jjc/reference/GRCm38/GRCm38.fa -I ${i}.addhead.dedup.bam -O ${i}.recal.table --known-sites /media/shen/disk1/jjc/reference/GRCm38/snp/mgp.v3.snps.rsIDdbSNPv137.vcf --known-sites /media/shen/disk1/jjc/reference/GRCm38/snp/mgp.v3.indels.rsIDdbSNPv137.vcf ; done ; for i in *.addhead.dedup.bam ; do i=${i%.addhead.dedup.bam*} ; ./gatk ApplyBQSR -R /media/shen/disk1/jjc/reference/GRCm38/GRCm38.fa -I ${i}.addhead.dedup.bam -bqsr ${i}.recal.table -O ${i}.addhead.dedup.BQSR.bam ; done ; for i in *.addhead.dedup.BQSR.bam ; do i=${i%.addhead.dedup.BQSR.bam*} ; ./gatk HaplotypeCaller -R /media/shen/disk1/jjc/reference/GRCm38/GRCm38.fa -I ${i}.addhead.dedup.BQSR.bam -D /media/shen/disk1/jjc/reference/GRCm38/snp/Mus_musculus.vcf -O ${i}.rawGATK.vcf ; done ; for i in *.rawGATK.vcf ; do i=${i%.rawGATK.vcf*} ; ./gatk SelectVariants -select-type SNP -V ${i}.rawGATK.vcf -O ${i}.rawGATK.snp.vcf ; done ; for i in *.rawGATK.vcf ; do i=${i%.rawGATK.vcf*} ; ./gatk SelectVariants -select-type INDEL -V ${i}.rawGATK.vcf -O ${i}.rawGATK.indel.vcf ; done ; for i in *.rawGATK.snp.vcf ; do i=${i%.rawGATK.snp.vcf*} ; ./gatk VariantFiltration -V ${i}.rawGATK.snp.vcf --filter-expression "QD<2.0 || MQ<40.0 || FS >60.0 || SOR >3.0 || MQRankSum < -12.5 || ReadPosRankSum < -8.0" --filter-name "PASS" -O ${i}.rawGATK.snp.filter.vcf ; done ; for i in *.rawGATK.indel.vcf ; do i=${i%.rawGATK.indel.vcf*} ; ./gatk VariantFiltration -V ${i}.rawGATK.indel.vcf --filter-expression "QD<2.0 || FS >200.0 || SOR >10.0 || MQRankSum < -12.5 || ReadPosRankSum < -8.0" --filter-name "PASS" -O ${i}.rawGATK.indel.filter.vcf ; done