Entering edit mode
6.2 years ago
ashaneev07
▴
40
Hi all.... I'm trying to extract all the snps in a range of regions from vcf file. Is there any option available for this ? Thank you!
Thanks for the reply. I tried with bcftools. The following command was used for the filtration.But it won't work for me. It created the out file,which contains only the header section of vcf file. bcftools filter -o snp.vcf -R position.txt test.vcf.gz
I've also tried with bedtools. (bedtools intersect -header -wa -a test.vcf -b position.txt >out.vcf) But the out file contains all the matched chromosomes, not the matching position. need your suggestions. Thanks.
Hello ashaneev07 ,
can you please show the content of
position.txt
?fin swimmer
yes.of course. Position.txt contains the scaffold id,start and stop positions.(I'm just showing only two lines from the file)
Using the above file i need to extract snps between 11021 and 11200 from the vcf file.So the output should be like the following;
Make sure the columns in
position.txt
are tab separated.When using
-R
the vcf file must be gzip'ed and index withtabix
orbcftools index
. If not one must use-T
which might be much slower if the vcf file is huge.fin swimmer