typed search is being added
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 24 Dec 2014 00:55:41 +0000 (00:55 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 24 Dec 2014 00:55:41 +0000 (00:55 +0000)
forester/java/src/org/forester/archaeopteryx/ControlPanel.java
forester/java/src/org/forester/phylogeny/PhylogenyMethods.java

index 98d5b54..7cac388 100644 (file)
@@ -224,12 +224,11 @@ final class ControlPanel extends JPanel implements ActionListener {
                 }
                 displayedPhylogenyMightHaveChanged( true );
             }
-            else if ( e.getSource() == _show_domain_architectures  ) {
+            else if ( e.getSource() == _show_domain_architectures ) {
                 search0();
                 search1();
                 displayedPhylogenyMightHaveChanged( true );
             }
-            
             else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) {
                 if ( e.getSource() == getDisplayAsPhylogramCb() ) {
                     setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() );
@@ -572,7 +571,7 @@ final class ControlPanel extends JPanel implements ActionListener {
             case Configuration.color_according_to_annotation:
                 _color_according_to_annotation = new JCheckBox( title );
                 _color_according_to_annotation
-                        .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
+                .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
                 addJCheckBox( _color_according_to_annotation, ch_panel );
                 add( ch_panel );
                 break;
@@ -629,7 +628,7 @@ final class ControlPanel extends JPanel implements ActionListener {
             case Configuration.use_style:
                 _use_visual_styles_cb = new JCheckBox( title );
                 getUseVisualStylesCb()
-                        .setToolTipText( "To use visual styles (node colors, fonts) and branch colors, if present" );
+                .setToolTipText( "To use visual styles (node colors, fonts) and branch colors, if present" );
                 addJCheckBox( getUseVisualStylesCb(), ch_panel );
                 add( ch_panel );
                 break;
@@ -1162,13 +1161,13 @@ final class ControlPanel extends JPanel implements ActionListener {
                     getNodeDescPopupCb().setSelected( state );
                 }
                 break;
-            /* GUILHEM_BEG */
+                /* GUILHEM_BEG */
             case Configuration.show_relation_confidence:
                 if ( _seq_relation_confidence_switch != null ) {
                     _seq_relation_confidence_switch.setSelected( state );
                 }
                 break;
-            /* GUILHEM_END */
+                /* GUILHEM_END */
             default:
                 throw new AssertionError( "unknown checkbox: " + which );
         }
@@ -1578,7 +1577,7 @@ final class ControlPanel extends JPanel implements ActionListener {
             }
             else {
                 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
-                        .getPhylogenyGraphicsType() );
+                                                                         .getPhylogenyGraphicsType() );
             }
             getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
             getMainPanel().getControlPanel().search0();
@@ -1636,7 +1635,7 @@ final class ControlPanel extends JPanel implements ActionListener {
             treepanel.resetPreferredSize();
             getMainPanel().getCurrentScrollPane().getViewport().validate();
             sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
-                    - ( sb.getVisibleAmount() / 2.0 ) ) );
+                                                  - ( sb.getVisibleAmount() / 2.0 ) ) );
         }
         else {
             final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
@@ -1661,7 +1660,7 @@ final class ControlPanel extends JPanel implements ActionListener {
         treepanel.resetPreferredSize();
         getMainPanel().getCurrentScrollPane().getViewport().validate();
         sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
-                - ( sb.getVisibleAmount() / 2.0 ) ) );
+                                              - ( sb.getVisibleAmount() / 2.0 ) ) );
         treepanel.resetPreferredSize();
         treepanel.updateOvSizes();
     }
@@ -1686,7 +1685,7 @@ final class ControlPanel extends JPanel implements ActionListener {
                 treepanel.resetPreferredSize();
                 getMainPanel().getCurrentScrollPane().getViewport().validate();
                 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
-                        - ( sb.getVisibleAmount() / 2.0 ) ) );
+                                                      - ( sb.getVisibleAmount() / 2.0 ) ) );
             }
             else {
                 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
@@ -1715,7 +1714,7 @@ final class ControlPanel extends JPanel implements ActionListener {
             treepanel.resetPreferredSize();
             getMainPanel().getCurrentScrollPane().getViewport().validate();
             sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
-                    - ( sb.getVisibleAmount() / 2.0 ) ) );
+                                                  - ( sb.getVisibleAmount() / 2.0 ) ) );
             treepanel.resetPreferredSize();
             treepanel.updateOvSizes();
         }
@@ -1760,7 +1759,7 @@ final class ControlPanel extends JPanel implements ActionListener {
                                                                                                         cellHasFocus );
                 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
                     ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
-                            .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
+                                                                       .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
                 }
                 return component;
             }
@@ -1819,24 +1818,26 @@ final class ControlPanel extends JPanel implements ActionListener {
                     continue;
                 }
                 query = query.trim();
-                if ( ( query.indexOf( '+' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
+                final TreePanel tp = getMainPanel().getCurrentTreePanel();
+                if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
                     nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
                                                                          tree,
                                                                          getOptions().isSearchCaseSensitive(),
                                                                          !getOptions().isMatchWholeTermsOnly(),
-                                                                         isShowDomainArchitectures() ) );
+                                                                         isShowDomainArchitectures(),
+                                                                         tp != null ? Math.pow( 10,
+                                                                                                tp.getDomainStructureEvalueThresholdExp() )
+                                                                                 : 0 ) );
                 }
                 else {
-                    final TreePanel tp = getMainPanel().getCurrentTreePanel();
-                   
-                    
                     nodes.addAll( PhylogenyMethods.searchData( query,
                                                                tree,
                                                                getOptions().isSearchCaseSensitive(),
                                                                !getOptions().isMatchWholeTermsOnly(),
                                                                getOptions().isSearchWithRegex(),
                                                                isShowDomainArchitectures(),
-                                                               tp != null ? Math.pow( 10, tp.getDomainStructureEvalueThresholdExp() ) : 0 )  );
+                                                               tp != null ? Math.pow( 10, tp
+                                                                       .getDomainStructureEvalueThresholdExp() ) : 0 ) );
                 }
             }
             if ( getOptions().isInverseSearchResult() ) {
@@ -1878,22 +1879,26 @@ final class ControlPanel extends JPanel implements ActionListener {
                     continue;
                 }
                 query = query.trim();
-                if ( ( query.indexOf( '+' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
+                final TreePanel tp = getMainPanel().getCurrentTreePanel();
+                if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
                     nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
                                                                          tree,
                                                                          getOptions().isSearchCaseSensitive(),
                                                                          !getOptions().isMatchWholeTermsOnly(),
-                                                                         isShowDomainArchitectures() ) );
+                                                                         isShowDomainArchitectures(),
+                                                                         tp != null ? Math.pow( 10,
+                                                                                                tp.getDomainStructureEvalueThresholdExp() )
+                                                                                 : 0 ) );
                 }
                 else {
-                    final TreePanel tp = getMainPanel().getCurrentTreePanel();
                     nodes.addAll( PhylogenyMethods.searchData( query,
                                                                tree,
                                                                getOptions().isSearchCaseSensitive(),
                                                                !getOptions().isMatchWholeTermsOnly(),
                                                                getOptions().isSearchWithRegex(),
                                                                isShowDomainArchitectures(),
-                                                               tp != null ? Math.pow( 10, tp.getDomainStructureEvalueThresholdExp() ) : 0 )  );
+                                                               tp != null ? Math.pow( 10, tp
+                                                                       .getDomainStructureEvalueThresholdExp() ) : 0 ) );
                 }
             }
             if ( getOptions().isInverseSearchResult() ) {
@@ -2044,14 +2049,12 @@ final class ControlPanel extends JPanel implements ActionListener {
             _get_ext_desc_data = cb_index;
             if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
                 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
-                                  .getLabelForGetExtDescendentsData() );
+                        .getLabelForGetExtDescendentsData() );
             }
             else {
-               
                 addClickToOption( Configuration.get_ext_desc_data,
                                   getConfiguration().getClickToTitle( Configuration.get_ext_desc_data ) );
             }
-           
             if ( default_option == Configuration.get_ext_desc_data ) {
                 selected_index = cb_index;
             }
index 458ff97..4f55278 100644 (file)
@@ -133,7 +133,7 @@ public class PhylogenyMethods {
                             if ( !ForesterUtil.isEmpty( stats.get( i ).getDescription() ) ) {\r
                                 if ( !stats.get( i ).getDescription().equalsIgnoreCase( c.getType() ) ) {\r
                                     throw new IllegalArgumentException( "support values in node [" + n.toString()\r
-                                                                        + "] appear inconsistently ordered" );\r
+                                            + "] appear inconsistently ordered" );\r
                                 }\r
                             }\r
                             stats.get( i ).setDescription( c.getType() );\r
@@ -936,24 +936,23 @@ public class PhylogenyMethods {
         }\r
     }\r
 \r
-    \r
     private static enum NDF {\r
-        NN( "NN" ),\r
-        TC( "TC" ),\r
-        CN( "CN" ),\r
-        TS( "TS" ),\r
-        TI( "TI" ),\r
-        SY( "SY" ),\r
-        SN( "SN" ),\r
-        GN( "GN" ),\r
-        SS( "SS" ),\r
-        SA( "SA" ),\r
-        DO( "DO" ),\r
-        AN( "AN" ),\r
-        XR( "XR" ),\r
-        BC( "BC" ),\r
-        MS( "MS" );\r
-        \r
+        NodeName( "NN" ),\r
+        TaxonomyCode( "TC" ),\r
+        TaxonomyCommonName( "CN" ),\r
+        TaxonomyScientificName( "TS" ),\r
+        TaxonomyIdentifier( "TI" ),\r
+        TaxonomySynonym( "SY" ),\r
+        SequenceName( "SN" ),\r
+        GeneName( "GN" ),\r
+        SequenceSymbol( "SS" ),\r
+        SequenceAccession( "SA" ),\r
+        Domain( "DO" ),\r
+        Annotation( "AN" ),\r
+        CrossRef( "XR" ),\r
+        BinaryCharacter( "BC" ),\r
+        MolecularSequence( "MS" );\r
+\r
         private final String _text;\r
 \r
         NDF( final String text ) {\r
@@ -961,16 +960,15 @@ public class PhylogenyMethods {
         }\r
 \r
         public static NDF fromString( final String text ) {\r
-                for( NDF n : NDF.values() ) {\r
-                    if ( text.startsWith( n._text ) ) {\r
-                        return n;\r
-                    }\r
+            for( final NDF n : NDF.values() ) {\r
+                if ( text.startsWith( n._text ) ) {\r
+                    return n;\r
                 }\r
+            }\r
             return null;\r
         }\r
     }\r
-  \r
-    \r
+\r
     public static List<PhylogenyNode> searchData( final String query,\r
                                                   final Phylogeny phy,\r
                                                   final boolean case_sensitive,\r
@@ -985,35 +983,41 @@ public class PhylogenyMethods {
         if ( ForesterUtil.isEmpty( query ) ) {\r
             return nodes;\r
         }\r
-\r
         String my_query = query;\r
         NDF ndf = null;\r
-\r
-        if ( my_query.length() > 2 &&  my_query.indexOf( ":" ) == 2 ) {\r
+        if ( ( my_query.length() > 2 ) && ( my_query.indexOf( ":" ) == 2 ) ) {\r
             ndf = NDF.fromString( my_query );\r
             if ( ndf != null ) {\r
                 my_query = my_query.substring( 3 );\r
             }\r
         }\r
-       \r
-        \r
         for( final PhylogenyNodeIterator iter = phy.iteratorPreorder(); iter.hasNext(); ) {\r
             final PhylogenyNode node = iter.next();\r
             boolean match = false;\r
-            \r
-            \r
-            if ( ( ndf == null || ndf == NDF.NN ) && match( node.getName(), my_query, case_sensitive, partial, regex ) ) {\r
+            if ( ( ( ndf == null ) || ( ndf == NDF.NodeName ) )\r
+                    && match( node.getName(), my_query, case_sensitive, partial, regex ) ) {\r
                 match = true;\r
             }\r
-            else if ( ( ndf == null || ndf == NDF.TC ) && node.getNodeData().isHasTaxonomy()\r
-                    && match( node.getNodeData().getTaxonomy().getTaxonomyCode(), my_query, case_sensitive, partial, regex ) ) {\r
+            else if ( ( ( ndf == null ) || ( ndf == NDF.TaxonomyCode ) )\r
+                    && node.getNodeData().isHasTaxonomy()\r
+                    && match( node.getNodeData().getTaxonomy().getTaxonomyCode(),\r
+                              my_query,\r
+                              case_sensitive,\r
+                              partial,\r
+                              regex ) ) {\r
                 match = true;\r
             }\r
-            else if ( ( ndf == null || ndf == NDF.CN ) && node.getNodeData().isHasTaxonomy()\r
-                    && match( node.getNodeData().getTaxonomy().getCommonName(), my_query, case_sensitive, partial, regex ) ) {\r
+            else if ( ( ( ndf == null ) || ( ndf == NDF.TaxonomyCommonName ) )\r
+                    && node.getNodeData().isHasTaxonomy()\r
+                    && match( node.getNodeData().getTaxonomy().getCommonName(),\r
+                              my_query,\r
+                              case_sensitive,\r
+                              partial,\r
+                              regex ) ) {\r
                 match = true;\r
             }\r
-            else if ( ( ndf == null || ndf == NDF.TS ) && node.getNodeData().isHasTaxonomy()\r
+            else if ( ( ( ndf == null ) || ( ndf == NDF.TaxonomyScientificName ) )\r
+                    && node.getNodeData().isHasTaxonomy()\r
                     && match( node.getNodeData().getTaxonomy().getScientificName(),\r
                               my_query,\r
                               case_sensitive,\r
@@ -1021,8 +1025,8 @@ public class PhylogenyMethods {
                               regex ) ) {\r
                 match = true;\r
             }\r
-            else if ( ( ndf == null || ndf == NDF.TI ) &&\r
-                    node.getNodeData().isHasTaxonomy()\r
+            else if ( ( ( ndf == null ) || ( ndf == NDF.TaxonomyIdentifier ) )\r
+                    && node.getNodeData().isHasTaxonomy()\r
                     && ( node.getNodeData().getTaxonomy().getIdentifier() != null )\r
                     && match( node.getNodeData().getTaxonomy().getIdentifier().getValue(),\r
                               my_query,\r
@@ -1031,9 +1035,8 @@ public class PhylogenyMethods {
                               regex ) ) {\r
                 match = true;\r
             }\r
-            else if ( \r
-                    ( ndf == null || ndf == NDF.SY ) &&\r
-                    node.getNodeData().isHasTaxonomy() && !node.getNodeData().getTaxonomy().getSynonyms().isEmpty() ) {\r
+            else if ( ( ( ndf == null ) || ( ndf == NDF.TaxonomySynonym ) ) && node.getNodeData().isHasTaxonomy()\r
+                    && !node.getNodeData().getTaxonomy().getSynonyms().isEmpty() ) {\r
                 final List<String> syns = node.getNodeData().getTaxonomy().getSynonyms();\r
                 I: for( final String syn : syns ) {\r
                     if ( match( syn, my_query, case_sensitive, partial, regex ) ) {\r
@@ -1042,26 +1045,21 @@ public class PhylogenyMethods {
                     }\r
                 }\r
             }\r
-            if (    !match && ( ndf == null || ndf == NDF.SN ) &&\r
-                     node.getNodeData().isHasSequence()\r
+            if ( !match && ( ( ndf == null ) || ( ndf == NDF.SequenceName ) ) && node.getNodeData().isHasSequence()\r
                     && match( node.getNodeData().getSequence().getName(), my_query, case_sensitive, partial, regex ) ) {\r
                 match = true;\r
             }\r
-            if (      !match && ( ndf == null || ndf == NDF.GN ) &&\r
-                     node.getNodeData().isHasSequence()\r
+            if ( !match && ( ( ndf == null ) || ( ndf == NDF.GeneName ) ) && node.getNodeData().isHasSequence()\r
                     && match( node.getNodeData().getSequence().getGeneName(), my_query, case_sensitive, partial, regex ) ) {\r
                 match = true;\r
             }\r
-            if (    !match && ( ndf == null || ndf == NDF.SS ) &&\r
-                    \r
-                     node.getNodeData().isHasSequence()\r
+            if ( !match && ( ( ndf == null ) || ( ndf == NDF.SequenceSymbol ) ) && node.getNodeData().isHasSequence()\r
                     && match( node.getNodeData().getSequence().getSymbol(), my_query, case_sensitive, partial, regex ) ) {\r
                 match = true;\r
             }\r
-            if (   !match && ( ndf == null || ndf == NDF.SA ) &&\r
-                    \r
-                   \r
-                     node.getNodeData().isHasSequence()\r
+            if ( !match\r
+                    && ( ( ndf == null ) || ( ndf == NDF.SequenceAccession ) )\r
+                    && node.getNodeData().isHasSequence()\r
                     && ( node.getNodeData().getSequence().getAccession() != null )\r
                     && match( node.getNodeData().getSequence().getAccession().getValue(),\r
                               my_query,\r
@@ -1070,19 +1068,19 @@ public class PhylogenyMethods {
                               regex ) ) {\r
                 match = true;\r
             }\r
-            if (  !match && ( (ndf == null && search_domains ) || ndf == NDF.DO ) && node.getNodeData().isHasSequence()\r
+            if ( !match && ( ( ( ndf == null ) && search_domains ) || ( ndf == NDF.Domain ) )\r
+                    && node.getNodeData().isHasSequence()\r
                     && ( node.getNodeData().getSequence().getDomainArchitecture() != null ) ) {\r
                 final DomainArchitecture da = node.getNodeData().getSequence().getDomainArchitecture();\r
                 I: for( int i = 0; i < da.getNumberOfDomains(); ++i ) {\r
-                    if ( ( da.getDomain( i ).getConfidence() <= domains_confidence_threshold ) && ( match( da.getDomain( i ).getName(), my_query, case_sensitive, partial, regex ) ) ) {\r
+                    if ( ( da.getDomain( i ).getConfidence() <= domains_confidence_threshold )\r
+                            && ( match( da.getDomain( i ).getName(), my_query, case_sensitive, partial, regex ) ) ) {\r
                         match = true;\r
                         break I;\r
                     }\r
                 }\r
             }\r
-            if ( \r
-                    !match && ( ndf == null || ndf == NDF.AN ) &&\r
-                    node.getNodeData().isHasSequence()\r
+            if ( !match && ( ( ndf == null ) || ( ndf == NDF.Annotation ) ) && node.getNodeData().isHasSequence()\r
                     && ( node.getNodeData().getSequence().getAnnotations() != null ) ) {\r
                 for( final Annotation ann : node.getNodeData().getSequence().getAnnotations() ) {\r
                     if ( match( ann.getDesc(), my_query, case_sensitive, partial, regex ) ) {\r
@@ -1095,8 +1093,7 @@ public class PhylogenyMethods {
                     }\r
                 }\r
             }\r
-            if ( !match && ( ndf == null || ndf == NDF.XR ) &&\r
-                    node.getNodeData().isHasSequence()\r
+            if ( !match && ( ( ndf == null ) || ( ndf == NDF.CrossRef ) ) && node.getNodeData().isHasSequence()\r
                     && ( node.getNodeData().getSequence().getCrossReferences() != null ) ) {\r
                 for( final Accession x : node.getNodeData().getSequence().getCrossReferences() ) {\r
                     if ( match( x.getComment(), my_query, case_sensitive, partial, regex ) ) {\r
@@ -1113,9 +1110,8 @@ public class PhylogenyMethods {
                     }\r
                 }\r
             }\r
-            //\r
-            if ( !match && ( ndf == null || ndf == NDF.BC ) &&\r
-                    ( node.getNodeData().getBinaryCharacters() != null ) ) {\r
+            if ( !match && ( ( ndf == null ) || ( ndf == NDF.BinaryCharacter ) )\r
+                    && ( node.getNodeData().getBinaryCharacters() != null ) ) {\r
                 Iterator<String> it = node.getNodeData().getBinaryCharacters().getPresentCharacters().iterator();\r
                 I: while ( it.hasNext() ) {\r
                     if ( match( it.next(), my_query, case_sensitive, partial, regex ) ) {\r
@@ -1131,6 +1127,16 @@ public class PhylogenyMethods {
                     }\r
                 }\r
             }\r
+            if ( !match\r
+                    && ( ndf == NDF.MolecularSequence )\r
+                    && node.getNodeData().isHasSequence()\r
+                    && match( node.getNodeData().getSequence().getMolecularSequence(),\r
+                              my_query,\r
+                              case_sensitive,\r
+                              true,\r
+                              regex ) ) {\r
+                match = true;\r
+            }\r
             if ( match ) {\r
                 nodes.add( node );\r
             }\r
@@ -1142,7 +1148,8 @@ public class PhylogenyMethods {
                                                             final Phylogeny phy,\r
                                                             final boolean case_sensitive,\r
                                                             final boolean partial,\r
-                                                            final boolean search_domains ) {\r
+                                                            final boolean search_domains,\r
+                                                            final double domains_confidence_threshold ) {\r
         final List<PhylogenyNode> nodes = new ArrayList<PhylogenyNode>();\r
         if ( phy.isEmpty() || ( queries == null ) || ( queries.length < 1 ) ) {\r
             return nodes;\r
@@ -1150,15 +1157,24 @@ public class PhylogenyMethods {
         for( final PhylogenyNodeIterator iter = phy.iteratorPreorder(); iter.hasNext(); ) {\r
             final PhylogenyNode node = iter.next();\r
             boolean all_matched = true;\r
-            for( final String query : queries ) {\r
+            for( String query : queries ) {\r
+                NDF ndf = null;\r
+                if ( ( query.length() > 2 ) && ( query.indexOf( ":" ) == 2 ) ) {\r
+                    ndf = NDF.fromString( query );\r
+                    if ( ndf != null ) {\r
+                        query = query.substring( 3 );\r
+                    }\r
+                }\r
                 boolean match = false;\r
                 if ( ForesterUtil.isEmpty( query ) ) {\r
                     continue;\r
                 }\r
-                if ( match( node.getName(), query, case_sensitive, partial, false ) ) {\r
+                if ( ( ( ndf == null ) || ( ndf == NDF.NodeName ) )\r
+                        && match( node.getName(), query, case_sensitive, partial, false ) ) {\r
                     match = true;\r
                 }\r
-                else if ( node.getNodeData().isHasTaxonomy()\r
+                else if ( ( ( ndf == null ) || ( ndf == NDF.TaxonomyCode ) )\r
+                        && node.getNodeData().isHasTaxonomy()\r
                         && match( node.getNodeData().getTaxonomy().getTaxonomyCode(),\r
                                   query,\r
                                   case_sensitive,\r
@@ -1166,7 +1182,8 @@ public class PhylogenyMethods {
                                   false ) ) {\r
                     match = true;\r
                 }\r
-                else if ( node.getNodeData().isHasTaxonomy()\r
+                else if ( ( ( ndf == null ) || ( ndf == NDF.TaxonomyCommonName ) )\r
+                        && node.getNodeData().isHasTaxonomy()\r
                         && match( node.getNodeData().getTaxonomy().getCommonName(),\r
                                   query,\r
                                   case_sensitive,\r
@@ -1174,7 +1191,8 @@ public class PhylogenyMethods {
                                   false ) ) {\r
                     match = true;\r
                 }\r
-                else if ( node.getNodeData().isHasTaxonomy()\r
+                else if ( ( ( ndf == null ) || ( ndf == NDF.TaxonomyScientificName ) )\r
+                        && node.getNodeData().isHasTaxonomy()\r
                         && match( node.getNodeData().getTaxonomy().getScientificName(),\r
                                   query,\r
                                   case_sensitive,\r
@@ -1182,7 +1200,8 @@ public class PhylogenyMethods {
                                   false ) ) {\r
                     match = true;\r
                 }\r
-                else if ( node.getNodeData().isHasTaxonomy()\r
+                else if ( ( ( ndf == null ) || ( ndf == NDF.TaxonomyIdentifier ) )\r
+                        && node.getNodeData().isHasTaxonomy()\r
                         && ( node.getNodeData().getTaxonomy().getIdentifier() != null )\r
                         && match( node.getNodeData().getTaxonomy().getIdentifier().getValue(),\r
                                   query,\r
@@ -1191,7 +1210,7 @@ public class PhylogenyMethods {
                                   false ) ) {\r
                     match = true;\r
                 }\r
-                else if ( node.getNodeData().isHasTaxonomy()\r
+                else if ( ( ( ndf == null ) || ( ndf == NDF.TaxonomySynonym ) ) && node.getNodeData().isHasTaxonomy()\r
                         && !node.getNodeData().getTaxonomy().getSynonyms().isEmpty() ) {\r
                     final List<String> syns = node.getNodeData().getTaxonomy().getSynonyms();\r
                     I: for( final String syn : syns ) {\r
@@ -1201,20 +1220,23 @@ public class PhylogenyMethods {
                         }\r
                     }\r
                 }\r
-                if ( !match && node.getNodeData().isHasSequence()\r
+                if ( !match && ( ( ndf == null ) || ( ndf == NDF.SequenceName ) ) && node.getNodeData().isHasSequence()\r
                         && match( node.getNodeData().getSequence().getName(), query, case_sensitive, partial, false ) ) {\r
                     match = true;\r
                 }\r
                 if ( !match\r
+                        && ( ( ndf == null ) || ( ndf == NDF.GeneName ) )\r
                         && node.getNodeData().isHasSequence()\r
                         && match( node.getNodeData().getSequence().getGeneName(), query, case_sensitive, partial, false ) ) {\r
                     match = true;\r
                 }\r
-                if ( !match && node.getNodeData().isHasSequence()\r
+                if ( !match && ( ( ndf == null ) || ( ndf == NDF.SequenceSymbol ) )\r
+                        && node.getNodeData().isHasSequence()\r
                         && match( node.getNodeData().getSequence().getSymbol(), query, case_sensitive, partial, false ) ) {\r
                     match = true;\r
                 }\r
                 if ( !match\r
+                        && ( ( ndf == null ) || ( ndf == NDF.SequenceAccession ) )\r
                         && node.getNodeData().isHasSequence()\r
                         && ( node.getNodeData().getSequence().getAccession() != null )\r
                         && match( node.getNodeData().getSequence().getAccession().getValue(),\r
@@ -1224,18 +1246,19 @@ public class PhylogenyMethods {
                                   false ) ) {\r
                     match = true;\r
                 }\r
-                if ( search_domains && !match && node.getNodeData().isHasSequence()\r
+                if ( !match && ( ( ( ndf == null ) && search_domains ) || ( ndf == NDF.Domain ) )\r
+                        && node.getNodeData().isHasSequence()\r
                         && ( node.getNodeData().getSequence().getDomainArchitecture() != null ) ) {\r
                     final DomainArchitecture da = node.getNodeData().getSequence().getDomainArchitecture();\r
                     I: for( int i = 0; i < da.getNumberOfDomains(); ++i ) {\r
-                        if ( match( da.getDomain( i ).getName(), query, case_sensitive, partial, false ) ) {\r
+                        if ( ( da.getDomain( i ).getConfidence() <= domains_confidence_threshold )\r
+                                && match( da.getDomain( i ).getName(), query, case_sensitive, partial, false ) ) {\r
                             match = true;\r
                             break I;\r
                         }\r
                     }\r
                 }\r
-                //\r
-                if ( !match && node.getNodeData().isHasSequence()\r
+                if ( !match && ( ( ndf == null ) || ( ndf == NDF.Annotation ) ) && node.getNodeData().isHasSequence()\r
                         && ( node.getNodeData().getSequence().getAnnotations() != null ) ) {\r
                     for( final Annotation ann : node.getNodeData().getSequence().getAnnotations() ) {\r
                         if ( match( ann.getDesc(), query, case_sensitive, partial, false ) ) {\r
@@ -1248,7 +1271,7 @@ public class PhylogenyMethods {
                         }\r
                     }\r
                 }\r
-                if ( !match && node.getNodeData().isHasSequence()\r
+                if ( !match && ( ( ndf == null ) || ( ndf == NDF.CrossRef ) ) && node.getNodeData().isHasSequence()\r
                         && ( node.getNodeData().getSequence().getCrossReferences() != null ) ) {\r
                     for( final Accession x : node.getNodeData().getSequence().getCrossReferences() ) {\r
                         if ( match( x.getComment(), query, case_sensitive, partial, false ) ) {\r
@@ -1265,8 +1288,8 @@ public class PhylogenyMethods {
                         }\r
                     }\r
                 }\r
-                //\r
-                if ( !match && ( node.getNodeData().getBinaryCharacters() != null ) ) {\r
+                if ( !match && ( ( ndf == null ) || ( ndf == NDF.BinaryCharacter ) )\r
+                        && ( node.getNodeData().getBinaryCharacters() != null ) ) {\r
                     Iterator<String> it = node.getNodeData().getBinaryCharacters().getPresentCharacters().iterator();\r
                     I: while ( it.hasNext() ) {\r
                         if ( match( it.next(), query, case_sensitive, partial, false ) ) {\r
@@ -1282,6 +1305,16 @@ public class PhylogenyMethods {
                         }\r
                     }\r
                 }\r
+                if ( !match\r
+                        && ( ndf == NDF.MolecularSequence )\r
+                        && node.getNodeData().isHasSequence()\r
+                        && match( node.getNodeData().getSequence().getMolecularSequence(),\r
+                                  query,\r
+                                  case_sensitive,\r
+                                  true,\r
+                                  false ) ) {\r
+                    match = true;\r
+                }\r
                 if ( !match ) {\r
                     all_matched = false;\r
                     break;\r
@@ -1428,7 +1461,7 @@ public class PhylogenyMethods {
             else if ( !( ref_ext_taxo.contains( n.getNodeData().getTaxonomy().getScientificName() ) )\r
                     && !( ref_ext_taxo.contains( n.getNodeData().getTaxonomy().getTaxonomyCode() ) )\r
                     && !( ( n.getNodeData().getTaxonomy().getIdentifier() != null ) && ref_ext_taxo.contains( n\r
-                                                                                                              .getNodeData().getTaxonomy().getIdentifier().getValuePlusProvider() ) ) ) {\r
+                            .getNodeData().getTaxonomy().getIdentifier().getValuePlusProvider() ) ) ) {\r
                 nodes_to_delete.add( n );\r
             }\r
         }\r
@@ -1565,7 +1598,7 @@ public class PhylogenyMethods {
                             n.setName( "" );\r
                         }\r
                         n.getNodeData().getTaxonomy()\r
-                        .setIdentifier( new Identifier( id, PhyloXmlUtil.UNIPROT_TAX_PROVIDER ) );\r
+                                .setIdentifier( new Identifier( id, PhyloXmlUtil.UNIPROT_TAX_PROVIDER ) );\r
                         break;\r
                     }\r
                     case TAXONOMY_ID_UNIPROT_2: {\r
@@ -1581,7 +1614,7 @@ public class PhylogenyMethods {
                             n.setName( "" );\r
                         }\r
                         n.getNodeData().getTaxonomy()\r
-                        .setIdentifier( new Identifier( id, PhyloXmlUtil.UNIPROT_TAX_PROVIDER ) );\r
+                                .setIdentifier( new Identifier( id, PhyloXmlUtil.UNIPROT_TAX_PROVIDER ) );\r
                         break;\r
                     }\r
                     case TAXONOMY_ID: {\r