iterating nh parser
[jalview.git] / forester / java / src / org / forester / io / parsers / nhx / NHXParser.java
index 1463d84..4711c8b 100644 (file)
@@ -46,14 +46,11 @@ import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.PhylogenyMethods;
 import org.forester.phylogeny.PhylogenyNode;
 import org.forester.phylogeny.data.Accession;
-import org.forester.phylogeny.data.Annotation;
 import org.forester.phylogeny.data.Confidence;
 import org.forester.phylogeny.data.DomainArchitecture;
 import org.forester.phylogeny.data.Event;
 import org.forester.phylogeny.data.Identifier;
 import org.forester.phylogeny.data.PhylogenyDataUtil;
-import org.forester.phylogeny.data.PropertiesMap;
-import org.forester.phylogeny.data.Property;
 import org.forester.phylogeny.data.Sequence;
 import org.forester.phylogeny.data.Taxonomy;
 import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
@@ -73,7 +70,6 @@ public final class NHXParser implements PhylogenyParser {
     final static private byte               BUFFERED_READER             = 3;
     final static private byte               STRING_BUILDER              = 4;
     private boolean                         _guess_rootedness;
-    private boolean                         _has_next;
     private boolean                         _ignore_quotes;
     private byte                            _input_type;
     private int                             _source_length;
@@ -99,10 +95,6 @@ public final class NHXParser implements PhylogenyParser {
         return _taxonomy_extraction;
     }
 
-    public boolean hasNext() {
-        return _has_next;
-    }
-
     /**
      * Parses the source set with setSource( final Object nhx_source ). Returns
      * the Phylogenies found in the source as Phylogeny[].
@@ -121,7 +113,6 @@ public final class NHXParser implements PhylogenyParser {
      */
     @Override
     public Phylogeny[] parse() throws IOException, NHXFormatException {
-        setHasNext( false );
         boolean in_comment = false;
         boolean saw_colon = false;
         boolean saw_open_bracket = false;
@@ -375,7 +366,6 @@ public final class NHXParser implements PhylogenyParser {
                     + " StringBuffer, char[], File," + " or InputStream " + " [attempt to parse object of "
                     + nhx_source.getClass() + "]." );
         }
-        setHasNext( true );
     }
 
     public void setTaxonomyExtraction( final NHXParser.TAXONOMY_EXTRACTION taxonomy_extraction ) {
@@ -493,7 +483,6 @@ public final class NHXParser implements PhylogenyParser {
         setReplaceUnderscores( REPLACE_UNDERSCORES_DEFAULT );
         setGuessRootedness( GUESS_ROOTEDNESS_DEFAULT );
         setIgnoreQuotes( IGNORE_QUOTES_DEFAULT );
-        setHasNext( false );
     }
 
     private boolean isGuessRootedness() {
@@ -618,10 +607,6 @@ public final class NHXParser implements PhylogenyParser {
         _current_phylogeny = current_phylogeny;
     }
 
-    private void setHasNext( final boolean has_next ) {
-        _has_next = has_next;
-    }
-
     private void setInputType( final byte input_type ) {
         _input_type = input_type;
     }
@@ -698,14 +683,6 @@ public final class NHXParser implements PhylogenyParser {
                         }
                         node_to_annotate.getNodeData().getTaxonomy().setScientificName( s.substring( 2 ) );
                     }
-                    else if ( s.startsWith( org.forester.io.parsers.nhx.NHXtags.ANNOTATION ) ) {
-                        if ( !node_to_annotate.getNodeData().isHasSequence() ) {
-                            node_to_annotate.getNodeData().setSequence( new Sequence() );
-                        }
-                        final Annotation annotation = new Annotation( "_:_" );
-                        annotation.setDesc( s.substring( 3 ) );
-                        node_to_annotate.getNodeData().getSequence().addAnnotation( annotation );
-                    }
                     else if ( s.startsWith( org.forester.io.parsers.nhx.NHXtags.IS_DUPLICATION ) ) {
                         if ( ( s.charAt( 2 ) == 'Y' ) || ( s.charAt( 2 ) == 'T' ) ) {
                             node_to_annotate.getNodeData().setEvent( Event.createSingleDuplicationEvent() );
@@ -738,12 +715,6 @@ public final class NHXParser implements PhylogenyParser {
                             PhylogenyMethods.setBranchColorValue( node_to_annotate, c );
                         }
                     }
-                    else if ( s.startsWith( NHXtags.CUSTOM_DATA_ON_NODE ) ) {
-                        if ( !node_to_annotate.getNodeData().isHasProperties() ) {
-                            node_to_annotate.getNodeData().setProperties( new PropertiesMap() );
-                        }
-                        node_to_annotate.getNodeData().getProperties().addProperty( Property.createFromNhxString( s ) );
-                    }
                     else if ( s.startsWith( NHXtags.DOMAIN_STRUCTURE ) ) {
                         if ( !node_to_annotate.getNodeData().isHasSequence() ) {
                             node_to_annotate.getNodeData().setSequence( new Sequence() );
@@ -751,9 +722,6 @@ public final class NHXParser implements PhylogenyParser {
                         node_to_annotate.getNodeData().getSequence()
                                 .setDomainArchitecture( new DomainArchitecture( s.substring( 3 ) ) );
                     }
-                    else if ( s.startsWith( NHXtags.NODE_IDENTIFIER ) ) {
-                        node_to_annotate.getNodeData().setNodeIdentifier( new Identifier( s.substring( 3 ) ) );
-                    }
                     else if ( s.startsWith( NHXtags.SEQUENCE_ACCESSION ) ) {
                         if ( !node_to_annotate.getNodeData().isHasSequence() ) {
                             node_to_annotate.getNodeData().setSequence( new Sequence() );
@@ -767,12 +735,6 @@ public final class NHXParser implements PhylogenyParser {
                         }
                         node_to_annotate.getNodeData().getSequence().setName( s.substring( 3 ) );
                     }
-                    else if ( s.startsWith( NHXtags.GENE_NAME_SYNONYM ) ) {
-                        if ( !node_to_annotate.getNodeData().isHasSequence() ) {
-                            node_to_annotate.getNodeData().setSequence( new Sequence() );
-                        }
-                        node_to_annotate.getNodeData().getSequence().setName( s.substring( 2 ) );
-                    }
                     else if ( s.indexOf( '=' ) < 0 ) {
                         if ( node_to_annotate.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
                             throw new NHXFormatException( "error in NHX formatted data: more than one distance to parent:"