Re: [Bioc-devel] How to import a setAs method in one's package?
Thankyou guys for your quick and helpful feedback! Aditya From: Michael Lawrence [lawrence.mich...@gene.com] Sent: Friday, May 08, 2020 7:35 PM To: Bhagwat, Aditya Cc: bioc-devel@r-project.org Subject: Re: [Bioc-devel] How to import a setAs method in one's package? setAs() defines methods on the coerce() generic, so you could write importMethodsFrom(pkg, coerce). However, as() searches the namespace associated with class(from) for coerce() methods. As long as that namespace hasn't selectively imported methods on coerce(), it should end up using the global table and find the appropriate method. It's best to just importFrom() a generic to get access to its global table, or import() the entire package. So Hervé's suggestion of import(methods) is the right way to go Michael. On Fri, May 8, 2020 at 2:07 AM Bhagwat, Aditya wrote: > > Dear BioC compatriots, > > How does one import a setAs method (which is generally not exported)? > I in particular need to import as(., DataFrame) and am a bit puzzled on how > to do this. > > Thank you! > > Aditya > > [[alternative HTML version deleted]] > > ___ > Bioc-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/bioc-devel -- Michael Lawrence Senior Scientist, Bioinformatics and Computational Biology Genentech, A Member of the Roche Group Office +1 (650) 225-7760 micha...@gene.com Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube ___ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
Re: [Bioc-devel] How to import a setAs method in one's package?
setAs() defines methods on the coerce() generic, so you could write importMethodsFrom(pkg, coerce). However, as() searches the namespace associated with class(from) for coerce() methods. As long as that namespace hasn't selectively imported methods on coerce(), it should end up using the global table and find the appropriate method. It's best to just importFrom() a generic to get access to its global table, or import() the entire package. So Hervé's suggestion of import(methods) is the right way to go Michael. On Fri, May 8, 2020 at 2:07 AM Bhagwat, Aditya wrote: > > Dear BioC compatriots, > > How does one import a setAs method (which is generally not exported)? > I in particular need to import as(., DataFrame) and am a bit puzzled on how > to do this. > > Thank you! > > Aditya > > [[alternative HTML version deleted]] > > ___ > Bioc-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/bioc-devel -- Michael Lawrence Senior Scientist, Bioinformatics and Computational Biology Genentech, A Member of the Roche Group Office +1 (650) 225-7760 micha...@gene.com Join Genentech on LinkedIn | Twitter | Facebook | Instagram | YouTube ___ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
Re: [Bioc-devel] How to import a setAs method in one's package?
Hi Aditya, It is very hard to get selective imports from the methods package right and there is no real benefit in doing so. I would strongly recommend that you just import its full namespace with: import(methods) Best, H. On 5/8/20 02:48, Bhagwat, Aditya wrote: Looks like this can be successfully done by @importFrom methods as @importFrom S4Vectors DataFrame Cheers, Aditya From: Bioc-devel [bioc-devel-boun...@r-project.org] on behalf of Bhagwat, Aditya [aditya.bhag...@mpi-bn.mpg.de] Sent: Friday, May 08, 2020 11:04 AM To: bioc-devel@r-project.org Subject: [Bioc-devel] How to import a setAs method in one's package? Dear BioC compatriots, How does one import a setAs method (which is generally not exported)? I in particular need to import as(., DataFrame) and am a bit puzzled on how to do this. Thank you! Aditya [[alternative HTML version deleted]] ___ Bioc-devel@r-project.org mailing list https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_bioc-2Ddevel=DwIFAg=eRAMFD45gAfqt84VtBcfhQ=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA=GvFB77RR45gI9MsOLDdWB-TapO-hwYBrAw1bBNVzTFE=ClOtwGLvXVUdxZgwOVZBOEaLrAvVEEa6rjOE5uzPyGM= ___ Bioc-devel@r-project.org mailing list https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_bioc-2Ddevel=DwIFAg=eRAMFD45gAfqt84VtBcfhQ=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA=GvFB77RR45gI9MsOLDdWB-TapO-hwYBrAw1bBNVzTFE=ClOtwGLvXVUdxZgwOVZBOEaLrAvVEEa6rjOE5uzPyGM= -- 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: hpa...@fredhutch.org Phone: (206) 667-5791 Fax:(206) 667-1319 ___ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
Re: [Bioc-devel] How to import a setAs method in one's package?
Looks like this can be successfully done by @importFrom methods as @importFrom S4Vectors DataFrame Cheers, Aditya From: Bioc-devel [bioc-devel-boun...@r-project.org] on behalf of Bhagwat, Aditya [aditya.bhag...@mpi-bn.mpg.de] Sent: Friday, May 08, 2020 11:04 AM To: bioc-devel@r-project.org Subject: [Bioc-devel] How to import a setAs method in one's package? Dear BioC compatriots, How does one import a setAs method (which is generally not exported)? I in particular need to import as(., DataFrame) and am a bit puzzled on how to do this. Thank you! Aditya [[alternative HTML version deleted]] ___ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel ___ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
[Bioc-devel] How to import a setAs method in one's package?
Dear BioC compatriots, How does one import a setAs method (which is generally not exported)? I in particular need to import as(., DataFrame) and am a bit puzzled on how to do this. Thank you! Aditya [[alternative HTML version deleted]] ___ Bioc-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel