This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Find Rs# From Vcf

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

Try grep -f file_with_set_of_rs# big_vcf_file > new_vcf.txt

Header will have to be added separately.

and try: grep -wFf

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

2 answers

duplicate of

Query a dbSNP VCF File

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

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

Log in to answer this question.