help needed in namespace definition
1
0
Entering edit mode
@frederic-fournier-4803
Last seen 9.6 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]]
GenomicRanges PICS GenomicRanges PICS • 1.3k views
ADD COMMENT
0
Entering edit mode
@herve-pages-1542
Last seen 22 hours ago
Seattle, WA, United States
Hi Frederic, On 11-08-12 11:09 AM, Frederic Fournier wrote: > 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? Importing as.data.frame from IRanges seems to solve the problem. as.data.frame is implicitly turned into an S4 generic when IRanges is installed. Output of R CMD INSTALL IRanges: ... Creating a generic function for "as.data.frame" from package "base" in package ?IRanges? ... Cheers, H. > > 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]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Hervé Pagès Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpages at fhcrc.org Phone: (206) 667-5791 Fax: (206) 667-1319
ADD COMMENT

Login before adding your answer.

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