with OP data (takes some time):
> coords=read.csv("coord.txt", stringsAsFactors = F, strip.white = T, header = F, sep="\t")
> library(biomaRt)
> mart=useMart(biomart="ENSEMBL_MART_SNP", host="grch37.ensembl.org", path="/biomart/martservice", dataset="hsapiens_snp")
> coords$V1=gsub("chr","",coords$V1)
> do.call(rbind,(apply(coords,1, function (x) getBM(attributes = c('refsnp_id','chrom_start','chrom_end', 'chrom_strand','allele'), filters = c('chr_name','start','end'), values = as.list(x), mart = mart))))
output:
refsnp_id chrom_start chrom_end chrom_strand allele
1 rs4844600 207679307 207679307 1 A/C/G
2 rs12037841 207684192 207684192 1 T/G
3 rs4266886 207685786 207685786 1 T/C
4 rs4562624 207685965 207685965 1 A/C
5 rs6656401 207692049 207692049 1 A/G
6 CR120974 207692049 207692049 1 HGMD_MUTATION
7 rs386638846 207692049 207692051 1 ATC/GTT
>
you can also use a loop as follows in lines of Dan:
code:
> coords=read.csv("coord.txt", stringsAsFactors = F, strip.white = T, header = F, sep="\t")
> library(biomaRt)
> mart=useMart(biomart="ENSEMBL_MART_SNP", host="grch37.ensembl.org", path="/biomart/martservice", dataset="hsapiens_snp")
> coords$V1=gsub("chr","",coords$V1)
> results=data.frame(matrix(ncol=5,nrow=0))
> for (i in seq (1,nrow(coords))){
ens=getBM(attributes = c('refsnp_id','allele','chrom_start','chrom_strand'), filters = c('chr_name','start','end'), values = as.list(coords[i,]), mart = mart)
results=rbind(results,ens)}
output:
> results
refsnp_id allele chrom_start chrom_strand
1 rs4844600 A/C/G 207679307 1
2 rs12037841 T/G 207684192 1
3 rs4266886 T/C 207685786 1
4 rs4562624 A/C 207685965 1
5 rs6656401 A/G 207692049 1
6 CR120974 HGMD_MUTATION 207692049 1
7 rs386638846 ATC/GTT 207692049 1
Why don't you save all the 390 SNPs in an object (will a data frame work?), and direct
values =to that?Your list is not in BED format. BED is 0-based, meaning that start and end coordinate cannot be identical. If, say on a genome browser you look at a single bp, e.g. chr14:14000, then the BED entry must be chr14-13999-14000. Be sure to reformat correctly in order to retrieve the correct data!
@OP: I think you don't need to use biomart at all. Format your data to bed format as ATpoint above suggested and then intersect with bedtools and latest dbSNP vcf data.. It should give you rsIDs and additional information from dbSNP.