SNP filtering from specific regions
2
0
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!

snp • 2.0k views
ADD COMMENT
3
Entering edit mode
6.2 years ago
ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

Hello ashaneev07 ,

can you please show the content of position.txt?

fin swimmer

ADD REPLY
0
Entering edit mode

yes.of course. Position.txt contains the scaffold id,start and stop positions.(I'm just showing only two lines from the file)

scf718000074           11021     11200  
    scf718000136          163    919

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;

scf718000074        11030   .   A   T   182
DP=28;VDB=0.621812;SGB=-0.651104;RPB=0.381255;MQB=0.898397;MQSB=0.751477;BQB=0.3611;MQ0F=0;ICB=1;HOB=0.5;AC=1;AN=2;DP4=11,1,5,3;MQ=59   GT:PL   0/1:215,0,255
ADD REPLY
0
Entering edit mode

Make sure the columns in position.txt are tab separated.

When using -R the vcf file must be gzip'ed and index with tabix or bcftools index. If not one must use -T which might be much slower if the vcf file is huge.

fin swimmer

ADD REPLY
2
Entering edit mode
6.1 years ago

Via BEDOPS bedops and vcf2bed:

$ bedops -e 1 <(vcf2bed < snps.vcf) regions.bed > answer.bed
ADD COMMENT

Login before adding your answer.

Traffic: 2074 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6