Entering edit mode
5.8 years ago
4galaxy77
2.9k
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.
https://samtools.github.io/bcftools/bcftools.html
.
do you just want option
--regions-file
or--targets-file
?sorry im not sure the difference. I tried reading the manual, but I didn't follow..
I have a txt file of positions:
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.
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.