Incorrect interpretation of fixed ALT homozygotes from bcftools filter?

Open
#2,123 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
shell

Research direction

Start by reproducing the two pipelines in the issue, including creation of sample_list.txt, and compare the VCF streams before and after bcftools view. Check how AF is interpreted by bcftools filter in each case and verify the reported sites against the 1/1 genotypes. Done means explaining the discrepancy and establishing a reliable way to count fixed ALT homozygotes.

Written by the indexing model from the issue text.

Description

requires-test-case

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!

Dominant language
C
Stars
891
Forks
277
Avg merge
2d 23h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from samtools/bcftools

All issues in samtools/bcftools

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.