This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Filter out overlapping deletions from a VCF file.

I try to filter out the spanning or overlapping deletions in a GVCF file, noted as asterisk in the VCF format. https://gatk.broadinstitute.org/hc/en-us/articles/360035531912-Spanning-or-overlapping-deletions-allele-

I have tried different bcftools command for this:

bcftools view -f '%ALT != *' -O z -o GVCF_SNPs_output.vcf.gz GVCF_input.vcf.gz

bcftools filter -i 'FORMAT/ALT="*"' -O z -o GVCF_SNPs_output.vcf.gz   GVCF_input.vcf.gz

But it seems not to work for loci having several alternative alleles (for example "A, *, C" in the ALT field).

Would anyone have successfully filtered out the deletions (*) out of a GVCF file?

vcf bcftools gvcf

If you're using GATK, following the joint genotyping with GenotypeGVCFs, you could use SelectVariants. For example:

gatk SelectVariants \
     -R ref.fasta \
     -V input_cohort.vcf \
     --select-type-to-include SNP \
     -O cohort_SNP.vcf

I only say afer GenotypeGVCFs as I don't know the implications of removing variants from a GVCF file. Alternatively, you could also use the --select-type-to-exclude parameter if you want more than just SNPs, though I can't see what type of variant * is in the docs.

Thank you for the answer dthorbur, it is interesting as I have already used this command to make the GVCF file. Which means that apparently overlapping deletions are not removed by this command.

~/gatk-4.2.0.0/gatk SelectVariants \
 --exclude-filtered true \
 --select-type-to-include SNP \
 --variant ./GenotypeGVCFs_filt.vcf.gz \
 --output ./GVCF_SNPs.vcf.gz

Damn. I remember I had this problem too a while ago as MSMC wouldn't accept * annotations, but I believe I just removed all sites where they were present.

I also found this previous forum post, which may offer a solution:

bcftools norm --check-ref w -f reference.fasta -m -any cohort_SNP.vcf.gz > cohort_SNP.norm.vcf

Where multiallelic annotations appear to be given their own line. Whilst this then would permit removal of * entries, it may result in multiple lines for otherwise multiallelic sites you want to keep.

Why do you need to remove the * annotations anyway?

0 answers

No answers yet.

Log in to answer this question.