I create a gVCF via GATK:
gatk-4.2.6.0/gatk --java-options "-Xmx4g" HaplotypeCaller --input HGFLY.AddOrReplaceReadGroups.sort.bam --reference /usr/local/share/hg38/hg38.fa -O HGFLY.g.vcf.gz -ERC GVCF
and then I attempt to get the SNP/indels thus:
gatk-4.2.6.0/gatk SelectVariants -V HGFLY.g.vcf.gz -R /usr/local/share/hg38/hg38.fa -O HGFLY.selectVariants.vcf
but this outputs a gVCF, when this isn't what I need:
chr1 1 . N <NON_REF> . . END=10066 GT:DP:GQ:MIN_DP:PL 0/0:0:0:0:0,0,0
chr1 10067 . T <NON_REF> . . END=10067 GT:DP:GQ:MIN_DP:PL 0/0:1:3:1:0,3,30
chr1 10068 . A <NON_REF> . . END=10068 GT:DP:GQ:MIN_DP:PL 0/0:1:0:1:0,0,0
chr1 10069 . A <NON_REF> . . END=10071 GT:DP:GQ:MIN_DP:PL 0/0:1:3:1:0,3,15
chr1 10072 . C <NON_REF> . . END=10072 GT:DP:GQ:MIN_DP:PL 0/0:1:0:1:0,0,0
chr1 10073 . T <NON_REF> . . END=10073 GT:DP:GQ:MIN_DP:PL 0/0:1:3:1:0,3,42
chr1 10074 . A <NON_REF> . . END=10074 GT:DP:GQ:MIN_DP:PL 0/0:1:0:1:0,0,0
chr1 10075 . A <NON_REF> . . END=10077 GT:DP:GQ:MIN_DP:PL 0/0:1:3:1:0,3,15
chr1 10078 . C <NON_REF> . . END=10078 GT:DP:GQ:MIN_DP:PL 0/0:1:0:1:0,0,0
why is SelectVariants
outputting another gVCF?
How can I alter the command so that a proper VCF is output?
Your command seems incomplete... Try using with
--select-type-to-include INDEL
If it works, you can use
--select-type-to-include
multiple times.friends shouldn't let you select variants in a GVCF file.
How can I select variant from the aligned bam without the intermediate gVCF? I would prefer to not use the gVCF, but https://gatk.broadinstitute.org/hc/en-us/articles/360037225632-HaplotypeCaller implies that the gVCF is necessary. The manual doesn't show how to make the VCF directly from HaplotypeCaller
This is how I use
HaplotypeCaller
to generateVCF
onlyyou'll need to generate a VCF with gatk GenotypeGVCF