Dear Cytoscape team,
I recently ported my Cytoscape 2.8.x plugin to the new Cytoscape 3.0.0 API.
I'm using the Simplified App approach.
My current version of the port works nice, but there are some minor
problems remaining:
A. In the previous version I created a custom VisualStyle programmatically
and want to do the same in the new version of the plugin. I followed the
example in the CookBook but this results in an error when trying to install
the plugin from a JAR file (using the App Manager):
Caused by: java.lang.NoClassDefFoundError:
org/cytoscape/view/vizmap/mappings/DiscreteMapping
at view.IRegulonVisualStyle.createVisualStyle(Unknown Source)
at view.IRegulonVisualStyle.install(Unknown Source)
at view.IRegulonApp.<init>(Unknown Source)
... 16 more
Caused by: java.lang.ClassNotFoundException:
org.cytoscape.view.vizmap.mappings.DiscreteMapping
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 19 more
The code snippet that results in the error is:
final VisualStyleFactory factory =
serviceRegistrar.getService(VisualStyleFactory.class);
final VisualMappingFunctionFactory continuousMappingFactory =
serviceRegistrar.getService(VisualMappingFunctionFactory.class,
"(mapping.type=continuous)");
final VisualMappingFunctionFactory discreteMappingFactory =
serviceRegistrar.getService(VisualMappingFunctionFactory.class,
"(mapping.type=discrete)");
final VisualMappingFunctionFactory passthroughMappingFactory =
serviceRegistrar.getService(VisualMappingFunctionFactory.class,
"(mapping.type=passthrough)");
final VisualStyle style = factory.createVisualStyle(NAME);
style.setDefaultValue(BasicVisualLexicon.NETWORK_BACKGROUND_PAINT,
Color.GRAY);
// Node label = name
style.addVisualMappingFunction(passthroughMappingFactory.createVisualMappin gFunction(
NetworkUtilities.ID_ATTRIBUTE_NAME,
String.class,
BasicVisualLexicon.NODE_LABEL));
// Node shape =
// 1. Ellipse when regulator
// 2. Rectangle when target gene
final DiscreteMapping<String,NodeShape> nodeShapeMapper =
(DiscreteMapping) discreteMappingFactory.createVisualMappingFunction(
NetworkUtilities.REGULATORY_FUNCTION_ATTRIBUTE_NAME,
String.class,
BasicVisualLexicon.NODE_SHAPE);
nodeShapeMapper.putMapValue(NetworkUtilities.REGULATORY_FUNCTION_TARGET_GEN E,
NodeShapeVisualProperty.RECTANGLE);
nodeShapeMapper.putMapValue(NetworkUtilities.REGULATORY_FUNCTION_REGULATOR,
NodeShapeVisualProperty.ELLIPSE);
style.addVisualMappingFunction(nodeShapeMapper);
B. Is there a way to log messages to the Developer's Log Console. I tried
to get an implementation of the OSGi LogService interface but this resulted
in a RuntimeException.
C. I tried to hook up HTML help pages to the Cytoscape help system via the
instructions provided in the CookBook. Unfortunately this results in a
HelpSetException at plugin installation time. The code snippet that results
in this error:
private void addHelp(final CyAppAdapter adapter) {
try {
final CyHelpBroker helpBroker =
adapter.getCyServiceRegistrar().getService(CyHelpBroker.class);
final ClassLoader classLoader = getClass().getClassLoader();
final URL helpSetURL = HelpSet.findHelpSet(classLoader,
HELP_SET_NAME);
final HelpSet newHelpSet = new HelpSet(classLoader, helpSetURL);
helpBroker.getHelpSet().add(newHelpSet);
} catch (RuntimeException e) {
Logger.getInstance().error("iRegulon: Could not install help.");
} catch (HelpSetException e) {
//TODO: Apparently this doesn't work ...
Logger.getInstance().error("iRegulon: Could not find help set:
\"" + HELP_SET_NAME + "\".");
} catch (LinkageError e) {
Logger.getInstance().error("iRegulon: Could not install help.");
}
}
D. My plugin registers the following listeners: NetworkViewAddedListener,
NetworkViewDestroyedListener and NetworkViewChangedListener. Could it be
that my listeners are not always called in the current version of Cytoscape
3.0?
Thanks for your feedback,
Bram Van de Sande