intersecting GRanges with UCSCTableQuery
1
0
Entering edit mode
d r ▴ 150
@d-r-5459
Last seen 6.7 years ago
Israel
Hello**** I am trying to use rtracklayer and specifically UCSCTableQuery to retrieve information from UCSC tables but I want to retrieve the information only on certain genomic segments. **** ** ** In the following example I try to create a UCSCTableQuery that will return A GRanges of the tRNAs in a set of given ranges, defined by a GRanges object . Specifically, I am interested in all the tRNAs that fall within CpG islands. **** In order to accomplish this, I first created a GRanges object (islandshg19) derived from UCSC CpG islands track:**** session <- browserSession()**** genome(session)<-"hg19"**** query <- ucscTableQuery(session, "CpG Islands")# define track**** islandshg19<-track(query, asRangedData=FALSE)# creates a grange of all CpG island**** ** ** Next I try to use a UCSCTableQuery with the range defined as the island GRanges:**** query <- ucscTableQuery(session, "tRNAs", range= islandshg19, table="tRNAs", names=NULL)**** this produced the error:**** Error in normGenomeRange(range, x) : **** 'range' must contain ranges on a single chromosome**** **** I then attempted to run the query after creating a subset of CpG islands on chromosome 1 (chr1):**** query <- ucscTableQuery(session, "tRNAs", range=chr1, table="tRNAs", names=NULL)**** chr1tRNAs<-track(query, asRangedData=FALSE)# creates a grange**** This indeed produced a UCSCTableQuery object, however, the qurey returned tRNAs not overlapped by any CpG island included in the chr1 GRAnges. it seems that the range the query returns is the entire portion of chr1 between the smallest and largest coordiantes in the chr1 object.**** **** I have two questions:**** a) how to set the query so that it will return only those tRNAs overlapping CpG islands? **** b) is it possible to use UCSCTableQuery to this end on GRanges located on more than one chromosome?**** **** Thanks in advance**** Dolev Rahat**** ** ** [[alternative HTML version deleted]]
rtracklayer rtracklayer • 1.3k views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 2.9 years ago
United States
On Wed, Aug 29, 2012 at 12:04 AM, d r <dolevrahat@gmail.com> wrote: > Hello**** > > I am trying to use rtracklayer and specifically UCSCTableQuery to retrieve > information from UCSC tables but I want to retrieve the information only > on certain genomic segments. **** > > ** ** > > In the following example I try to create a UCSCTableQuery that will return > A GRanges of the tRNAs in a set of given ranges, defined by a GRanges > object . Specifically, I am interested in all the tRNAs that fall within > CpG islands. **** > > In order to accomplish this, I first created a GRanges object (islandshg19) > derived from UCSC CpG islands track:**** > > session <- browserSession()**** > > genome(session)<-"hg19"**** > > query <- ucscTableQuery(session, "CpG Islands")# define track**** > > islandshg19<-track(query, asRangedData=FALSE)# creates a grange of all CpG > island**** > > ** ** > > Next I try to use a UCSCTableQuery with the range defined as the island > GRanges:**** > > query <- ucscTableQuery(session, "tRNAs", range= islandshg19, > table="tRNAs", names=NULL)**** > > this produced the error:**** > > Error in normGenomeRange(range, x) : **** > > 'range' must contain ranges on a single chromosome**** > > **** > > I then attempted to run the query after creating a subset of CpG islands on > chromosome 1 (chr1):**** > > query <- ucscTableQuery(session, "tRNAs", range=chr1, table="tRNAs", > names=NULL)**** > > chr1tRNAs<-track(query, asRangedData=FALSE)# creates a grange**** > > This indeed produced a UCSCTableQuery object, however, the qurey returned > tRNAs not overlapped by any CpG island included in the chr1 GRAnges. it > seems that the range the query returns is the entire portion of chr1 > between the smallest and largest coordiantes in the chr1 object.**** > > **** > > I have two questions:**** > > a) how to set the query so that it will return only those tRNAs > overlapping CpG islands? **** > > This is not possible, unless you query for one CpG island at a time. In theory, one could get the table browser to process batch queries by uploading a custom track and taking the intersection. It's not supported yet though. For now, I would recommend just downloading the track of interest and using subsetByOverlaps between the GRanges. That will be quicker in the long run (assuming reuse) and will facilitate reproducibility, since one is not downloading different data every day. Michael b) is it possible to use UCSCTableQuery to this end on GRanges located on > more than one chromosome?**** > > **** > > Thanks in advance**** > > Dolev Rahat**** > > ** ** > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor@r-project.org > 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

Login before adding your answer.

Traffic: 725 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