inprogress
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Thu, 3 Jan 2013 23:07:19 +0000 (23:07 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Thu, 3 Jan 2013 23:07:19 +0000 (23:07 +0000)
forester/java/src/org/forester/io/parsers/nhx/NHXParser.java
forester/java/src/org/forester/io/parsers/nhx/NHXParser2.java
forester/java/src/org/forester/io/parsers/nhx/NHXtags.java
forester/java/src/org/forester/test/Test.java

index 1b5aab0..5a47ab0 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;
@@ -698,14 +695,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 +727,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() );
index 339bbe2..ae04b6d 100644 (file)
@@ -45,14 +45,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;
@@ -227,8 +224,7 @@ public final class NHXParser2 implements PhylogenyParser {
         } //  while ( true ) 
         System.out.println( "done with loop" );
         if ( getCladeLevel() != 0 ) {
-            //   setPhylogenies( null );
-            //   throw new PhylogenyParserException( "error in NH (Newick)/NHX formatted data: most likely cause: number of open parens does not equal number of close parens" );
+            throw new PhylogenyParserException( "error in NH (Newick)/NHX formatted data: most likely cause: number of open parens does not equal number of close parens" );
         }
         if ( getCurrentPhylogeny() != null ) {
             return finishPhylogeny2();
@@ -667,14 +663,6 @@ public final class NHXParser2 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() );
@@ -707,12 +695,6 @@ public final class NHXParser2 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() );
index fa951e7..ca8e386 100644 (file)
@@ -27,16 +27,11 @@ package org.forester.io.parsers.nhx;
 
 public final class NHXtags {
 
-    public static final String CUSTOM_DATA_ON_NODE = "XN=";
     public static final String COLOR               = "C=";
     public static final String PARENT_BRANCH_WIDTH = "W=";
-    public static final String SUBTREE_NEIGHBORS   = "SNn=";
-    public static final String SUPER_ORTHOLOGOUS   = "SOn=";
-    public static final String ORTHOLOGOUS         = "On=";
     public static final String TAXONOMY_ID         = "T=";
     public static final String SUPPORT             = "B=";
     public static final String IS_DUPLICATION      = "D=";
-    public static final String ANNOTATION          = "AN=";
     public static final String SPECIES_NAME        = "S=";
     public static final String DOMAIN_STRUCTURE    = "DS=";
     public static final String GENE_NAME           = "GN=";
index dfce289..683955e 100644 (file)
@@ -5175,9 +5175,6 @@ public final class Test {
             if ( PhylogenyMethods.getBranchWidthValue( n5 ) != 2 ) {
                 return false;
             }
-            if ( n5.getNodeData().getProperties().getPropertyRefs().length != 2 ) {
-                return false;
-            }
             final PhylogenyNode n8 = PhylogenyNode
                     .createInstanceFromNhxString( "n8_ECOLI/12:0.01", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
             if ( !n8.getName().equals( "n8_ECOLI/12" ) ) {
@@ -5386,32 +5383,6 @@ public final class Test {
             if ( !PhylogenyMethods.getSpecies( o ).equals( "MOUSE" ) ) {
                 return false;
             }
-            final Property tvu1 = n5.getNodeData().getProperties().getProperty( "tag1" );
-            final Property tvu3 = n5.getNodeData().getProperties().getProperty( "tag3" );
-            if ( !tvu1.getRef().equals( "tag1" ) ) {
-                return false;
-            }
-            if ( !tvu1.getDataType().equals( "xsd:string" ) ) {
-                return false;
-            }
-            if ( !tvu1.getUnit().equals( "unit1" ) ) {
-                return false;
-            }
-            if ( !tvu1.getValue().equals( "value1" ) ) {
-                return false;
-            }
-            if ( !tvu3.getRef().equals( "tag3" ) ) {
-                return false;
-            }
-            if ( !tvu3.getDataType().equals( "xsd:string" ) ) {
-                return false;
-            }
-            if ( !tvu3.getUnit().equals( "unit3" ) ) {
-                return false;
-            }
-            if ( !tvu3.getValue().equals( "value3" ) ) {
-                return false;
-            }
             if ( n1.getName().compareTo( "" ) != 0 ) {
                 return false;
             }
@@ -5438,21 +5409,6 @@ public final class Test {
             if ( !n00.getNodeData().getSequence().getAccession().getValue().equals( "accession123" ) ) {
                 return false;
             }
-            if ( !n00.getNodeData().getProperties().getProperty( "url_tag" ).getRef().equals( "url_tag" ) ) {
-                return false;
-            }
-            if ( n00.getNodeData().getProperties().getProperty( "url_tag" ).getAppliesTo() != Property.AppliesTo.NODE ) {
-                return false;
-            }
-            if ( !n00.getNodeData().getProperties().getProperty( "url_tag" ).getDataType().equals( "xsd:anyURI" ) ) {
-                return false;
-            }
-            if ( !n00.getNodeData().getProperties().getProperty( "url_tag" ).getValue().equals( "www.yahoo.com" ) ) {
-                return false;
-            }
-            if ( !n00.getNodeData().getProperties().getProperty( "url_tag" ).getUnit().equals( "" ) ) {
-                return false;
-            }
             final PhylogenyNode nx = PhylogenyNode.createInstanceFromNhxString( "n5:0.1[&&NHX:S=Ecoli:GN=gene_1]" );
             if ( !nx.getNodeData().getSequence().getName().equals( "gene_1" ) ) {
                 return false;