This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bcftools filter by ALT == '.'

I have a large vcf.gz file for 70 samples. It contains many positions where all 70 samples match the reference. I'd like to filter those lines out.

I tried:

bcftools filter -e '%ALT == .' ./SIDXXX.vcf.gz

but it came back with ...

[filter.c:1741 filters_init1] Error: the tag "INFO/%ALT" is not defined in the VCF header

Thanks!

snp next-gen sequencing sequence snp

1 answer

try to use the variable N_ALT see https://samtools.github.io/bcftools/bcftools.html (with N_ALT==0)

variables calculated on the fly if not present: number of alternate alleles; number of samples; count of alternate alleles; minor allele count (similar to AC but is always smaller than 0.5); frequency of alternate alleles (AF=AC/AN); frequency of minor alleles (MAF=MAC/AN); number of alleles in called genotypes; number of samples with missing genotype; fraction of samples with missing genotype

N_ALT, N_SAMPLES, AC, MAC, AF, MAF, AN, N_MISSING, F_MISSING

Log in to answer this question.