Entering edit mode
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]]