[Bioc-devel] adding a validity method to a class
Paul Shannon
pshannon at systemsbiology.org
Thu Mar 31 19:42:02 CEST 2011
I have defined a rather lengthy validity function for CytoscapeWindowClass.
In my testing, I create incomplete or broken instances of the class.
I get the results I want when I call the validity function like this, for example:
> RCytoscape:::validCytoscapeWindow (cw.broken)
You must provide an 'edgeType' edge attribute, which will be mapped to Cytoscape's 'interaction' edge attribute.
[1] FALSE
But when, following the example in the graphNEL source code, I try to assign this function to the 'validity' slot of the class, the function is not found.
The class definition:
setClass ("CytoscapeWindowClass",
representation = representation (title="character",
window.id='character',
graph="graph"),
contains='CytoscapeConnectionClass',
prototype = prototype (title="R graph",
graph=new ("graphNEL", edgemode='directed'),
uri="http://localhost:9000"),
validity=function(obj) validCytoscapeWindow (obj)
#validity=function(obj) RCytoscape:::validCytoscapeWindow (obj) # I also tried this
)
Calling 'validObject (cw)' should invoke 'validCytoscapeWindow' but does not.
Can anyone explain what I am doing wrong?
Thanks!
- Paul
More information about the Bioc-devel
mailing list