5.3 years ago by
Seattle, WA USA
What i would like to do is get the chromosome and coordinate for each of my SNPs from the dbSNP VCF.
$ vcf2bed < mySnps.vcf | grep -w <rsNumber> | cut -f1-3 > <rsNumber>.bed
<rsNumber> with your SNP ID of interest. The result is a BED file, with the first column containing the chromosome and the second and third columns the reference base position of the SNP.
If you're going to do this for a lot of SNPs, save the converted results and
grep on that:
$ vcf2bed < mySnps.vcf > mySnps.bed
$ grep -w <rsNumber1> mySnps.bed | cut -f1-3 > <rsNumber1>.bed
$ grep -w <rsNumber2> mySnps.bed | cut -f1-3 > <rsNumber2>.bed
$ grep -w <rsNumberN> mySnps.bed | cut -f1-3 > <rsNumberN>.bed
Or put into a shell script, iterating over a list of
More information on
vcf2bed is located here.