domain + go output work begins
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Sat, 13 Dec 2014 03:14:31 +0000 (03:14 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Sat, 13 Dec 2014 03:14:31 +0000 (03:14 +0000)
forester/java/src/org/forester/archaeopteryx/Options.java
forester/java/src/org/forester/archaeopteryx/TreePanel.java
forester/java/src/org/forester/phylogeny/data/NodeData.java

index ec72006..8130013 100644 (file)
@@ -94,7 +94,11 @@ final public class Options {
     }
 
     public NodeData.NODE_DATA getExtDescNodeDataToReturn() {
-        return _ext_desc_data_to_return;
+        return NodeData.NODE_DATA.DOMAINS;
+        // TODO fix me
+        // FIXME remove me
+        // ~~~~~~
+        //return _ext_desc_data_to_return;
     }
 
     public boolean isAllowErrorsInDistanceToParent() {
index 4d50d28..c100ec5 100644 (file)
@@ -77,8 +77,11 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
+import java.util.SortedMap;
 import java.util.SortedSet;
+import java.util.TreeMap;
 
 import javax.swing.BorderFactory;
 import javax.swing.JApplet;
@@ -121,6 +124,7 @@ import org.forester.phylogeny.data.NodeVisualData.NodeShape;
 import org.forester.phylogeny.data.PhylogenyDataUtil;
 import org.forester.phylogeny.data.PropertiesMap;
 import org.forester.phylogeny.data.Property;
+import org.forester.phylogeny.data.ProteinDomain;
 import org.forester.phylogeny.data.Sequence;
 import org.forester.phylogeny.data.SequenceRelation;
 import org.forester.phylogeny.data.Taxonomy;
@@ -5491,6 +5495,9 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
 
     private void showExtDescNodeData( final PhylogenyNode node ) {
         final List<String> data = new ArrayList<String>();
+        final SortedMap<String,Integer> string_int_map = new TreeMap<String,Integer>();
+        
+        
         final List<PhylogenyNode> nodes = node.getAllExternalDescendants();
         if ( ( getFoundNodes0() != null ) || ( getFoundNodes1() != null ) ) {
             for( final PhylogenyNode n : getFoundNodesAsListOfPhylogenyNodes() ) {
@@ -5607,6 +5614,32 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                         data.add( n.getNodeData().getTaxonomy().getTaxonomyCode() );
                     }
                     break;
+                case DOMAINS:
+                    if ( n.getNodeData().isHasSequence()
+                            && n.getNodeData().getSequence().getDomainArchitecture() != null ) {
+                        final DomainArchitecture da = n.getNodeData().getSequence().getDomainArchitecture();
+                        for( int i = 0; i < da.getDomains().size(); ++i ) {
+                            final ProteinDomain d = da.getDomain( i );
+                            if ( d.getConfidence() < 1 ) {
+                                String dn = d.getName();
+                                if ( !string_int_map.containsKey(  dn ) ) {
+                                    string_int_map.put( dn, 1 );
+                                }
+                                else {
+                                    string_int_map.put( dn, string_int_map.get( dn ) + 1 );
+                                }
+                                
+                            }
+                            
+                        }
+                    }
+                    break;    
+                case GO_ANNOTATIONS:
+                    if ( n.getNodeData().isHasSequence() ) {
+                        //TODO do something clever
+                    }
+                    break;     
+                    
                 case UNKNOWN:
                     TreePanelUtil.showExtDescNodeDataUserSelectedHelper( getControlPanel(), n, data );
                     break;
@@ -5615,6 +5648,17 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                             + getOptions().getExtDescNodeDataToReturn() );
             }
         } // for loop
+        ///////////////////////////////////////////////////////
+        //TODO remove me
+        if ( string_int_map != null ) {
+            for( final Object key :  string_int_map.keySet() ) {
+                System.out.print( key.toString() );
+                System.out.print( ": " );
+                System.out.print( string_int_map.get( key ).toString() );
+                System.out.println();
+            }
+        }
+        ///////////////////////////////////////////////////////
         final StringBuilder sb = new StringBuilder();
         final int size = TreePanelUtil.makeSB( data, getOptions(), sb );
         if ( ( getConfiguration().getExtNodeDataReturnOn() == EXT_NODE_DATA_RETURN_ON.CONSOLE )
index 28bedb9..4cdf9b3 100644 (file)
@@ -50,7 +50,9 @@ public class NodeData implements PhylogenyData {
         TAXONOMY_SCIENTIFIC_NAME,
         TAXONOMY_COMM0N_NAME,
         TAXONOMY_CODE,
-        UNKNOWN;
+        UNKNOWN,
+        DOMAINS,
+        GO_ANNOTATIONS;
     }
     private String             _node_name;
     private Event              _event;