[Bioc-devel] TypeInfo

Wolfgang Huber huber at ebi.ac.uk
Thu Mar 8 14:41:27 CET 2007


Dear Robert and Martin,

thanks for your answers! That is really encouraging and interesting.
I had read the R News article / vignette (but then was surprised at
seeing so little use in madman/Rpacks and in the svn log of the package
directory.)

Martin wrote:
> If you'd like an example,
> point to a suitable function and I'll generate something

The function "justvsn" would be appropriate.

> The input arguments to S4 methods are already strongly typed, so for
> these methods the benefit of TypeInfo is restricted to specifying
> return values.

Question: I have a function

setGeneric("vsn2",
  function(x, reference, strata, ...)
   standardGeneric("vsn2"))

and methods like:

setMethod("vsn2", "ExpressionSet",
   function(x,  reference, strata, ...)
      vsnMatrix(exprs(x),  reference, strata, ...))

for which not _all_ arguments are typed in the signature (vsnMatrix is a
'normal' R function). As far as I understand (and it may be wrong),
these arguments can also not be typed with TypeInfo. So is this style of
programming discouraged?

 Best wishes
  Wolfgang



Martin Morgan wrote:
> Hi Wolfgang --
> 
> Yes, you should do it!
> 
> There's a vignette in TypeInfo written in the form of an R News
> article (though not published as such) that outlines the basic steps &
> benefits. 
> 
> 
> It's used in our RWebServices packages, which should make it to Rpacks
> real soon now.  We've exposed functionality of DNAcopy, PROcess and
> affy as web services (http://cabig.bioconductor.org/axis/services;
> affy is not there yet, these are not meant to be 'production'
> services). There's a powerpoint presentation at
> http://tinyurl.com/34u4lq discussing some issues; slides 7-15
> illustrate some of the functionality, slides 27-28 sketch TypeInfo
> approaches.
> 
> TypeInfo provides functionality that is useful for ensuring that
> incoming and return arguments match specified type. This means that
> the code in the functions can focus on the operations they perform,
> rather than checking that the arguments are valid.
> 
> TypeInfo also provides the language 'reflection' that's necessary when
> moving from a weakly typed language like R to strongly typed languages
> like Java or xsd-based web representations of data and methods. It
> also makes creation of, e.g., graphical widgets easier.
> 
> There are costs to TypeInfo, in that the argument and return types are
> actually checked (could be computationally expensive, but probably not
> in terms of the overall functionality of vsn). Also, TypeInfo offers
> advanced features that are beyond what the ArrayExpress people want --
> basically, you'll want to stick to SimulataneousTypeSpecification with
> TypedSignature matching arguments to specific classes (TypeInfo could,
> in principle, do things like make sure that the lengths of different
> input vectors were the same, or that there were no NA values, or...)
> 
> Which also points to an important issue, that to be useful in the web
> services environment TypeInfo has to identify either primitive types
> (e.g., "numeric") or S4 classes; S3 classes are not structured enough
> to be useful.
> 
> The input arguments to S4 methods are already strongly typed, so for
> these methods the benefit of TypeInfo is restricted to specifying
> return values.
> 
> In terms of the ArrayExpress request, my experience has been that the
> web environment probably wants to 'see' only selected functions or
> functions that integrate a series of steps into a convenient work
> flow. The basic issues are: big data transfer (which will make repeated
> 'interactive' calls impossibly slow); restricted functionality (side
> effects like image creation are hard to deal / need to be made into
> main effects with in the web context); and maybe a need to expose only
> methods and parameters that are suitable for consumption by the
> general populace rather than the full gamut of options relevant to
> exploratory analyses or research statisticians. For these reasons, we
> ended up writing 'wrapper' packages that contain a small number of
> 'work flow' functions that take and return S4 classes, and that have
> TypeInfo applied.
> 
> We did some initial investigation with vsn and it seemed quite
> possible to add the necessary information. If you'd like an example,
> point to a suitable function and I'll generate something for you.
> 
> Martin
> 
> Wolfgang Huber <huber at ebi.ac.uk> writes:
> 
>> Hi Martin, Robert, Seth
>>
>> what's up with "TypeInfo"? Seems that nobody has been using it so far in 
>> Bioconductor:
>>
>> huber at lobito:~/madman/Rpacks$ find . -name DESCRIPTION \
>>      -exec grep -H TypeInfo {} \;
>> ./TypeInfo/DESCRIPTION:Package: TypeInfo
>> ......and nothing else......
>>
>> and the last substantial svn commits are from 2005.
>>
>> Misha's person at ArrayExpress who wants to put Web-GUIs on 
>> bioc-packages has asked me to provide the functions in vsn with 
>> TypeInfo, is that something worthwhile?
>>
>> Best wishes
>>    Wolfgang
>>
>> ------------------------------------------------------------------
>> Wolfgang Huber  EBI/EMBL  Cambridge UK  http://www.ebi.ac.uk/huber
>>
>> _______________________________________________
>> Bioc-devel at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
> 


-- 
Best wishes
 Wolfgang

------------------------------------------------------------------
Wolfgang Huber  EBI/EMBL  Cambridge UK  http://www.ebi.ac.uk/huber



More information about the Bioc-devel mailing list