[Bioc-devel] implementing interfaces

Martin Morgan mtmorgan at fhcrc.org
Tue Nov 25 21:21:16 CET 2008

James Bullard wrote:
> hi all, this will probably demonstrate my lack of knowledge concerning 
> OOP in R, but I am hoping for some quick answers. This is a problem I 
> have faced before.
> I want to use the method bg.correct.mas, this method takes as its object 
> an AffyBatch. I don't have an AffyBatch nor do I want to massage my data 
> structures into such an object, so I want to implement the AffyBatch 
> interface. However, I can see no way to determine the list of generics 
> which have methods defined on AffyBatch (and superclasses). I understand 
> that things are method-centric, however I assume that being 
> method-centric still leaves room for a way to know the methods 
> specialized for a class/interface so that I as a programmer can define 
> the suitable methods on a new class without having to dig around all 
> over the place determining what I need to define. My question is:
> is there a function to determine all the methods that are specialized 
> for a certain class? Also, would it be possible to write a function 
> adheresTo(classA, classB), which tells me that classB satisfies the 
> calling requirements of classA (forget for a moment that we have public 
> member variables).
> note, i don't want to make a subclass of AffyBatch.


gets you some of the way there. But in a brand spanking new session it 
shows nothing (because the packages where methods are defined, e.g., 
affy, has not been loaded) and this illustrates a fundamental problem: 
the interface to AffyBatch is dynamically determined by loaded packages.

Likely you'd invoke

showMethods(class="AffyBatch", where=getNamespace("affy")

to get a kind of base-line set of expected methods, i.e., those visible 
from affy.

AshowMethods returns a connection (!) which is basically useless for 
programmatic purposes, e.g., adheresTo().


> thanks, jim
> _______________________________________________
> Bioc-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793

More information about the Bioc-devel mailing list