import org.forester.io.parsers.nexus.NexusCharactersParser;
import org.forester.io.parsers.nexus.NexusPhylogeniesParser;
import org.forester.io.parsers.nhx.NHXParser;
+import org.forester.io.parsers.nhx.NHXParser.TAXONOMY_EXTRACTION;
import org.forester.io.parsers.phyloxml.PhyloXmlParser;
import org.forester.io.parsers.tol.TolParser;
+import org.forester.io.parsers.util.ParserUtils;
import org.forester.io.writers.PhylogenyWriter;
import org.forester.msa.BasicMsa;
import org.forester.msa.Mafft;
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyBranch;
import org.forester.phylogeny.PhylogenyMethods;
-import org.forester.phylogeny.PhylogenyMethods.TAXONOMY_EXTRACTION;
import org.forester.phylogeny.PhylogenyNode;
-import org.forester.phylogeny.PhylogenyNodeI.NH_CONVERSION_SUPPORT_VALUE_STYLE;
+import org.forester.phylogeny.PhylogenyNode.NH_CONVERSION_SUPPORT_VALUE_STYLE;
import org.forester.phylogeny.data.BinaryCharacters;
import org.forester.phylogeny.data.BranchWidth;
import org.forester.phylogeny.data.Confidence;
}
else {
System.out.println( "failed." );
- System.exit( -1 ); //TODO FIXME remove me!! ~
failed++;
}
System.out.print( "Hmmscan output parser: " );
System.out.println( "failed." );
failed++;
}
+ System.out.print( "Taxonomy extraction: " );
+ if ( Test.testExtractTaxonomyCodeFromNodeName() ) {
+ System.out.println( "OK." );
+ succeeded++;
+ }
+ else {
+ System.out.println( "failed." );
+ failed++;
+ }
System.out.print( "Basic node construction and parsing of NHX (node level): " );
if ( Test.testNHXNodeParsing() ) {
System.out.println( "OK." );
System.out.println( "failed." );
failed++;
}
- // System.out.print( "WABI TxSearch: " );
- // if ( Test.testWabiTxSearch() ) {
- // System.out.println( "OK." );
- // succeeded++;
- // }
- // else {
- // System.out
- // .println( "failed [will not count towards failed tests since it might be due to absence internet connection]" );
- // }
System.out.println();
final Runtime rt = java.lang.Runtime.getRuntime();
final long free_memory = rt.freeMemory() / 1000000;
else {
System.out.println( "Not OK." );
}
- // System.out.println();
- // Development.setTime( true );
- //try {
- // final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
- // final String clc = System.getProperty( "user.dir" ) + ForesterUtil.getFileSeparator()
- // + "examples" + ForesterUtil.getFileSeparator() + "CLC.nhx";
- // final String multi = Test.PATH_TO_EXAMPLE_FILES +
- // "multifurcations_ex_1.nhx";
- // final String domains = Test.PATH_TO_EXAMPLE_FILES + "domains1.nhx";
- // final Phylogeny t1 = factory.create( new File( domains ), new
- // NHXParser() )[ 0 ];
- // final Phylogeny t2 = factory.create( new File( clc ), new NHXParser() )[ 0 ];
- // }
- // catch ( final Exception e ) {
- // e.printStackTrace();
- // }
- // t1.getRoot().preorderPrint();
- // final PhylogenyFactory factory = ParserBasedPhylogenyFactory
- // .getInstance();
- // try {
- //
- // Helper.readNHtree( new File( PATH_TO_EXAMPLE_FILES
- // + "\\AtNBSpos.nhx" ) );
- // factory.create(
- // new File( PATH_TO_EXAMPLE_FILES + "\\AtNBSpos.nhx" ),
- // new NHXParser() );
- // Helper.readNHtree( new File( PATH_TO_EXAMPLE_FILES
- // + "\\AtNBSpos.nhx" ) );
- // factory.create(
- // new File( PATH_TO_EXAMPLE_FILES + "\\AtNBSpos.nhx" ),
- // new NHXParser() );
- //
- //
- // Helper.readNHtree( new File( PATH_TO_EXAMPLE_FILES
- // + "\\big_tree.nhx" ) );
- // Helper.readNHtree( new File( PATH_TO_EXAMPLE_FILES
- // + "\\big_tree.nhx" ) );
- // factory.create(
- // new File( PATH_TO_EXAMPLE_FILES + "\\big_tree.nhx" ),
- // new NHXParser() );
- // factory.create(
- // new File( PATH_TO_EXAMPLE_FILES + "\\big_tree.nhx" ),
- // new NHXParser() );
- //
- // Helper.readNHtree( new File( PATH_TO_EXAMPLE_FILES
- // + "\\big_tree.nhx" ) );
- // Helper.readNHtree( new File( PATH_TO_EXAMPLE_FILES
- // + "\\big_tree.nhx" ) );
- //
- // factory.create(
- // new File( PATH_TO_EXAMPLE_FILES + "\\big_tree.nhx" ),
- // new NHXParser() );
- // factory.create(
- // new File( PATH_TO_EXAMPLE_FILES + "\\big_tree.nhx" ),
- // new NHXParser() );
- //
- // Helper.readNHtree( new File( PATH_TO_EXAMPLE_FILES
- // + "\\AtNBSpos.nhx" ) );
- // factory.create(
- // new File( PATH_TO_EXAMPLE_FILES + "\\AtNBSpos.nhx" ),
- // new NHXParser() );
- //
- // }
- // catch ( IOException e ) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
+ }
+
+ private static boolean testExtractTaxonomyCodeFromNodeName() {
+ try {
+ if ( !ParserUtils.extractTaxonomyCodeFromNodeName( "MOUSE", TAXONOMY_EXTRACTION.YES ).equals( "MOUSE" ) ) {
+ return false;
+ }
+ if ( !ParserUtils.extractTaxonomyCodeFromNodeName( "RAT", TAXONOMY_EXTRACTION.YES ).equals( "RAT" ) ) {
+ return false;
+ }
+ if ( ParserUtils.extractTaxonomyCodeFromNodeName( "RAT1", TAXONOMY_EXTRACTION.YES ) != null ) {
+ return false;
+ }
+ if ( !ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_MOUSE function = 23445", TAXONOMY_EXTRACTION.YES )
+ .equals( "MOUSE" ) ) {
+ return false;
+ }
+ if ( !ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_MOUSE_function = 23445", TAXONOMY_EXTRACTION.YES )
+ .equals( "MOUSE" ) ) {
+ return false;
+ }
+ if ( !ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_MOUSE|function = 23445", TAXONOMY_EXTRACTION.YES )
+ .equals( "MOUSE" ) ) {
+ return false;
+ }
+ if ( ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_MOUSEfunction = 23445", TAXONOMY_EXTRACTION.YES ) != null ) {
+ return false;
+ }
+ if ( ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_MOUSEFunction = 23445", TAXONOMY_EXTRACTION.YES ) != null ) {
+ return false;
+ }
+ if ( !ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_RAT function = 23445", TAXONOMY_EXTRACTION.YES )
+ .equals( "RAT" ) ) {
+ return false;
+ }
+ if ( !ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_RAT_function = 23445", TAXONOMY_EXTRACTION.YES )
+ .equals( "RAT" ) ) {
+ return false;
+ }
+ if ( !ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_RAT|function = 23445", TAXONOMY_EXTRACTION.YES )
+ .equals( "RAT" ) ) {
+ return false;
+ }
+ if ( ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_RATfunction = 23445", TAXONOMY_EXTRACTION.YES ) != null ) {
+ return false;
+ }
+ if ( ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_RATFunction = 23445", TAXONOMY_EXTRACTION.YES ) != null ) {
+ return false;
+ }
+ if ( !ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_RAT/1-3", TAXONOMY_EXTRACTION.YES ).equals( "RAT" ) ) {
+ return false;
+ }
+ if ( !ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_PIG/1-3", TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY )
+ .equals( "PIG" ) ) {
+ return false;
+ }
+ if ( !ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_MOUSE/1-3", TAXONOMY_EXTRACTION.YES )
+ .equals( "MOUSE" ) ) {
+ return false;
+ }
+ if ( !ParserUtils.extractTaxonomyCodeFromNodeName( "BCL2_MOUSE/1-3", TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY )
+ .equals( "MOUSE" ) ) {
+ return false;
+ }
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace( System.out );
+ return false;
+ }
+ return true;
}
private static boolean testBasicNodeMethods() {
}
final PhylogenyNode n1 = new PhylogenyNode();
final PhylogenyNode n2 = PhylogenyNode
- .createInstanceFromNhxString( "", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
final PhylogenyNode n3 = PhylogenyNode
- .createInstanceFromNhxString( "n3", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n3", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
final PhylogenyNode n4 = PhylogenyNode
- .createInstanceFromNhxString( "n4:0.01", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n4:0.01", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( n1.isHasAssignedEvent() ) {
return false;
}
if ( !t3.getNode( "root node" ).getNodeData().getSequence().getAccession().getSource().equals( "UniProtKB" ) ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getDesc()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getDesc()
.equals( "apoptosis" ) ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getRef()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getRef()
.equals( "GO:0006915" ) ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getSource()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getSource()
.equals( "UniProtKB" ) ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getEvidence()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getEvidence()
.equals( "experimental" ) ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getType()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getType()
.equals( "function" ) ) {
return false;
}
- if ( ( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getConfidence()
+ if ( ( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getConfidence()
.getValue() != 1 ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getConfidence()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getConfidence()
.getType().equals( "ml" ) ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getDesc()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getDesc()
.equals( "apoptosis" ) ) {
return false;
}
- if ( ( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getProperties()
+ if ( ( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
.getProperty( "AFFY:expression" ).getAppliesTo() != AppliesTo.ANNOTATION ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getProperties()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
.getProperty( "AFFY:expression" ).getDataType().equals( "xsd:double" ) ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getProperties()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
.getProperty( "AFFY:expression" ).getRef().equals( "AFFY:expression" ) ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getProperties()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
.getProperty( "AFFY:expression" ).getUnit().equals( "AFFY:x" ) ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getProperties()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
.getProperty( "AFFY:expression" ).getValue().equals( "0.2" ) ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getProperties()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
.getProperty( "MED:disease" ).getValue().equals( "lymphoma" ) ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 0 ) ).getRef()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getRef()
.equals( "GO:0005829" ) ) {
return false;
}
- if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getDesc()
+ if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 0 ) ).getDesc()
.equals( "intracellular organelle" ) ) {
return false;
}
if ( !( t3.getNode( "root node" ).getNodeData().getSequence().getLocation().equals( "12p13-p12" ) ) ) {
return false;
}
- //if ( !( t3.getNode( "root node" ).getNodeData().getDistribution().getDesc().equals( "irgendwo" ) ) ) {
- // return false;
- //}
- // if ( !( t3.getNode( "root node" ).getNodeData().getReference().getDoi().equals( "10.1074/jbc.M005889200" ) ) ) {
- // return false;
- // }
- // if ( !t3.getNode( "root node" ).getNodeData().getTaxonomy().getType().equals( "host" ) ) {
- // return false;
- // }
- // if ( !t3.getNode( "root node" ).getNodeData().getTaxonomy().getTaxonomyCode().equals( "ECDYS" ) ) {
- // return false;
- // }
- // if ( !t3.getNode( "root node" ).getNodeData().getTaxonomy().getScientificName().equals( "ecdysozoa" ) ) {
- // return false;
- // }
- // if ( !t3.getNode( "root node" ).getNodeData().getTaxonomy().getCommonName().equals( "molting animals" ) ) {
- // return false;
- // }
- // if ( !t3.getNode( "root node" ).getNodeData().getTaxonomy().getIdentifier().getValue().equals( "1" ) ) {
- // return false;
- // }
- // if ( !t3.getNode( "root node" ).getNodeData().getTaxonomy().getIdentifier().getType().equals( "ncbi" ) ) {
- // return false;
- // }
- // if ( t3.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getTotalLength() != 124 ) {
- // return false;
- // }
- // if ( !t3.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getDomain( 0 ).getName()
- // .equals( "B" ) ) {
- // return false;
- // }
- // if ( t3.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getDomain( 0 ).getFrom() != 21 ) {
- // return false;
- // }
- // if ( t3.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getDomain( 0 ).getTo() != 44 ) {
- // return false;
- // }
- // if ( t3.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getDomain( 0 ).getLength() != 24 ) {
- // return false;
- // }
- // if ( t3.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getDomain( 0 )
- // .getConfidence() != 2144 ) {
- // return false;
- // }
- // if ( !t3.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getDomain( 0 ).getId()
- // .equals( "pfam" ) ) {
- // return false;
- // }
- // if ( t3.getNode( "node bb" ).getNodeData().getBinaryCharacters().getGainedCharacters().size() != 3 ) {
- // return false;
- // }
- // if ( t3.getNode( "node bb" ).getNodeData().getBinaryCharacters().getPresentCharacters().size() != 2 ) {
- // return false;
- // }
- // if ( t3.getNode( "node bb" ).getNodeData().getBinaryCharacters().getLostCharacters().size() != 1 ) {
- // return false;
- // }
- // if ( !t3.getNode( "node bb" ).getNodeData().getBinaryCharacters().getType().equals( "domains" ) ) {
- // return false;
- // }
- // if ( ( ( BinaryCharacters ) t3.getNode( "node bb" ).getNodeData().getBinaryCharacters().copy() )
- // .getLostCount() != BinaryCharacters.COUNT_DEFAULT ) {
- // ;
- // return false;
- // }
- // if ( t3.getNode( "node b" ).getNodeData().getBinaryCharacters().getGainedCount() != 1 ) {
- // return false;
- // }
- // if ( t3.getNode( "node b" ).getNodeData().getBinaryCharacters().getGainedCharacters().size() != 1 ) {
- // return false;
- // }
- // if ( t3.getNode( "node b" ).getNodeData().getBinaryCharacters().getLostCount() != 3 ) {
- // return false;
- // }
- // if ( t3.getNode( "node b" ).getNodeData().getBinaryCharacters().getLostCharacters().size() != 3 ) {
- // return false;
- // }
- // if ( t3.getNode( "node b" ).getNodeData().getBinaryCharacters().getPresentCount() != 2 ) {
- // return false;
- // }
- // if ( t3.getNode( "node b" ).getNodeData().getBinaryCharacters().getPresentCharacters().size() != 2 ) {
- // return false;
- // }
- // if ( !t3.getNode( "node b" ).getNodeData().getBinaryCharacters().getType().equals( "characters" ) ) {
- // return false;
- // }
- // final Phylogeny[] phylogenies_1 = factory.create( Test.PATH_TO_TEST_DATA + "phyloxml_test_t4.xml",
- // xml_parser );
- // if ( xml_parser.getErrorCount() > 0 ) {
- // System.out.println( xml_parser.getErrorMessages().toString() );
- // return false;
- // }
- // if ( phylogenies_1.length != 2 ) {
- // return false;
- // }
- // final Phylogeny a = phylogenies_1[ 0 ];
- // if ( !a.getName().equals( "tree 4" ) ) {
- // return false;
- // }
- // if ( a.getNumberOfExternalNodes() != 3 ) {
- // return false;
- // }
- // if ( !a.getNode( "node b1" ).getNodeData().getSequence().getName().equals( "b1 gene" ) ) {
- // return false;
- // }
- // if ( !a.getNode( "node b1" ).getNodeData().getTaxonomy().getCommonName().equals( "b1 species" ) ) {
- // return false;
- // }
}
catch ( final Exception e ) {
e.printStackTrace( System.out );
.equals( "UniProtKB" ) ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getDesc()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getDesc()
.equals( "apoptosis" ) ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getRef()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getRef()
.equals( "GO:0006915" ) ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getSource()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getSource()
.equals( "UniProtKB" ) ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getEvidence()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getEvidence()
.equals( "experimental" ) ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getType()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getType()
.equals( "function" ) ) {
return false;
}
- if ( ( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getConfidence()
+ if ( ( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getConfidence()
.getValue() != 1 ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getConfidence()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getConfidence()
.getType().equals( "ml" ) ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getDesc()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getDesc()
.equals( "apoptosis" ) ) {
return false;
}
- if ( ( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getProperties()
+ if ( ( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
.getProperty( "AFFY:expression" ).getAppliesTo() != AppliesTo.ANNOTATION ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getProperties()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
.getProperty( "AFFY:expression" ).getDataType().equals( "xsd:double" ) ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getProperties()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
.getProperty( "AFFY:expression" ).getRef().equals( "AFFY:expression" ) ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getProperties()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
.getProperty( "AFFY:expression" ).getUnit().equals( "AFFY:x" ) ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getProperties()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
.getProperty( "AFFY:expression" ).getValue().equals( "0.2" ) ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getProperties()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
.getProperty( "MED:disease" ).getValue().equals( "lymphoma" ) ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 0 ) ).getRef()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 1 ) ).getRef()
.equals( "GO:0005829" ) ) {
return false;
}
- if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getDesc()
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 0 ) ).getDesc()
.equals( "intracellular organelle" ) ) {
return false;
}
private static boolean testGetLCA2() {
try {
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+ final Phylogeny p_a = factory.create( "(a)", new NHXParser() )[ 0 ];
+ PhylogenyMethods.preOrderReId( p_a );
+ final PhylogenyNode p_a_1 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p_a.getNode( "a" ),
+ p_a.getNode( "a" ) );
+ if ( !p_a_1.getName().equals( "a" ) ) {
+ return false;
+ }
+ final Phylogeny p_b = factory.create( "((a)b)", new NHXParser() )[ 0 ];
+ PhylogenyMethods.preOrderReId( p_b );
+ final PhylogenyNode p_b_1 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p_b.getNode( "b" ),
+ p_b.getNode( "a" ) );
+ if ( !p_b_1.getName().equals( "b" ) ) {
+ return false;
+ }
+ final PhylogenyNode p_b_2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p_b.getNode( "a" ),
+ p_b.getNode( "b" ) );
+ if ( !p_b_2.getName().equals( "b" ) ) {
+ return false;
+ }
+ final Phylogeny p_c = factory.create( "(((a)b)c)", new NHXParser() )[ 0 ];
+ PhylogenyMethods.preOrderReId( p_c );
+ final PhylogenyNode p_c_1 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p_c.getNode( "b" ),
+ p_c.getNode( "a" ) );
+ if ( !p_c_1.getName().equals( "b" ) ) {
+ return false;
+ }
+ final PhylogenyNode p_c_2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p_c.getNode( "a" ),
+ p_c.getNode( "c" ) );
+ if ( !p_c_2.getName().equals( "c" ) ) {
+ System.out.println( p_c_2.getName() );
+ System.exit( -1 );
+ return false;
+ }
+ final PhylogenyNode p_c_3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p_c.getNode( "a" ),
+ p_c.getNode( "b" ) );
+ if ( !p_c_3.getName().equals( "b" ) ) {
+ return false;
+ }
+ final PhylogenyNode p_c_4 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p_c.getNode( "c" ),
+ p_c.getNode( "a" ) );
+ if ( !p_c_4.getName().equals( "c" ) ) {
+ return false;
+ }
final Phylogeny p1 = factory.create( "((((((A,B)ab,C)abc,D)abcd,E)abcde,F)abcdef,(G,H)gh)abcdefgh",
new NHXParser() )[ 0 ];
PhylogenyMethods.preOrderReId( p1 );
return false;
}
final NHXParser nhxp = new NHXParser();
- nhxp.setTaxonomyExtraction( PhylogenyMethods.TAXONOMY_EXTRACTION.NO );
+ nhxp.setTaxonomyExtraction( NHXParser.TAXONOMY_EXTRACTION.NO );
nhxp.setReplaceUnderscores( true );
final Phylogeny uc0 = factory.create( "(A__A_,_B_B)", nhxp )[ 0 ];
if ( !uc0.getRoot().getChildNode( 0 ).getName().equals( "A A " ) ) {
return false;
}
final PhylogenyNode n8 = PhylogenyNode
- .createInstanceFromNhxString( "n8_ECOLI/12:0.01",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n8_ECOLI/12:0.01", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n8.getName().equals( "n8_ECOLI/12" ) ) {
return false;
}
- if ( !PhylogenyMethods.getSpecies( n8 ).equals( "ECOLI" ) ) {
+ if ( PhylogenyMethods.getSpecies( n8 ).equals( "ECOLI" ) ) {
return false;
}
final PhylogenyNode n9 = PhylogenyNode
- .createInstanceFromNhxString( "n9_ECOLI/12=12:0.01",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n9_ECOLI/12=12:0.01", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n9.getName().equals( "n9_ECOLI/12=12" ) ) {
return false;
}
- if ( !PhylogenyMethods.getSpecies( n9 ).equals( "ECOLI" ) ) {
+ if ( PhylogenyMethods.getSpecies( n9 ).equals( "ECOLI" ) ) {
return false;
}
final PhylogenyNode n10 = PhylogenyNode
- .createInstanceFromNhxString( "n10.ECOLI", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n10.ECOLI", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n10.getName().equals( "n10.ECOLI" ) ) {
return false;
}
final PhylogenyNode n20 = PhylogenyNode
- .createInstanceFromNhxString( "n20_ECOLI/1-2", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n20_ECOLI/1-2", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n20.getName().equals( "n20_ECOLI/1-2" ) ) {
return false;
}
if ( !PhylogenyMethods.getSpecies( n20 ).equals( "ECOLI" ) ) {
return false;
}
- final PhylogenyNode n20x = PhylogenyNode
- .createInstanceFromNhxString( "n20_ECOL1/1-2", PhylogenyMethods.TAXONOMY_EXTRACTION.YES );
+ final PhylogenyNode n20x = PhylogenyNode.createInstanceFromNhxString( "n20_ECOL1/1-2",
+ NHXParser.TAXONOMY_EXTRACTION.YES );
if ( !n20x.getName().equals( "n20_ECOL1/1-2" ) ) {
return false;
}
return false;
}
final PhylogenyNode n20xx = PhylogenyNode
- .createInstanceFromNhxString( "n20_eCOL1/1-2", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n20_eCOL1/1-2", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n20xx.getName().equals( "n20_eCOL1/1-2" ) ) {
return false;
}
return false;
}
final PhylogenyNode n20xxx = PhylogenyNode
- .createInstanceFromNhxString( "n20_ecoli/1-2", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n20_ecoli/1-2", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n20xxx.getName().equals( "n20_ecoli/1-2" ) ) {
return false;
}
return false;
}
final PhylogenyNode n20xxxx = PhylogenyNode
- .createInstanceFromNhxString( "n20_Ecoli/1-2", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n20_Ecoli/1-2", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n20xxxx.getName().equals( "n20_Ecoli/1-2" ) ) {
return false;
}
if ( PhylogenyMethods.getSpecies( n20xxxx ).length() > 0 ) {
return false;
}
- final PhylogenyNode n21 = PhylogenyNode
- .createInstanceFromNhxString( "n21_PIG", PhylogenyMethods.TAXONOMY_EXTRACTION.YES );
+ final PhylogenyNode n21 = PhylogenyNode.createInstanceFromNhxString( "n21_PIG",
+ NHXParser.TAXONOMY_EXTRACTION.YES );
if ( !n21.getName().equals( "n21_PIG" ) ) {
return false;
}
return false;
}
final PhylogenyNode n21x = PhylogenyNode
- .createInstanceFromNhxString( "n21_PIG", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n21_PIG", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n21x.getName().equals( "n21_PIG" ) ) {
return false;
}
return false;
}
final PhylogenyNode n22 = PhylogenyNode
- .createInstanceFromNhxString( "n22/PIG", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n22/PIG", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n22.getName().equals( "n22/PIG" ) ) {
return false;
}
return false;
}
final PhylogenyNode n23 = PhylogenyNode
- .createInstanceFromNhxString( "n23/PIG_1", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n23/PIG_1", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n23.getName().equals( "n23/PIG_1" ) ) {
return false;
}
return false;
}
final PhylogenyNode a = PhylogenyNode
- .createInstanceFromNhxString( "n10_ECOLI/1-2", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n10_ECOLI/1-2", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !a.getName().equals( "n10_ECOLI/1-2" ) ) {
return false;
}
return false;
}
final PhylogenyNode b = PhylogenyNode
- .createInstanceFromNhxString( "n10_ECOLI1/1-2",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n10_ECOLI1/1-2", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !b.getName().equals( "n10_ECOLI1/1-2" ) ) {
return false;
}
- if ( !PhylogenyMethods.getSpecies( b ).equals( "ECOLI" ) ) {
+ if ( PhylogenyMethods.getSpecies( b ).equals( "ECOLI" ) ) {
return false;
}
final PhylogenyNode c = PhylogenyNode
.createInstanceFromNhxString( "n10_RATAF12/1000-2000",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !c.getName().equals( "n10_RATAF12/1000-2000" ) ) {
return false;
}
- if ( !PhylogenyMethods.getSpecies( c ).equals( "RATAF" ) ) {
+ if ( PhylogenyMethods.getSpecies( c ).equals( "RATAF" ) ) {
return false;
}
final PhylogenyNode c1 = PhylogenyNode
.createInstanceFromNhxString( "n10_BOVIN_1/1000-2000",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !c1.getName().equals( "n10_BOVIN_1/1000-2000" ) ) {
return false;
}
- if ( !PhylogenyMethods.getSpecies( c1 ).equals( "BOVIN" ) ) {
+ if ( PhylogenyMethods.getSpecies( c1 ).equals( "BOVIN" ) ) {
return false;
}
final PhylogenyNode c2 = PhylogenyNode
.createInstanceFromNhxString( "n10_Bovin_1/1000-2000",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !c2.getName().equals( "n10_Bovin_1/1000-2000" ) ) {
return false;
}
return false;
}
final PhylogenyNode d = PhylogenyNode
- .createInstanceFromNhxString( "n10_RAT1/1-2", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n10_RAT1/1-2", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !d.getName().equals( "n10_RAT1/1-2" ) ) {
return false;
}
- if ( !PhylogenyMethods.getSpecies( d ).equals( "RAT" ) ) {
+ if ( PhylogenyMethods.getSpecies( d ).equals( "RAT" ) ) {
return false;
}
final PhylogenyNode e = PhylogenyNode
- .createInstanceFromNhxString( "n10_RAT1", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "n10_RAT1", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !e.getName().equals( "n10_RAT1" ) ) {
return false;
}
if ( !ForesterUtil.isEmpty( PhylogenyMethods.getSpecies( e ) ) ) {
return false;
}
- final PhylogenyNode e2 = PhylogenyNode
- .createInstanceFromNhxString( "n10_RAT1", PhylogenyMethods.TAXONOMY_EXTRACTION.YES );
+ final PhylogenyNode e2 = PhylogenyNode.createInstanceFromNhxString( "n10_RAT1",
+ NHXParser.TAXONOMY_EXTRACTION.YES );
if ( !e2.getName().equals( "n10_RAT1" ) ) {
return false;
}
if ( !PhylogenyMethods.getSpecies( e2 ).equals( "RAT" ) ) {
return false;
}
- final PhylogenyNode e3 = PhylogenyNode
- .createInstanceFromNhxString( "n10_RAT~", PhylogenyMethods.TAXONOMY_EXTRACTION.YES );
+ final PhylogenyNode e3 = PhylogenyNode.createInstanceFromNhxString( "n10_RAT~",
+ NHXParser.TAXONOMY_EXTRACTION.YES );
if ( !e3.getName().equals( "n10_RAT~" ) ) {
return false;
}
}
final PhylogenyNode n11 = PhylogenyNode
.createInstanceFromNhxString( "n111111_ECOLI/jdj:0.4",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n11.getName().equals( "n111111_ECOLI/jdj" ) ) {
return false;
}
if ( n11.getDistanceToParent() != 0.4 ) {
return false;
}
- if ( !PhylogenyMethods.getSpecies( n11 ).equals( "ECOLI" ) ) {
+ if ( PhylogenyMethods.getSpecies( n11 ).equals( "ECOLI" ) ) {
return false;
}
final PhylogenyNode n12 = PhylogenyNode
.createInstanceFromNhxString( "n111111-ECOLI---/jdj:0.4",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n12.getName().equals( "n111111-ECOLI---/jdj" ) ) {
return false;
}
if ( PhylogenyMethods.getSpecies( n12 ).length() > 0 ) {
return false;
}
- final PhylogenyNode m = PhylogenyNode
- .createInstanceFromNhxString( "n10_MOUSEa", PhylogenyMethods.TAXONOMY_EXTRACTION.YES );
+ final PhylogenyNode m = PhylogenyNode.createInstanceFromNhxString( "n10_MOUSEa",
+ NHXParser.TAXONOMY_EXTRACTION.YES );
if ( !m.getName().equals( "n10_MOUSEa" ) ) {
return false;
}
- if ( !PhylogenyMethods.getSpecies( m ).equals( "MOUSE" ) ) {
+ if ( PhylogenyMethods.getSpecies( m ).equals( "MOUSE" ) ) {
return false;
}
- final PhylogenyNode o = PhylogenyNode
- .createInstanceFromNhxString( "n10_MOUSE_", PhylogenyMethods.TAXONOMY_EXTRACTION.YES );
+ final PhylogenyNode o = PhylogenyNode.createInstanceFromNhxString( "n10_MOUSE_",
+ NHXParser.TAXONOMY_EXTRACTION.YES );
if ( !o.getName().equals( "n10_MOUSE_" ) ) {
return false;
}
return false;
}
final PhylogenyNode n13 = PhylogenyNode
- .createInstanceFromNhxString( "blah_12345/1-2",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "blah_12345/1-2", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n13.getName().equals( "blah_12345/1-2" ) ) {
return false;
}
return false;
}
final PhylogenyNode n14 = PhylogenyNode
- .createInstanceFromNhxString( "blah_12X45/1-2",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "blah_12X45/1-2", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n14.getName().equals( "blah_12X45/1-2" ) ) {
return false;
}
}
final PhylogenyNode n15 = PhylogenyNode
.createInstanceFromNhxString( "something_wicked[123]",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n15.getName().equals( "something_wicked" ) ) {
return false;
}
return false;
}
final PhylogenyNode n16 = PhylogenyNode
- .createInstanceFromNhxString( "something_wicked2[9]",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "something_wicked2[9]", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n16.getName().equals( "something_wicked2" ) ) {
return false;
}
return false;
}
final PhylogenyNode n17 = PhylogenyNode
- .createInstanceFromNhxString( "something_wicked3[a]",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( "something_wicked3[a]", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !n17.getName().equals( "something_wicked3" ) ) {
return false;
}
return false;
}
final PhylogenyNode n18 = PhylogenyNode
- .createInstanceFromNhxString( ":0.5[91]", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ .createInstanceFromNhxString( ":0.5[91]", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
if ( !isEqual( n18.getDistanceToParent(), 0.5 ) ) {
return false;
}
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
final Phylogeny s1 = factory.create( Test.PATH_TO_TEST_DATA + "rio_species.xml", new PhyloXmlParser() )[ 0 ];
final NHXParser p = new NHXParser();
- p.setTaxonomyExtraction( TAXONOMY_EXTRACTION.YES );
+ p.setTaxonomyExtraction( NHXParser.TAXONOMY_EXTRACTION.YES );
final Phylogeny g1[] = factory.create( new File( Test.PATH_TO_TEST_DATA
+ "rio_Bcl-2_e1_20_mafft_05_40_fme.mlt" ), p );
for( final Phylogeny gt : g1 ) {
final GSDI sdi = new GSDI( gt, s1, true, true, true );
}
final IntMatrix m = RIO.calculateOrthologTable( g1 );
- System.out.println( m.toString() );
+ // System.out.println( m.toString() );
}
catch ( final Exception e ) {
e.printStackTrace();