problem about using 'rtracklayer' package to retrieve SNP chromosome position
2
0
Entering edit mode
li lilingdu ▴ 450
@li-lilingdu-1884
Last seen 5.9 years ago
Dear list, using rtracklayer, it's possible to retrieve data with functions of 'ucscTableQuery' and 'getTable'. however, these functions could only retrieve data given a genomic range. For example, using following code could retrieve snps between 10000 to 20000 basepair on chromosome 2. ####====================== library(rtracklayer) browserSession("UCSC")->session ucscTableQuery(session, "snp129",GenomicRanges(10000,20000, 2))->todo tableName(todo)<-"snp129" getTable(todo) ####====================== my question is how to retrieve data using identifiers(names/accessions). for example, is it possible to retrieve chromosome position given the rs number of several SNPs, such as rs10003974 rs10087355 rs10075230 ... is there any function in 'rtracklayer' package can do this? thanks! LiGang
rtracklayer rtracklayer • 1.1k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 5 minutes ago
United States
Hi LiGang, LiGang wrote: > Dear list, > > using rtracklayer, it's possible to retrieve data with functions > of 'ucscTableQuery' and 'getTable'. > however, these functions could only retrieve data given a genomic range. > For example, using following code could retrieve snps between 10000 to 20000 > basepair on chromosome 2. > > ####====================== > library(rtracklayer) > browserSession("UCSC")->session > ucscTableQuery(session, "snp129",GenomicRanges(10000,20000, 2))->todo > tableName(todo)<-"snp129" > getTable(todo) > ####====================== > > my question is how to retrieve data using identifiers(names/accessions). > for example, is it possible to retrieve chromosome position given the rs > number of several SNPs, such as > rs10003974 > rs10087355 > rs10075230 > ... > > is there any function in 'rtracklayer' package can do this? I don't know if you can do this with rtracklayer, but it isn't difficult to do it with RMySQL. > library(RMySQL) Loading required package: DBI > con <- dbConnect("MySQL", user = "genome", host = "genome-mysql.cse.ucsc.edu", dbname = "hg18") > snps <- scan("clipboard", what = "c") Read 3 items > snps [1] "rs10003974" "rs10087355" "rs10075230" > sql <- paste("select name, chrom, chromEnd from snp129 where name in ('", paste(snps, collapse = "','"), "');", sep = "") > dbGetQuery(con, sql) name chrom chromEnd 1 rs10003974 chr4 154710828 2 rs10075230 chr5 44862908 3 rs10087355 chr8 41531957 Or you could use biomaRt > mart <- useMart("snp", "hsapiens_snp") Checking attributes ... ok Checking filters ... ok > getBM(c("refsnp_id","chr_name","chrom_start"), "refsnp", snps, mart) refsnp_id chr_name chrom_start 1 rs10003974 4 154491378 2 rs10075230 5 44827151 3 rs10087355 8 41412800 Best, Jim > > thanks! > > LiGang > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald, M.S. Biostatistician Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826
ADD COMMENT
0
Entering edit mode
@michael-lawrence-2759
Last seen 9.6 years ago
On Fri, Jul 17, 2009 at 12:07 AM, LiGang <luzifer.li@gmail.com> wrote: > Dear list, > > using rtracklayer, it's possible to retrieve data with functions > of 'ucscTableQuery' and 'getTable'. > however, these functions could only retrieve data given a genomic range. > For example, using following code could retrieve snps between 10000 to > 20000 > basepair on chromosome 2. > > ####====================== > library(rtracklayer) > browserSession("UCSC")->session > ucscTableQuery(session, "snp129",GenomicRanges(10000,20000, 2))->todo > tableName(todo)<-"snp129" > getTable(todo) > ####====================== > > my question is how to retrieve data using identifiers(names/accessions). > for example, is it possible to retrieve chromosome position given the rs > number of several SNPs, such as > rs10003974 > rs10087355 > rs10075230 > ... > > is there any function in 'rtracklayer' package can do this? > This type of query does not seem to be supported by the UCSC Table Browser. As suggested by another poster, you could use their MySQL server. A high-level interface to the UCSC database would be nice. I'm just not sure if it falls within the scope of rtracklayer. The original goal of the project was to represent tracks in R and interact with genome browsers. The table browser interface was added for downloading tracks and we supported arbitrary tables as well, because we got it almost for free. Something like biomaRt for UCSC might belong in its own package. Discussion welcome. Thanks, Michael > > thanks! > > LiGang > > _______________________________________________ > Bioconductor mailing list > Bioconductor@stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor > [[alternative HTML version deleted]]
ADD COMMENT
0
Entering edit mode
On Sun, Jul 19, 2009 at 4:18 AM, Michael Lawrence <mflawren@fhcrc.org>wrote: > > > On Fri, Jul 17, 2009 at 12:07 AM, LiGang <luzifer.li@gmail.com> wrote: > >> Dear list, >> >> using rtracklayer, it's possible to retrieve data with functions >> of 'ucscTableQuery' and 'getTable'. >> however, these functions could only retrieve data given a genomic range. >> For example, using following code could retrieve snps between 10000 to >> 20000 >> basepair on chromosome 2. >> >> ####====================== >> library(rtracklayer) >> browserSession("UCSC")->session >> ucscTableQuery(session, "snp129",GenomicRanges(10000,20000, 2))->todo >> tableName(todo)<-"snp129" >> getTable(todo) >> ####====================== >> >> my question is how to retrieve data using identifiers(names/accessions). >> for example, is it possible to retrieve chromosome position given the rs >> number of several SNPs, such as >> rs10003974 >> rs10087355 >> rs10075230 >> ... >> >> is there any function in 'rtracklayer' package can do this? >> > > This type of query does not seem to be supported by the UCSC Table Browser. > As suggested by another poster, you could use their MySQL server. A > high-level interface to the UCSC database would be nice. I'm just not sure > if it falls within the scope of rtracklayer. The original goal of the > project was to represent tracks in R and interact with genome browsers. The > table browser interface was added for downloading tracks and we supported > arbitrary tables as well, because we got it almost for free. Something like > biomaRt for UCSC might belong in its own package. Discussion welcome. > Well, I found that it is possible to do this type of query with the table browser, and it didn't take much work to add it to rtracklayer. With 1.5.9 you can do this: > library(rtracklayer) Loading required package: RCurl Loading required package: bitops > browserSession("UCSC")->session > query <- ucscTableQuery(session, "snp129", names = c("rs10003974", "rs10087355", "rs10075230")) > getTable(query) bin chrom chromStart chromEnd name score strand refNCBI refUCSC 1 1765 chr4 154710827 154710828 rs10003974 0 + A A 2 927 chr5 44862907 44862908 rs10075230 0 + A A 3 901 chr8 41531956 41531957 rs10087355 0 + T T observed molType class valid avHet avHetSE func 1 A/G genomic single by-frequency,by-hapmap 0.200927 0.245136 intron 2 A/G genomic single by-hapmap 0.004751 0.048505 unknown 3 G/T genomic single unknown 0.000000 0.000000 unknown locType weight 1 exact 1 2 exact 1 3 exact 1 Michael > > Thanks, > Michael > > >> >> thanks! >> >> LiGang >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor@stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: >> http://news.gmane.org/gmane.science.biology.informatics.conductor >> > > [[alternative HTML version deleted]]
ADD REPLY

Login before adding your answer.

Traffic: 863 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6