import java.util.Set;
import org.forester.application.support_transfer;
+import org.forester.datastructures.IntMatrix;
import org.forester.development.DevelopmentTools;
import org.forester.evoinference.TestPhylogenyReconstruction;
import org.forester.evoinference.matrix.character.CharacterStateMatrix;
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.msa.Msa;
import org.forester.msa.MsaInferrer;
+import org.forester.msa.MsaMethods;
import org.forester.pccx.TestPccx;
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyBranch;
import org.forester.phylogeny.PhylogenyMethods;
import org.forester.phylogeny.PhylogenyNode;
+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;
import org.forester.phylogeny.data.Event;
import org.forester.phylogeny.data.Identifier;
import org.forester.phylogeny.data.PhylogenyData;
+import org.forester.phylogeny.data.PhylogenyDataUtil;
import org.forester.phylogeny.data.Polygon;
import org.forester.phylogeny.data.PropertiesMap;
import org.forester.phylogeny.data.Property;
import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory;
import org.forester.phylogeny.factories.PhylogenyFactory;
import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
+import org.forester.protein.Protein;
+import org.forester.sdi.GSDI;
+import org.forester.sdi.RIO;
import org.forester.sdi.SDI;
import org.forester.sdi.SDIR;
import org.forester.sdi.SDIse;
-import org.forester.sdi.TaxonomyAssigner;
import org.forester.sdi.TestGSDI;
import org.forester.sequence.BasicSequence;
import org.forester.sequence.Sequence;
-import org.forester.surfacing.Protein;
import org.forester.surfacing.TestSurfacing;
import org.forester.tools.ConfidenceAssessor;
import org.forester.tools.SupportCount;
import org.forester.util.ForesterConstants;
import org.forester.util.ForesterUtil;
import org.forester.util.GeneralTable;
-import org.forester.ws.uniprot.DatabaseTools;
-import org.forester.ws.uniprot.SequenceDatabaseEntry;
-import org.forester.ws.uniprot.UniProtTaxonomy;
-import org.forester.ws.uniprot.UniProtWsTools;
+import org.forester.util.SequenceIdParser;
+import org.forester.ws.seqdb.SequenceDatabaseEntry;
+import org.forester.ws.seqdb.SequenceDbWsTools;
+import org.forester.ws.seqdb.UniProtTaxonomy;
import org.forester.ws.wabi.TxSearch;
import org.forester.ws.wabi.TxSearch.RANKS;
import org.forester.ws.wabi.TxSearch.TAX_NAME_CLASS;
private final static Event getEvent( final Phylogeny p, final String n1, final String n2 ) {
final PhylogenyMethods pm = PhylogenyMethods.getInstance();
- return pm.obtainLCA( p.getNode( n1 ), p.getNode( n2 ) ).getNodeData().getEvent();
+ return PhylogenyMethods.calculateLCA( p.getNode( n1 ), p.getNode( n2 ) ).getNodeData().getEvent();
}
public static boolean isEqual( final double a, final double b ) {
System.exit( -1 );
}
final long start_time = new Date().getTime();
+ System.out.print( "Sequence id parsing: " );
+ if ( testSequenceIdParsing() ) {
+ System.out.println( "OK." );
+ succeeded++;
+ }
+ else {
+ System.out.println( "failed." );
+ failed++;
+ }
System.out.print( "Hmmscan output parser: " );
if ( testHmmscanOutputParser() ) {
System.out.println( "OK." );
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( "Calculation of distance between nodes: " );
- if ( Test.testGetDistance() ) {
+ System.out.print( "Finding of LCA 2: " );
+ if ( Test.testGetLCA2() ) {
System.out.println( "OK." );
succeeded++;
}
System.out.println( "failed." );
failed++;
}
- System.out.print( "SDIse: " );
- if ( Test.testSDIse() ) {
+ System.out.print( "Calculation of distance between nodes: " );
+ if ( Test.testGetDistance() ) {
System.out.println( "OK." );
succeeded++;
}
System.out.println( "failed." );
failed++;
}
- System.out.print( "Taxonomy assigner: " );
- if ( Test.testTaxonomyAssigner() ) {
+ System.out.print( "SDIse: " );
+ if ( Test.testSDIse() ) {
System.out.println( "OK." );
succeeded++;
}
System.out.println( "failed." );
failed++;
}
+ System.out.print( "Ortholog table: " );
+ if ( Test.testOrthologTable() ) {
+ System.out.println( "OK." );
+ succeeded++;
+ }
+ else {
+ System.out.println( "failed." );
+ failed++;
+ }
System.out.print( "Descriptive statistics: " );
if ( Test.testDescriptiveStatistics() ) {
System.out.println( "OK." );
System.out.println( "failed." );
failed++;
}
- if ( Mafft.isInstalled() ) {
+ //----
+ String path = "";
+ final String os = ForesterUtil.OS_NAME.toLowerCase();
+ if ( ( os.indexOf( "mac" ) >= 0 ) && ( os.indexOf( "os" ) > 0 ) ) {
+ path = "/usr/local/bin/mafft";
+ }
+ else if ( os.indexOf( "win" ) >= 0 ) {
+ path = "C:\\Program Files\\mafft-win\\mafft.bat";
+ }
+ else {
+ path = "/home/czmasek/bin/mafft";
+ }
+ if ( !MsaInferrer.isInstalled( path ) ) {
+ path = "mafft";
+ }
+ if ( !MsaInferrer.isInstalled( path ) ) {
+ path = "/usr/local/bin/mafft";
+ }
+ if ( MsaInferrer.isInstalled( path ) ) {
System.out.print( "MAFFT (external program): " );
- if ( Test.testMafft() ) {
+ if ( Test.testMafft( path ) ) {
System.out.println( "OK." );
succeeded++;
}
System.out.println( "failed [will not count towards failed tests]" );
}
}
+ //----
System.out.print( "Next nodes with collapsed: " );
if ( Test.testNextNodeWithCollapsing() ) {
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.print( "Simple MSA quality: " );
+ if ( Test.testMsaQualityMethod() ) {
+ System.out.println( "OK." );
+ succeeded++;
+ }
+ else {
+ System.out.println( "failed." );
+ failed++;
+ }
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;
}
final List<BasicTable<String>> tl = BasicTableParser.parse( source2.toString(),
";",
false,
+ false,
"comment:",
false );
if ( tl.size() != 2 ) {
return false;
}
final PhylogenyNode n = t3.getNode( "ABC" );
- PhylogenyNodeIterator it;
- for( it = n.iterateChildNodesForward(); it.hasNext(); ) {
- it.next();
- }
- for( it.reset(); it.hasNext(); ) {
- it.next();
- }
- final PhylogenyNodeIterator it2 = n.iterateChildNodesForward();
- if ( !it2.next().getName().equals( "A" ) ) {
- return false;
- }
- if ( !it2.next().getName().equals( "B" ) ) {
- return false;
- }
- if ( !it2.next().getName().equals( "C" ) ) {
- return false;
- }
- if ( it2.hasNext() ) {
- return false;
- }
final Phylogeny t4 = factory.create( "((A:1,B:2,C:10)ABC:1,(D:3,E:5)DE:3,(F,G,H,I))", new NHXParser() )[ 0 ];
if ( t4.getNumberOfExternalNodes() != 9 ) {
return false;
.create( "((A,C),X);((A,X),C);(A,C);((((A,B),C),D),E);((A,B),((E,D),C));(((A,B),C),(E,D));(A,(((E,D),C),B));(B,(A,((E,D),C)));(C,((E,D),(A,B)));(D,(E,((A,B),C)));((((A,C)ac,D)acd,E)acde,B)abcd",
new NHXParser() );
ConfidenceAssessor.evaluate( "bootstrap", ev_b, t_b, false, 1 );
- // Archaeopteryx.createApplication( t_b ); //TODO use me again me working here...
if ( !isEqual( t_b.getNode( "ac" ).getBranchData().getConfidence( 0 ).getValue(), 4 ) ) {
return false;
}
return false;
}
t2.setIdentifier( new Identifier( "ecoli" ) );
- t2.setTaxonomyCode( "other" );
+ t2.setTaxonomyCode( "OTHER" );
t2.setScientificName( "what" );
t2.setCommonName( "something" );
if ( !t1.isEqual( t2 ) ) {
dss3.addValue( 10 );
final AsciiHistogram histo = new AsciiHistogram( dss3 );
histo.toStringBuffer( 10, '=', 40, 5 );
- histo.toStringBuffer( 3, 8, 10, '=', 40, 5 );
+ histo.toStringBuffer( 3, 8, 10, '=', 40, 5, null );
}
catch ( final Exception e ) {
e.printStackTrace( System.out );
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
final Phylogeny p1 = factory.create( "((((((A,B)ab,C)abc,D)abcd,E)abcde,F)abcdef,(G,H)gh)abcdefgh",
new NHXParser() )[ 0 ];
- final PhylogenyMethods pm = PhylogenyMethods.getInstance();
- final PhylogenyNode A = pm.obtainLCA( p1.getNode( "A" ), p1.getNode( "A" ) );
+ final PhylogenyNode A = PhylogenyMethods.calculateLCA( p1.getNode( "A" ), p1.getNode( "A" ) );
if ( !A.getName().equals( "A" ) ) {
return false;
}
- final PhylogenyNode gh = pm.obtainLCA( p1.getNode( "gh" ), p1.getNode( "gh" ) );
+ final PhylogenyNode gh = PhylogenyMethods.calculateLCA( p1.getNode( "gh" ), p1.getNode( "gh" ) );
if ( !gh.getName().equals( "gh" ) ) {
return false;
}
- final PhylogenyNode ab = pm.obtainLCA( p1.getNode( "A" ), p1.getNode( "B" ) );
+ final PhylogenyNode ab = PhylogenyMethods.calculateLCA( p1.getNode( "A" ), p1.getNode( "B" ) );
if ( !ab.getName().equals( "ab" ) ) {
return false;
}
- final PhylogenyNode ab2 = pm.obtainLCA( p1.getNode( "B" ), p1.getNode( "A" ) );
+ final PhylogenyNode ab2 = PhylogenyMethods.calculateLCA( p1.getNode( "B" ), p1.getNode( "A" ) );
if ( !ab2.getName().equals( "ab" ) ) {
return false;
}
- final PhylogenyNode gh2 = pm.obtainLCA( p1.getNode( "H" ), p1.getNode( "G" ) );
+ final PhylogenyNode gh2 = PhylogenyMethods.calculateLCA( p1.getNode( "H" ), p1.getNode( "G" ) );
if ( !gh2.getName().equals( "gh" ) ) {
return false;
}
- final PhylogenyNode gh3 = pm.obtainLCA( p1.getNode( "G" ), p1.getNode( "H" ) );
+ final PhylogenyNode gh3 = PhylogenyMethods.calculateLCA( p1.getNode( "G" ), p1.getNode( "H" ) );
if ( !gh3.getName().equals( "gh" ) ) {
return false;
}
- final PhylogenyNode abc = pm.obtainLCA( p1.getNode( "C" ), p1.getNode( "A" ) );
+ final PhylogenyNode abc = PhylogenyMethods.calculateLCA( p1.getNode( "C" ), p1.getNode( "A" ) );
if ( !abc.getName().equals( "abc" ) ) {
return false;
}
- final PhylogenyNode abc2 = pm.obtainLCA( p1.getNode( "A" ), p1.getNode( "C" ) );
+ final PhylogenyNode abc2 = PhylogenyMethods.calculateLCA( p1.getNode( "A" ), p1.getNode( "C" ) );
if ( !abc2.getName().equals( "abc" ) ) {
return false;
}
- final PhylogenyNode abcd = pm.obtainLCA( p1.getNode( "A" ), p1.getNode( "D" ) );
+ final PhylogenyNode abcd = PhylogenyMethods.calculateLCA( p1.getNode( "A" ), p1.getNode( "D" ) );
if ( !abcd.getName().equals( "abcd" ) ) {
return false;
}
- final PhylogenyNode abcd2 = pm.obtainLCA( p1.getNode( "D" ), p1.getNode( "A" ) );
+ final PhylogenyNode abcd2 = PhylogenyMethods.calculateLCA( p1.getNode( "D" ), p1.getNode( "A" ) );
if ( !abcd2.getName().equals( "abcd" ) ) {
return false;
}
- final PhylogenyNode abcdef = pm.obtainLCA( p1.getNode( "A" ), p1.getNode( "F" ) );
+ final PhylogenyNode abcdef = PhylogenyMethods.calculateLCA( p1.getNode( "A" ), p1.getNode( "F" ) );
if ( !abcdef.getName().equals( "abcdef" ) ) {
return false;
}
- final PhylogenyNode abcdef2 = pm.obtainLCA( p1.getNode( "F" ), p1.getNode( "A" ) );
+ final PhylogenyNode abcdef2 = PhylogenyMethods.calculateLCA( p1.getNode( "F" ), p1.getNode( "A" ) );
if ( !abcdef2.getName().equals( "abcdef" ) ) {
return false;
}
- final PhylogenyNode abcdef3 = pm.obtainLCA( p1.getNode( "ab" ), p1.getNode( "F" ) );
+ final PhylogenyNode abcdef3 = PhylogenyMethods.calculateLCA( p1.getNode( "ab" ), p1.getNode( "F" ) );
if ( !abcdef3.getName().equals( "abcdef" ) ) {
return false;
}
- final PhylogenyNode abcdef4 = pm.obtainLCA( p1.getNode( "F" ), p1.getNode( "ab" ) );
+ final PhylogenyNode abcdef4 = PhylogenyMethods.calculateLCA( p1.getNode( "F" ), p1.getNode( "ab" ) );
if ( !abcdef4.getName().equals( "abcdef" ) ) {
return false;
}
- final PhylogenyNode abcde = pm.obtainLCA( p1.getNode( "A" ), p1.getNode( "E" ) );
+ final PhylogenyNode abcde = PhylogenyMethods.calculateLCA( p1.getNode( "A" ), p1.getNode( "E" ) );
if ( !abcde.getName().equals( "abcde" ) ) {
return false;
}
- final PhylogenyNode abcde2 = pm.obtainLCA( p1.getNode( "E" ), p1.getNode( "A" ) );
+ final PhylogenyNode abcde2 = PhylogenyMethods.calculateLCA( p1.getNode( "E" ), p1.getNode( "A" ) );
if ( !abcde2.getName().equals( "abcde" ) ) {
return false;
}
- final PhylogenyNode r = pm.obtainLCA( p1.getNode( "abcdefgh" ), p1.getNode( "abcdefgh" ) );
+ final PhylogenyNode r = PhylogenyMethods.calculateLCA( p1.getNode( "abcdefgh" ), p1.getNode( "abcdefgh" ) );
if ( !r.getName().equals( "abcdefgh" ) ) {
return false;
}
- final PhylogenyNode r2 = pm.obtainLCA( p1.getNode( "A" ), p1.getNode( "H" ) );
+ final PhylogenyNode r2 = PhylogenyMethods.calculateLCA( p1.getNode( "A" ), p1.getNode( "H" ) );
if ( !r2.getName().equals( "abcdefgh" ) ) {
return false;
}
- final PhylogenyNode r3 = pm.obtainLCA( p1.getNode( "H" ), p1.getNode( "A" ) );
+ final PhylogenyNode r3 = PhylogenyMethods.calculateLCA( p1.getNode( "H" ), p1.getNode( "A" ) );
if ( !r3.getName().equals( "abcdefgh" ) ) {
return false;
}
- final PhylogenyNode abcde3 = pm.obtainLCA( p1.getNode( "E" ), p1.getNode( "abcde" ) );
+ final PhylogenyNode abcde3 = PhylogenyMethods.calculateLCA( p1.getNode( "E" ), p1.getNode( "abcde" ) );
if ( !abcde3.getName().equals( "abcde" ) ) {
return false;
}
- final PhylogenyNode abcde4 = pm.obtainLCA( p1.getNode( "abcde" ), p1.getNode( "E" ) );
+ final PhylogenyNode abcde4 = PhylogenyMethods.calculateLCA( p1.getNode( "abcde" ), p1.getNode( "E" ) );
if ( !abcde4.getName().equals( "abcde" ) ) {
return false;
}
- final PhylogenyNode ab3 = pm.obtainLCA( p1.getNode( "ab" ), p1.getNode( "B" ) );
+ final PhylogenyNode ab3 = PhylogenyMethods.calculateLCA( p1.getNode( "ab" ), p1.getNode( "B" ) );
if ( !ab3.getName().equals( "ab" ) ) {
return false;
}
- final PhylogenyNode ab4 = pm.obtainLCA( p1.getNode( "B" ), p1.getNode( "ab" ) );
+ final PhylogenyNode ab4 = PhylogenyMethods.calculateLCA( p1.getNode( "B" ), p1.getNode( "ab" ) );
if ( !ab4.getName().equals( "ab" ) ) {
return false;
}
final Phylogeny p2 = factory.create( "(a,b,(((c,d)cd,e)cde,f)cdef)r", new NHXParser() )[ 0 ];
- final PhylogenyNode cd = pm.obtainLCA( p2.getNode( "c" ), p2.getNode( "d" ) );
+ final PhylogenyNode cd = PhylogenyMethods.calculateLCA( p2.getNode( "c" ), p2.getNode( "d" ) );
if ( !cd.getName().equals( "cd" ) ) {
return false;
}
- final PhylogenyNode cd2 = pm.obtainLCA( p2.getNode( "d" ), p2.getNode( "c" ) );
+ final PhylogenyNode cd2 = PhylogenyMethods.calculateLCA( p2.getNode( "d" ), p2.getNode( "c" ) );
if ( !cd2.getName().equals( "cd" ) ) {
return false;
}
- final PhylogenyNode cde = pm.obtainLCA( p2.getNode( "c" ), p2.getNode( "e" ) );
+ final PhylogenyNode cde = PhylogenyMethods.calculateLCA( p2.getNode( "c" ), p2.getNode( "e" ) );
if ( !cde.getName().equals( "cde" ) ) {
return false;
}
- final PhylogenyNode cde2 = pm.obtainLCA( p2.getNode( "e" ), p2.getNode( "c" ) );
+ final PhylogenyNode cde2 = PhylogenyMethods.calculateLCA( p2.getNode( "e" ), p2.getNode( "c" ) );
if ( !cde2.getName().equals( "cde" ) ) {
return false;
}
- final PhylogenyNode cdef = pm.obtainLCA( p2.getNode( "c" ), p2.getNode( "f" ) );
+ final PhylogenyNode cdef = PhylogenyMethods.calculateLCA( p2.getNode( "c" ), p2.getNode( "f" ) );
if ( !cdef.getName().equals( "cdef" ) ) {
return false;
}
- final PhylogenyNode cdef2 = pm.obtainLCA( p2.getNode( "d" ), p2.getNode( "f" ) );
+ final PhylogenyNode cdef2 = PhylogenyMethods.calculateLCA( p2.getNode( "d" ), p2.getNode( "f" ) );
if ( !cdef2.getName().equals( "cdef" ) ) {
return false;
}
- final PhylogenyNode cdef3 = pm.obtainLCA( p2.getNode( "f" ), p2.getNode( "d" ) );
+ final PhylogenyNode cdef3 = PhylogenyMethods.calculateLCA( p2.getNode( "f" ), p2.getNode( "d" ) );
if ( !cdef3.getName().equals( "cdef" ) ) {
return false;
}
- final PhylogenyNode rt = pm.obtainLCA( p2.getNode( "c" ), p2.getNode( "a" ) );
+ final PhylogenyNode rt = PhylogenyMethods.calculateLCA( p2.getNode( "c" ), p2.getNode( "a" ) );
if ( !rt.getName().equals( "r" ) ) {
return false;
}
final Phylogeny p3 = factory
.create( "((((a,(b,c)bc)abc,(d,e)de)abcde,f)abcdef,(((g,h)gh,(i,j)ij)ghij,k)ghijk,l)",
new NHXParser() )[ 0 ];
- final PhylogenyNode bc_3 = pm.obtainLCA( p3.getNode( "b" ), p3.getNode( "c" ) );
+ final PhylogenyNode bc_3 = PhylogenyMethods.calculateLCA( p3.getNode( "b" ), p3.getNode( "c" ) );
if ( !bc_3.getName().equals( "bc" ) ) {
return false;
}
- final PhylogenyNode ac_3 = pm.obtainLCA( p3.getNode( "a" ), p3.getNode( "c" ) );
+ final PhylogenyNode ac_3 = PhylogenyMethods.calculateLCA( p3.getNode( "a" ), p3.getNode( "c" ) );
if ( !ac_3.getName().equals( "abc" ) ) {
return false;
}
- final PhylogenyNode ad_3 = pm.obtainLCA( p3.getNode( "a" ), p3.getNode( "d" ) );
+ final PhylogenyNode ad_3 = PhylogenyMethods.calculateLCA( p3.getNode( "a" ), p3.getNode( "d" ) );
if ( !ad_3.getName().equals( "abcde" ) ) {
return false;
}
- final PhylogenyNode af_3 = pm.obtainLCA( p3.getNode( "a" ), p3.getNode( "f" ) );
+ final PhylogenyNode af_3 = PhylogenyMethods.calculateLCA( p3.getNode( "a" ), p3.getNode( "f" ) );
if ( !af_3.getName().equals( "abcdef" ) ) {
return false;
}
- final PhylogenyNode ag_3 = pm.obtainLCA( p3.getNode( "a" ), p3.getNode( "g" ) );
+ final PhylogenyNode ag_3 = PhylogenyMethods.calculateLCA( p3.getNode( "a" ), p3.getNode( "g" ) );
if ( !ag_3.getName().equals( "" ) ) {
return false;
}
if ( !ag_3.isRoot() ) {
return false;
}
- final PhylogenyNode al_3 = pm.obtainLCA( p3.getNode( "a" ), p3.getNode( "l" ) );
+ final PhylogenyNode al_3 = PhylogenyMethods.calculateLCA( p3.getNode( "a" ), p3.getNode( "l" ) );
if ( !al_3.getName().equals( "" ) ) {
return false;
}
if ( !al_3.isRoot() ) {
return false;
}
- final PhylogenyNode kl_3 = pm.obtainLCA( p3.getNode( "k" ), p3.getNode( "l" ) );
+ final PhylogenyNode kl_3 = PhylogenyMethods.calculateLCA( p3.getNode( "k" ), p3.getNode( "l" ) );
if ( !kl_3.getName().equals( "" ) ) {
return false;
}
if ( !kl_3.isRoot() ) {
return false;
}
- final PhylogenyNode fl_3 = pm.obtainLCA( p3.getNode( "f" ), p3.getNode( "l" ) );
+ final PhylogenyNode fl_3 = PhylogenyMethods.calculateLCA( p3.getNode( "f" ), p3.getNode( "l" ) );
if ( !fl_3.getName().equals( "" ) ) {
return false;
}
if ( !fl_3.isRoot() ) {
return false;
}
- final PhylogenyNode gk_3 = pm.obtainLCA( p3.getNode( "g" ), p3.getNode( "k" ) );
+ final PhylogenyNode gk_3 = PhylogenyMethods.calculateLCA( p3.getNode( "g" ), p3.getNode( "k" ) );
if ( !gk_3.getName().equals( "ghijk" ) ) {
return false;
}
final Phylogeny p4 = factory.create( "(a,b,c)r", new NHXParser() )[ 0 ];
- final PhylogenyNode r_4 = pm.obtainLCA( p4.getNode( "b" ), p4.getNode( "c" ) );
+ final PhylogenyNode r_4 = PhylogenyMethods.calculateLCA( p4.getNode( "b" ), p4.getNode( "c" ) );
if ( !r_4.getName().equals( "r" ) ) {
return false;
}
final Phylogeny p5 = factory.create( "((a,b),c,d)root", new NHXParser() )[ 0 ];
- final PhylogenyNode r_5 = pm.obtainLCA( p5.getNode( "a" ), p5.getNode( "c" ) );
+ final PhylogenyNode r_5 = PhylogenyMethods.calculateLCA( p5.getNode( "a" ), p5.getNode( "c" ) );
if ( !r_5.getName().equals( "root" ) ) {
return false;
}
final Phylogeny p6 = factory.create( "((a,b),c,d)rot", new NHXParser() )[ 0 ];
- final PhylogenyNode r_6 = pm.obtainLCA( p6.getNode( "c" ), p6.getNode( "a" ) );
+ final PhylogenyNode r_6 = PhylogenyMethods.calculateLCA( p6.getNode( "c" ), p6.getNode( "a" ) );
if ( !r_6.getName().equals( "rot" ) ) {
return false;
}
final Phylogeny p7 = factory.create( "(((a,b)x,c)x,d,e)rott", new NHXParser() )[ 0 ];
- final PhylogenyNode r_7 = pm.obtainLCA( p7.getNode( "a" ), p7.getNode( "e" ) );
+ final PhylogenyNode r_7 = PhylogenyMethods.calculateLCA( p7.getNode( "a" ), p7.getNode( "e" ) );
if ( !r_7.getName().equals( "rott" ) ) {
return false;
}
return true;
}
- private static boolean testHmmscanOutputParser() {
- final String test_dir = Test.PATH_TO_TEST_DATA;
+ private static boolean testGetLCA2() {
try {
- final HmmscanPerDomainTableParser parser1 = new HmmscanPerDomainTableParser( new File( test_dir
- + ForesterUtil.getFileSeparator() + "hmmscan30b3_output_1" ), "MONBR", INDIVIDUAL_SCORE_CUTOFF.NONE );
- parser1.parse();
- final HmmscanPerDomainTableParser parser2 = new HmmscanPerDomainTableParser( new File( test_dir
- + ForesterUtil.getFileSeparator() + "hmmscan30b3_output_2" ), "MONBR", INDIVIDUAL_SCORE_CUTOFF.NONE );
- final List<Protein> proteins = parser2.parse();
- if ( parser2.getProteinsEncountered() != 4 ) {
+ 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;
}
- if ( proteins.size() != 4 ) {
+ 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;
}
- if ( parser2.getDomainsEncountered() != 69 ) {
+ final PhylogenyNode p_b_2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p_b.getNode( "a" ),
+ p_b.getNode( "b" ) );
+ if ( !p_b_2.getName().equals( "b" ) ) {
return false;
}
- if ( parser2.getDomainsIgnoredDueToDuf() != 0 ) {
+ 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;
}
- if ( parser2.getDomainsIgnoredDueToEval() != 0 ) {
+ 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 Protein p1 = proteins.get( 0 );
- if ( p1.getNumberOfProteinDomains() != 15 ) {
+ 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 Protein p2 = proteins.get( 1 );
- if ( p2.getNumberOfProteinDomains() != 51 ) {
+ 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 Protein p3 = proteins.get( 2 );
- if ( p3.getNumberOfProteinDomains() != 2 ) {
+ 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 );
+ final PhylogenyNode A = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "A" ),
+ p1.getNode( "A" ) );
+ if ( !A.getName().equals( "A" ) ) {
return false;
}
- final Protein p4 = proteins.get( 3 );
- if ( p4.getNumberOfProteinDomains() != 1 ) {
+ final PhylogenyNode gh = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "gh" ),
+ p1.getNode( "gh" ) );
+ if ( !gh.getName().equals( "gh" ) ) {
return false;
}
- if ( !p4.getProteinDomain( 0 ).getDomainId().toString().equals( "DNA_pol_B_new" ) ) {
+ final PhylogenyNode ab = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "A" ),
+ p1.getNode( "B" ) );
+ if ( !ab.getName().equals( "ab" ) ) {
return false;
}
- if ( p4.getProteinDomain( 0 ).getFrom() != 51 ) {
+ final PhylogenyNode ab2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "B" ),
+ p1.getNode( "A" ) );
+ if ( !ab2.getName().equals( "ab" ) ) {
return false;
}
- if ( p4.getProteinDomain( 0 ).getTo() != 395 ) {
+ final PhylogenyNode gh2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "H" ),
+ p1.getNode( "G" ) );
+ if ( !gh2.getName().equals( "gh" ) ) {
return false;
}
- if ( !Test.isEqual( p4.getProteinDomain( 0 ).getPerDomainEvalue(), 1.2e-39 ) ) {
+ final PhylogenyNode gh3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "G" ),
+ p1.getNode( "H" ) );
+ if ( !gh3.getName().equals( "gh" ) ) {
return false;
}
- if ( !Test.isEqual( p4.getProteinDomain( 0 ).getPerDomainScore(), 135.7 ) ) {
+ final PhylogenyNode abc = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "C" ),
+ p1.getNode( "A" ) );
+ if ( !abc.getName().equals( "abc" ) ) {
return false;
}
- if ( !Test.isEqual( p4.getProteinDomain( 0 ).getPerSequenceEvalue(), 8.3e-40 ) ) {
+ final PhylogenyNode abc2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "A" ),
+ p1.getNode( "C" ) );
+ if ( !abc2.getName().equals( "abc" ) ) {
return false;
}
- if ( !Test.isEqual( p4.getProteinDomain( 0 ).getPerSequenceScore(), 136.3 ) ) {
+ final PhylogenyNode abcd = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "A" ),
+ p1.getNode( "D" ) );
+ if ( !abcd.getName().equals( "abcd" ) ) {
return false;
}
- if ( !Test.isEqual( p4.getProteinDomain( 0 ).getNumber(), 1 ) ) {
+ final PhylogenyNode abcd2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "D" ),
+ p1.getNode( "A" ) );
+ if ( !abcd2.getName().equals( "abcd" ) ) {
return false;
}
- if ( !Test.isEqual( p4.getProteinDomain( 0 ).getTotalCount(), 1 ) ) {
+ final PhylogenyNode abcdef = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "A" ),
+ p1.getNode( "F" ) );
+ if ( !abcdef.getName().equals( "abcdef" ) ) {
return false;
}
- }
- catch ( final Exception e ) {
- e.printStackTrace( System.out );
- return false;
- }
- return true;
- }
-
- private static boolean testLastExternalNodeMethods() {
- try {
- final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
- final char[] a0 = { '(', '(', 'A', ',', 'B', ')', ',', '(', 'C', ',', 'D', ')', ')', };
- final Phylogeny t0 = factory.create( a0, new NHXParser() )[ 0 ];
- final PhylogenyNode n1 = t0.getNode( "A" );
- if ( n1.isLastExternalNode() ) {
+ final PhylogenyNode abcdef2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "F" ),
+ p1.getNode( "A" ) );
+ if ( !abcdef2.getName().equals( "abcdef" ) ) {
return false;
}
- final PhylogenyNode n2 = t0.getNode( "B" );
- if ( n2.isLastExternalNode() ) {
+ final PhylogenyNode abcdef3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "ab" ),
+ p1.getNode( "F" ) );
+ if ( !abcdef3.getName().equals( "abcdef" ) ) {
return false;
}
- final PhylogenyNode n3 = t0.getNode( "C" );
- if ( n3.isLastExternalNode() ) {
+ final PhylogenyNode abcdef4 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "F" ),
+ p1.getNode( "ab" ) );
+ if ( !abcdef4.getName().equals( "abcdef" ) ) {
return false;
}
- final PhylogenyNode n4 = t0.getNode( "D" );
- if ( !n4.isLastExternalNode() ) {
+ final PhylogenyNode abcde = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "A" ),
+ p1.getNode( "E" ) );
+ if ( !abcde.getName().equals( "abcde" ) ) {
return false;
}
- }
- catch ( final Exception e ) {
- e.printStackTrace( System.out );
- return false;
- }
- return true;
- }
-
- private static boolean testLevelOrderIterator() {
- try {
- final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
- final Phylogeny t0 = factory.create( "((A,B)ab,(C,D)cd)r", new NHXParser() )[ 0 ];
- PhylogenyNodeIterator it0;
- for( it0 = t0.iteratorLevelOrder(); it0.hasNext(); ) {
- it0.next();
+ final PhylogenyNode abcde2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "E" ),
+ p1.getNode( "A" ) );
+ if ( !abcde2.getName().equals( "abcde" ) ) {
+ return false;
+ }
+ final PhylogenyNode r = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "abcdefgh" ),
+ p1.getNode( "abcdefgh" ) );
+ if ( !r.getName().equals( "abcdefgh" ) ) {
+ return false;
+ }
+ final PhylogenyNode r2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "A" ),
+ p1.getNode( "H" ) );
+ if ( !r2.getName().equals( "abcdefgh" ) ) {
+ return false;
+ }
+ final PhylogenyNode r3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "H" ),
+ p1.getNode( "A" ) );
+ if ( !r3.getName().equals( "abcdefgh" ) ) {
+ return false;
+ }
+ final PhylogenyNode abcde3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "E" ),
+ p1.getNode( "abcde" ) );
+ if ( !abcde3.getName().equals( "abcde" ) ) {
+ return false;
+ }
+ final PhylogenyNode abcde4 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "abcde" ),
+ p1.getNode( "E" ) );
+ if ( !abcde4.getName().equals( "abcde" ) ) {
+ return false;
+ }
+ final PhylogenyNode ab3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "ab" ),
+ p1.getNode( "B" ) );
+ if ( !ab3.getName().equals( "ab" ) ) {
+ return false;
+ }
+ final PhylogenyNode ab4 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p1.getNode( "B" ),
+ p1.getNode( "ab" ) );
+ if ( !ab4.getName().equals( "ab" ) ) {
+ return false;
+ }
+ final Phylogeny p2 = factory.create( "(a,b,(((c,d)cd,e)cde,f)cdef)r", new NHXParser() )[ 0 ];
+ PhylogenyMethods.preOrderReId( p2 );
+ final PhylogenyNode cd = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p2.getNode( "c" ),
+ p2.getNode( "d" ) );
+ if ( !cd.getName().equals( "cd" ) ) {
+ return false;
+ }
+ final PhylogenyNode cd2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p2.getNode( "d" ),
+ p2.getNode( "c" ) );
+ if ( !cd2.getName().equals( "cd" ) ) {
+ return false;
+ }
+ final PhylogenyNode cde = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p2.getNode( "c" ),
+ p2.getNode( "e" ) );
+ if ( !cde.getName().equals( "cde" ) ) {
+ return false;
+ }
+ final PhylogenyNode cde2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p2.getNode( "e" ),
+ p2.getNode( "c" ) );
+ if ( !cde2.getName().equals( "cde" ) ) {
+ return false;
+ }
+ final PhylogenyNode cdef = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p2.getNode( "c" ),
+ p2.getNode( "f" ) );
+ if ( !cdef.getName().equals( "cdef" ) ) {
+ return false;
+ }
+ final PhylogenyNode cdef2 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p2.getNode( "d" ),
+ p2.getNode( "f" ) );
+ if ( !cdef2.getName().equals( "cdef" ) ) {
+ return false;
+ }
+ final PhylogenyNode cdef3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p2.getNode( "f" ),
+ p2.getNode( "d" ) );
+ if ( !cdef3.getName().equals( "cdef" ) ) {
+ return false;
+ }
+ final PhylogenyNode rt = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p2.getNode( "c" ),
+ p2.getNode( "a" ) );
+ if ( !rt.getName().equals( "r" ) ) {
+ return false;
+ }
+ final Phylogeny p3 = factory
+ .create( "((((a,(b,c)bc)abc,(d,e)de)abcde,f)abcdef,(((g,h)gh,(i,j)ij)ghij,k)ghijk,l)",
+ new NHXParser() )[ 0 ];
+ PhylogenyMethods.preOrderReId( p3 );
+ final PhylogenyNode bc_3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p3.getNode( "b" ),
+ p3.getNode( "c" ) );
+ if ( !bc_3.getName().equals( "bc" ) ) {
+ return false;
+ }
+ final PhylogenyNode ac_3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p3.getNode( "a" ),
+ p3.getNode( "c" ) );
+ if ( !ac_3.getName().equals( "abc" ) ) {
+ return false;
+ }
+ final PhylogenyNode ad_3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p3.getNode( "a" ),
+ p3.getNode( "d" ) );
+ if ( !ad_3.getName().equals( "abcde" ) ) {
+ return false;
+ }
+ final PhylogenyNode af_3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p3.getNode( "a" ),
+ p3.getNode( "f" ) );
+ if ( !af_3.getName().equals( "abcdef" ) ) {
+ return false;
+ }
+ final PhylogenyNode ag_3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p3.getNode( "a" ),
+ p3.getNode( "g" ) );
+ if ( !ag_3.getName().equals( "" ) ) {
+ return false;
+ }
+ if ( !ag_3.isRoot() ) {
+ return false;
+ }
+ final PhylogenyNode al_3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p3.getNode( "a" ),
+ p3.getNode( "l" ) );
+ if ( !al_3.getName().equals( "" ) ) {
+ return false;
+ }
+ if ( !al_3.isRoot() ) {
+ return false;
+ }
+ final PhylogenyNode kl_3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p3.getNode( "k" ),
+ p3.getNode( "l" ) );
+ if ( !kl_3.getName().equals( "" ) ) {
+ return false;
+ }
+ if ( !kl_3.isRoot() ) {
+ return false;
+ }
+ final PhylogenyNode fl_3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p3.getNode( "f" ),
+ p3.getNode( "l" ) );
+ if ( !fl_3.getName().equals( "" ) ) {
+ return false;
+ }
+ if ( !fl_3.isRoot() ) {
+ return false;
+ }
+ final PhylogenyNode gk_3 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p3.getNode( "g" ),
+ p3.getNode( "k" ) );
+ if ( !gk_3.getName().equals( "ghijk" ) ) {
+ return false;
+ }
+ final Phylogeny p4 = factory.create( "(a,b,c)r", new NHXParser() )[ 0 ];
+ PhylogenyMethods.preOrderReId( p4 );
+ final PhylogenyNode r_4 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p4.getNode( "b" ),
+ p4.getNode( "c" ) );
+ if ( !r_4.getName().equals( "r" ) ) {
+ return false;
+ }
+ final Phylogeny p5 = factory.create( "((a,b),c,d)root", new NHXParser() )[ 0 ];
+ PhylogenyMethods.preOrderReId( p5 );
+ final PhylogenyNode r_5 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p5.getNode( "a" ),
+ p5.getNode( "c" ) );
+ if ( !r_5.getName().equals( "root" ) ) {
+ return false;
+ }
+ final Phylogeny p6 = factory.create( "((a,b),c,d)rot", new NHXParser() )[ 0 ];
+ PhylogenyMethods.preOrderReId( p6 );
+ final PhylogenyNode r_6 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p6.getNode( "c" ),
+ p6.getNode( "a" ) );
+ if ( !r_6.getName().equals( "rot" ) ) {
+ return false;
+ }
+ final Phylogeny p7 = factory.create( "(((a,b)x,c)x,d,e)rott", new NHXParser() )[ 0 ];
+ PhylogenyMethods.preOrderReId( p7 );
+ final PhylogenyNode r_7 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p7.getNode( "a" ),
+ p7.getNode( "e" ) );
+ if ( !r_7.getName().equals( "rott" ) ) {
+ return false;
+ }
+ final PhylogenyNode r_71 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p7.getNode( "e" ),
+ p7.getNode( "a" ) );
+ if ( !r_71.getName().equals( "rott" ) ) {
+ return false;
+ }
+ final PhylogenyNode r_72 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p7.getNode( "e" ),
+ p7.getNode( "rott" ) );
+ if ( !r_72.getName().equals( "rott" ) ) {
+ return false;
+ }
+ final PhylogenyNode r_73 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p7.getNode( "rott" ),
+ p7.getNode( "a" ) );
+ if ( !r_73.getName().equals( "rott" ) ) {
+ return false;
+ }
+ final PhylogenyNode r_74 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p7.getNode( "rott" ),
+ p7.getNode( "rott" ) );
+ if ( !r_74.getName().equals( "rott" ) ) {
+ return false;
+ }
+ final PhylogenyNode r_75 = PhylogenyMethods.calculateLCAonTreeWithIdsInPreOrder( p7.getNode( "e" ),
+ p7.getNode( "e" ) );
+ if ( !r_75.getName().equals( "e" ) ) {
+ return false;
+ }
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace( System.out );
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean testHmmscanOutputParser() {
+ final String test_dir = Test.PATH_TO_TEST_DATA;
+ try {
+ final HmmscanPerDomainTableParser parser1 = new HmmscanPerDomainTableParser( new File( test_dir
+ + ForesterUtil.getFileSeparator() + "hmmscan30b3_output_1" ), "MONBR", INDIVIDUAL_SCORE_CUTOFF.NONE );
+ parser1.parse();
+ final HmmscanPerDomainTableParser parser2 = new HmmscanPerDomainTableParser( new File( test_dir
+ + ForesterUtil.getFileSeparator() + "hmmscan30b3_output_2" ), "MONBR", INDIVIDUAL_SCORE_CUTOFF.NONE );
+ final List<Protein> proteins = parser2.parse();
+ if ( parser2.getProteinsEncountered() != 4 ) {
+ return false;
+ }
+ if ( proteins.size() != 4 ) {
+ return false;
+ }
+ if ( parser2.getDomainsEncountered() != 69 ) {
+ return false;
+ }
+ if ( parser2.getDomainsIgnoredDueToDuf() != 0 ) {
+ return false;
+ }
+ if ( parser2.getDomainsIgnoredDueToEval() != 0 ) {
+ return false;
+ }
+ final Protein p1 = proteins.get( 0 );
+ if ( p1.getNumberOfProteinDomains() != 15 ) {
+ return false;
+ }
+ if ( p1.getLength() != 850 ) {
+ return false;
+ }
+ final Protein p2 = proteins.get( 1 );
+ if ( p2.getNumberOfProteinDomains() != 51 ) {
+ return false;
+ }
+ if ( p2.getLength() != 1291 ) {
+ return false;
+ }
+ final Protein p3 = proteins.get( 2 );
+ if ( p3.getNumberOfProteinDomains() != 2 ) {
+ return false;
+ }
+ final Protein p4 = proteins.get( 3 );
+ if ( p4.getNumberOfProteinDomains() != 1 ) {
+ return false;
+ }
+ if ( !p4.getProteinDomain( 0 ).getDomainId().toString().equals( "DNA_pol_B_new" ) ) {
+ return false;
+ }
+ if ( p4.getProteinDomain( 0 ).getFrom() != 51 ) {
+ return false;
+ }
+ if ( p4.getProteinDomain( 0 ).getTo() != 395 ) {
+ return false;
+ }
+ if ( !Test.isEqual( p4.getProteinDomain( 0 ).getPerDomainEvalue(), 1.2e-39 ) ) {
+ return false;
+ }
+ if ( !Test.isEqual( p4.getProteinDomain( 0 ).getPerDomainScore(), 135.7 ) ) {
+ return false;
+ }
+ if ( !Test.isEqual( p4.getProteinDomain( 0 ).getPerSequenceEvalue(), 8.3e-40 ) ) {
+ return false;
+ }
+ if ( !Test.isEqual( p4.getProteinDomain( 0 ).getPerSequenceScore(), 136.3 ) ) {
+ return false;
+ }
+ if ( !Test.isEqual( p4.getProteinDomain( 0 ).getNumber(), 1 ) ) {
+ return false;
+ }
+ if ( !Test.isEqual( p4.getProteinDomain( 0 ).getTotalCount(), 1 ) ) {
+ return false;
+ }
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace( System.out );
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean testLastExternalNodeMethods() {
+ try {
+ final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+ final char[] a0 = { '(', '(', 'A', ',', 'B', ')', ',', '(', 'C', ',', 'D', ')', ')', };
+ final Phylogeny t0 = factory.create( a0, new NHXParser() )[ 0 ];
+ final PhylogenyNode n1 = t0.getNode( "A" );
+ if ( n1.isLastExternalNode() ) {
+ return false;
+ }
+ final PhylogenyNode n2 = t0.getNode( "B" );
+ if ( n2.isLastExternalNode() ) {
+ return false;
+ }
+ final PhylogenyNode n3 = t0.getNode( "C" );
+ if ( n3.isLastExternalNode() ) {
+ return false;
+ }
+ final PhylogenyNode n4 = t0.getNode( "D" );
+ if ( !n4.isLastExternalNode() ) {
+ return false;
+ }
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace( System.out );
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean testLevelOrderIterator() {
+ try {
+ final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+ final Phylogeny t0 = factory.create( "((A,B)ab,(C,D)cd)r", new NHXParser() )[ 0 ];
+ PhylogenyNodeIterator it0;
+ for( it0 = t0.iteratorLevelOrder(); it0.hasNext(); ) {
+ it0.next();
}
for( it0.reset(); it0.hasNext(); ) {
it0.next();
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 " ) ) {
if ( ( p46.length != 1 ) || !p46[ 0 ].isEmpty() ) {
return false;
}
+ final Phylogeny p47 = factory.create( new StringBuffer( "((A,B)ab:2[0.44],C)" ), new NHXParser() )[ 0 ];
+ if ( !isEqual( 0.44, p47.getNode( "ab" ).getBranchData().getConfidence( 0 ).getValue() ) ) {
+ return false;
+ }
+ final Phylogeny p48 = factory.create( new StringBuffer( "((A,B)ab:2[88],C)" ), new NHXParser() )[ 0 ];
+ if ( !isEqual( 88, p48.getNode( "ab" ).getBranchData().getConfidence( 0 ).getValue() ) ) {
+ return false;
+ }
+ final Phylogeny p49 = factory
+ .create( new StringBuffer( "((A,B)a[comment:a,b;(a)]b:2[0.44][comment(a,b,b);],C)" ),
+ new NHXParser() )[ 0 ];
+ if ( !isEqual( 0.44, p49.getNode( "ab" ).getBranchData().getConfidence( 0 ).getValue() ) ) {
+ return false;
+ }
+ final Phylogeny p50 = factory.create( new StringBuffer( "((\"A\",B)ab:2[88],C)" ), new NHXParser() )[ 0 ];
+ if ( p50.getNode( "A" ) == null ) {
+ return false;
+ }
+ if ( !p50.toNewHampshire( false, NH_CONVERSION_SUPPORT_VALUE_STYLE.IN_SQUARE_BRACKETS )
+ .equals( "((A,B)ab:2.0[88],C);" ) ) {
+ return false;
+ }
+ if ( !p50.toNewHampshire( false, NH_CONVERSION_SUPPORT_VALUE_STYLE.NONE ).equals( "((A,B)ab:2.0,C);" ) ) {
+ return false;
+ }
+ if ( !p50.toNewHampshire( false, NH_CONVERSION_SUPPORT_VALUE_STYLE.AS_INTERNAL_NODE_NAMES )
+ .equals( "((A,B)88:2.0,C);" ) ) {
+ return false;
+ }
+ final Phylogeny p51 = factory.create( new StringBuffer( "((\"A(A\",B)ab:2[88],C)" ), new NHXParser() )[ 0 ];
+ if ( p51.getNode( "A(A" ) == null ) {
+ return false;
+ }
+ final Phylogeny p52 = factory.create( new StringBuffer( "(('A(A',B)ab:2[88],C)" ), new NHXParser() )[ 0 ];
+ if ( p52.getNode( "A(A" ) == null ) {
+ return false;
+ }
+ final Phylogeny p53 = factory
+ .create( new StringBuffer( "(('A(A',\"B (x (a' ,b) f(x);\"[com])[ment]ab:2[88],C)" ),
+ new NHXParser() )[ 0 ];
+ if ( p53.getNode( "B (x (a' ,b) f(x);" ) == null ) {
+ return false;
+ }
+ //
+ final Phylogeny p54 = factory.create( new StringBuffer( "((A,B):[88],C)" ), new NHXParser() )[ 0 ];
+ if ( p54.getNode( "A" ) == null ) {
+ return false;
+ }
+ if ( !p54.toNewHampshire( false, NH_CONVERSION_SUPPORT_VALUE_STYLE.IN_SQUARE_BRACKETS )
+ .equals( "((A,B)[88],C);" ) ) {
+ return false;
+ }
}
catch ( final Exception e ) {
e.printStackTrace( System.out );
return false;
}
if ( !n5.toNewHampshireX()
- .equals( "n5:0.1[&&NHX:T=1:S=Ecoli:D=Y:XN=S=tag1=value1=unit1:B=56.0:W=2.0:C=10.20.30]" ) ) {
+ .equals( "n5:0.1[&&NHX:T=1:S=Ecoli:D=Y:XN=S=tag1=value1=unit1:B=56:W=2.0:C=10.20.30]" ) ) {
return false;
}
- if ( !n6.toNewHampshireX()
- .equals( "n6:1.0E-6[&&NHX:T=1:S=Ecoli:D=N:XN=B=bool_tag=T:B=100.0:W=2.0:C=0.0.0]" ) ) {
+ if ( !n6.toNewHampshireX().equals( "n6:1.0E-6[&&NHX:T=1:S=Ecoli:D=N:XN=B=bool_tag=T:B=100:W=2.0:C=0.0.0]" ) ) {
return false;
}
}
if ( !n3.getName().equals( "n3" ) ) {
return false;
}
- if ( n3.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+ if ( n3.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
return false;
}
if ( n3.isDuplication() ) {
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;
}
if ( PhylogenyMethods.getSpecies( n23 ).length() > 0 ) {
return false;
}
- if ( NHXParser.LIMIT_SPECIES_NAMES_TO_FIVE_CHARS ) {
- final PhylogenyNode a = PhylogenyNode
- .createInstanceFromNhxString( "n10_ECOLI/1-2",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
- if ( !a.getName().equals( "n10_ECOLI/1-2" ) ) {
- return false;
- }
- if ( !PhylogenyMethods.getSpecies( a ).equals( "ECOLI" ) ) {
- return false;
- }
- final PhylogenyNode b = PhylogenyNode
- .createInstanceFromNhxString( "n10_ECOLI1/1-2",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
- if ( !b.getName().equals( "n10_ECOLI1/1-2" ) ) {
- return false;
- }
- if ( !PhylogenyMethods.getSpecies( b ).equals( "ECOLI" ) ) {
- return false;
- }
- final PhylogenyNode c = PhylogenyNode
- .createInstanceFromNhxString( "n10_RATAF12/1000-2000",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
- if ( !c.getName().equals( "n10_RATAF12/1000-2000" ) ) {
- return false;
- }
- if ( !PhylogenyMethods.getSpecies( c ).equals( "RATAF" ) ) {
- return false;
- }
- final PhylogenyNode d = PhylogenyNode
- .createInstanceFromNhxString( "n10_RAT1/1-2",
- PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
- if ( !d.getName().equals( "n10_RAT1/1-2" ) ) {
- return false;
- }
- if ( !PhylogenyMethods.getSpecies( d ).equals( "RAT" ) ) {
- return false;
- }
- final PhylogenyNode e = PhylogenyNode
- .createInstanceFromNhxString( "n10_RAT1", PhylogenyMethods.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
- if ( !e.getName().equals( "n10_RAT1" ) ) {
- return false;
- }
- if ( !ForesterUtil.isEmpty( PhylogenyMethods.getSpecies( e ) ) ) {
- return false;
- }
+ final PhylogenyNode a = PhylogenyNode
+ .createInstanceFromNhxString( "n10_ECOLI/1-2", NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ if ( !a.getName().equals( "n10_ECOLI/1-2" ) ) {
+ return false;
+ }
+ if ( !PhylogenyMethods.getSpecies( a ).equals( "ECOLI" ) ) {
+ return false;
+ }
+ final PhylogenyNode b = PhylogenyNode
+ .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" ) ) {
+ return false;
+ }
+ final PhylogenyNode c = PhylogenyNode
+ .createInstanceFromNhxString( "n10_RATAF12/1000-2000",
+ NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ if ( !c.getName().equals( "n10_RATAF12/1000-2000" ) ) {
+ return false;
+ }
+ if ( PhylogenyMethods.getSpecies( c ).equals( "RATAF" ) ) {
+ return false;
+ }
+ final PhylogenyNode c1 = PhylogenyNode
+ .createInstanceFromNhxString( "n10_BOVIN_1/1000-2000",
+ NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ if ( !c1.getName().equals( "n10_BOVIN_1/1000-2000" ) ) {
+ return false;
+ }
+ if ( PhylogenyMethods.getSpecies( c1 ).equals( "BOVIN" ) ) {
+ return false;
+ }
+ final PhylogenyNode c2 = PhylogenyNode
+ .createInstanceFromNhxString( "n10_Bovin_1/1000-2000",
+ NHXParser.TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY );
+ if ( !c2.getName().equals( "n10_Bovin_1/1000-2000" ) ) {
+ return false;
+ }
+ if ( !PhylogenyMethods.getSpecies( c2 ).equals( "" ) ) {
+ return false;
+ }
+ final PhylogenyNode d = PhylogenyNode
+ .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" ) ) {
+ return false;
+ }
+ final PhylogenyNode e = PhylogenyNode
+ .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",
+ 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~",
+ NHXParser.TAXONOMY_EXTRACTION.YES );
+ if ( !e3.getName().equals( "n10_RAT~" ) ) {
+ return false;
+ }
+ if ( !PhylogenyMethods.getSpecies( e3 ).equals( "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",
+ NHXParser.TAXONOMY_EXTRACTION.YES );
+ if ( !m.getName().equals( "n10_MOUSEa" ) ) {
+ return false;
+ }
+ if ( PhylogenyMethods.getSpecies( m ).equals( "MOUSE" ) ) {
+ return false;
+ }
+ final PhylogenyNode o = PhylogenyNode.createInstanceFromNhxString( "n10_MOUSE_",
+ NHXParser.TAXONOMY_EXTRACTION.YES );
+ if ( !o.getName().equals( "n10_MOUSE_" ) ) {
+ return false;
+ }
+ 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" ) ) {
if ( PhylogenyMethods.getConfidenceValue( n1 ) != Confidence.CONFIDENCE_DEFAULT_VALUE ) {
return false;
}
- if ( n1.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+ if ( n1.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
return false;
}
if ( n2.getName().compareTo( "" ) != 0 ) {
if ( PhylogenyMethods.getConfidenceValue( n2 ) != Confidence.CONFIDENCE_DEFAULT_VALUE ) {
return false;
}
- if ( n2.getDistanceToParent() != PhylogenyNode.DISTANCE_DEFAULT ) {
+ if ( n2.getDistanceToParent() != PhylogenyDataUtil.BRANCH_LENGTH_DEFAULT ) {
return false;
}
final PhylogenyNode n00 = PhylogenyNode
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;
}
- if ( !PhylogenyMethods.getSpecies( n13 ).equals( "" ) ) {
+ if ( !PhylogenyMethods.getSpecies( n13 ).equals( "12345" ) ) {
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;
}
return false;
}
final Phylogeny p9 = factory.create( "((A:0.2,B:0.3):0.5[91],C:0.1)root:0.1[100]", new NHXParser() )[ 0 ];
- if ( !p9.toNewHampshireX().equals( "((A:0.2,B:0.3):0.5[&&NHX:B=91.0],C:0.1)root:0.1[&&NHX:B=100.0]" ) ) {
+ if ( !p9.toNewHampshireX().equals( "((A:0.2,B:0.3):0.5[&&NHX:B=91],C:0.1)root:0.1[&&NHX:B=100]" ) ) {
return false;
}
final Phylogeny p10 = factory
.create( " [79] ( (A [co mment] :0 .2[comment],B:0.3[com])[com ment]: 0. 5 \t[ 9 1 ][ comment],C: 0.1)[comment]root:0.1[100] [comment]",
new NHXParser() )[ 0 ];
- if ( !p10.toNewHampshireX().equals( "((A:0.2,B:0.3):0.5[&&NHX:B=91.0],C:0.1)root:0.1[&&NHX:B=100.0]" ) ) {
+ if ( !p10.toNewHampshireX().equals( "((A:0.2,B:0.3):0.5[&&NHX:B=91],C:0.1)root:0.1[&&NHX:B=100]" ) ) {
return false;
}
}
final Phylogeny p10 = factory
.create( " [79] ( (\"A \n\tB \" [co mment] :0 .2[comment],'B':0.3[com])[com ment]: 0. 5 \t[ 9 1 ][ comment],'C (or D?\\//;,))': 0.1)[comment]'\nroot is here (cool, was! ) ':0.1[100] [comment]",
new NHXParser() )[ 0 ];
- final String p10_clean_str = "(('A B':0.2,B:0.3):0.5[&&NHX:B=91.0],'C (or D?\\//;,))':0.1)'root is here (cool, was! )':0.1[&&NHX:B=100.0]";
+ final String p10_clean_str = "(('A B':0.2,B:0.3):0.5[&&NHX:B=91],'C (or D?\\//;,))':0.1)'root is here (cool, was! )':0.1[&&NHX:B=100]";
if ( !p10.toNewHampshireX().equals( p10_clean_str ) ) {
return false;
}
final Phylogeny p12 = factory
.create( " [79] ( (\"A \n\tB \" [[][] :0 .2[comment][\t&\t&\n N\tH\tX:S=mo\tnkey !],'\tB\t\b\t\n\f\rB B ':0.0\b3[])\t[com ment]: 0. 5 \t[ 9 1 ][ \ncomment],'C\t (or D?\\//;,))': 0.\b1)[comment]'\nroot \tis here (cool, \b\t\n\f\r was! ) ':0.1[100] [comment]",
new NHXParser() )[ 0 ];
- final String p12_clean_str = "(('A B':0.2[&&NHX:S=monkey!],'BB B':0.03):0.5[&&NHX:B=91.0],'C (or D?\\//;,))':0.1)'root is here (cool, was! )':0.1[&&NHX:B=100.0]";
+ final String p12_clean_str = "(('A B':0.2[&&NHX:S=monkey!],'BB B':0.03):0.5[&&NHX:B=91],'C (or D?\\//;,))':0.1)'root is here (cool, was! )':0.1[&&NHX:B=100]";
if ( !p12.toNewHampshireX().equals( p12_clean_str ) ) {
return false;
}
private static boolean testNHXParsingMB() {
try {
final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
- final Phylogeny p1 = factory.create( "(1[&prob=1.000000000000000e+00,prob_stddev=0.000000000000000e+00,"
+ final Phylogeny p1 = factory.create( "(1[&prob=0.9500000000000000e+00,prob_stddev=0.1100000000000000e+00,"
+ "prob_range={1.000000000000000e+00,1.000000000000000e+00},prob(percent)=\"100\","
+ "prob+-sd=\"100+-0\"]:4.129000000000000e-02[&length_mean=4.153987461671767e-02,"
+ "length_median=4.129000000000000e-02,length_95%HPD={3.217800000000000e-02,"
- + "5.026800000000000e-02}],2[&prob=1.000000000000000e+00,prob_stddev=0.000000000000000e+00,"
+ + "5.026800000000000e-02}],2[&prob=0.810000000000000e+00,prob_stddev=0.000000000000000e+00,"
+ "prob_range={1.000000000000000e+00,1.000000000000000e+00},prob(percent)=\"100\","
+ "prob+-sd=\"100+-0\"]:6.375699999999999e-02[&length_mean=6.395210411945065e-02,"
+ "length_median=6.375699999999999e-02,length_95%HPD={5.388600000000000e-02,"
+ "7.369400000000000e-02}])", new NHXParser() )[ 0 ];
if ( !isEqual( p1.getNode( "1" ).getDistanceToParent(), 4.129e-02 ) ) {
- System.out.println( p1.getNode( "1" ).getDistanceToParent() );
- System.exit( -1 );
return false;
}
- // if ( !p1.toNewHampshireX().equals( "(A[&&NHX:S=a_species],B1[&&NHX:S=b_species])" ) ) {
- // return false;
- // }
+ if ( !isEqual( p1.getNode( "1" ).getBranchData().getConfidence( 0 ).getValue(), 0.9500000000000000e+00 ) ) {
+ return false;
+ }
+ if ( !isEqual( p1.getNode( "1" ).getBranchData().getConfidence( 0 ).getStandardDeviation(),
+ 0.1100000000000000e+00 ) ) {
+ return false;
+ }
+ if ( !isEqual( p1.getNode( "2" ).getDistanceToParent(), 6.375699999999999e-02 ) ) {
+ return false;
+ }
+ if ( !isEqual( p1.getNode( "2" ).getBranchData().getConfidence( 0 ).getValue(), 0.810000000000000e+00 ) ) {
+ return false;
+ }
+ final Phylogeny p2 = factory
+ .create( "(1[something_else(?)s,prob=0.9500000000000000e+00{}(((,p)rob_stddev=0.110000000000e+00,"
+ + "prob_range={1.000000000000000e+00,1.000000000000000e+00},prob(percent)=\"100\","
+ + "prob+-sd=\"100+-0\"]:4.129000000000000e-02[&length_mean=4.153987461671767e-02,"
+ + "length_median=4.129000000000000e-02,length_95%HPD={3.217800000000000e-02,"
+ + "5.026800000000000e-02}],2[&prob=0.810000000000000e+00,prob_stddev=0.000000000000000e+00,"
+ + "prob_range={1.000000000000000e+00,1.000000000000000e+00},prob(percent)=\"100\","
+ + "prob+-sd=\"100+-0\"]:6.375699999999999e-02[&length_mean=6.395210411945065e-02,"
+ + "length_median=6.375699999999999e-02,length_95%HPD={5.388600000000000e-02,"
+ + "7.369400000000000e-02}])",
+ new NHXParser() )[ 0 ];
+ if ( p2.getNode( "1" ) == null ) {
+ return false;
+ }
+ if ( p2.getNode( "2" ) == null ) {
+ return false;
+ }
}
catch ( final Exception e ) {
e.printStackTrace( System.out );
if ( p.getNode( "r" ).getId() != count ) {
return false;
}
- if ( p.getNode( "A" ).getId() != count + 1 ) {
+ if ( p.getNode( "A" ).getId() != ( count + 1 ) ) {
return false;
}
- if ( p.getNode( "B" ).getId() != count + 1 ) {
+ if ( p.getNode( "B" ).getId() != ( count + 1 ) ) {
return false;
}
- if ( p.getNode( "C" ).getId() != count + 1 ) {
+ if ( p.getNode( "C" ).getId() != ( count + 1 ) ) {
return false;
}
- if ( p.getNode( "1" ).getId() != count + 2 ) {
+ if ( p.getNode( "1" ).getId() != ( count + 2 ) ) {
return false;
}
- if ( p.getNode( "2" ).getId() != count + 2 ) {
+ if ( p.getNode( "2" ).getId() != ( count + 2 ) ) {
return false;
}
- if ( p.getNode( "3" ).getId() != count + 2 ) {
+ if ( p.getNode( "3" ).getId() != ( count + 2 ) ) {
return false;
}
- if ( p.getNode( "4" ).getId() != count + 2 ) {
+ if ( p.getNode( "4" ).getId() != ( count + 2 ) ) {
return false;
}
- if ( p.getNode( "5" ).getId() != count + 2 ) {
+ if ( p.getNode( "5" ).getId() != ( count + 2 ) ) {
return false;
}
- if ( p.getNode( "6" ).getId() != count + 2 ) {
+ if ( p.getNode( "6" ).getId() != ( count + 2 ) ) {
return false;
}
- if ( p.getNode( "a" ).getId() != count + 3 ) {
+ if ( p.getNode( "a" ).getId() != ( count + 3 ) ) {
return false;
}
- if ( p.getNode( "b" ).getId() != count + 3 ) {
+ if ( p.getNode( "b" ).getId() != ( count + 3 ) ) {
return false;
}
- if ( p.getNode( "X" ).getId() != count + 4 ) {
+ if ( p.getNode( "X" ).getId() != ( count + 4 ) ) {
return false;
}
- if ( p.getNode( "Y" ).getId() != count + 4 ) {
+ if ( p.getNode( "Y" ).getId() != ( count + 4 ) ) {
return false;
}
- if ( p.getNode( "Z" ).getId() != count + 4 ) {
+ if ( p.getNode( "Z" ).getId() != ( count + 4 ) ) {
return false;
}
}
if ( p8[ 0 ].getNode( "4-5-6-7-8-9" ).isDuplication() ) {
return false;
}
- p8 = null;
+ p8 = null;
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace( System.out );
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean testOrthologTable() {
+ try {
+ 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( 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 ) {
+ gt.setRooted( true );
+ final GSDI sdi = new GSDI( gt, s1, true, true, true );
+ }
+ final IntMatrix m = RIO.calculateOrthologTable( g1 );
+ // System.out.println( m.toString() );
}
catch ( final Exception e ) {
- e.printStackTrace( System.out );
+ e.printStackTrace();
return false;
}
return true;
return true;
}
- private static boolean testTaxonomyAssigner() {
- try {
- String s0_str = "(((([&&NHX:S=A],[&&NHX:S=B])[&&NHX:S=AB],[&&NHX:S=C])[&&NHX:S=ABC],[&&NHX:S=D])[&&NHX:S=ABCD],[&&NHX:S=E])[&&NHX:S=ABCDE]";
- String g0_str = "((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=A])a,[&&NHX:S=B])b,[&&NHX:S=C])c";
- Phylogeny s0 = ParserBasedPhylogenyFactory.getInstance().create( s0_str, new NHXParser() )[ 0 ];
- Phylogeny g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- s0.setRooted( true );
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "A" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "AB" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "ABC" ) ) {
- return false;
- }
- g0_str = "((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=A])a,[&&NHX:S=A])b,[&&NHX:S=A])c";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "A" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "A" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "A" ) ) {
- return false;
- }
- g0_str = "((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=B])a,[&&NHX:S=A])b,[&&NHX:S=A])c";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "AB" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "AB" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "AB" ) ) {
- return false;
- }
- g0_str = "((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=B])a,[&&NHX:S=C])b,[&&NHX:S=A])c";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "AB" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "ABC" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "ABC" ) ) {
- return false;
- }
- g0_str = "((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=B])a,[&&NHX:S=C])b,[&&NHX:S=D])c";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "AB" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "ABC" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- g0_str = "((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=E])a,[&&NHX:S=C])b,[&&NHX:S=D])c";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCDE" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCDE" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCDE" ) ) {
- return false;
- }
- g0_str = "((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=E])a,[&&NHX:S=A])b,[&&NHX:S=A])c";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCDE" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCDE" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCDE" ) ) {
- return false;
- }
- s0_str = "(([&&NHX:S=A],[&&NHX:S=B],[&&NHX:S=C],[&&NHX:S=D])[&&NHX:S=ABCD],"
- + "([&&NHX:S=E],[&&NHX:S=F],[&&NHX:S=G],[&&NHX:S=H])[&&NHX:S=EFGH],"
- + "([&&NHX:S=I],[&&NHX:S=J],[&&NHX:S=K],[&&NHX:S=L])[&&NHX:S=IJKL], "
- + "([&&NHX:S=M],[&&NHX:S=N],[&&NHX:S=O],[&&NHX:S=P])[&&NHX:S=MNOP])[&&NHX:S=ROOT]";
- s0 = ParserBasedPhylogenyFactory.getInstance().create( s0_str, new NHXParser() )[ 0 ];
- s0.setRooted( true );
- g0_str = "(([&&NHX:S=A],[&&NHX:S=B],[&&NHX:S=C],[&&NHX:S=D])a,"
- + "([&&NHX:S=E],[&&NHX:S=F],[&&NHX:S=G],[&&NHX:S=H])b,"
- + "([&&NHX:S=I],[&&NHX:S=J],[&&NHX:S=K],[&&NHX:S=L])c, "
- + "([&&NHX:S=M],[&&NHX:S=N],[&&NHX:S=O],[&&NHX:S=P])d)r";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "EFGH" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "IJKL" ) ) {
- return false;
- }
- if ( !g0.getNode( "d" ).getNodeData().getTaxonomy().getScientificName().equals( "MNOP" ) ) {
- return false;
- }
- if ( !g0.getNode( "r" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- g0_str = "(([&&NHX:S=A],[&&NHX:S=B],[&&NHX:S=A],[&&NHX:S=B])a,"
- + "([&&NHX:S=E],[&&NHX:S=F],[&&NHX:S=F],[&&NHX:S=F])b,"
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=I])c, "
- + "([&&NHX:S=M],[&&NHX:S=N],[&&NHX:S=O],[&&NHX:S=O])d)r";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "EFGH" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "IJKL" ) ) {
- return false;
- }
- if ( !g0.getNode( "d" ).getNodeData().getTaxonomy().getScientificName().equals( "MNOP" ) ) {
- return false;
- }
- if ( !g0.getNode( "r" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- g0_str = "(([&&NHX:S=A],[&&NHX:S=B],[&&NHX:S=A],[&&NHX:S=B])a,"
- + "([&&NHX:S=E],[&&NHX:S=F],[&&NHX:S=F],[&&NHX:S=F])b,"
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L])c, "
- + "([&&NHX:S=M],[&&NHX:S=N],[&&NHX:S=A],[&&NHX:S=O])d)r";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "EFGH" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "L" ) ) {
- return false;
- }
- if ( !g0.getNode( "d" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- if ( !g0.getNode( "r" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- g0_str = "(([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L])a,"
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L])b,"
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L])c, "
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L])d)r";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "L" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "L" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "L" ) ) {
- return false;
- }
- if ( !g0.getNode( "d" ).getNodeData().getTaxonomy().getScientificName().equals( "L" ) ) {
- return false;
- }
- if ( !g0.getNode( "r" ).getNodeData().getTaxonomy().getScientificName().equals( "L" ) ) {
- return false;
- }
- g0_str = "((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=A])a,[&&NHX:S=A])b,[&&NHX:S=A])c";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "A" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "A" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "A" ) ) {
- return false;
- }
- g0_str = "((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=B])a,[&&NHX:S=I])b,[&&NHX:S=J])c";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- g0_str = "(((([&&NHX:S=A],[&&NHX:S=B],[&&NHX:S=C],[&&NHX:S=D])a,"
- + "([&&NHX:S=D],[&&NHX:S=C],[&&NHX:S=B],[&&NHX:S=A])b)ab,"
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L])c)abc, "
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L])d)r";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "ab" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "L" ) ) {
- return false;
- }
- if ( !g0.getNode( "abc" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- if ( !g0.getNode( "d" ).getNodeData().getTaxonomy().getScientificName().equals( "L" ) ) {
- return false;
- }
- if ( !g0.getNode( "r" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- g0_str = "(((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=C],[&&NHX:S=D])a,"
- + "([&&NHX:S=D],[&&NHX:S=D],[&&NHX:S=B],[&&NHX:S=A])b)ab,"
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L])c)abc, "
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L])d)r";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "ab" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "L" ) ) {
- return false;
- }
- if ( !g0.getNode( "abc" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- if ( !g0.getNode( "d" ).getNodeData().getTaxonomy().getScientificName().equals( "L" ) ) {
- return false;
- }
- if ( !g0.getNode( "r" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- g0_str = "(((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=C],[&&NHX:S=D])a,"
- + "([&&NHX:S=D],[&&NHX:S=D],[&&NHX:S=B],[&&NHX:S=A])b)ab,"
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L])c)abc, "
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=A])d)r";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "ab" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "L" ) ) {
- return false;
- }
- if ( !g0.getNode( "abc" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- if ( !g0.getNode( "d" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- if ( !g0.getNode( "r" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- g0_str = "(((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=C],[&&NHX:S=D])a,"
- + "([&&NHX:S=D],[&&NHX:S=D],[&&NHX:S=B],[&&NHX:S=A])b)ab,"
- + "([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=A])c)abc, "
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=A])d)r";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( !g0.getNode( "a" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "b" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "ab" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "A" ) ) {
- return false;
- }
- if ( !g0.getNode( "abc" ).getNodeData().getTaxonomy().getScientificName().equals( "ABCD" ) ) {
- return false;
- }
- if ( !g0.getNode( "d" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- if ( !g0.getNode( "r" ).getNodeData().getTaxonomy().getScientificName().equals( "ROOT" ) ) {
- return false;
- }
- s0_str = "(([&&NHX:S=A],[&&NHX:S=B],[&&NHX:S=C],[&&NHX:S=D]),"
- + "([&&NHX:S=E],[&&NHX:S=F],[&&NHX:S=G],[&&NHX:S=H]),"
- + "([&&NHX:S=I],[&&NHX:S=J],[&&NHX:S=K],[&&NHX:S=L]), "
- + "([&&NHX:S=M],[&&NHX:S=N],[&&NHX:S=O],[&&NHX:S=P]))";
- s0 = ParserBasedPhylogenyFactory.getInstance().create( s0_str, new NHXParser() )[ 0 ];
- s0.setRooted( true );
- g0_str = "(((([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=C],[&&NHX:S=D])a,"
- + "([&&NHX:S=D],[&&NHX:S=D],[&&NHX:S=B],[&&NHX:S=A])b)ab,"
- + "([&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=A],[&&NHX:S=A])c)abc, "
- + "([&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=L],[&&NHX:S=A])d)r";
- g0 = ParserBasedPhylogenyFactory.getInstance().create( g0_str, new NHXParser() )[ 0 ];
- g0.setRooted( true );
- TaxonomyAssigner.execute( g0, s0 );
- if ( g0.getNode( "a" ).getNodeData().isHasTaxonomy() ) {
- return false;
- }
- if ( !g0.getNode( "c" ).getNodeData().getTaxonomy().getScientificName().equals( "A" ) ) {
- return false;
- }
- }
- catch ( final Exception e ) {
- e.printStackTrace( System.out );
- return false;
- }
- return true;
- }
-
private static boolean testUniprotTaxonomySearch() {
try {
- List<UniProtTaxonomy> results = UniProtWsTools
- .getTaxonomiesFromCommonNameStrict( "starlet sea anemone", 10 );
+ List<UniProtTaxonomy> results = SequenceDbWsTools.getTaxonomiesFromCommonNameStrict( "starlet sea anemone",
+ 10 );
if ( results.size() != 1 ) {
return false;
}
return false;
}
results = null;
- results = UniProtWsTools.getTaxonomiesFromScientificNameStrict( "Nematostella vectensis", 10 );
+ results = SequenceDbWsTools.getTaxonomiesFromScientificNameStrict( "Nematostella vectensis", 10 );
if ( results.size() != 1 ) {
return false;
}
return false;
}
results = null;
- results = UniProtWsTools.getTaxonomiesFromId( "45351", 10 );
+ results = SequenceDbWsTools.getTaxonomiesFromId( "45351", 10 );
if ( results.size() != 1 ) {
return false;
}
return false;
}
results = null;
- results = UniProtWsTools.getTaxonomiesFromTaxonomyCode( "NEMVE", 10 );
+ results = SequenceDbWsTools.getTaxonomiesFromTaxonomyCode( "NEMVE", 10 );
if ( results.size() != 1 ) {
return false;
}
//Nucleotide: 1 letter + 5 numerals OR 2 letters + 6 numerals
//Protein: 3 letters + 5 numerals
//http://www.ncbi.nlm.nih.gov/Sequin/acc.html
- if ( !DatabaseTools.parseGenbankAccessor( "AY423861" ).equals( "AY423861" ) ) {
+ if ( !SequenceIdParser.parseGenbankAccessor( "AY423861" ).equals( "AY423861" ) ) {
return false;
}
- if ( !DatabaseTools.parseGenbankAccessor( ".AY423861." ).equals( "AY423861" ) ) {
+ if ( !SequenceIdParser.parseGenbankAccessor( ".AY423861." ).equals( "AY423861" ) ) {
return false;
}
- if ( DatabaseTools.parseGenbankAccessor( "AAY423861" ) != null ) {
+ if ( SequenceIdParser.parseGenbankAccessor( "AAY423861" ) != null ) {
return false;
}
- if ( DatabaseTools.parseGenbankAccessor( "AY4238612" ) != null ) {
+ if ( SequenceIdParser.parseGenbankAccessor( "AY4238612" ) != null ) {
return false;
}
- if ( DatabaseTools.parseGenbankAccessor( "AAY4238612" ) != null ) {
+ if ( SequenceIdParser.parseGenbankAccessor( "AAY4238612" ) != null ) {
return false;
}
- if ( DatabaseTools.parseGenbankAccessor( "Y423861" ) != null ) {
+ if ( SequenceIdParser.parseGenbankAccessor( "Y423861" ) != null ) {
return false;
}
- if ( !DatabaseTools.parseGenbankAccessor( "S12345" ).equals( "S12345" ) ) {
+ if ( !SequenceIdParser.parseGenbankAccessor( "S12345" ).equals( "S12345" ) ) {
return false;
}
- if ( !DatabaseTools.parseGenbankAccessor( "|S12345|" ).equals( "S12345" ) ) {
+ if ( !SequenceIdParser.parseGenbankAccessor( "|S12345|" ).equals( "S12345" ) ) {
return false;
}
- if ( DatabaseTools.parseGenbankAccessor( "|S123456" ) != null ) {
+ if ( SequenceIdParser.parseGenbankAccessor( "|S123456" ) != null ) {
return false;
}
- if ( DatabaseTools.parseGenbankAccessor( "ABC123456" ) != null ) {
+ if ( SequenceIdParser.parseGenbankAccessor( "ABC123456" ) != null ) {
return false;
}
- if ( !DatabaseTools.parseGenbankAccessor( "ABC12345" ).equals( "ABC12345" ) ) {
+ if ( !SequenceIdParser.parseGenbankAccessor( "ABC12345" ).equals( "ABC12345" ) ) {
return false;
}
- if ( !DatabaseTools.parseGenbankAccessor( "&ABC12345&" ).equals( "ABC12345" ) ) {
+ if ( !SequenceIdParser.parseGenbankAccessor( "&ABC12345&" ).equals( "ABC12345" ) ) {
return false;
}
- if ( DatabaseTools.parseGenbankAccessor( "ABCD12345" ) != null ) {
+ if ( SequenceIdParser.parseGenbankAccessor( "ABCD12345" ) != null ) {
return false;
}
return true;
}
private static boolean testUniprotEntryRetrieval() {
- if ( !UniProtWsTools.parseUniProtAccessor( "P12345" ).equals( "P12345" ) ) {
+ if ( !SequenceDbWsTools.parseUniProtAccessor( "P12345" ).equals( "P12345" ) ) {
return false;
}
- if ( UniProtWsTools.parseUniProtAccessor( "EP12345" ) != null ) {
+ if ( SequenceDbWsTools.parseUniProtAccessor( "EP12345" ) != null ) {
return false;
}
- if ( UniProtWsTools.parseUniProtAccessor( "3 4P12345" ) != null ) {
+ if ( SequenceDbWsTools.parseUniProtAccessor( "3 4P12345" ) != null ) {
return false;
}
- if ( UniProtWsTools.parseUniProtAccessor( "P12345E" ) != null ) {
+ if ( SequenceDbWsTools.parseUniProtAccessor( "P12345E" ) != null ) {
return false;
}
- if ( UniProtWsTools.parseUniProtAccessor( "P123455" ) != null ) {
+ if ( SequenceDbWsTools.parseUniProtAccessor( "P123455" ) != null ) {
return false;
}
- if ( UniProtWsTools.parseUniProtAccessor( "EP12345E" ) != null ) {
+ if ( SequenceDbWsTools.parseUniProtAccessor( "EP12345E" ) != null ) {
return false;
}
- if ( UniProtWsTools.parseUniProtAccessor( "AY423861" ) != null ) {
+ if ( SequenceDbWsTools.parseUniProtAccessor( "AY423861" ) != null ) {
return false;
}
- if ( !UniProtWsTools.parseUniProtAccessor( "P1DDD5" ).equals( "P1DDD5" ) ) {
+ if ( !SequenceDbWsTools.parseUniProtAccessor( "P1DDD5" ).equals( "P1DDD5" ) ) {
return false;
}
- if ( UniProtWsTools.parseUniProtAccessor( "P1DDDD" ) != null ) {
+ if ( SequenceDbWsTools.parseUniProtAccessor( "P1DDDD" ) != null ) {
return false;
}
- if ( !UniProtWsTools.parseUniProtAccessor( "P1234X/P12345/12-42" ).equals( "P12345" ) ) {
+ if ( !SequenceDbWsTools.parseUniProtAccessor( "P1234X/P12345/12-42" ).equals( "P12345" ) ) {
return false;
}
- if ( !UniProtWsTools.parseUniProtAccessor( "P1234X P12345 12-42" ).equals( "P12345" ) ) {
+ if ( !SequenceDbWsTools.parseUniProtAccessor( "P1234X P12345 12-42" ).equals( "P12345" ) ) {
return false;
}
- if ( !UniProtWsTools.parseUniProtAccessor( "P12345/12-42" ).equals( "P12345" ) ) {
+ if ( !SequenceDbWsTools.parseUniProtAccessor( "P12345/12-42" ).equals( "P12345" ) ) {
return false;
}
- if ( !UniProtWsTools.parseUniProtAccessor( "P1234X/P12345" ).equals( "P12345" ) ) {
+ if ( !SequenceDbWsTools.parseUniProtAccessor( "P1234X/P12345" ).equals( "P12345" ) ) {
return false;
}
try {
- final SequenceDatabaseEntry entry = UniProtWsTools.obtainUniProtEntry( "P12345", 200 );
+ final SequenceDatabaseEntry entry = SequenceDbWsTools.obtainUniProtEntry( "P12345", 200 );
if ( !entry.getAccession().equals( "P12345" ) ) {
return false;
}
try {
final String msa_str_0 = "seq1 abcd\n\nseq2 efgh\n";
final Msa msa_0 = GeneralMsaParser.parse( new ByteArrayInputStream( msa_str_0.getBytes() ) );
- final String msa_str_1 = "seq_1 abc\nseq2 ghi\nseq_1 def\nseq2 jkm\n";
+ final String msa_str_1 = "seq1 abc\nseq2 ghi\nseq1 def\nseq2 jkm\n";
final Msa msa_1 = GeneralMsaParser.parse( new ByteArrayInputStream( msa_str_1.getBytes() ) );
final String msa_str_2 = "seq1 abc\nseq2 ghi\n\ndef\njkm\n";
final Msa msa_2 = GeneralMsaParser.parse( new ByteArrayInputStream( msa_str_2.getBytes() ) );
final String msa_str_3 = "seq1 abc\n def\nseq2 ghi\n jkm\n";
final Msa msa_3 = GeneralMsaParser.parse( new ByteArrayInputStream( msa_str_3.getBytes() ) );
+ if ( !msa_1.getSequenceAsString( 0 ).toString().equalsIgnoreCase( "abcdef" ) ) {
+ return false;
+ }
+ if ( !msa_1.getSequenceAsString( 1 ).toString().equalsIgnoreCase( "ghixkm" ) ) {
+ return false;
+ }
+ if ( !msa_1.getIdentifier( 0 ).toString().equals( "seq1" ) ) {
+ return false;
+ }
+ if ( !msa_1.getIdentifier( 1 ).toString().equals( "seq2" ) ) {
+ return false;
+ }
+ if ( !msa_2.getSequenceAsString( 0 ).toString().equalsIgnoreCase( "abcdef" ) ) {
+ return false;
+ }
+ if ( !msa_2.getSequenceAsString( 1 ).toString().equalsIgnoreCase( "ghixkm" ) ) {
+ return false;
+ }
+ if ( !msa_2.getIdentifier( 0 ).toString().equals( "seq1" ) ) {
+ return false;
+ }
+ if ( !msa_2.getIdentifier( 1 ).toString().equals( "seq2" ) ) {
+ return false;
+ }
+ if ( !msa_3.getSequenceAsString( 0 ).toString().equalsIgnoreCase( "abcdef" ) ) {
+ return false;
+ }
+ if ( !msa_3.getSequenceAsString( 1 ).toString().equalsIgnoreCase( "ghixkm" ) ) {
+ return false;
+ }
+ if ( !msa_3.getIdentifier( 0 ).toString().equals( "seq1" ) ) {
+ return false;
+ }
+ if ( !msa_3.getIdentifier( 1 ).toString().equals( "seq2" ) ) {
+ return false;
+ }
final Msa msa_4 = GeneralMsaParser.parse( new FileInputStream( PATH_TO_TEST_DATA + "msa_1.txt" ) );
if ( !msa_4.getSequenceAsString( 0 ).toString().equalsIgnoreCase( "abcdefeeeeeeeexx" ) ) {
return false;
return true;
}
- private static boolean testMafft() {
+ private static boolean testMafft( final String path ) {
try {
final List<String> opts = new ArrayList<String>();
opts.add( "--maxiterate" );
opts.add( "--localpair" );
opts.add( "--quiet" );
Msa msa = null;
- final MsaInferrer mafft = Mafft.createInstance();
- msa = mafft.infer( new File( PATH_TO_TEST_DATA + "ncbi.fasta" ), opts );
- if ( ( msa == null ) || ( msa.getLength() < 10 ) || ( msa.getNumberOfSequences() != 19 ) ) {
+ final MsaInferrer mafft = Mafft.createInstance( path );
+ msa = mafft.infer( new File( PATH_TO_TEST_DATA + "ncbi_sn.fasta" ), opts );
+ if ( ( msa == null ) || ( msa.getLength() < 20 ) || ( msa.getNumberOfSequences() != 19 ) ) {
+ return false;
+ }
+ if ( !msa.getIdentifier( 0 ).toString().equals( "a" ) ) {
return false;
}
}
}
return true;
}
+
+ private static boolean testMsaQualityMethod() {
+ try {
+ final Sequence s0 = BasicSequence.createAaSequence( "a", "ABAXEFGHIJ" );
+ final Sequence s1 = BasicSequence.createAaSequence( "b", "ABBXEFGHIJ" );
+ final Sequence s2 = BasicSequence.createAaSequence( "c", "AXCXEFGHIJ" );
+ final Sequence s3 = BasicSequence.createAaSequence( "d", "AXDDEFGHIJ" );
+ final List<Sequence> l = new ArrayList<Sequence>();
+ l.add( s0 );
+ l.add( s1 );
+ l.add( s2 );
+ l.add( s3 );
+ final Msa msa = BasicMsa.createInstance( l );
+ if ( !isEqual( 1, MsaMethods.calculateIdentityRatio( msa, 0 ) ) ) {
+ return false;
+ }
+ if ( !isEqual( 0.5, MsaMethods.calculateIdentityRatio( msa, 1 ) ) ) {
+ return false;
+ }
+ if ( !isEqual( 0.25, MsaMethods.calculateIdentityRatio( msa, 2 ) ) ) {
+ return false;
+ }
+ if ( !isEqual( 0.75, MsaMethods.calculateIdentityRatio( msa, 3 ) ) ) {
+ return false;
+ }
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace( System.out );
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean testSequenceIdParsing() {
+ try {
+ Identifier id = SequenceIdParser.parse( "gb_ADF31344_segmented_worms_" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getProvider() )
+ || !id.getValue().equals( "ADF31344" ) || !id.getProvider().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getProvider() );
+ }
+ return false;
+ }
+ //
+ id = SequenceIdParser.parse( "segmented worms|gb_ADF31344" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getProvider() )
+ || !id.getValue().equals( "ADF31344" ) || !id.getProvider().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getProvider() );
+ }
+ return false;
+ }
+ //
+ id = SequenceIdParser.parse( "segmented worms gb_ADF31344 and more" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getProvider() )
+ || !id.getValue().equals( "ADF31344" ) || !id.getProvider().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getProvider() );
+ }
+ return false;
+ }
+ //
+ id = SequenceIdParser.parse( "gb_AAA96518_1" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getProvider() )
+ || !id.getValue().equals( "AAA96518" ) || !id.getProvider().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getProvider() );
+ }
+ return false;
+ }
+ //
+ id = SequenceIdParser.parse( "gb_EHB07727_1_rodents_" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getProvider() )
+ || !id.getValue().equals( "EHB07727" ) || !id.getProvider().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getProvider() );
+ }
+ return false;
+ }
+ //
+ id = SequenceIdParser.parse( "dbj_BAF37827_1_turtles_" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getProvider() )
+ || !id.getValue().equals( "BAF37827" ) || !id.getProvider().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getProvider() );
+ }
+ return false;
+ }
+ //
+ id = SequenceIdParser.parse( "emb_CAA73223_1_primates_" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getProvider() )
+ || !id.getValue().equals( "CAA73223" ) || !id.getProvider().equals( "ncbi" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getProvider() );
+ }
+ return false;
+ }
+ //
+ id = SequenceIdParser.parse( "mites|ref_XP_002434188_1" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getProvider() )
+ || !id.getValue().equals( "XP_002434188" ) || !id.getProvider().equals( "refseq" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getProvider() );
+ }
+ return false;
+ }
+ //
+ id = SequenceIdParser.parse( "mites_ref_XP_002434188_1_bla_XP_12345" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getProvider() )
+ || !id.getValue().equals( "XP_002434188" ) || !id.getProvider().equals( "refseq" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getProvider() );
+ }
+ return false;
+ }
+ //
+ id = SequenceIdParser.parse( "P4A123" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getProvider() )
+ || !id.getValue().equals( "P4A123" ) || !id.getProvider().equals( "sp" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getProvider() );
+ }
+ return false;
+ }
+ //
+ id = SequenceIdParser.parse( "pllf[pok P4A123_osdjfosnqo035-9233332904i000490 vf tmv x45" );
+ if ( ( id == null ) || ForesterUtil.isEmpty( id.getValue() ) || ForesterUtil.isEmpty( id.getProvider() )
+ || !id.getValue().equals( "P4A123" ) || !id.getProvider().equals( "sp" ) ) {
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getProvider() );
+ }
+ return false;
+ }
+ //
+ id = SequenceIdParser.parse( "XP_12345" );
+ if ( id != null ) {
+ System.out.println( "value =" + id.getValue() );
+ System.out.println( "provider=" + id.getProvider() );
+ return false;
+ }
+ // lcl_91970_unknown_
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace( System.out );
+ return false;
+ }
+ return true;
+ }
}