Entering edit mode
Frederic Fournier
▴
10
@frederic-fournier-4803
Last seen 10.4 years ago
Hello,
I'm in need of some help with what I think is namespace
administration. I'm
modifying some methods of the package PICS so that they can take
GRanges
object (from the GenomicRanges package) as input.
In doing so, I want to use the method as.data.frame(GRanges) defined
in the
GenomicRanges package.
But when I try to transform a GRanges object in a data.frame, I get
this
error:
"Error in as.data.frame.default(gr, row.names = NULL, optional =
FALSE) :
cannot coerce class '"GRanges"' into a data.frame"
In the DESCRIPTION file of the package, I have included
"Imports: ..., GenomicRanges, ..."
In the NAMESPACE file of the package, I have included:
"importFrom(GenomicRanges)
importClassesFrom(GenomicRanges, GRanges)
importMethodsFrom(GenomicRanges, as.data.frame)"
If I do a showMethods("as.data.frame") from PICS namespace
environment, I
get:
> showMethods(as.data.frame)
Function: as.data.frame (package base)
x="ANY"
x="AtomicList"
x="DataFrame"
x="DataFrameList"
x="GappedAlignments"
x="GappedRanges"
x="GenomicRanges"
x="GRangesList"
...
which shows that the "as.data.frame" method defined in GenomicRanges
is
available (x="GRanges" is inherited from x="GenomicRanges"), but
still, I
can't use as.data.frame on a GRanges object without getting this
error:
"Error in as.data.frame.default(gr, row.names = NULL, optional =
FALSE) :
cannot coerce class '"GRanges"' into a data.frame"
Any idea what I am doing wrong?
Also, if anyone knows a good source of information on the syntax to
use in
the NAMESPACE and DESCRIPTION files?
Thank you very much!
Frederic
[[alternative HTML version deleted]]