This is a test version of Biostars. For the public version, visit https://www.biostars.org.
GATK's selectVariants not outputting VCF

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?

gatk

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.

This is how I use HaplotypeCaller to generate VCF only

$GATK HaplotypeCaller -R $REF_GATK -I ${i}.bam -O $GATK_OUT/${i}.vcf --sequence-dictionary $DICT --dbsnp $DBSNP -stand-call-conf 30 --min-pruning 3 --add-output-vcf-command-line false -L $TARGETS

you'll need to generate a VCF with gatk GenotypeGVCF

1 answer

The correct way to enter in the command to GATK's HaplotypeCaller is

/usr/local/share/gatk-4.2.6.0/gatk --java-options '-Xmx4g' HaplotypeCaller --input HGFLY.AORGs.sort.bam -reference /usr/local/share/hg38/hg38.fa -O HGFLY.variants.only.vcf

the above command generates a VCF that has the necessary VCF

Log in to answer this question.