Question: filtering by POS in bcftools
0
gravatar for 4galaxy77
9 weeks ago by
4galaxy7730
United Kingdom
4galaxy7730 wrote:

Hi,

I have a vcf file which I would like to filter by a list of SNP positions, which are present in a positions.txt file.

 bcftools filter -i 'POS=@positions.txt' input.vcf.bgz > output.vcf

However, this says:

Error: could not parse the expression. Note that the "@file_name" syntax can be currently used with ID column only.

Is there another simple way filter by POS in bcftools?

Thanks.

bcftools software error • 159 views
ADD COMMENTlink modified 9 weeks ago by finswimmer11k • written 9 weeks ago by 4galaxy7730
1

https://samtools.github.io/bcftools/bcftools.html

file names (this is currently supported only to filter by the ID column)

.

Is there another simple way filter by POS in bcftools?

do you just want option --regions-file or --targets-file ?

ADD REPLYlink modified 9 weeks ago • written 9 weeks ago by Pierre Lindenbaum118k

sorry im not sure the difference. I tried reading the manual, but I didn't follow..

I have a txt file of positions:

1324324
4325435
etc

and within the vcf file, SNPs with those positions. I would like to create a new vcf file, which is a subset of the first, only containing those SNPs and their corresponding information.

Thanks.

ADD REPLYlink modified 9 weeks ago • written 9 weeks ago by 4galaxy7730
1

position alone is insufficient to locate a feature, you would need the chromosomal coordinate as well. You can use what Pierre Lindenbaum said or you may also use bedtools intersect to isolate regions, sometimes there can be differences on how tools operate when the variation is an interval. With bedtools the documentation is more explicit.

ADD REPLYlink written 9 weeks ago by Istvan Albert ♦♦ 80k

Yeah, I figured.

Actually found the answer here, so you can close the thread

Best way to query VCF for specific variants

thanks.

ADD REPLYlink written 9 weeks ago by 4galaxy7730
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1458 users visited in the last hour