Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect interpretation of fixed ALT homozygotes from bcftools filter? #2123

Open
pmoizerv opened this issue Mar 8, 2024 · 1 comment
Open

Comments

@pmoizerv
Copy link

pmoizerv commented Mar 8, 2024

Hi all,

Not completely sure if this is an issue, if it is the expected function for the two bcftools commands (filter and view) or if I am misunderstanding something.

I want to get the number of sites that are fixed ALT homozygotes and to do that I used
bcftools filter -i 'AF=1' my_species.vcf | grep -v "^#" | wc -l which returns 0.

If I use bcftools view first to "subsample" using a list of all my samples as such:
bcftools query -l my_species.vcf > sample_list.txt ; bcftools view -S sample_list.txt my_species.vcf | bcftools filter -i 'AF=1' - | grep -v "^#" | wc -l it returns 8, while essentially I am running the same command.

Why does that happen? This number seems to be right, in the sense that the samples are all homozygous for ALT (1/1) but I am not sure if there are other sites missing from the final number. In the vcf I have kept biallelic snps and monomorphic sites. Some genotypes are missing but if I filter for missingness (say F_MISSINGNESS < 0.6) the result remains the same. Do you have any other suggestion on how to do this?

Thanks for your help!

@pd3
Copy link
Member

pd3 commented Mar 14, 2024

This could happen when existing INFO/AC,AN counts are different from the ones calculated from the genotypes FORMAT/GT. The command bcftools view -S recalculates the values.

If this is not the case, we'd need a small test case to reproduce the problem and investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants