This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Uploading to dbSNP, need 25nt upstream and downstream of variants

Hello,

So I have a VCF file I want to upload to dbSNP, however the genome should be released at the same time as SNPs, which means I need to provide 25nt upstream and downstream for every variant.

Does anyone have an easy R script to create this columns for every VCF file? Given Contig names, position of variants and a fasta file.

Adrian

vcf dbsnp

2 answers

Well, you can just flank() think in R and use getSeq() with a BSgenome. Having said that, this is likely faster with bedtools (flank followed by getfasta).

Perhaps convert to BED and pad:

$ bedops --everything --range 25 <(vcf2bed < variants.vcf) < padded_variants.bed

Then convert to FASTA with bed2fasta.pl or similar.

Log in to answer this question.