Find Rs# From Vcf
2
0
Entering edit mode
10.3 years ago
win ▴ 970

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 • 5.9k 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.3 years ago

duplicate of

Query a dbSNP VCF File

ADD COMMENT
0
Entering edit mode
10.0 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: 1285 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