Author: chinmoy
Date: 2009-07-31 12:34:24 -0700 (Fri, 31 Jul 2009)
New Revision: 17636
Added:
csplugins/trunk/soc/chinmoy/phylotree/.classpath
csplugins/trunk/soc/chinmoy/phylotree/.project
csplugins/trunk/soc/chinmoy/phylotree/.settings/
csplugins/trunk/soc/chinmoy/phylotree/.settings/org.eclipse.jdt.core.prefs
csplugins/trunk/soc/chinmoy/phylotree/bin/
Modified:
csplugins/trunk/soc/chinmoy/phylotree/src/org/cytoscape/phylotree/actions/PhyloTreeImportAction.java
Log:
completed phyloxml support
Added: csplugins/trunk/soc/chinmoy/phylotree/.classpath
===================================================================
--- csplugins/trunk/soc/chinmoy/phylotree/.classpath
(rev 0)
+++ csplugins/trunk/soc/chinmoy/phylotree/.classpath 2009-07-31 19:34:24 UTC
(rev 17636)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre6"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/activation.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/biojava-1.4.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/colt.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/coltginy.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/commons-cli-1.x-cytoscape-custom.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/com-nerius-math-xform.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/concurrent.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/cytoscape-cruft-obo.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/cytoscape-geom-rtree.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/cytoscape-geom-spacial.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/cytoscape-graph-dynamic.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/cytoscape-graph-fixed.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/cytoscape-render-export.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/cytoscape-render-immed.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/cytoscape-render-stateful.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/cytoscape-task.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/cytoscape-util-intr.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/ding.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/FastInfoset.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/fing.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/freehep-export-2.1.1.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/freehep-graphics2d-2.1.1.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/freehep-graphicsio-2.1.1.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/freehep-graphicsio-java-2.1.1.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/freehep-graphicsio-ps-2.1.1.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/freehep-graphicsio-svg-2.1.1.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/freehep-io-2.0.2.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/freehep-jas-plotter-2.2.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/freehep-swing-2.0.3.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/freehep-util-2.0.2.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/freehep-xml-2.1.1.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/giny.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/glf.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/http.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/i4jruntime.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/itext-2.0.4.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/jaxb-api.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/jaxb-impl.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/jaxws-api.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/jaxws-rt.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/jaxws-tools.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/jdom-1.0.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/jhall.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/jnlp.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/jsr173_1.0_api.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/jsr181-api.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/jsr250-api.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/junit.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/l2fprod-common-all.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/looks-2.1.4.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/phoebe.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/piccolo.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/resolver.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/saaj-api.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/saaj-impl.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/sjsxp.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/stax-ex.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/streambuffer.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/swing-layout-1.0.1.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/swingx-2006_10_27.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/tclib.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/undo.support.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/violinstrings-1.0.2.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/lib/wizard.jar"/>
+ <classpathentry kind="lib" path="C:/Program
Files/Cytoscape_v2.6.2/cytoscape.jar"/>
+ <classpathentry kind="lib" path="lib/forester.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: csplugins/trunk/soc/chinmoy/phylotree/.project
===================================================================
--- csplugins/trunk/soc/chinmoy/phylotree/.project
(rev 0)
+++ csplugins/trunk/soc/chinmoy/phylotree/.project 2009-07-31 19:34:24 UTC
(rev 17636)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>phylotreePlugin</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
csplugins/trunk/soc/chinmoy/phylotree/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- csplugins/trunk/soc/chinmoy/phylotree/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++ csplugins/trunk/soc/chinmoy/phylotree/.settings/org.eclipse.jdt.core.prefs
2009-07-31 19:34:24 UTC (rev 17636)
@@ -0,0 +1,12 @@
+#Sun Jul 26 06:34:03 EDT 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Modified:
csplugins/trunk/soc/chinmoy/phylotree/src/org/cytoscape/phylotree/actions/PhyloTreeImportAction.java
===================================================================
---
csplugins/trunk/soc/chinmoy/phylotree/src/org/cytoscape/phylotree/actions/PhyloTreeImportAction.java
2009-07-31 17:04:43 UTC (rev 17635)
+++
csplugins/trunk/soc/chinmoy/phylotree/src/org/cytoscape/phylotree/actions/PhyloTreeImportAction.java
2009-07-31 19:34:24 UTC (rev 17636)
@@ -12,10 +12,13 @@
import org.cytoscape.phylotree.PhylotreePlugin;
import org.cytoscape.phylotree.ui.PhyloFileDialog;
import org.cytoscape.phylotree.parser.*;
+import org.forester.io.parsers.PhylogenyParser;
import org.forester.io.parsers.PhylogenyParserException;
import org.forester.io.parsers.phyloxml.PhyloXmlParser;
+
import org.forester.phylogeny.data.*;
+import org.forester.phylogeny.factories.*;
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
@@ -24,8 +27,8 @@
import java.io.IOException;
import java.util.List;
import java.util.Iterator;
-import java.util.Map;
+
import cytoscape.layout.CyLayouts;
public class PhyloTreeImportAction extends CytoscapeAction{
@@ -55,12 +58,7 @@
}
- // Apply default layout
- CyLayouts.getLayout("slanted_cladogram").doLayout();
- // Apply visual style
- Cytoscape.firePropertyChange(Cytoscape.VIZMAP_LOADED, null,
"phyloVizMap.props");
-
}
@@ -107,18 +105,28 @@
cyAttributes.setUserEditable("branchLength", false);
cyAttributes.setUserVisible("branchLength", true);
+
+ // Apply default layout
+ CyLayouts.getLayout("slanted_cladogram").doLayout();
+ // Apply visual style
+ Cytoscape.firePropertyChange(Cytoscape.VIZMAP_LOADED, null,
"phyloVizMap.props");
}
private void loadnetwork_phyloXML(File pFile) {
- PhyloXmlParser parser = new PhyloXmlParser();
+// PhyloXmlParser parser = new PhyloXmlParser();
+ PhylogenyParser parser = new PhyloXmlParser();
- parser.setSource(pFile);
+ //parser.setSource(pFile);
- Phylogeny[] trees;
+ PhylogenyFactory factory =
ParserBasedPhylogenyFactory.getInstance();
+ Phylogeny[] trees;
try {
- trees = parser.parse();
+ trees = factory.create(pFile, parser);
+ //trees = parser.parse();
+
+
}
catch (PhylogenyParserException ppe){
System.out.println("PhloXML Parser error occured.");
@@ -127,81 +135,332 @@
catch(IOException ioe){
System.out.println("I/O Error occured.");
return;
- }
+ }
for (int i=0; i< trees.length; i++){
PhylogenyNodeIterator it =
trees[i].iteratorLevelOrder();
+
+
// Create a network
CyNetwork cyNetwork =
Cytoscape.createNetwork(trees[i].getName(), true);
- CyAttributes edgeAttributes =
Cytoscape.getEdgeAttributes();
- CyAttributes nodeAttributes =
Cytoscape.getNodeAttributes();
+
// Add network attributes
- addNetworkAttributes(trees[i]);
+ addPhyloXMLNetworkAttributes(trees[i],
cyNetwork.getIdentifier());
+ int unnamedNodeIndex = 0;
// process each node, get node, edge and attributes
while (it.hasNext())
{
PhylogenyNode node = (PhylogenyNode) it.next();
PhylogenyNode parent = node.getParent(); // for
edge
+
// Add the node to the network
+ if(node.getNodeName().equals(""))
+ {
+ node.setName("Node"+unnamedNodeIndex);
+ unnamedNodeIndex++;
+ }
CyNode cyNode =
Cytoscape.getCyNode(node.getNodeName(), true);
// Add the node's attributes
- NodeData nodeData = node.getNodeData();
cyNetwork.addNode(cyNode);
- double length = 0.0;
+ addPhyloXMLNodeAttributes(node,
cyNode.getIdentifier());
+
// If parent exists, add it as well as all
edges connecting the two
if(parent!=null)
{
CyNode cyParent =
Cytoscape.getCyNode(parent.getNodeName(), true);
+
+
if(cyParent.getRootGraphIndex()!=cyNode.getRootGraphIndex())
+ {
// Add the parent's attributes
-
- cyNetwork.addNode(cyParent);
-
-
CyEdge cyEdge =
Cytoscape.getCyEdge(cyParent, cyNode, Semantics.INTERACTION, "pp", true, true);
// Add the edge's attributes
- length =
node.getDistanceToParent();
- System.out.println(length);
+ cyNetwork.addEdge(cyEdge);
+ addPhyloXMLEdgeAttributes(node,
cyEdge.getIdentifier());
-
-
edgeAttributes.setAttribute(cyEdge.getIdentifier(), "branchLength", length);
- cyNetwork.addEdge(cyEdge);
-
+ }
}
}
+
+
+
+ // Apply default layout
+ CyLayouts.getLayout("slanted_cladogram").doLayout();
+
+ // Apply visual style
+ Cytoscape.firePropertyChange(Cytoscape.VIZMAP_LOADED,
null, "phyloVizMap.props");
}
}
- private void addNetworkAttributes(Phylogeny phy )
+ private void addPhyloXMLNetworkAttributes(Phylogeny phy, String
networkID )
{
CyAttributes networkAttributes =
Cytoscape.getNetworkAttributes();
+ // Check and assign network attributes
+ if(!phy.getName().equals(""))
+
networkAttributes.setAttribute(networkID,"Name",phy.getName());
+
+ if(phy.getIdentifier()!=null)
+ networkAttributes.setAttribute(networkID, "ID",
phy.getIdentifier().getValue());
+
+ if(!phy.getDescription().equals(""))
+
networkAttributes.setAttribute(networkID,"Description",phy.getDescription());
+
+ if(phy.getConfidence()!=null)
+
networkAttributes.setAttribute(networkID,"Confidence",phy.getConfidence().getValue());
+ if(phy.isRooted())
+ networkAttributes.setAttribute(networkID, "Rooted",
true);
+ else
+ networkAttributes.setAttribute(networkID, "Rooted",
false);
+ if(phy.isRerootable())
+ networkAttributes.setAttribute(networkID, "Rerootable",
true);
+ else
+ networkAttributes.setAttribute(networkID, "Rerootable",
false);
+ if(!phy.getType().equals(""))
+
networkAttributes.setAttribute(networkID,"Type",phy.getType());
+
+ if(!phy.getDistanceUnit().equals(""))
+ networkAttributes.setAttribute(networkID,"Distance
Unit",phy.getDistanceUnit());
- if(phy.getConfidence()!=null)
-
networkAttributes.setAttribute(phy.getName(),"Confidence",phy.getConfidence().getValue());
+ Cytoscape.firePropertyChange(Cytoscape.ATTRIBUTES_CHANGED,
null, null);
- if(phy.getDescription()!=null)
-
networkAttributes.setAttribute(phy.getName(),"Description",phy.getDescription());
+ }
+
+ private void addPhyloXMLNodeAttributes(PhylogenyNode node, String
nodeID )
+ {
+ NodeData nodeData = node.getNodeData();
+
+ CyAttributes nodeAttributes = Cytoscape.getNodeAttributes();
+
- if(phy.getDistanceUnit()!=null)
- networkAttributes.setAttribute(phy.getName(),"Distance
Unit",phy.getDistanceUnit());
+ // Check and assign node attributes
-// if(phy.getDescription()!=null)
-//
networkAttributes.setAttribute(phy.getName(),"Description",phy.getDescription());
-// if(phy.getDescription()!=null)
-//
networkAttributes.setAttribute(phy.getName(),"Description",phy.getDescription());
+ if(nodeData.isHasTaxonomy())
+ {
+ if(!nodeData.getTaxonomy().getCommonName().equals(""))
+ nodeAttributes.setAttribute(nodeID, "Taxonomy:
Common Name", nodeData.getTaxonomy().getCommonName());
+
if(!nodeData.getTaxonomy().getScientificName().equals(""))
+ nodeAttributes.setAttribute(nodeID, "Taxonomy:
Scientific Name", nodeData.getTaxonomy().getScientificName());
+ if(!nodeData.getTaxonomy().getRank().equals(""))
+ nodeAttributes.setAttribute(nodeID, "Taxonomy:
Rank", nodeData.getTaxonomy().getRank());
+ if(nodeData.getTaxonomy().getIdentifier()!=null)
+ nodeAttributes.setAttribute(nodeID, "Taxonomy:
Identifier", nodeData.getTaxonomy().getIdentifier().toString());
+ if(!nodeData.getTaxonomy().getTaxonomyCode().equals(""))
+ nodeAttributes.setAttribute(nodeID, "Taxonomy:
Code", nodeData.getTaxonomy().getTaxonomyCode());
+ if(!nodeData.getTaxonomy().getType().equals(""))
+ nodeAttributes.setAttribute(nodeID, "Taxonomy:
Type", nodeData.getTaxonomy().getType());
+ if(nodeData.getTaxonomy().getUri()!=null)
+ {
+
if(!nodeData.getTaxonomy().getUri().getValue().toString().equals(""))
+ nodeAttributes.setAttribute(nodeID,
"Taxonomy: URI", nodeData.getTaxonomy().getUri().getValue().toString());
+
if(!nodeData.getTaxonomy().getUri().getType().equals(""))
+ nodeAttributes.setAttribute(nodeID,
"Taxonomy: URI Type", nodeData.getTaxonomy().getUri().getType());
+
if(!nodeData.getTaxonomy().getUri().getDescription().equals(""))
+ nodeAttributes.setAttribute(nodeID,
"Taxonomy: URI Description", nodeData.getTaxonomy().getUri().getDescription());
+ }
+ }
+ if(nodeData.isHasBinaryCharacters())
+ {
+ nodeAttributes.setAttribute(nodeID, "Binary
Characters", nodeData.getBinaryCharacters().toString());
+ }
+
+
+ if(nodeData.isHasDate())
+ {
+ if(nodeData.getDate().getRange()!=null)
+ nodeAttributes.setAttribute(nodeID, "Date:
Range", nodeData.getDate().getRange().toString());
+ if(!nodeData.getDate().getUnit().equals(""))
+ nodeAttributes.setAttribute(nodeID, "Date:
Unit", nodeData.getDate().getUnit());
+ if(!nodeData.getDate().getDesc().equals(""))
+ nodeAttributes.setAttribute(nodeID, "Date:
Description", nodeData.getDate().getDesc());
+ if(nodeData.getDate().getValue()!=null)
+ nodeAttributes.setAttribute(nodeID, "Date:
Value", nodeData.getDate().getValue().toString());
+
+
+ }
+
+ if(nodeData.isHasDistribution())
+ {
+ if(nodeData.getDistribution().getAltitude()!=null)
+ nodeAttributes.setAttribute(nodeID,
"Distribution: Altitude", nodeData.getDistribution().getAltitude().toString());
+ if(!nodeData.getDistribution().getDesc().equals(""))
+ nodeAttributes.setAttribute(nodeID,
"Distribution: Description", nodeData.getDistribution().getDesc());
+
if(!nodeData.getDistribution().getGeodeticDatum().equals(""))
+ nodeAttributes.setAttribute(nodeID,
"Distribution: Geodetic Datum", nodeData.getDistribution().getGeodeticDatum());
+ if(nodeData.getDistribution().getLatitude()!=null)
+ nodeAttributes.setAttribute(nodeID,
"Distribution: Latitude", nodeData.getDistribution().getLatitude().toString());
+ if(nodeData.getDistribution().getLongitude()!=null)
+ nodeAttributes.setAttribute(nodeID,
"Distribution: Longitude",
nodeData.getDistribution().getLongitude().toString());
+
+ }
+
+ if(nodeData.isHasEvent())
+ {
+ if(nodeData.getEvent().getEventType()!=null)
+ nodeAttributes.setAttribute(nodeID, "Event:
Type", nodeData.getEvent().getEventType().name());
+ if(nodeData.getEvent().getConfidence()!=null)
+ nodeAttributes.setAttribute(nodeID, "Event:
Confidence", nodeData.getEvent().getConfidence().getType());
+
+ nodeAttributes.setAttribute(nodeID, "Event: #
Duplications", nodeData.getEvent().getNumberOfDuplications());
+ nodeAttributes.setAttribute(nodeID, "Event: # Gene
Losses", nodeData.getEvent().getNumberOfGeneLosses());
+ nodeAttributes.setAttribute(nodeID, "Event: #
Speciations", nodeData.getEvent().getNumberOfSpeciations());
+
+ }
+
+ if(nodeData.isHasNodeIdentifier())
+ {
+
+ if(!nodeData.getNodeIdentifier().getValue().equals(""))
+
nodeAttributes.setAttribute(nodeID,"Identifier",nodeData.getNodeIdentifier().getValue());
+
+ }
+
+ if(nodeData.isHasProperties())
+ {
+ Property[] props =
nodeData.getProperties().getPropertiesArray();
+ for(int i = 0; i < props.length; i++)
+ {
+ if(props[i].getAppliesTo()!=null)
+
nodeAttributes.setAttribute(nodeID,"Property"+i+": Applies To",
props[i].getAppliesTo().name());
+ if(!props[i].getDataType().equals(""))
+
nodeAttributes.setAttribute(nodeID,"Property"+i+": Type",
props[i].getDataType());
+ if(!props[i].getIdRef().equals(""))
+
nodeAttributes.setAttribute(nodeID,"Property"+i+": IDRef", props[i].getIdRef());
+ if(!props[i].getRef().equals(""))
+
nodeAttributes.setAttribute(nodeID,"Property"+i+": Ref", props[i].getRef());
+ if(!props[i].getUnit().equals(""))
+
nodeAttributes.setAttribute(nodeID,"Property"+i+": Unit", props[i].getUnit());
+ if(!props[i].getValue().equals(""))
+
nodeAttributes.setAttribute(nodeID,"Property"+i+": Value", props[i].getValue());
+
+ }
+
+ }
+
+ if(nodeData.isHasReference())
+ {
+ if(!nodeData.getReference().getDoi().equals(""))
+ nodeAttributes.setAttribute(nodeID,"Reference:
DOI", nodeData.getReference().getDoi());
+ if(!nodeData.getReference().getValue().equals(""))
+ nodeAttributes.setAttribute(nodeID,"Reference:
Value", nodeData.getReference().getValue());
+ }
+
+ if(nodeData.isHasSequence())
+ {
+
+ if(nodeData.getSequence().getLocation().equals(""))
+ nodeAttributes.setAttribute(nodeID, "Sequence:
Location", nodeData.getSequence().getLocation());
+
+
if(nodeData.getSequence().getMolecularSequence().equals(""))
+ nodeAttributes.setAttribute(nodeID, "Sequence:
Molecular", nodeData.getSequence().getMolecularSequence());
+
+ if(nodeData.getSequence().getName().equals(""))
+ nodeAttributes.setAttribute(nodeID, "Sequence:
Name", nodeData.getSequence().getName());
+
+ if(nodeData.getSequence().getSymbol().equals(""))
+ nodeAttributes.setAttribute(nodeID, "Sequence:
Symbol", nodeData.getSequence().getSymbol());
+
+ if(nodeData.getSequence().getType().equals(""))
+ nodeAttributes.setAttribute(nodeID, "Sequence:
Type", nodeData.getSequence().getType());
+
+ if(nodeData.getSequence().getUri()!=null)
+ {
+
if(!nodeData.getSequence().getUri().getValue().toString().equals(""))
+ nodeAttributes.setAttribute(nodeID,
"Sequence: URI", nodeData.getSequence().getUri().getValue().toString());
+
if(!nodeData.getSequence().getUri().getType().equals(""))
+ nodeAttributes.setAttribute(nodeID,
"Sequence: URI Type", nodeData.getSequence().getUri().getType());
+
if(!nodeData.getSequence().getUri().getDescription().equals(""))
+ nodeAttributes.setAttribute(nodeID,
"Sequence: URI Description", nodeData.getSequence().getUri().getDescription());
+ }
+
+ if(nodeData.getSequence().getAccession()!=null)
+ {
+
if(!nodeData.getSequence().getAccession().getSource().equals(""))
+ nodeAttributes.setAttribute(nodeID,
"Sequence: Accession Source",
nodeData.getSequence().getAccession().getSource());
+
if(!nodeData.getSequence().getAccession().getValue().equals(""))
+ nodeAttributes.setAttribute(nodeID,
"Sequence: Accession", nodeData.getSequence().getAccession().getValue());
+
+ }
+
+ if(nodeData.getSequence().getDomainArchitecture()!=null)
+ {
+ nodeAttributes.setAttribute(nodeID, "Sequence:
Domain Total Length",
nodeData.getSequence().getDomainArchitecture().getTotalLength());
+ for(int i = 0; i <
nodeData.getSequence().getDomainArchitecture().getNumberOfDomains(); i++)
+ {
+
if(!nodeData.getSequence().getDomainArchitecture().getDomain(i).getId().equals(""))
+
nodeAttributes.setAttribute(nodeID, "Sequence: Domain"+i+" ID",
nodeData.getSequence().getDomainArchitecture().getDomain(i).getId());
+
+
if(!nodeData.getSequence().getDomainArchitecture().getDomain(i).getName().equals(""))
+
nodeAttributes.setAttribute(nodeID, "Sequence: Domain"+i+" Name",
nodeData.getSequence().getDomainArchitecture().getDomain(i).getName());
+
+
nodeAttributes.setAttribute(nodeID, "Sequence: Domain"+i+" Confidence",
nodeData.getSequence().getDomainArchitecture().getDomain(i).getConfidence());
+
nodeAttributes.setAttribute(nodeID, "Sequence: Domain"+i+" From",
nodeData.getSequence().getDomainArchitecture().getDomain(i).getFrom());
+
nodeAttributes.setAttribute(nodeID, "Sequence: Domain"+i+" To",
nodeData.getSequence().getDomainArchitecture().getDomain(i).getTo());
+
nodeAttributes.setAttribute(nodeID, "Sequence: Domain"+i+" Length",
nodeData.getSequence().getDomainArchitecture().getDomain(i).getLength());
+
+ }
+
+ }
+
+ List<PhylogenyData> annotations =
nodeData.getSequence().getAnnotations();
+ Iterator<PhylogenyData> iterator =
annotations.iterator();
+
+ int index = 0;
+ while(iterator.hasNext())
+ {
+ PhylogenyData data = iterator.next();
+ if(!data.toString().equals(""))
+ nodeAttributes.setAttribute(nodeID,
"Sequence: Annotation"+index, data.toString());
+ index++;
+ }
+
+
+
+
+ }
+
+ Cytoscape.firePropertyChange(Cytoscape.ATTRIBUTES_CHANGED,
null, null);
+ }
+
+
+ private void addPhyloXMLEdgeAttributes(PhylogenyNode node, String
edgeID )
+ {
+ BranchData branchData = node.getBranchData();
+ CyAttributes edgeAttributes = Cytoscape.getEdgeAttributes();
+
+ if(branchData.getBranchWidth()!=null)
+ edgeAttributes.setAttribute(edgeID, "branchLength",
branchData.getBranchWidth().getValue());
+ else
+ edgeAttributes.setAttribute(edgeID, "branchLength",
node.getDistanceToParent());
+
+ if(branchData.getBranchColor()!=null)
+ edgeAttributes.setAttribute(edgeID, "Color",
branchData.getBranchColor().getValue().toString());
+
+ List<Confidence> confidences = branchData.getConfidences();
+ Iterator<Confidence> iterator = confidences.iterator();
+ int index = 0;
+ while(iterator.hasNext())
+ {
+ Confidence c = iterator.next();
+ edgeAttributes.setAttribute(edgeID, "Confidence"+index,
c.getValue());
+ edgeAttributes.setAttribute(edgeID,
"Confidence"+index+" type", c.getType());
+ index++;
+
+ }
+
}
-
+
+
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en
-~----------~----~----~----~------~----~------~--~---