On Tue, Nov 25, 2008 at 3:11 PM, James Bullard <bullard@berkeley.edu> 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).
>

showMethods(class="AffyBatch")

The semantics for OOP in R are a bit different than in other languages.  In
particular, an AffyBatch object is an object of class "AffyBatch" and does
not have methods directly attached to it.  Instead, methods are written as
other pieces of code that utilize the data structure that is the AffyBatch
object to do computation.  So, there is no "interface" because methods are
defined separately from the object itself.

To do what you are suggesting, you could define another class, "ABC", that
contains data of your choice.  Then, you would need to implement any methods
that are needed by calling code (that would usually accept an AffyBatch) for
your class.  If the methods on an AffyBatch were defined for your object and
returned the appropriate data types for the code using those methods, then
your class could be used as a replacement for AffyBatch (assuming that all
calling code is written with OOP in mind).

All that said, sometimes it is easier to look at the method definition
themselves and extract the code of interest for your own use.

Hope that clarifies a bit.

Sean


>
> note, i don't want to make a subclass of AffyBatch.
>
> thanks, jim
>
> _______________________________________________
> Bioc-devel@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>

	[[alternative HTML version deleted]]

