Author: rodche
Date: 2012-06-20 08:23:43 -0700 (Wed, 20 Jun 2012)
New Revision: 29638

Modified:
   
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/BioPaxMapper.java
   
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/action/BioPaxViewTracker.java
   
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/util/BioPaxUtil.java
   
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/util/BioPaxVisualStyleUtil.java
   
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/view/BioPaxDetailsPanel.java
   
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/util/BioPaxUtil.java
Log:
Improved BioPAX visual style (Complex node shape, size, etc.). Removed or made 
private much of unused code in the BiopaxUtils.

Modified: 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/BioPaxMapper.java
===================================================================
--- 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/BioPaxMapper.java
  2012-06-20 13:01:46 UTC (rev 29637)
+++ 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/BioPaxMapper.java
  2012-06-20 15:23:43 UTC (rev 29638)
@@ -908,7 +908,7 @@
 
        
        private static String addIHOPLinks(CyNetwork network, BioPAXElement 
bpe) {
-               List<String> synList = new 
ArrayList<String>(BioPaxUtil.getSynonymList(bpe));
+               List<String> synList = new 
ArrayList<String>(BioPaxUtil.getSynonyms(bpe));
                List<ExternalLink> dbList = xrefToExternalLinks(bpe, 
Xref.class);
                
                if (!synList.isEmpty() || !dbList.isEmpty()) {

Modified: 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/action/BioPaxViewTracker.java
===================================================================
--- 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/action/BioPaxViewTracker.java
      2012-06-20 13:01:46 UTC (rev 29637)
+++ 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/action/BioPaxViewTracker.java
      2012-06-20 15:23:43 UTC (rev 29638)
@@ -9,6 +9,7 @@
 import org.cytoscape.application.CyApplicationManager;
 import org.cytoscape.application.events.SetCurrentNetworkViewEvent;
 import org.cytoscape.application.events.SetCurrentNetworkViewListener;
+import org.cytoscape.biopax.internal.BioPaxMapper;
 import org.cytoscape.biopax.internal.util.BioPaxUtil;
 import org.cytoscape.biopax.internal.util.BioPaxVisualStyleUtil;
 import org.cytoscape.biopax.internal.view.BioPaxContainer;
@@ -69,7 +70,7 @@
        @Override
        public void handleEvent(NetworkViewAddedEvent e) {      
                final CyNetworkView view = e.getNetworkView();
-               if(BioPaxUtil.isBioPAXNetwork(view.getModel())) {
+               if(isBioPAXNetwork(view.getModel())) {
                        SwingUtilities.invokeLater(new Runnable() {
                                @Override
                                public void run() {
@@ -95,7 +96,7 @@
                CyNetworkView view = e.getNetworkView();
                
                // update bpPanel accordingly
-               if (view != null && 
BioPaxUtil.isBioPAXNetwork(view.getModel())) {
+               if (view != null && isBioPAXNetwork(view.getModel())) {
                        SwingUtilities.invokeLater(new Runnable() {
                                @Override
                                public void run() {
@@ -108,7 +109,7 @@
 
        @Override
        public void handleEvent(NetworkViewAboutToBeDestroyedEvent e) {
-               if (BioPaxUtil.isBioPAXNetwork(e.getNetworkView().getModel())) {
+               if (isBioPAXNetwork(e.getNetworkView().getModel())) {
                        //TODO nothing?
                }
        }
@@ -120,7 +121,7 @@
                if(view == null) return;
                
                final CyNetwork network = view.getModel();
-               if (BioPaxUtil.isBioPAXNetwork(network)) {
+               if (isBioPAXNetwork(network)) {
 
                        if 
(!network.getDefaultNodeTable().equals(e.getSource()))
                                return;
@@ -253,4 +254,10 @@
 //                     dingNodeView.addCustomGraphic(rect, paint, 
NodeDetails.ANCHOR_CENTER);
 //             }
        }
+
+       
+       private static boolean isBioPAXNetwork(CyNetwork cyNetwork) {
+               return Boolean.TRUE == cyNetwork.getRow(cyNetwork)
+                       .get(BioPaxMapper.BIOPAX_NETWORK, Boolean.class);
+       }
 }

Modified: 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/util/BioPaxUtil.java
===================================================================
--- 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/util/BioPaxUtil.java
       2012-06-20 13:01:46 UTC (rev 29637)
+++ 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/util/BioPaxUtil.java
       2012-06-20 15:23:43 UTC (rev 29638)
@@ -31,7 +31,6 @@
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -47,18 +46,13 @@
 import org.biopax.paxtools.model.BioPAXLevel;
 import org.biopax.paxtools.model.Model;
 import org.biopax.paxtools.model.level3.BioSource;
-import org.biopax.paxtools.model.level3.Entity;
-import org.biopax.paxtools.model.level3.EntityReference;
 import org.biopax.paxtools.model.level3.Interaction;
-import org.biopax.paxtools.model.level3.Level3Element;
 import org.biopax.paxtools.model.level3.Named;
 import org.biopax.paxtools.model.level3.Pathway;
-import org.biopax.paxtools.model.level3.Provenance;
 import org.biopax.paxtools.model.level3.SimplePhysicalEntity;
 import org.biopax.paxtools.model.level3.XReferrable;
 import org.biopax.paxtools.model.level3.Xref;
 import org.biopax.paxtools.util.ClassFilterSet;
-import org.cytoscape.biopax.internal.BioPaxMapper;
 import org.cytoscape.model.CyNetwork;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -182,7 +176,7 @@
                if (nodeName == null || nodeName.length()== 0) {
                        nodeName = getStandardName(bpe);
                        if (nodeName == null || nodeName.length() == 0) {
-                               Collection<String> names = getSynonymList(bpe);
+                               Collection<String> names = getSynonyms(bpe);
                                if (!names.isEmpty())
                                        nodeName = getTheShortestString(names);
                        }
@@ -194,7 +188,7 @@
        
        
        // get the shortest string
-       public static String getTheShortestString(Collection<String> nameList) {
+       private static String getTheShortestString(Collection<String> nameList) 
{
                String shortest = null;
                if (nameList != null && !nameList.isEmpty()) {
                        int minLength = -1;
@@ -285,7 +279,7 @@
         * @param bpe BioPAX element
         * @return short name field, or null if not available.
         */
-       public static String getShortName(BioPAXElement bpe) {
+       private static String getShortName(BioPAXElement bpe) {
                String shortName = null;
                
                if(bpe instanceof Named) {
@@ -301,7 +295,7 @@
         * @param bpe BioPAX element
         * @return name field, or null if not available.
         */
-       public static String getStandardName(BioPAXElement bpe) {
+       private static String getStandardName(BioPAXElement bpe) {
                if(bpe instanceof Named) {
                        return ((Named)bpe).getStandardName();
                } else 
@@ -309,58 +303,18 @@
        }
 
        /**
-        * Gets synonym names.
+        * Gets all names, if any.
         *
         * @param bpe BioPAX element
-        * @return Collection of Synonym String Objects.
+        * @return Collection of names.
         */
-       public static Collection<String> getSynonymList(BioPAXElement bpe) {
+       public static Collection<String> getSynonyms(BioPAXElement bpe) {
                Collection<String> names = new HashSet<String>();
                if(bpe instanceof Named) {
                        names = ((Named)bpe).getName();
                }
                return names;
        }
-
-       /**
-        * Gets the Organism Name.
-        *
-        * @param bpe BioPAX element
-        * @return organism field, or null if not available.
-        */
-       public static String getOrganismName(CyNetwork network, BioPAXElement 
bpe) {
-               String organism = null;
-                       
-               BioPAXElement bs = (BioPAXElement) getValue(bpe, "organism");
-               if (bs != null) {
-                       organism = getNodeName(bs);
-               } 
-
-               return organism;
-       }
-
-       /**
-        * If exist, gets all data sources 
-        * (according to the BioPAX spec. there should be only one...)
-        * names as "comment : name"...
-        * 
-        * @param bpe BioPAX element
-        * @return data source names
-        */
-       public static String getDataSource(BioPAXElement bpe) {
-               StringBuffer sb = new StringBuffer();
-               
-               if(bpe instanceof Entity) {
-                       Collection<Provenance> datasources = 
((Entity)bpe).getDataSource();
-                       for(Provenance pr : datasources) {
-                               if(pr.getComment() != null) 
-                                       sb.append(pr.getComment().toString());
-                               sb.append(" : 
").append(getNodeName(pr)).append(' '); 
-                       }
-               }
-               
-               return sb.toString();
-       }
        
        
        /**
@@ -387,29 +341,6 @@
 
                return taxonomyId;
        }
-
-       /**
-        * Gets the Comment field.
-        *
-        * @param bpe a BioPAX element
-        * @return comment field
-        */
-       public static String getComment(BioPAXElement bpe) {
-               return ((Level3Element)bpe).getComment().toString();
-       }
-
-       /**
-        * Gets the Availability Field.
-        *
-        * @param bpe BioPAX element
-        * @return availability field or null, if not available.
-        */
-       public static String getAvailability(BioPAXElement bpe) {
-               if(bpe instanceof Entity) {
-                       return ((Entity)bpe).getAvailability().toString();
-               } else
-                       return null;
-       }
        
        
        public static <T extends Xref> List<T> getXRefs(BioPAXElement bpe, 
Class<T> xrefClass) {
@@ -475,45 +406,9 @@
 
                return name;
        }
-
        
-       /**
-        * Gets all the objects of provided BioPAX types.
-        * 
-        * @param model BioPAX (PaxTools) model
-        * @param classes query BioPAX types - e.g. Protein.class, Complex.class
-        * @return
-        */
-       public static Set<? extends BioPAXElement> getObjects(Model model, 
Class<? extends BioPAXElement>... classes) {
-               Set<BioPAXElement> coll = new HashSet<BioPAXElement>();
-               if (model != null) {
-                       for (Class<? extends BioPAXElement> c : classes) {
-                               coll.addAll(model.getObjects(c));
-                       }
-               }
-               return coll;
-       }
        
-
        /**
-        * Checks whether the element is of 
-        * any of the listed BioPAX types.
-        * 
-        * @param e
-        * @param classes
-        * @return
-        */
-       public static boolean isOneOfBiopaxClasses(BioPAXElement e, Class<? 
extends BioPAXElement>... classes) {
-               for(Class<? extends BioPAXElement> c : classes) {
-                       if(c.isInstance(e)) {
-                               return true;
-                       }
-               }
-               return false;
-       }
-       
-       
-       /**
         * Gets abbreviated cellular location term.
         * 
         * @param value
@@ -544,15 +439,6 @@
        }
        
        
-       public static Map<String, String> getChemModificationsMap() {
-               return Collections.unmodifiableMap(chemModificationsMap);
-       }
-       
-       public static Map<String, String> getCellLocationMap() {
-               return Collections.unmodifiableMap(cellLocationMap);
-       }
-       
-       
        public static String truncateLongStr(String str) {
                if(str != null) {
                        str = str.replaceAll("[\n\r \t]+", " ");
@@ -564,12 +450,6 @@
        }
 
        
-       public static boolean isBioPAXNetwork(CyNetwork cyNetwork) {
-               return Boolean.TRUE == cyNetwork.getRow(cyNetwork)
-                       .get(BioPaxMapper.BIOPAX_NETWORK, Boolean.class);
-       }
-       
-       
        public static String toOwl(final BioPAXElement bpe) {
                final StringWriter writer = new StringWriter();
                final SimpleIOHandler simpleExporter = new 
SimpleIOHandler(BioPAXLevel.L3);
@@ -586,34 +466,4 @@
                return writer.toString();
        }
        
-       
-       public static void fixDisplayName(Model model) {
-               if (log.isInfoEnabled())
-                       log.info("Trying to auto-fix 'null' displayName...");
-               // where it's null, set to the shortest name if possible
-               for (Named e : model.getObjects(Named.class)) {
-                       if (e.getDisplayName() == null) {
-                               if (e.getStandardName() != null) {
-                                       e.setDisplayName(e.getStandardName());
-                               } else if (!e.getName().isEmpty()) {
-                                       String dsp = 
e.getName().iterator().next();
-                                       for (String name : e.getName()) {
-                                               if (name.length() < 
dsp.length())
-                                                       dsp = name;
-                                       }
-                                       e.setDisplayName(dsp);
-                               }
-                       }
-               }
-               // if required, set PE name to (already fixed) ER's name...
-               for(EntityReference er : 
model.getObjects(EntityReference.class)) {
-                       for(SimplePhysicalEntity spe : 
er.getEntityReferenceOf()) {
-                               if(spe.getDisplayName() == null || 
spe.getDisplayName().trim().length() == 0) {
-                                       if(er.getDisplayName() != null && 
er.getDisplayName().trim().length() > 0) {
-                                               
spe.setDisplayName(er.getDisplayName());
-                                       }
-                               }
-                       }
-               }
-       }
 }

Modified: 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/util/BioPaxVisualStyleUtil.java
===================================================================
--- 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/util/BioPaxVisualStyleUtil.java
    2012-06-20 13:01:46 UTC (rev 29637)
+++ 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/util/BioPaxVisualStyleUtil.java
    2012-06-20 15:23:43 UTC (rev 29638)
@@ -95,12 +95,12 @@
        /**
         * Size of interaction node
         */
-       private static final double 
BIO_PAX_VISUAL_STYLE_INTERACTION_NODE_SIZE_SCALE = 0.33;
+       private static final double 
BIO_PAX_VISUAL_STYLE_INTERACTION_NODE_SIZE_SCALE = 0.67;
 
        /**
         * Size of complex node
         */
-       private static final double 
BIO_PAX_VISUAL_STYLE_COMPLEX_NODE_SIZE_SCALE = 0.33;
+       private static final double 
BIO_PAX_VISUAL_STYLE_COMPLEX_NODE_SIZE_SCALE = 0.67;
 
        /**
         * Default color of nodes
@@ -110,18 +110,17 @@
        /**
         * Node border color
         */
-       private static final Color DEFAULT_NODE_BORDER_COLOR = new Color(0, 102,
-                       102);
+       private static final Color DEFAULT_NODE_BORDER_COLOR = new Color(0, 
102, 102);
 
        /**
         * Complex node color
         */
-       private static final Color COMPLEX_NODE_COLOR = new Color(0, 0, 0);
+       private static final Color COMPLEX_NODE_COLOR = DEFAULT_NODE_COLOR; 
//new Color(0, 0, 0);
 
        /**
         * Complex node color
         */
-       private static final Color COMPLEX_NODE_BORDER_COLOR = 
COMPLEX_NODE_COLOR;
+       private static final Color COMPLEX_NODE_BORDER_COLOR = 
DEFAULT_NODE_BORDER_COLOR; //COMPLEX_NODE_COLOR;
 
        VisualStyle style;
 
@@ -186,7 +185,9 @@
                        String name = claz.getSimpleName();
                        shape.putMapValue(name, 
NodeShapeVisualProperty.ELLIPSE);
                }
-
+               // use a different shape for Complex nodes
+               shape.putMapValue("Complex", NodeShapeVisualProperty.DIAMOND);
+               
                // hack for phosphorylated proteins
                shape.putMapValue(BioPaxUtil.PROTEIN_PHOSPHORYLATED,
                                NodeShapeVisualProperty.ELLIPSE);
@@ -241,17 +242,6 @@
                        new 
Double(BIO_PAX_VISUAL_STYLE_PHYSICAL_ENTITY_NODE_HEIGHT
                                * 
BIO_PAX_VISUAL_STYLE_COMPLEX_NODE_SIZE_SCALE));
 
-               /*
-                * // hack for phosphorylated proteins - make them large so 
label fits
-                * within node // commented out by Ethan Cerami, November 15, 
2006
-                * 
discreteMappingWidth.putMapValue(BioPaxUtil.PROTEIN_PHOSPHORYLATED,
-                * new Double(BIO_PAX_VISUAL_STYLE_PHYSICAL_ENTITY_NODE_WIDTH
-                * BIO_PAX_VISUAL_STYLE_PHYSICAL_ENTITY_NODE_SIZE_SCALE));
-                * 
discreteMappingHeight.putMapValue(BioPaxUtil.PROTEIN_PHOSPHORYLATED,
-                * new Double(BIO_PAX_VISUAL_STYLE_PHYSICAL_ENTITY_NODE_HEIGHT
-                * BIO_PAX_VISUAL_STYLE_PHYSICAL_ENTITY_NODE_SIZE_SCALE));
-                */
-
                // create and set node height calculator in node appearance 
calculator
                style.setDefaultValue(BasicVisualLexicon.NODE_WIDTH,
                                
BIO_PAX_VISUAL_STYLE_PHYSICAL_ENTITY_NODE_WIDTH);

Modified: 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/view/BioPaxDetailsPanel.java
===================================================================
--- 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/view/BioPaxDetailsPanel.java
       2012-06-20 13:01:46 UTC (rev 29637)
+++ 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/view/BioPaxDetailsPanel.java
       2012-06-20 15:23:43 UTC (rev 29638)
@@ -212,8 +212,8 @@
         stringRef = 
network.getRow(node,CyNetwork.HIDDEN_ATTRS).get(BioPaxUtil.BIOPAX_DATA, 
String.class);
         //stringRef = row.get(BioPaxUtil.BIOPAX_DATA, String.class);
         if (stringRef != null) {
-               appendHeader("BioPAX L3 (excerpt)", buf);
-            buf.append("<pre>" + StringEscapeUtils.escapeXml(stringRef) + 
"</pre>");
+               appendHeader("BioPAX L3 (fragment)", buf);
+            buf.append("<pre class='excerpt'>" + 
StringEscapeUtils.escapeXml(stringRef) + "</pre>");
         }
                
                buf.append("</BODY></HTML>");

Modified: 
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/util/BioPaxUtil.java
===================================================================
--- 
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/util/BioPaxUtil.java
       2012-06-20 13:01:46 UTC (rev 29637)
+++ 
core3/impl/trunk/cpath2-impl/src/main/java/org/cytoscape/cpath2/internal/util/BioPaxUtil.java
       2012-06-20 15:23:43 UTC (rev 29638)
@@ -25,13 +25,10 @@
  **/
 package org.cytoscape.cpath2.internal.util;
 
-import java.io.FileNotFoundException;
-import java.io.InputStream;
 import java.io.StringWriter;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -45,7 +42,6 @@
 import org.biopax.paxtools.controller.ObjectPropertyEditor;
 import org.biopax.paxtools.controller.PropertyEditor;
 import org.biopax.paxtools.controller.SimpleEditorMap;
-import org.biopax.paxtools.converter.OneTwoThree;
 import org.biopax.paxtools.io.SimpleIOHandler;
 import org.biopax.paxtools.model.BioPAXElement;
 import org.biopax.paxtools.model.BioPAXLevel;
@@ -53,12 +49,9 @@
 import org.biopax.paxtools.model.level3.BioSource;
 import org.biopax.paxtools.model.level3.CellularLocationVocabulary;
 import org.biopax.paxtools.model.level3.Entity;
-import org.biopax.paxtools.model.level3.EntityReference;
 import org.biopax.paxtools.model.level3.Interaction;
-import org.biopax.paxtools.model.level3.Level3Element;
 import org.biopax.paxtools.model.level3.Named;
 import org.biopax.paxtools.model.level3.PhysicalEntity;
-import org.biopax.paxtools.model.level3.Provenance;
 import org.biopax.paxtools.model.level3.PublicationXref;
 import org.biopax.paxtools.model.level3.RelationshipTypeVocabulary;
 import org.biopax.paxtools.model.level3.RelationshipXref;
@@ -140,36 +133,12 @@
        
 
        /**
-        * Constructor.
-        *
-        * @param in BioPAX data file name.
-        * @return BioPaxUtil new instance (containing the imported BioPAX data)
-        * @throws FileNotFoundException 
-        */
-       public static Model read(final InputStream in) throws 
FileNotFoundException {
-               Model model = null;
-               try {
-                       SimpleIOHandler handler = new SimpleIOHandler();
-                       handler.mergeDuplicates(true); // a workaround 
(illegal) BioPAX data having duplicated rdf:ID...
-                       model =  handler.convertFromOWL(in);    
-                       // immediately convert to BioPAX Level3 model
-                       if(model != null && 
BioPAXLevel.L2.equals(model.getLevel())) {
-                               model = new OneTwoThree().filter(model);
-                       }
-               } catch (Throwable e) {
-                       log.warn("Import failed: " + e);
-               }
-               return model;
-       }
-
-       
-       /**
         * Gets or infers the name of the node. 
         * 
         * @param bpe BioPAX Element
         * @return
         */
-       public static String getNodeName(BioPAXElement bpe) {
+       private static String getNodeName(BioPAXElement bpe) {
 
                if(bpe == null) {
                        return "";
@@ -179,7 +148,7 @@
                if (nodeName == null || nodeName.length()== 0) {
                        nodeName = getStandardName(bpe);
                        if (nodeName == null || nodeName.length() == 0) {
-                               Collection<String> names = getSynonymList(bpe);
+                               Collection<String> names = getSynonyms(bpe);
                                if (!names.isEmpty())
                                        nodeName = getTheShortestString(names);
                        }
@@ -191,7 +160,7 @@
        
        
        // get the shortest string
-       public static String getTheShortestString(Collection<String> nameList) {
+       private static String getTheShortestString(Collection<String> nameList) 
{
                String shortest = null;
                if (nameList != null && !nameList.isEmpty()) {
                        int minLength = -1;
@@ -214,7 +183,7 @@
         * 
         * @return the value or null
         */
-       public static Object getValue(BioPAXElement bpe, String... properties) {
+       private static Object getValue(BioPAXElement bpe, String... properties) 
{
                for (String property : properties) {
                        try {
                                Method method = 
bpe.getModelInterface().getMethod(
@@ -246,7 +215,7 @@
         * 
         * @return the set of property values or null
         */
-       public static Collection<?> getValues(BioPAXElement bpe, String... 
properties) {
+       private static Collection<?> getValues(BioPAXElement bpe, String... 
properties) {
                Collection<Object> col = new HashSet<Object>();
                
                for (String property : properties) {
@@ -282,7 +251,7 @@
         * @param bpe BioPAX element
         * @return short name field, or null if not available.
         */
-       public static String getShortName(BioPAXElement bpe) {
+       private static String getShortName(BioPAXElement bpe) {
                String shortName = null;
                
                if(bpe instanceof Named) {
@@ -298,7 +267,7 @@
         * @param bpe BioPAX element
         * @return name field, or null if not available.
         */
-       public static String getStandardName(BioPAXElement bpe) {
+       private static String getStandardName(BioPAXElement bpe) {
                if(bpe instanceof Named) {
                        return ((Named)bpe).getStandardName();
                } else 
@@ -306,12 +275,12 @@
        }
 
        /**
-        * Gets synonym names.
+        * Gets all names, if any present.
         *
         * @param bpe BioPAX element
-        * @return Collection of Synonym String Objects.
+        * @return Collection of names.
         */
-       public static Collection<String> getSynonymList(BioPAXElement bpe) {
+       private static Collection<String> getSynonyms(BioPAXElement bpe) {
                Collection<String> names = new HashSet<String>();
                if(bpe instanceof Named) {
                        names = ((Named)bpe).getName();
@@ -319,54 +288,14 @@
                return names;
        }
 
-       /**
-        * Gets the Organism Name.
-        *
-        * @param bpe BioPAX element
-        * @return organism field, or null if not available.
-        */
-       public static String getOrganismName(CyNetwork network, BioPAXElement 
bpe) {
-               String organism = null;
-                       
-               BioPAXElement bs = (BioPAXElement) getValue(bpe, "organism");
-               if (bs != null) {
-                       organism = getNodeName(bs);
-               } 
-
-               return organism;
-       }
-
-       /**
-        * If exist, gets all data sources 
-        * (according to the BioPAX spec. there should be only one...)
-        * names as "comment : name"...
-        * 
-        * @param bpe BioPAX element
-        * @return data source names
-        */
-       public static String getDataSource(BioPAXElement bpe) {
-               StringBuffer sb = new StringBuffer();
-               
-               if(bpe instanceof Entity) {
-                       Collection<Provenance> datasources = 
((Entity)bpe).getDataSource();
-                       for(Provenance pr : datasources) {
-                               if(pr.getComment() != null) 
-                                       sb.append(pr.getComment().toString());
-                               sb.append(" : 
").append(getNodeName(pr)).append(' '); 
-                       }
-               }
-               
-               return sb.toString();
-       }
        
-       
        /**
         * Gets the NCBI Taxonomy ID.
         *
         * @param bpe BioPAX element
         * @return taxonomyId, or -1, if not available.
         */
-       public static int getOrganismTaxonomyId(CyNetwork network, 
BioPAXElement bpe) {
+       private static int getOrganismTaxonomyId(CyNetwork network, 
BioPAXElement bpe) {
                int taxonomyId = -1;
                
                try {
@@ -385,31 +314,9 @@
                return taxonomyId;
        }
 
-       /**
-        * Gets the Comment field.
-        *
-        * @param bpe a BioPAX element
-        * @return comment field
-        */
-       public static String getComment(BioPAXElement bpe) {
-               return ((Level3Element)bpe).getComment().toString();
-       }
-
-       /**
-        * Gets the Availability Field.
-        *
-        * @param bpe BioPAX element
-        * @return availability field or null, if not available.
-        */
-       public static String getAvailability(BioPAXElement bpe) {
-               if(bpe instanceof Entity) {
-                       return ((Entity)bpe).getAvailability().toString();
-               } else
-                       return null;
-       }
        
        
-       public static <T extends Xref> List<T> getXRefs(BioPAXElement bpe, 
Class<T> xrefClass) {
+       private static <T extends Xref> List<T> getXRefs(BioPAXElement bpe, 
Class<T> xrefClass) {
                if(bpe instanceof XReferrable) {
                        List<T> erefs = new ArrayList<T>();
                        erefs.addAll(new ClassFilterSet<Xref,T>( 
((XReferrable)bpe).getXref(), xrefClass) );
@@ -423,67 +330,15 @@
                }
                return new ArrayList<T>();
        }
-
        
-       /**
-        * Gets the joint set of all known subclasses of the specified BioPAX 
types.
-        * 
-        * @param classes BioPAX (PaxTools Model Interfaces) Classes
-        * @return
-        */
-       public static Collection<Class> getSubclassNames(Class<? extends 
BioPAXElement>... classes) {
-               Collection<Class> subclasses = new HashSet<Class>();
-               
-               for (Class<? extends BioPAXElement> c : classes) {
-                       
subclasses.addAll(SimpleEditorMap.L3.getKnownSubClassesOf(c));
-               }
-               
-               return subclasses;
-       }
        
        /**
-        * Gets all the objects of provided BioPAX types.
-        * 
-        * @param model BioPAX (PaxTools) model
-        * @param classes query BioPAX types - e.g. Protein.class, Complex.class
-        * @return
-        */
-       public static Set<? extends BioPAXElement> getObjects(Model model, 
Class<? extends BioPAXElement>... classes) {
-               Set<BioPAXElement> coll = new HashSet<BioPAXElement>();
-               if (model != null) {
-                       for (Class<? extends BioPAXElement> c : classes) {
-                               coll.addAll(model.getObjects(c));
-                       }
-               }
-               return coll;
-       }
-       
-
-       /**
-        * Checks whether the element is of 
-        * any of the listed BioPAX types.
-        * 
-        * @param e
-        * @param classes
-        * @return
-        */
-       public static boolean isOneOfBiopaxClasses(BioPAXElement e, Class<? 
extends BioPAXElement>... classes) {
-               for(Class<? extends BioPAXElement> c : classes) {
-                       if(c.isInstance(e)) {
-                               return true;
-                       }
-               }
-               return false;
-       }
-       
-       
-       /**
         * Gets abbreviated cellular location term.
         * 
         * @param value
         * @return
         */
-       public static String getAbbrCellLocation(String value) {
+       private static String getAbbrCellLocation(String value) {
                for(String abr: cellLocationMap.keySet()) {
                        if(value.toLowerCase().contains(abr)) {
                                return cellLocationMap.get(abr);
@@ -498,7 +353,7 @@
         * @param value
         * @return
         */
-       public static String getAbbrChemModification(String value) {
+       private static String getAbbrChemModification(String value) {
                for(String abr: chemModificationsMap.keySet()) {
                        if(value.toLowerCase().contains(abr)) {
                                return chemModificationsMap.get(abr);
@@ -508,16 +363,7 @@
        }
        
        
-       public static Map<String, String> getChemModificationsMap() {
-               return Collections.unmodifiableMap(chemModificationsMap);
-       }
-       
-       public static Map<String, String> getCellLocationMap() {
-               return Collections.unmodifiableMap(cellLocationMap);
-       }
-       
-       
-       public static String truncateLongStr(String str) {
+       private static String truncateLongStr(String str) {
                if(str != null) {
                        str = str.replaceAll("[\n\r \t]+", " ");
                        if (str.length() > MAX_DISPLAY_STRING_LEN) {
@@ -528,7 +374,7 @@
        }
 
        
-       public static String toOwl(BioPAXElement bpe) {
+       private static String toOwl(BioPAXElement bpe) {
                StringWriter writer = new StringWriter();
                try {
                        SimpleIOHandler simpleExporter = new 
SimpleIOHandler(BioPAXLevel.L3);
@@ -540,37 +386,13 @@
        }
        
        
-       public static void fixDisplayName(Model model) {
-               if (log.isInfoEnabled())
-                       log.info("Trying to auto-fix 'null' displayName...");
-               // where it's null, set to the shortest name if possible
-               for (Named e : model.getObjects(Named.class)) {
-                       if (e.getDisplayName() == null) {
-                               if (e.getStandardName() != null) {
-                                       e.setDisplayName(e.getStandardName());
-                               } else if (!e.getName().isEmpty()) {
-                                       String dsp = 
e.getName().iterator().next();
-                                       for (String name : e.getName()) {
-                                               if (name.length() < 
dsp.length())
-                                                       dsp = name;
-                                       }
-                                       e.setDisplayName(dsp);
-                               }
-                       }
-               }
-               // if required, set PE name to (already fixed) ER's name...
-               for(EntityReference er : 
model.getObjects(EntityReference.class)) {
-                       for(SimplePhysicalEntity spe : 
er.getEntityReferenceOf()) {
-                               if(spe.getDisplayName() == null || 
spe.getDisplayName().trim().length() == 0) {
-                                       if(er.getDisplayName() != null && 
er.getDisplayName().trim().length() > 0) {
-                                               
spe.setDisplayName(er.getDisplayName());
-                                       }
-                               }
-                       }
-               }
-       }
-       
-       
+       /**
+        * Generates node attributes from BioPAX properties.
+        * 
+        * @param element
+        * @param node
+        * @param network
+        */
        public static void createAttributesFromProperties(final BioPAXElement 
element,
                        final CyNode node, final CyNetwork network) 
        {
@@ -803,27 +625,8 @@
        }
 
     
-       private static String addXRefs(List<ExternalLink> xrefList) {
-               if (!xrefList.isEmpty()) {
-                       StringBuffer temp = new StringBuffer("<ul>");
-                       for (ExternalLink link : xrefList) {
-                //  Ignore cPath Link.
-                if (link.getDbName() != null && 
link.getDbName().equalsIgnoreCase("CPATH")) {
-                    continue;
-                }
-                temp.append("<li>- ");
-                               
temp.append(ExternalLinkUtil.createLink(link.getDbName(), link.getId()));
-                temp.append("</li>");
-                       }
-                       temp.append("</ul>");
-                       return temp.toString();
-               }
-
-               return null;
-       }
-       
        private static String addIHOPLinks(CyNetwork network, BioPAXElement 
bpe) {
-               List<String> synList = new 
ArrayList<String>(BioPaxUtil.getSynonymList(bpe));
+               List<String> synList = new 
ArrayList<String>(BioPaxUtil.getSynonyms(bpe));
                List<ExternalLink> dbList = xrefToExternalLinks(bpe, 
Xref.class);
                
                if (!synList.isEmpty() || !dbList.isEmpty()) {
@@ -836,8 +639,9 @@
 
                return null;
        }
+
        
-       public static <T extends Xref> List<ExternalLink> 
xrefToExternalLinks(BioPAXElement bpe, Class<T> xrefClass) {
+       private static <T extends Xref> List<ExternalLink> 
xrefToExternalLinks(BioPAXElement bpe, Class<T> xrefClass) {
                
                if(bpe instanceof XReferrable) {
                        List<ExternalLink> erefs = new 
ArrayList<ExternalLink>();
@@ -897,6 +701,7 @@
 
                return dbList;
        }
+
        
        private static List<String> getXRefList(BioPAXElement bpe, String 
xrefType) {
                List<String> listToReturn = new ArrayList<String>();
@@ -919,6 +724,7 @@
 
                return listToReturn;
        }
+
        
        private static NodeAttributesWrapper 
getInteractionChemicalModifications(BioPAXElement participantElement) 
        {
@@ -976,6 +782,7 @@
 
                return new NodeAttributesWrapper(chemicalModificationsMap, 
chemicalModifications);
        }
+
        
        private static String getModificationsString(NodeAttributesWrapper 
chemicalModificationsWrapper) 
        {

-- 
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.

Reply via email to