Find Rs# From Vcf
2
0
Entering edit mode
10.9 years ago
win ▴ 990

Hi all, I have a set of rs#, about 1500 or so and what i want to do is query my annotated VCF files which already has the dbSNP ids and create another VCF file with only those variants if they are found to be there.

i tried to use grep but i think it can only do one search term at a time, so how would i find all my rs#, I could put all the rs# in a single text file.

any ideas?

vcf • 6.2k views
ADD COMMENT
1
Entering edit mode

Try grep -f file_with_set_of_rs# big_vcf_file > new_vcf.txt

Header will have to be added separately.

ADD REPLY
1
Entering edit mode

and try: grep -wFf

ADD REPLY
0
Entering edit mode

Cool. -F can be used to make it faster as no regex is involved.

ADD REPLY
0
Entering edit mode
10.9 years ago

duplicate of

Query a dbSNP VCF File

ADD COMMENT
0
Entering edit mode
10.6 years ago
pd3 ▴ 350

Try `bcftools view -i'%ID=@path/to/ids.txt' file.vcf`

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

ADD COMMENT

Login before adding your answer.

Traffic: 2608 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