GRanges DitancetoNearest query
1
0
Entering edit mode
d r ▴ 150
@d-r-5459
Last seen 6.2 years ago
Israel
I am attempting to use GRanges to calculate the distances between certain probes and their nearest respective transcription start sites. I have created two GRanges objects, one containing the position of the probes and another containing the positions of the genes (which I produced from USCS Table Browser). This is the code I used: genes<-GRanges(seqnames=refseq[,1],ranges=IRanges(start=refseq[,4],end =refseq[,5]),strand=refseq[,3],gene=refseq[,11]) probes<-GRanges(seqnames=annotations[,3],ranges=IRanges(start=annotati ons[,4],end=annotations[,4]),probe=annotations[,1]) distance_from_TSS<-distanceToNearest(probes,genes) when I tried to run the last command I got this error message: Error in function (classes, fdef, mtable) : unable to find an inherited method for function "distanceToNearest", for signature "GRanges", "GRanges" traceback() produced this output: 3: stop("unable to find an inherited method for function \"", fdef@generic, "\", for signature ", cnames) 2: function (classes, fdef, mtable) { methods <- .findInheritedMethods(classes, fdef, mtable) if (length(methods) == 1L) return(methods[[1L]]) else if (length(methods) == 0L) { cnames <- paste0("\"", sapply(classes, as.character), "\"", collapse = ", ") stop("unable to find an inherited method for function \"", fdef@generic, "\", for signature ", cnames) } else stop("Internal error in finding inherited methods; didn't return a unique method") }(list("GRanges", "GRanges"), function (x, subject = x, ...) standardGeneric("distanceToNearest"), <environment>) 1: distanceToNearest(probes, genes) I have successfully used the GRanges objects I created in order to find overlaps between the probes in genes, so I assume that the data itself is fine. I have also attempted to modify this command so that the distance calculated to be the start position of each gene: distance_from_TSS<-distanceToNearest(probes,start(genes)) which produced this error message: Error in function (classes, fdef, mtable) : unable to find an inherited method for function "distanceToNearest", for signature "GRanges", "integer" I have also reinstalled GenomicRanges in order to rule out the possibility that the probelm may be related to defective installation. This did not help either. Does anyone have any idea what may be wrong? Thanks in advance Dolev Rahat [[alternative HTML version deleted]]
Transcription GenomicRanges Transcription GenomicRanges • 4.8k views
ADD COMMENT
0
Entering edit mode
@steve-lianoglou-2771
Last seen 14 months ago
United States
Hi, On Mon, Aug 20, 2012 at 7:41 AM, d r <dolevrahat at="" gmail.com=""> wrote: > I am attempting to use GRanges to calculate the distances between > certain probes > and their nearest respective transcription start sites. I have created two > GRanges objects, one containing the position of the probes and another > containing the positions of the genes (which I produced from USCS Table > Browser). > > This is the code I used: > > genes<-GRanges(seqnames=refseq[,1],ranges=IRanges(start=refseq[,4],e nd=refseq[,5]),strand=refseq[,3],gene=refseq[,11]) > > probes<-GRanges(seqnames=annotations[,3],ranges=IRanges(start=annota tions[,4],end=annotations[,4]),probe=annotations[,1]) > > distance_from_TSS<-distanceToNearest(probes,genes) > > when I tried to run the last command I got this error message: > > Error in function (classes, fdef, mtable) : > > unable to find an inherited method for function "distanceToNearest", for > signature "GRanges", "GRanges" Can we get the output of your sessionInfo() please? This seems to work find here: R> gr <- GRanges('chr1', IRanges(c(10, 50), width=10), '+') R> gg <- GRanges('chr1', IRanges(c(1, 30, 80), width=10), '+') R> distanceToNearest(gr, gg) DataFrame with 2 rows and 3 columns queryHits subjectHits distance <integer> <integer> <integer> 1 1 2 11 2 2 3 21 R> sessionInfo() R version 2.15.1 (2012-06-22) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] GenomicRanges_1.9.48 IRanges_1.15.35 BiocGenerics_0.3.1 HTH, -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
ADD COMMENT
0
Entering edit mode
Hi Steve I have tried running your code on my machine and got the same error message. This is my sessuinInfo(): R version 2.15.1 (2012-06-22) Platform: x86_64-pc-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252 attached base packages: [1] splines stats graphics grDevices utils datasets methods base other attached packages: [1] doBy_4.5-3 MASS_7.3-20 snow_0.3-10 lme4_0.999999-0 Matrix_1.0-6 lattice_0.20-6 multcomp_1.2-12 [8] mvtnorm_0.9-9992 R2HTML_2.2 survival_2.36-14 GenomicRanges_1.8.12 IRanges_1.14.4 BiocGenerics_0.2.0 loaded via a namespace (and not attached): [1] grid_2.15.1 nlme_3.1-104 stats4_2.15.1 tools_2.15.1 Thanks in advance Dolev On Mon, Aug 20, 2012 at 6:14 PM, Steve Lianoglou < mailinglist.honeypot@gmail.com> wrote: > Hi, > > On Mon, Aug 20, 2012 at 7:41 AM, d r <dolevrahat@gmail.com> wrote: > > I am attempting to use GRanges to calculate the distances between > > certain probes > > and their nearest respective transcription start sites. I have created > two > > GRanges objects, one containing the position of the probes and another > > containing the positions of the genes (which I produced from USCS Table > > Browser). > > > > This is the code I used: > > > > > genes<-GRanges(seqnames=refseq[,1],ranges=IRanges(start=refseq[,4],e nd=refseq[,5]),strand=refseq[,3],gene=refseq[,11]) > > > > > probes<-GRanges(seqnames=annotations[,3],ranges=IRanges(start=annota tions[,4],end=annotations[,4]),probe=annotations[,1]) > > > > distance_from_TSS<-distanceToNearest(probes,genes) > > > > when I tried to run the last command I got this error message: > > > > Error in function (classes, fdef, mtable) : > > > > unable to find an inherited method for function "distanceToNearest", > for > > signature "GRanges", "GRanges" > > Can we get the output of your sessionInfo() please? > > This seems to work find here: > > R> gr <- GRanges('chr1', IRanges(c(10, 50), width=10), '+') > R> gg <- GRanges('chr1', IRanges(c(1, 30, 80), width=10), '+') > R> distanceToNearest(gr, gg) > DataFrame with 2 rows and 3 columns > queryHits subjectHits distance > <integer> <integer> <integer> > 1 1 2 11 > 2 2 3 21 > > R> sessionInfo() > R version 2.15.1 (2012-06-22) > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) > > locale: > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] GenomicRanges_1.9.48 IRanges_1.15.35 BiocGenerics_0.3.1 > > HTH, > -steve > > -- > Steve Lianoglou > Graduate Student: Computational Systems Biology > | Memorial Sloan-Kettering Cancer Center > | Weill Medical College of Cornell University > Contact Info: http://cbio.mskcc.org/~lianos/contact > [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
On Mon, Aug 20, 2012 at 11:55 AM, d r <dolevrahat@gmail.com> wrote: > Hi Steve > > I have tried running your code on my machine and got the same error > message. > > distanceToNearest for GRanges was added in version 1.9.4 of GenomicRanges, so it is currently available in the devel version of bioconductor. http://article.gmane.org/gmane.science.biology.informatics.conductor/4 0360/match=distancetonearest+granges For information on using the devel version, see here: http://www.bioconductor.org/developers/useDevel/ Sean > This is my sessuinInfo(): > > R version 2.15.1 (2012-06-22) > Platform: x86_64-pc-mingw32/x64 (64-bit) > > locale: > [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United > States.1252 LC_MONETARY=English_United States.1252 > [4] LC_NUMERIC=C LC_TIME=English_United > States.1252 > > attached base packages: > [1] splines stats graphics grDevices utils datasets > methods base > > other attached packages: > [1] doBy_4.5-3 MASS_7.3-20 snow_0.3-10 > lme4_0.999999-0 Matrix_1.0-6 lattice_0.20-6 > multcomp_1.2-12 > [8] mvtnorm_0.9-9992 R2HTML_2.2 survival_2.36-14 > GenomicRanges_1.8.12 IRanges_1.14.4 BiocGenerics_0.2.0 > > loaded via a namespace (and not attached): > [1] grid_2.15.1 nlme_3.1-104 stats4_2.15.1 tools_2.15.1 > > Thanks in advance > Dolev > > > > On Mon, Aug 20, 2012 at 6:14 PM, Steve Lianoglou < > mailinglist.honeypot@gmail.com> wrote: > > > Hi, > > > > On Mon, Aug 20, 2012 at 7:41 AM, d r <dolevrahat@gmail.com> wrote: > > > I am attempting to use GRanges to calculate the distances between > > > certain probes > > > and their nearest respective transcription start sites. I have created > > two > > > GRanges objects, one containing the position of the probes and > another > > > containing the positions of the genes (which I produced from USCS Table > > > Browser). > > > > > > This is the code I used: > > > > > > > > > genes<-GRanges(seqnames=refseq[,1],ranges=IRanges(start=refseq[,4],e nd=refseq[,5]),strand=refseq[,3],gene=refseq[,11]) > > > > > > > > > probes<-GRanges(seqnames=annotations[,3],ranges=IRanges(start=annota tions[,4],end=annotations[,4]),probe=annotations[,1]) > > > > > > distance_from_TSS<-distanceToNearest(probes,genes) > > > > > > when I tried to run the last command I got this error message: > > > > > > Error in function (classes, fdef, mtable) : > > > > > > unable to find an inherited method for function "distanceToNearest", > > for > > > signature "GRanges", "GRanges" > > > > Can we get the output of your sessionInfo() please? > > > > This seems to work find here: > > > > R> gr <- GRanges('chr1', IRanges(c(10, 50), width=10), '+') > > R> gg <- GRanges('chr1', IRanges(c(1, 30, 80), width=10), '+') > > R> distanceToNearest(gr, gg) > > DataFrame with 2 rows and 3 columns > > queryHits subjectHits distance > > <integer> <integer> <integer> > > 1 1 2 11 > > 2 2 3 21 > > > > R> sessionInfo() > > R version 2.15.1 (2012-06-22) > > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) > > > > locale: > > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 > > > > attached base packages: > > [1] stats graphics grDevices utils datasets methods base > > > > other attached packages: > > [1] GenomicRanges_1.9.48 IRanges_1.15.35 BiocGenerics_0.3.1 > > > > HTH, > > -steve > > > > -- > > Steve Lianoglou > > Graduate Student: Computational Systems Biology > > | Memorial Sloan-Kettering Cancer Center > > | Weill Medical College of Cornell University > > Contact Info: http://cbio.mskcc.org/~lianos/contact > > > > [[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 REPLY
0
Entering edit mode
Thanks Sean. It seemed to have worked. D. On Mon, Aug 20, 2012 at 7:03 PM, Sean Davis <sdavis2@mail.nih.gov> wrote: > > > On Mon, Aug 20, 2012 at 11:55 AM, d r <dolevrahat@gmail.com> wrote: > >> Hi Steve >> >> I have tried running your code on my machine and got the same error >> message. >> >> > distanceToNearest for GRanges was added in version 1.9.4 of GenomicRanges, > so it is currently available in the devel version of bioconductor. > > > http://article.gmane.org/gmane.science.biology.informatics.conductor /40360/match=distancetonearest+granges > > For information on using the devel version, see here: > > http://www.bioconductor.org/developers/useDevel/ > > Sean > > > >> This is my sessuinInfo(): >> >> R version 2.15.1 (2012-06-22) >> Platform: x86_64-pc-mingw32/x64 (64-bit) >> >> locale: >> [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United >> States.1252 LC_MONETARY=English_United States.1252 >> [4] LC_NUMERIC=C LC_TIME=English_United >> States.1252 >> >> attached base packages: >> [1] splines stats graphics grDevices utils datasets >> methods base >> >> other attached packages: >> [1] doBy_4.5-3 MASS_7.3-20 snow_0.3-10 >> lme4_0.999999-0 Matrix_1.0-6 lattice_0.20-6 >> multcomp_1.2-12 >> [8] mvtnorm_0.9-9992 R2HTML_2.2 survival_2.36-14 >> GenomicRanges_1.8.12 IRanges_1.14.4 BiocGenerics_0.2.0 >> >> loaded via a namespace (and not attached): >> [1] grid_2.15.1 nlme_3.1-104 stats4_2.15.1 tools_2.15.1 >> >> Thanks in advance >> Dolev >> >> >> >> On Mon, Aug 20, 2012 at 6:14 PM, Steve Lianoglou < >> mailinglist.honeypot@gmail.com> wrote: >> >> > Hi, >> > >> > On Mon, Aug 20, 2012 at 7:41 AM, d r <dolevrahat@gmail.com> wrote: >> > > I am attempting to use GRanges to calculate the distances between >> > > certain probes >> > > and their nearest respective transcription start sites. I have created >> > two >> > > GRanges objects, one containing the position of the probes and >> another >> > > containing the positions of the genes (which I produced from USCS >> Table >> > > Browser). >> > > >> > > This is the code I used: >> > > >> > > >> > >> genes<-GRanges(seqnames=refseq[,1],ranges=IRanges(start=refseq[,4], end=refseq[,5]),strand=refseq[,3],gene=refseq[,11]) >> > > >> > > >> > >> probes<-GRanges(seqnames=annotations[,3],ranges=IRanges(start=annot ations[,4],end=annotations[,4]),probe=annotations[,1]) >> > > >> > > distance_from_TSS<-distanceToNearest(probes,genes) >> > > >> > > when I tried to run the last command I got this error message: >> > > >> > > Error in function (classes, fdef, mtable) : >> > > >> > > unable to find an inherited method for function "distanceToNearest", >> > for >> > > signature "GRanges", "GRanges" >> > >> > Can we get the output of your sessionInfo() please? >> > >> > This seems to work find here: >> > >> > R> gr <- GRanges('chr1', IRanges(c(10, 50), width=10), '+') >> > R> gg <- GRanges('chr1', IRanges(c(1, 30, 80), width=10), '+') >> > R> distanceToNearest(gr, gg) >> > DataFrame with 2 rows and 3 columns >> > queryHits subjectHits distance >> > <integer> <integer> <integer> >> > 1 1 2 11 >> > 2 2 3 21 >> > >> > R> sessionInfo() >> > R version 2.15.1 (2012-06-22) >> > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) >> > >> > locale: >> > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 >> > >> > attached base packages: >> > [1] stats graphics grDevices utils datasets methods base >> > >> > other attached packages: >> > [1] GenomicRanges_1.9.48 IRanges_1.15.35 BiocGenerics_0.3.1 >> > >> > HTH, >> > -steve >> > >> > -- >> > Steve Lianoglou >> > Graduate Student: Computational Systems Biology >> > | Memorial Sloan-Kettering Cancer Center >> > | Weill Medical College of Cornell University >> > Contact Info: http://cbio.mskcc.org/~lianos/contact >> > >> >> [[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 REPLY

Login before adding your answer.

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