This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How can I get a list of all SNPs from a gene of my interest?

I would like to download the list all SNPs for a gene of my interest with all their details like Chromosome, Physical position etc. How can I do this?

snp gene ncbi hapmap

2 answers

Dear Mahantesh,

For people who are not used to command line, biomart has a very nice interface for downloading SNPs etc. Go to http://www.ensembl.org/biomart/martview/ . You can filter based on gene IDs, you will find these on ensembl/UCSC.

Thank you Ibrahim. I had a question; I followed your response and got a table. Why some refSNPs are listed more than once? Is that because of alternative splicing or I have done something wrong? Variant name Protein location (aa) Variant alleles

rs141402957------------------T/C

rs28934578-------175-------C/A/T

rs141402957----- 312-------T/C

rs28934578------- 136-------C/A/T

rs28934578------- 43---------C/A/T

rs141402957----- 219-------T/C

rs141402957-----192--------T/C

rs28934578-------16---------C/A/T

rs141402957------351-------T/C

rs28934578--------82--------C/A/T

rs28934578-------------------C/A/T

rs141402957-----340-------T/C

rs28934578-------164-------C/A/T

Get all SNP rs* IDs via the command line:

$ mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -N -e 'SELECT chrom, chromStart, chromEnd, name FROM snp142Common' hg19 > snp142Common.bed

Get genes and convert to BED with gtf2bed:

$ wget -qO- ftp://ftp.sanger.ac.uk/pub/gencode/Gencode_human/release_19/gencode.v19.annotation.gtf.gz \
    | gunzip -c \
    | grep -w "gene" \
    | gtf2bed \
    > genes.bed

Adjust this step for whichever annotations you use or prefer.

Filter gene names for the gene of interest, then map SNPs to gene, using bedmap to look for SNPs whose positions overlap those of Gencode genes:

$ grep -w 'name-of-gene' genes.bed | bedmap --echo snp142Common.bed - > answer.bed

Can you possibly give a real example? I dont know linux and dont know what is the order of commands and for example how to enter 'SELECT chrom, chromStart, chromEnd, name FROM snp142Common'

Log in to answer this question.