Question: filtering by POS in bcftools
1
gravatar for 4galaxy77
7 months ago by
4galaxy7760
United Kingdom
4galaxy7760 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 • 508 views
ADD COMMENTlink modified 7 months ago by finswimmer12k • written 7 months ago by 4galaxy7760
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 7 months ago • written 7 months ago by Pierre Lindenbaum122k

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 7 months ago • written 7 months ago by 4galaxy7760
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 7 months ago by Istvan Albert ♦♦ 81k
1
gravatar for 4galaxy77
7 months ago by
4galaxy7760
United Kingdom
4galaxy7760 wrote:

Yeah, I figured.

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

Best way to query VCF for specific variants

thanks.

ADD COMMENTlink written 7 months ago by 4galaxy7760
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: 1869 users visited in the last hour