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

Filtering vcf using bcftools filter-Expression Question #1224

Closed
luised94 opened this issue May 22, 2020 · 2 comments
Closed

Filtering vcf using bcftools filter-Expression Question #1224

luised94 opened this issue May 22, 2020 · 2 comments

Comments

@luised94
Copy link

luised94 commented May 22, 2020

Hello!
I want to filter my vcf file using the QD (Qual score normalized by Allele Depth, QUAL/AD) metric.
To do this I have been using the following command:

bcftools filter -i 'QUAL/FMT/AD[0:1]>2' -o calls_filt.vcf calls.vcf

I am trying to divide the QUAL value by the second value of the format AD array.

My initial vcf (calls.vcf) has around 8000 variants. Using this command reduces the number to 16. However, these variants don't satisfy the condition as you can see from the following output:
bcftools image for filtering issue

I am not sure how it is actually performing the filtering or how division is working inside the expression. Filtering by one condition works just fine. Not sure if i am missing something for how expressions work for filtering or if there is way to do this with another tool.

Thanks for your time and help. Let me know if any additional info can help.
Hope everyone is staying safe.
Best

@luised94
Copy link
Author

luised94 commented May 24, 2020

I annotatetd the total allelic depths in the info column and used the following command:

bcftools query -i 'QUAL/INFO/AD[1]>2' -f '%CHROM %POS %QUAL [%AD{0} %AD{1}]\n' call.vcf | wc -1

The result shows that they comply with the condition. I get the a 'Warning: Assuming INFO/AD' message even tho I specify it.

I think its working now but will wait for some feedback before I close the issue just in case.

@pd3 pd3 closed this as completed in 68c8aba May 28, 2020
@pd3
Copy link
Member

pd3 commented May 28, 2020

Ah, thank you for noticing and reporting the bug, now fixed by 68c8aba. Regarding the warning, I am not able to reproduce it with the latest github version. Can you please test if it indeed disappears with the latest version? http://samtools.github.io/bcftools/howtos/install.html

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

No branches or pull requests

2 participants