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],end=refseq[,5]),strand=refseq[,3],gene=refseq[,11])
> >
> >
> probes<-GRanges(seqnames=annotations[,3],ranges=IRanges(start=annotations[,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]]

