From 12298ec6ab774c405b20389b81f73329ea3323a0 Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Tue, 26 Jun 2012 21:00:59 +0000 Subject: [PATCH] taxonomy code more stringent now --- .../archaeopteryx/MainFrameApplication.java | 2 +- .../src/org/forester/io/parsers/nhx/NHXParser.java | 45 +- .../io/parsers/phyloxml/PhyloXmlParser.java | 10 +- .../forester/io/parsers/phyloxml/PhyloXmlUtil.java | 3 +- .../org/forester/io/parsers/util/ParserUtils.java | 43 +- .../org/forester/phylogeny/PhylogenyMethods.java | 6 +- forester/java/src/org/forester/sdi/GSDI.java | 7 +- forester/java/src/org/forester/sdi/TestGSDI.java | 1132 ++++++++++---------- forester/java/src/org/forester/test/Test.java | 158 +-- 9 files changed, 715 insertions(+), 691 deletions(-) diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index 1a113ab..96febec 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -1385,7 +1385,7 @@ public final class MainFrameApplication extends MainFrame { final String name = n.getName().trim(); if ( !ForesterUtil.isEmpty( name ) ) { final String code = ParserUtils - .extractTaxonomyCodeFromNodeName( name, false, PhylogenyMethods.TAXONOMY_EXTRACTION.YES ); + .extractTaxonomyCodeFromNodeName( name, PhylogenyMethods.TAXONOMY_EXTRACTION.YES ); if ( !ForesterUtil.isEmpty( code ) ) { PhylogenyMethods.setTaxonomyCode( n, code ); } diff --git a/forester/java/src/org/forester/io/parsers/nhx/NHXParser.java b/forester/java/src/org/forester/io/parsers/nhx/NHXParser.java index f03ed69..c1cfa40 100644 --- a/forester/java/src/org/forester/io/parsers/nhx/NHXParser.java +++ b/forester/java/src/org/forester/io/parsers/nhx/NHXParser.java @@ -61,17 +61,16 @@ import org.forester.util.ForesterUtil; public final class NHXParser implements PhylogenyParser { - public static final boolean LIMIT_SPECIES_NAMES_TO_FIVE_CHARS = false; - public static final PhylogenyMethods.TAXONOMY_EXTRACTION TAXONOMY_EXTRACTION_DEFAULT = PhylogenyMethods.TAXONOMY_EXTRACTION.NO; - final static private boolean GUESS_ROOTEDNESS_DEFAULT = true; - final static private boolean GUESS_IF_SUPPORT_VALUES = true; - final static private boolean IGNORE_QUOTES_DEFAULT = false; - final static public boolean REPLACE_UNDERSCORES_DEFAULT = false; + public static final PhylogenyMethods.TAXONOMY_EXTRACTION TAXONOMY_EXTRACTION_DEFAULT = PhylogenyMethods.TAXONOMY_EXTRACTION.NO; + final static private boolean GUESS_ROOTEDNESS_DEFAULT = true; + final static private boolean GUESS_IF_SUPPORT_VALUES = true; + final static private boolean IGNORE_QUOTES_DEFAULT = false; + final static public boolean REPLACE_UNDERSCORES_DEFAULT = false; private boolean _saw_closing_paren; - final static private byte STRING = 0; - final static private byte STRING_BUFFER = 1; - final static private byte CHAR_ARRAY = 2; - final static private byte BUFFERED_READER = 3; + final static private byte STRING = 0; + final static private byte STRING_BUFFER = 1; + final static private byte CHAR_ARRAY = 2; + final static private byte BUFFERED_READER = 3; private boolean _guess_rootedness; private boolean _has_next; private boolean _ignore_quotes; @@ -85,16 +84,16 @@ public final class NHXParser implements PhylogenyParser { private Phylogeny _current_phylogeny; private PhylogenyMethods.TAXONOMY_EXTRACTION _taxonomy_extraction; private boolean _replace_underscores; - public final static Pattern UC_LETTERS_NUMBERS_PATTERN = Pattern - .compile( "^[A-Z0-9]+$" ); - public final static Pattern NUMBERS_ONLY_PATTERN = Pattern - .compile( "^[0-9\\.]+$" ); - public final static Pattern MB_PROB_PATTERN = Pattern - .compile( "prob=([^,]+)" ); - public final static Pattern MB_PROB_SD_PATTERN = Pattern - .compile( "prob_stddev=([^,]+)" ); - public final static Pattern MB_BL_PATTERN = Pattern - .compile( "length_median=([^,]+)" ); + public final static Pattern UC_LETTERS_NUMBERS_PATTERN = Pattern + .compile( "^[A-Z0-9]+$" ); + public final static Pattern NUMBERS_ONLY_PATTERN = Pattern + .compile( "^[0-9\\.]+$" ); + public final static Pattern MB_PROB_PATTERN = Pattern + .compile( "prob=([^,]+)" ); + public final static Pattern MB_PROB_SD_PATTERN = Pattern + .compile( "prob_stddev=([^,]+)" ); + public final static Pattern MB_BL_PATTERN = Pattern + .compile( "length_median=([^,]+)" ); public NHXParser() { init(); @@ -692,10 +691,8 @@ public final class NHXParser implements PhylogenyParser { node_to_annotate.setName( t.nextToken() ); if ( !replace_underscores && ( !is_nhx && ( taxonomy_extraction != PhylogenyMethods.TAXONOMY_EXTRACTION.NO ) ) ) { - final String tax = ParserUtils - .extractTaxonomyCodeFromNodeName( node_to_annotate.getName(), - LIMIT_SPECIES_NAMES_TO_FIVE_CHARS, - taxonomy_extraction ); + final String tax = ParserUtils.extractTaxonomyCodeFromNodeName( node_to_annotate.getName(), + taxonomy_extraction ); if ( !ForesterUtil.isEmpty( tax ) ) { if ( !node_to_annotate.getNodeData().isHasTaxonomy() ) { node_to_annotate.getNodeData().setTaxonomy( new Taxonomy() ); diff --git a/forester/java/src/org/forester/io/parsers/phyloxml/PhyloXmlParser.java b/forester/java/src/org/forester/io/parsers/phyloxml/PhyloXmlParser.java index 5c08974..b8de6cf 100644 --- a/forester/java/src/org/forester/io/parsers/phyloxml/PhyloXmlParser.java +++ b/forester/java/src/org/forester/io/parsers/phyloxml/PhyloXmlParser.java @@ -193,18 +193,12 @@ public class PhyloXmlParser implements PhylogenyParser { else if ( getSource() instanceof InputStream ) { if ( !isZippedInputstream() ) { final InputStream is = ( InputStream ) getSource(); - final Reader reader = new InputStreamReader( is ); - xml_reader.parse( new InputSource( reader ) ); + xml_reader.parse( new InputSource( new InputStreamReader( is ) ) ); } else { final ZipInputStream zip_is = new ZipInputStream( ( InputStream ) getSource() ); zip_is.getNextEntry(); - final Reader reader = new InputStreamReader( zip_is ); - if ( reader == null ) { - throw new PhylogenyParserException( "zip input stream \"" + getSource() - + "\" appears not to contain any (phyloXML) data" ); - } - xml_reader.parse( new InputSource( reader ) ); + xml_reader.parse( new InputSource( new InputStreamReader( zip_is ) ) ); } } else if ( getSource() instanceof String ) { diff --git a/forester/java/src/org/forester/io/parsers/phyloxml/PhyloXmlUtil.java b/forester/java/src/org/forester/io/parsers/phyloxml/PhyloXmlUtil.java index 9ccfdf9..5083c91 100644 --- a/forester/java/src/org/forester/io/parsers/phyloxml/PhyloXmlUtil.java +++ b/forester/java/src/org/forester/io/parsers/phyloxml/PhyloXmlUtil.java @@ -36,8 +36,7 @@ public final class PhyloXmlUtil { public static final String OTHER = "other"; public static final String UNKNOWN = "unknown"; public final static Pattern SEQUENCE_SYMBOL_PATTERN = Pattern.compile( "\\S{1,20}" ); - public final static Pattern TAXOMONY_CODE_PATTERN = Pattern - .compile( "[a-zA-Z0-9_]{1,10}" ); + public final static Pattern TAXOMONY_CODE_PATTERN = Pattern.compile( "[A-Z0-9]{3,5}" ); public final static Pattern LIT_REF_DOI_PATTERN = Pattern .compile( "[a-zA-Z0-9_\\.]+\\S+" ); public final static Set SEQUENCE_TYPES = new HashSet(); diff --git a/forester/java/src/org/forester/io/parsers/util/ParserUtils.java b/forester/java/src/org/forester/io/parsers/util/ParserUtils.java index bb89472..58a48ff 100644 --- a/forester/java/src/org/forester/io/parsers/util/ParserUtils.java +++ b/forester/java/src/org/forester/io/parsers/util/ParserUtils.java @@ -36,6 +36,7 @@ import java.io.InputStreamReader; import java.io.StringReader; import java.net.URL; import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.forester.io.parsers.PhylogenyParser; import org.forester.io.parsers.nexus.NexusPhylogeniesParser; @@ -49,6 +50,9 @@ import org.forester.util.ForesterUtil; public final class ParserUtils { + final private static Pattern TAXOMONY_CODE_PATTERN_1 = Pattern.compile( "[A-Z0-9]{5}" ); + final private static Pattern TAXOMONY_CODE_PATTERN_2 = Pattern.compile( "([A-Z0-9]{5})[^A-Z].*" ); + final public static PhylogenyParser createParserDependingFileContents( final File file, final boolean phyloxml_validate_against_xsd ) throws FileNotFoundException, IOException { @@ -218,11 +222,9 @@ public final class ParserUtils { * Return null if no code extractable. * * @param name - * @param limit_to_five * @return */ public static String extractTaxonomyCodeFromNodeName( final String name, - final boolean limit_to_five, final PhylogenyMethods.TAXONOMY_EXTRACTION taxonomy_extraction ) { if ( ( name.indexOf( "_" ) > 0 ) && ( name.length() < 31 ) @@ -234,21 +236,30 @@ public final class ParserUtils { && ( ( ( name.indexOf( "/" ) ) < 0 ) || ( name.indexOf( "/" ) > name.indexOf( "_" ) ) ) ) { final String[] s = name.split( "[_/]" ); if ( s.length > 1 ) { - String str = s[ 1 ]; - if ( ( str.length() < 6 ) || ( !limit_to_five && ( str.length() < 7 ) ) ) { - if ( ( str.length() < 5 ) && ( str.startsWith( "RAT" ) || str.startsWith( "PIG" ) ) ) { - str = str.substring( 0, 3 ); - } - final Matcher uc_letters_and_numbers = NHXParser.UC_LETTERS_NUMBERS_PATTERN.matcher( str ); - if ( !uc_letters_and_numbers.matches() ) { - return null; - } - final Matcher numbers_only = NHXParser.NUMBERS_ONLY_PATTERN.matcher( str ); - if ( numbers_only.matches() ) { - return null; - } - return str; + final String str = s[ 1 ]; + // if ( str.length() < 6 ) { + if ( ( str.length() < 5 ) && ( str.startsWith( "RAT" ) || str.startsWith( "PIG" ) ) ) { + return str.substring( 0, 3 ); + } + final Matcher m1 = TAXOMONY_CODE_PATTERN_1.matcher( str ); + if ( m1.matches() ) { + return m1.group(); + } + final Matcher m2 = TAXOMONY_CODE_PATTERN_2.matcher( str ); + if ( m2.matches() ) { + return m2.group( 1 ); } + // return null; + // final Matcher uc_letters_and_numbers = NHXParser.UC_LETTERS_NUMBERS_PATTERN.matcher( str ); + // if ( !uc_letters_and_numbers.matches() ) { + // return null; + // } + // final Matcher numbers_only = NHXParser.NUMBERS_ONLY_PATTERN.matcher( str ); + // if ( numbers_only.matches() ) { + // return null; + // } + // return str; + // } } } return null; diff --git a/forester/java/src/org/forester/phylogeny/PhylogenyMethods.java b/forester/java/src/org/forester/phylogeny/PhylogenyMethods.java index 94db898..01a4ab6 100644 --- a/forester/java/src/org/forester/phylogeny/PhylogenyMethods.java +++ b/forester/java/src/org/forester/phylogeny/PhylogenyMethods.java @@ -977,12 +977,12 @@ public class PhylogenyMethods { if ( !node.getNodeData().isHasTaxonomy() ) { return ""; } - if ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getTaxonomyCode() ) ) { - return node.getNodeData().getTaxonomy().getTaxonomyCode(); - } else if ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getScientificName() ) ) { return node.getNodeData().getTaxonomy().getScientificName(); } + if ( !ForesterUtil.isEmpty( node.getNodeData().getTaxonomy().getTaxonomyCode() ) ) { + return node.getNodeData().getTaxonomy().getTaxonomyCode(); + } else { return node.getNodeData().getTaxonomy().getCommonName(); } diff --git a/forester/java/src/org/forester/sdi/GSDI.java b/forester/java/src/org/forester/sdi/GSDI.java index 7ce94fc..780aba9 100644 --- a/forester/java/src/org/forester/sdi/GSDI.java +++ b/forester/java/src/org/forester/sdi/GSDI.java @@ -158,10 +158,8 @@ public final class GSDI extends SDI { // Determine the sum of traversals. int traversals_sum = 0; int max_traversals = 0; - PhylogenyNode max_traversals_node = null; if ( !s.isExternal() ) { - for( int i = 0; i < s.getNumberOfDescendants(); ++i ) { final PhylogenyNode current_node = s.getChildNode( i ); final int traversals = getTraversalCount( current_node ); @@ -170,7 +168,6 @@ public final class GSDI extends SDI { max_traversals = traversals; max_traversals_node = current_node; } - } } // System.out.println( " sum=" + traversals_sum ); @@ -216,15 +213,13 @@ public final class GSDI extends SDI { for( int i = 0; i < s.getNumberOfDescendants(); ++i ) { final PhylogenyNode current_node = s.getChildNode( i ); final int traversals = getTraversalCount( current_node ); - if ( traversals < min_traversals ) { min_traversals = traversals; - } } for( int i = 0; i < s.getNumberOfDescendants(); ++i ) { final PhylogenyNode current_node = s.getChildNode( i ); - _transversal_counts.put( current_node, getTraversalCount( current_node ) - min_traversals ); + _transversal_counts.put( current_node, getTraversalCount( current_node ) - min_traversals ); } } diff --git a/forester/java/src/org/forester/sdi/TestGSDI.java b/forester/java/src/org/forester/sdi/TestGSDI.java index 18ce53f..70655c6 100644 --- a/forester/java/src/org/forester/sdi/TestGSDI.java +++ b/forester/java/src/org/forester/sdi/TestGSDI.java @@ -650,574 +650,574 @@ public final class TestGSDI { if ( !TestGSDI.getEvent( g2_22, "n1", "n3" ).isSpeciationOrDuplication() ) { return false; } - final Phylogeny g2_23 = TestGSDI - .createPhylogeny( "((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),(c1[&&NHX:S=c1],d1[&&NHX:S=d1]))" ); - final GSDI sdi2_23 = new GSDI( g2_23, s2, false ); - if ( sdi2_23.getDuplicationsSum() != 0 ) { - return false; - } - if ( sdi2_23.getSpeciationOrDuplicationEventsSum() != 1 ) { - return false; - } - if ( sdi2_23.getSpeciationsSum() != 2 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_23, "a1", "b1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_23, "c1", "d1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_23, "a1", "c1" ).isSpeciationOrDuplication() ) { - return false; - } - final Phylogeny g2_24 = TestGSDI - .createPhylogeny( "((a1[&&NHX:S=a1],e1[&&NHX:S=e1]),(i1[&&NHX:S=i1],m1[&&NHX:S=m1]))" ); - final GSDI sdi2_24 = new GSDI( g2_24, s2, false ); - if ( sdi2_24.getDuplicationsSum() != 0 ) { - return false; - } - if ( sdi2_24.getSpeciationOrDuplicationEventsSum() != 1 ) { - return false; - } - if ( sdi2_24.getSpeciationsSum() != 2 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_24, "a1", "e1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_24, "i1", "m1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_24, "a1", "i1" ).isSpeciationOrDuplication() ) { - return false; - } - final Phylogeny g2_25 = TestGSDI - .createPhylogeny( "((a1[&&NHX:S=a1],a4[&&NHX:S=a4]),(b1[&&NHX:S=b1],c1[&&NHX:S=c1]))" ); - final GSDI sdi2_25 = new GSDI( g2_25, s2, false ); - if ( sdi2_25.getDuplicationsSum() != 0 ) { - return false; - } - if ( sdi2_25.getSpeciationOrDuplicationEventsSum() != 1 ) { - return false; - } - if ( sdi2_25.getSpeciationsSum() != 2 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_25, "a1", "a4" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_25, "b1", "c1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_25, "a1", "b1" ).isSpeciationOrDuplication() ) { - return false; - } - final Phylogeny g2_26 = TestGSDI - .createPhylogeny( "(((a1[&&NHX:S=a1],a4[&&NHX:S=a4]),b1[&&NHX:S=b1]),e1[&&NHX:S=e1])" ); - final GSDI sdi2_26 = new GSDI( g2_26, s2, false ); - if ( sdi2_26.getDuplicationsSum() != 0 ) { - return false; - } - if ( sdi2_26.getSpeciationOrDuplicationEventsSum() != 0 ) { - return false; - } - if ( sdi2_26.getSpeciationsSum() != 3 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_26, "a1", "a4" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_26, "a1", "b1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_26, "a1", "e1" ).isSpeciation() ) { - return false; - } - final Phylogeny g2_27 = TestGSDI - .createPhylogeny( "(((a1[&&NHX:S=a1],a4[&&NHX:S=a4]),b1[&&NHX:S=b1]),c1[&&NHX:S=c1])" ); - final GSDI sdi2_27 = new GSDI( g2_27, s2, false ); - if ( sdi2_27.getDuplicationsSum() != 0 ) { - return false; - } - if ( sdi2_27.getSpeciationOrDuplicationEventsSum() != 1 ) { - return false; - } - if ( sdi2_27.getSpeciationsSum() != 2 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_27, "a1", "a4" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_27, "a1", "b1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_27, "a1", "c1" ).isSpeciationOrDuplication() ) { - return false; - } - final Phylogeny g2_28 = TestGSDI - .createPhylogeny( "(((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),e1[&&NHX:S=e1])" ); - final GSDI sdi2_28 = new GSDI( g2_28, s2, false ); - if ( sdi2_28.getDuplicationsSum() != 0 ) { - return false; - } - if ( sdi2_28.getSpeciationOrDuplicationEventsSum() != 1 ) { - return false; - } - if ( sdi2_28.getSpeciationsSum() != 2 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_28, "a1", "b1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_28, "a1", "c1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_28, "a1", "e1" ).isSpeciation() ) { - return false; - } - final Phylogeny g2_29 = TestGSDI - .createPhylogeny( "(((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),d1[&&NHX:S=d1])" ); - final GSDI sdi2_29 = new GSDI( g2_29, s2, false ); - if ( sdi2_29.getDuplicationsSum() != 0 ) { - return false; - } - if ( sdi2_29.getSpeciationOrDuplicationEventsSum() != 2 ) { - return false; - } - if ( sdi2_29.getSpeciationsSum() != 1 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_29, "a1", "b1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_29, "a1", "c1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_29, "a1", "d1" ).isSpeciationOrDuplication() ) { - return false; - } - final Phylogeny g2_30 = TestGSDI - .createPhylogeny( "(((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),a2[&&NHX:S=a2])" ); - final GSDI sdi2_30 = new GSDI( g2_30, s2, false ); - if ( sdi2_30.getDuplicationsSum() != 1 ) { - return false; - } - if ( sdi2_30.getSpeciationOrDuplicationEventsSum() != 1 ) { - return false; - } - if ( sdi2_30.getSpeciationsSum() != 1 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_30, "a1", "b1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_30, "a1", "c1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_30, "a1", "a2" ).isDuplication() ) { - return false; - } - final Phylogeny g2_31 = TestGSDI - .createPhylogeny( "(((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),c2[&&NHX:S=c2])" ); - final GSDI sdi2_31 = new GSDI( g2_31, s2, false ); - if ( sdi2_31.getDuplicationsSum() != 1 ) { - return false; - } - if ( sdi2_31.getSpeciationOrDuplicationEventsSum() != 1 ) { - return false; - } - if ( sdi2_31.getSpeciationsSum() != 1 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_31, "a1", "b1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_31, "a1", "c1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_31, "a1", "c2" ).isDuplication() ) { - return false; - } - final Phylogeny g2_32 = TestGSDI - .createPhylogeny( "((((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2]),b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),d1[&&NHX:S=d1]),x[&&NHX:S=x]),p1[&&NHX:S=p1]),i1[&&NHX:S=i1]),e1[&&NHX:S=e1]),y[&&NHX:S=y]),z[&&NHX:S=z])" ); - final GSDI sdi2_32 = new GSDI( g2_32, s2, false ); - if ( sdi2_32.getDuplicationsSum() != 0 ) { - return false; - } - if ( sdi2_32.getSpeciationOrDuplicationEventsSum() != 7 ) { - return false; - } - if ( sdi2_32.getSpeciationsSum() != 3 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_32, "a1", "a2" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_32, "a1", "b1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_32, "a1", "c1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_32, "a1", "d1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_32, "a1", "x" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_32, "a1", "p1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_32, "a1", "i1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_32, "a1", "e1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_32, "a1", "y" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_32, "a1", "z" ).isSpeciationOrDuplication() ) { - return false; - } + final Phylogeny g2_23 = TestGSDI + .createPhylogeny( "((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),(c1[&&NHX:S=c1],d1[&&NHX:S=d1]))" ); + final GSDI sdi2_23 = new GSDI( g2_23, s2, false ); + if ( sdi2_23.getDuplicationsSum() != 0 ) { + return false; + } + if ( sdi2_23.getSpeciationOrDuplicationEventsSum() != 1 ) { + return false; + } + if ( sdi2_23.getSpeciationsSum() != 2 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_23, "a1", "b1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_23, "c1", "d1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_23, "a1", "c1" ).isSpeciationOrDuplication() ) { + return false; + } + final Phylogeny g2_24 = TestGSDI + .createPhylogeny( "((a1[&&NHX:S=a1],e1[&&NHX:S=e1]),(i1[&&NHX:S=i1],m1[&&NHX:S=m1]))" ); + final GSDI sdi2_24 = new GSDI( g2_24, s2, false ); + if ( sdi2_24.getDuplicationsSum() != 0 ) { + return false; + } + if ( sdi2_24.getSpeciationOrDuplicationEventsSum() != 1 ) { + return false; + } + if ( sdi2_24.getSpeciationsSum() != 2 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_24, "a1", "e1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_24, "i1", "m1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_24, "a1", "i1" ).isSpeciationOrDuplication() ) { + return false; + } + final Phylogeny g2_25 = TestGSDI + .createPhylogeny( "((a1[&&NHX:S=a1],a4[&&NHX:S=a4]),(b1[&&NHX:S=b1],c1[&&NHX:S=c1]))" ); + final GSDI sdi2_25 = new GSDI( g2_25, s2, false ); + if ( sdi2_25.getDuplicationsSum() != 0 ) { + return false; + } + if ( sdi2_25.getSpeciationOrDuplicationEventsSum() != 1 ) { + return false; + } + if ( sdi2_25.getSpeciationsSum() != 2 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_25, "a1", "a4" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_25, "b1", "c1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_25, "a1", "b1" ).isSpeciationOrDuplication() ) { + return false; + } + final Phylogeny g2_26 = TestGSDI + .createPhylogeny( "(((a1[&&NHX:S=a1],a4[&&NHX:S=a4]),b1[&&NHX:S=b1]),e1[&&NHX:S=e1])" ); + final GSDI sdi2_26 = new GSDI( g2_26, s2, false ); + if ( sdi2_26.getDuplicationsSum() != 0 ) { + return false; + } + if ( sdi2_26.getSpeciationOrDuplicationEventsSum() != 0 ) { + return false; + } + if ( sdi2_26.getSpeciationsSum() != 3 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_26, "a1", "a4" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_26, "a1", "b1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_26, "a1", "e1" ).isSpeciation() ) { + return false; + } + final Phylogeny g2_27 = TestGSDI + .createPhylogeny( "(((a1[&&NHX:S=a1],a4[&&NHX:S=a4]),b1[&&NHX:S=b1]),c1[&&NHX:S=c1])" ); + final GSDI sdi2_27 = new GSDI( g2_27, s2, false ); + if ( sdi2_27.getDuplicationsSum() != 0 ) { + return false; + } + if ( sdi2_27.getSpeciationOrDuplicationEventsSum() != 1 ) { + return false; + } + if ( sdi2_27.getSpeciationsSum() != 2 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_27, "a1", "a4" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_27, "a1", "b1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_27, "a1", "c1" ).isSpeciationOrDuplication() ) { + return false; + } + final Phylogeny g2_28 = TestGSDI + .createPhylogeny( "(((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),e1[&&NHX:S=e1])" ); + final GSDI sdi2_28 = new GSDI( g2_28, s2, false ); + if ( sdi2_28.getDuplicationsSum() != 0 ) { + return false; + } + if ( sdi2_28.getSpeciationOrDuplicationEventsSum() != 1 ) { + return false; + } + if ( sdi2_28.getSpeciationsSum() != 2 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_28, "a1", "b1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_28, "a1", "c1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_28, "a1", "e1" ).isSpeciation() ) { + return false; + } + final Phylogeny g2_29 = TestGSDI + .createPhylogeny( "(((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),d1[&&NHX:S=d1])" ); + final GSDI sdi2_29 = new GSDI( g2_29, s2, false ); + if ( sdi2_29.getDuplicationsSum() != 0 ) { + return false; + } + if ( sdi2_29.getSpeciationOrDuplicationEventsSum() != 2 ) { + return false; + } + if ( sdi2_29.getSpeciationsSum() != 1 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_29, "a1", "b1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_29, "a1", "c1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_29, "a1", "d1" ).isSpeciationOrDuplication() ) { + return false; + } + final Phylogeny g2_30 = TestGSDI + .createPhylogeny( "(((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),a2[&&NHX:S=a2])" ); + final GSDI sdi2_30 = new GSDI( g2_30, s2, false ); + if ( sdi2_30.getDuplicationsSum() != 1 ) { + return false; + } + if ( sdi2_30.getSpeciationOrDuplicationEventsSum() != 1 ) { + return false; + } + if ( sdi2_30.getSpeciationsSum() != 1 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_30, "a1", "b1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_30, "a1", "c1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_30, "a1", "a2" ).isDuplication() ) { + return false; + } + final Phylogeny g2_31 = TestGSDI + .createPhylogeny( "(((a1[&&NHX:S=a1],b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),c2[&&NHX:S=c2])" ); + final GSDI sdi2_31 = new GSDI( g2_31, s2, false ); + if ( sdi2_31.getDuplicationsSum() != 1 ) { + return false; + } + if ( sdi2_31.getSpeciationOrDuplicationEventsSum() != 1 ) { + return false; + } + if ( sdi2_31.getSpeciationsSum() != 1 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_31, "a1", "b1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_31, "a1", "c1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_31, "a1", "c2" ).isDuplication() ) { + return false; + } + final Phylogeny g2_32 = TestGSDI + .createPhylogeny( "((((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2]),b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),d1[&&NHX:S=d1]),x[&&NHX:S=x]),p1[&&NHX:S=p1]),i1[&&NHX:S=i1]),e1[&&NHX:S=e1]),y[&&NHX:S=y]),z[&&NHX:S=z])" ); + final GSDI sdi2_32 = new GSDI( g2_32, s2, false ); + if ( sdi2_32.getDuplicationsSum() != 0 ) { + return false; + } + if ( sdi2_32.getSpeciationOrDuplicationEventsSum() != 7 ) { + return false; + } + if ( sdi2_32.getSpeciationsSum() != 3 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_32, "a1", "a2" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_32, "a1", "b1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_32, "a1", "c1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_32, "a1", "d1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_32, "a1", "x" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_32, "a1", "p1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_32, "a1", "i1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_32, "a1", "e1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_32, "a1", "y" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_32, "a1", "z" ).isSpeciationOrDuplication() ) { + return false; + } // //- - final Phylogeny g2_33_d = TestGSDI - .createPhylogeny( "((((((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2])[&&NHX:D=N],b1[&&NHX:S=b1])[&&NHX:D=N],c1[&&NHX:S=c1])[&&NHX:D=?],d1[&&NHX:S=d1])[&&NHX:D=?],x[&&NHX:S=x])[&&NHX:D=N],p1[&&NHX:S=p1])[&&NHX:D=?],i1[&&NHX:S=i1])[&&NHX:D=?],k2[&&NHX:S=k2])[&&NHX:D=Y],e1[&&NHX:S=e1])[&&NHX:D=Y],y[&&NHX:S=y])[&&NHX:D=Y],z[&&NHX:S=z])[&&NHX:D=?],(((((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2])[&&NHX:D=N],b1[&&NHX:S=b1])[&&NHX:D=N],c1[&&NHX:S=c1])[&&NHX:D=?],d1[&&NHX:S=d1])[&&NHX:D=?],x[&&NHX:S=x])[&&NHX:D=N],p1[&&NHX:S=p1])[&&NHX:D=?],i1[&&NHX:S=i1])[&&NHX:D=?],k2[&&NHX:S=k2])[&&NHX:D=Y],e1[&&NHX:S=e1])[&&NHX:D=Y],y[&&NHX:S=y])[&&NHX:D=Y],z[&&NHX:S=z])[&&NHX:D=?])" ); - final GSDI sdi2_33_d = new GSDI( g2_33_d, s2, false ); - Archaeopteryx.createApplication( g2_33_d ); - // Archaeopteryx.createApplication( s2 ); - //- - final Phylogeny g2_33 = TestGSDI - .createPhylogeny( "(((((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2]),b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),d1[&&NHX:S=d1]),x[&&NHX:S=x]),p1[&&NHX:S=p1]),i1[&&NHX:S=i1]),k2[&&NHX:S=k2]),e1[&&NHX:S=e1]),y[&&NHX:S=y]),z[&&NHX:S=z])" ); - final GSDI sdi2_33 = new GSDI( g2_33, s2, false ); - Archaeopteryx.createApplication( g2_33 ); - // Archaeopteryx.createApplication( s2 ); - if ( sdi2_33.getDuplicationsSum() != 1 ) { - return false; - } - if ( sdi2_33.getSpeciationOrDuplicationEventsSum() != 7 ) { - return false; - } - if ( sdi2_33.getSpeciationsSum() != 3 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_33, "a1", "a2" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_33, "a1", "b1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_33, "a1", "c1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_33, "a1", "d1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_33, "a1", "x" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_33, "a1", "p1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_33, "a1", "i1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_33, "a1", "k2" ).isDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_33, "a1", "e1" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_33, "a1", "y" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_33, "a1", "z" ).isSpeciationOrDuplication() ) { - return false; - } - final Phylogeny g2_34 = TestGSDI - .createPhylogeny( "(((n1_0[&&NHX:S=n1],n2_0[&&NHX:S=n2]),(n1_1[&&NHX:S=n1],n3_0[&&NHX:S=n3])),n4_0[&&NHX:S=n4])" ); - final GSDI sdi2_34 = new GSDI( g2_34, s2, false ); - if ( sdi2_34.getDuplicationsSum() != 1 ) { - return false; - } - if ( sdi2_34.getSpeciationOrDuplicationEventsSum() != 1 ) { - return false; - } - if ( sdi2_34.getSpeciationsSum() != 2 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_34, "n1_0", "n2_0" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_34, "n1_1", "n3_0" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_34, "n1_0", "n1_1" ).isDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_34, "n1_0", "n4_0" ).isSpeciationOrDuplication() ) { - return false; - } - final Phylogeny g2_35 = TestGSDI - .createPhylogeny( "((((n1_0[&&NHX:S=n1],n2_0[&&NHX:S=n2]),(n1_1[&&NHX:S=n1],n3_0[&&NHX:S=n3])),n4_0[&&NHX:S=n4]),a1_0[&&NHX:S=a1])" ); - final GSDI sdi2_35 = new GSDI( g2_35, s2, false ); - if ( sdi2_35.getDuplicationsSum() != 1 ) { - return false; - } - if ( sdi2_35.getSpeciationOrDuplicationEventsSum() != 1 ) { - return false; - } - if ( sdi2_35.getSpeciationsSum() != 3 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_35, "n1_0", "n2_0" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_35, "n1_1", "n3_0" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_35, "n1_0", "n1_1" ).isDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_35, "n1_0", "n4_0" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_35, "n1_0", "a1_0" ).isSpeciation() ) { - return false; - } - final Phylogeny g2_36 = TestGSDI - .createPhylogeny( "(((a1_0[&&NHX:S=a1],b1_0[&&NHX:S=b1]),(a1_1[&&NHX:S=a1],c1_0[&&NHX:S=c1])),d1_0[&&NHX:S=d1])" ); - final GSDI sdi2_36 = new GSDI( g2_36, s2, false ); - if ( sdi2_36.getDuplicationsSum() != 1 ) { - return false; - } - if ( sdi2_36.getSpeciationOrDuplicationEventsSum() != 1 ) { - return false; - } - if ( sdi2_36.getSpeciationsSum() != 2 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_36, "a1_0", "b1_0" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_36, "a1_1", "c1_0" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_36, "a1_0", "c1_0" ).isDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_36, "a1_0", "d1_0" ).isSpeciationOrDuplication() ) { - return false; - } - final Phylogeny g2_37 = TestGSDI - .createPhylogeny( "(((a1_0[&&NHX:S=a1],b1_0[&&NHX:S=b1]),(a2_0[&&NHX:S=a2],c1_0[&&NHX:S=c1])),d1_0[&&NHX:S=d1])" ); - final GSDI sdi2_37 = new GSDI( g2_37, s2, false ); - if ( sdi2_37.getDuplicationsSum() != 1 ) { - return false; - } - if ( sdi2_37.getSpeciationOrDuplicationEventsSum() != 1 ) { - return false; - } - if ( sdi2_37.getSpeciationsSum() != 2 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_37, "a1_0", "b1_0" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_37, "a2_0", "c1_0" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_37, "a1_0", "c1_0" ).isDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_37, "a1_0", "d1_0" ).isSpeciationOrDuplication() ) { - return false; - } - final Phylogeny g2_38 = TestGSDI - .createPhylogeny( "(((([&&NHX:S=n1],[&&NHX:S=n1]),([&&NHX:S=n1],[&&NHX:S=n1])),[&&NHX:S=n1]),[&&NHX:S=n1])" ); - final GSDI sdi2_38 = new GSDI( g2_38, s2, false ); - if ( sdi2_38.getDuplicationsSum() != 5 ) { - return false; - } - if ( sdi2_38.getSpeciationOrDuplicationEventsSum() != 0 ) { - return false; - } - if ( sdi2_38.getSpeciationsSum() != 0 ) { - return false; - } - final Phylogeny g2_100 = TestGSDI - .createPhylogeny( "(((e1[&&NHX:S=e1],f2[&&NHX:S=f2]),(d3[&&NHX:S=d3],g4[&&NHX:S=g4])),(((a1[&&NHX:S=a1],h2[&&NHX:S=h2]),c3[&&NHX:S=c3]),(i4[&&NHX:S=i4],b1[&&NHX:S=b1])))" ); - final GSDI sdi2_100 = new GSDI( g2_100, s2, false ); - if ( sdi2_100.getDuplicationsSum() != 4 ) { - return false; - } - if ( sdi2_100.getSpeciationOrDuplicationEventsSum() != 0 ) { - return false; - } - if ( sdi2_100.getSpeciationsSum() != 4 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_100, "e1", "f2" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_100, "d3", "g4" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_100, "e1", "d3" ).isDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_100, "a1", "h2" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_100, "a1", "c3" ).isDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_100, "i4", "b1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_100, "a1", "i4" ).isDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_100, "e1", "a1" ).isDuplication() ) { - return false; - } - final Phylogeny g2_101 = TestGSDI - .createPhylogeny( "(((e1[&&NHX:S=e1],f2[&&NHX:S=f2]),(d3[&&NHX:S=d3],g4[&&NHX:S=g4])),(((a1[&&NHX:S=a1],b2[&&NHX:S=b2]),c3[&&NHX:S=c3]),(i4[&&NHX:S=i4],j1[&&NHX:S=j1])))" ); - final GSDI sdi2_101 = new GSDI( g2_101, s2, false ); - if ( sdi2_101.getDuplicationsSum() != 2 ) { - return false; - } - if ( sdi2_101.getSpeciationOrDuplicationEventsSum() != 1 ) { - return false; - } - if ( sdi2_101.getSpeciationsSum() != 5 ) { - return false; - } - if ( !TestGSDI.getEvent( g2_101, "e1", "f2" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_101, "d3", "g4" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_101, "e1", "d3" ).isDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_101, "a1", "b2" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_101, "a1", "c3" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_101, "i4", "j1" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_101, "a1", "i4" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g2_101, "e1", "a1" ).isDuplication() ) { - return false; - } - final Phylogeny s_7_4 = DevelopmentTools.createBalancedPhylogeny( 7, 4 ); - DevelopmentTools.numberSpeciesInOrder( s_7_4 ); - final Phylogeny g_7_4_1 = TestGSDI - .createPhylogeny( "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" - + "1[&&NHX:S=1],2[&&NHX:S=2]),3[&&NHX:S=3]),4[&&NHX:S=4]),5[&&NHX:S=5])," - + "6[&&NHX:S=6]),7[&&NHX:S=7]),8[&&NHX:S=8]),9[&&NHX:S=9]),10[&&NHX:S=10]),11[&&NHX:S=11])," - + "12[&&NHX:S=12]),13[&&NHX:S=13]),14[&&NHX:S=14]),15[&&NHX:S=15]),16[&&NHX:S=16]),17[&&NHX:S=17])," - + "18[&&NHX:S=18]),19[&&NHX:S=19]),20[&&NHX:S=20]),21[&&NHX:S=21]),22[&&NHX:S=22]),23[&&NHX:S=23])," - + "24[&&NHX:S=24]),25[&&NHX:S=25]),26[&&NHX:S=26]),27[&&NHX:S=27]),28[&&NHX:S=28]),29[&&NHX:S=29])," - + "30[&&NHX:S=30]),31[&&NHX:S=31]),32[&&NHX:S=32]),33[&&NHX:S=33]),34[&&NHX:S=34]),35[&&NHX:S=35])," - + "36[&&NHX:S=36]),37[&&NHX:S=37]),38[&&NHX:S=38]),39[&&NHX:S=39]),40[&&NHX:S=40]),41[&&NHX:S=41])," - + "42[&&NHX:S=42]),43[&&NHX:S=43]),44[&&NHX:S=44]),45[&&NHX:S=45]),46[&&NHX:S=46]),47[&&NHX:S=47])," - + "48[&&NHX:S=48]),49[&&NHX:S=49]),50[&&NHX:S=50]),51[&&NHX:S=51]),52[&&NHX:S=52]),53[&&NHX:S=53])," - + "54[&&NHX:S=54]),55[&&NHX:S=55]),56[&&NHX:S=56]),57[&&NHX:S=57]),58[&&NHX:S=58]),59[&&NHX:S=59])," - + "60[&&NHX:S=60]),61[&&NHX:S=61]),62[&&NHX:S=62]),63[&&NHX:S=63]),64[&&NHX:S=64]),65[&&NHX:S=65])" ); - final GSDI sdi7_4_1 = new GSDI( g_7_4_1, s_7_4, false ); - if ( sdi7_4_1.getDuplicationsSum() != 54 ) { - return false; - } - if ( sdi7_4_1.getSpeciationOrDuplicationEventsSum() != 6 ) { - return false; - } - if ( sdi7_4_1.getSpeciationsSum() != 4 ) { - return false; - } - if ( !TestGSDI.getEvent( g_7_4_1, "1", "2" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g_7_4_1, "1", "3" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g_7_4_1, "1", "4" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g_7_4_1, "1", "5" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g_7_4_1, "1", "6" ).isDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g_7_4_1, "1", "9" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g_7_4_1, "1", "13" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g_7_4_1, "1", "17" ).isSpeciation() ) { - return false; - } - if ( !TestGSDI.getEvent( g_7_4_1, "1", "33" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g_7_4_1, "1", "49" ).isSpeciationOrDuplication() ) { - return false; - } - if ( !TestGSDI.getEvent( g_7_4_1, "1", "65" ).isSpeciation() ) { - return false; - } - final Phylogeny g_7_4_2 = TestGSDI - .createPhylogeny( "(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" - + "1[&&NHX:S=1],2[&&NHX:S=2]),3[&&NHX:S=3]),4[&&NHX:S=4]),5[&&NHX:S=5])," - + "6[&&NHX:S=6]),7[&&NHX:S=7]),8[&&NHX:S=8]),9[&&NHX:S=9]),10[&&NHX:S=10]),11[&&NHX:S=11])," - + "12[&&NHX:S=12]),13[&&NHX:S=13]),14[&&NHX:S=14]),15[&&NHX:S=15]),16[&&NHX:S=16]),17[&&NHX:S=17])," - + "18[&&NHX:S=18]),19[&&NHX:S=19]),20[&&NHX:S=20]),21[&&NHX:S=21]),22[&&NHX:S=22]),23[&&NHX:S=23])," - + "24[&&NHX:S=24]),25[&&NHX:S=25]),26[&&NHX:S=26]),27[&&NHX:S=27]),28[&&NHX:S=28]),29[&&NHX:S=29])," - + "30[&&NHX:S=30]),31[&&NHX:S=31]),32[&&NHX:S=32]),33[&&NHX:S=33]),34[&&NHX:S=34]),35[&&NHX:S=35])," - + "36[&&NHX:S=36]),37[&&NHX:S=37]),38[&&NHX:S=38]),39[&&NHX:S=39]),40[&&NHX:S=40]),41[&&NHX:S=41])," - + "42[&&NHX:S=42]),43[&&NHX:S=43]),44[&&NHX:S=44]),45[&&NHX:S=45]),46[&&NHX:S=46]),47[&&NHX:S=47])," - + "48[&&NHX:S=48]),49[&&NHX:S=49]),50[&&NHX:S=50]),51[&&NHX:S=51]),52[&&NHX:S=52]),53[&&NHX:S=53])," - + "54[&&NHX:S=54]),55[&&NHX:S=55]),56[&&NHX:S=56]),57[&&NHX:S=57]),58[&&NHX:S=58]),59[&&NHX:S=59])," - + "60[&&NHX:S=60]),61[&&NHX:S=61]),62[&&NHX:S=62]),63[&&NHX:S=63]),64[&&NHX:S=64]),65[&&NHX:S=65])," - + "66[&&NHX:S=66]),257[&&NHX:S=257]),258[&&NHX:S=258]),513[&&NHX:S=513]),514[&&NHX:S=514]),769[&&NHX:S=769]),770[&&NHX:S=770])" ); - final GSDI sdi7_4_2 = new GSDI( g_7_4_2, s_7_4, false ); - if ( sdi7_4_2.getDuplicationsSum() != 58 ) { - return false; - } - if ( sdi7_4_2.getSpeciationOrDuplicationEventsSum() != 8 ) { - return false; - } - if ( sdi7_4_2.getSpeciationsSum() != 5 ) { - return false; - } + final Phylogeny g2_33_d = TestGSDI + .createPhylogeny( "((((((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2])[&&NHX:D=N],b1[&&NHX:S=b1])[&&NHX:D=N],c1[&&NHX:S=c1])[&&NHX:D=?],d1[&&NHX:S=d1])[&&NHX:D=?],x[&&NHX:S=x])[&&NHX:D=N],p1[&&NHX:S=p1])[&&NHX:D=?],i1[&&NHX:S=i1])[&&NHX:D=?],k2[&&NHX:S=k2])[&&NHX:D=Y],e1[&&NHX:S=e1])[&&NHX:D=Y],y[&&NHX:S=y])[&&NHX:D=Y],z[&&NHX:S=z])[&&NHX:D=?],(((((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2])[&&NHX:D=N],b1[&&NHX:S=b1])[&&NHX:D=N],c1[&&NHX:S=c1])[&&NHX:D=?],d1[&&NHX:S=d1])[&&NHX:D=?],x[&&NHX:S=x])[&&NHX:D=N],p1[&&NHX:S=p1])[&&NHX:D=?],i1[&&NHX:S=i1])[&&NHX:D=?],k2[&&NHX:S=k2])[&&NHX:D=Y],e1[&&NHX:S=e1])[&&NHX:D=Y],y[&&NHX:S=y])[&&NHX:D=Y],z[&&NHX:S=z])[&&NHX:D=?])" ); + final GSDI sdi2_33_d = new GSDI( g2_33_d, s2, false ); + Archaeopteryx.createApplication( g2_33_d ); + // Archaeopteryx.createApplication( s2 ); + //- + final Phylogeny g2_33 = TestGSDI + .createPhylogeny( "(((((((((((a1[&&NHX:S=a1],a2[&&NHX:S=a2]),b1[&&NHX:S=b1]),c1[&&NHX:S=c1]),d1[&&NHX:S=d1]),x[&&NHX:S=x]),p1[&&NHX:S=p1]),i1[&&NHX:S=i1]),k2[&&NHX:S=k2]),e1[&&NHX:S=e1]),y[&&NHX:S=y]),z[&&NHX:S=z])" ); + final GSDI sdi2_33 = new GSDI( g2_33, s2, false ); + Archaeopteryx.createApplication( g2_33 ); + // Archaeopteryx.createApplication( s2 ); + if ( sdi2_33.getDuplicationsSum() != 1 ) { + return false; + } + if ( sdi2_33.getSpeciationOrDuplicationEventsSum() != 7 ) { + return false; + } + if ( sdi2_33.getSpeciationsSum() != 3 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_33, "a1", "a2" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_33, "a1", "b1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_33, "a1", "c1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_33, "a1", "d1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_33, "a1", "x" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_33, "a1", "p1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_33, "a1", "i1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_33, "a1", "k2" ).isDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_33, "a1", "e1" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_33, "a1", "y" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_33, "a1", "z" ).isSpeciationOrDuplication() ) { + return false; + } + final Phylogeny g2_34 = TestGSDI + .createPhylogeny( "(((n1_0[&&NHX:S=n1],n2_0[&&NHX:S=n2]),(n1_1[&&NHX:S=n1],n3_0[&&NHX:S=n3])),n4_0[&&NHX:S=n4])" ); + final GSDI sdi2_34 = new GSDI( g2_34, s2, false ); + if ( sdi2_34.getDuplicationsSum() != 1 ) { + return false; + } + if ( sdi2_34.getSpeciationOrDuplicationEventsSum() != 1 ) { + return false; + } + if ( sdi2_34.getSpeciationsSum() != 2 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_34, "n1_0", "n2_0" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_34, "n1_1", "n3_0" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_34, "n1_0", "n1_1" ).isDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_34, "n1_0", "n4_0" ).isSpeciationOrDuplication() ) { + return false; + } + final Phylogeny g2_35 = TestGSDI + .createPhylogeny( "((((n1_0[&&NHX:S=n1],n2_0[&&NHX:S=n2]),(n1_1[&&NHX:S=n1],n3_0[&&NHX:S=n3])),n4_0[&&NHX:S=n4]),a1_0[&&NHX:S=a1])" ); + final GSDI sdi2_35 = new GSDI( g2_35, s2, false ); + if ( sdi2_35.getDuplicationsSum() != 1 ) { + return false; + } + if ( sdi2_35.getSpeciationOrDuplicationEventsSum() != 1 ) { + return false; + } + if ( sdi2_35.getSpeciationsSum() != 3 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_35, "n1_0", "n2_0" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_35, "n1_1", "n3_0" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_35, "n1_0", "n1_1" ).isDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_35, "n1_0", "n4_0" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_35, "n1_0", "a1_0" ).isSpeciation() ) { + return false; + } + final Phylogeny g2_36 = TestGSDI + .createPhylogeny( "(((a1_0[&&NHX:S=a1],b1_0[&&NHX:S=b1]),(a1_1[&&NHX:S=a1],c1_0[&&NHX:S=c1])),d1_0[&&NHX:S=d1])" ); + final GSDI sdi2_36 = new GSDI( g2_36, s2, false ); + if ( sdi2_36.getDuplicationsSum() != 1 ) { + return false; + } + if ( sdi2_36.getSpeciationOrDuplicationEventsSum() != 1 ) { + return false; + } + if ( sdi2_36.getSpeciationsSum() != 2 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_36, "a1_0", "b1_0" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_36, "a1_1", "c1_0" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_36, "a1_0", "c1_0" ).isDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_36, "a1_0", "d1_0" ).isSpeciationOrDuplication() ) { + return false; + } + final Phylogeny g2_37 = TestGSDI + .createPhylogeny( "(((a1_0[&&NHX:S=a1],b1_0[&&NHX:S=b1]),(a2_0[&&NHX:S=a2],c1_0[&&NHX:S=c1])),d1_0[&&NHX:S=d1])" ); + final GSDI sdi2_37 = new GSDI( g2_37, s2, false ); + if ( sdi2_37.getDuplicationsSum() != 1 ) { + return false; + } + if ( sdi2_37.getSpeciationOrDuplicationEventsSum() != 1 ) { + return false; + } + if ( sdi2_37.getSpeciationsSum() != 2 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_37, "a1_0", "b1_0" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_37, "a2_0", "c1_0" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_37, "a1_0", "c1_0" ).isDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_37, "a1_0", "d1_0" ).isSpeciationOrDuplication() ) { + return false; + } + final Phylogeny g2_38 = TestGSDI + .createPhylogeny( "(((([&&NHX:S=n1],[&&NHX:S=n1]),([&&NHX:S=n1],[&&NHX:S=n1])),[&&NHX:S=n1]),[&&NHX:S=n1])" ); + final GSDI sdi2_38 = new GSDI( g2_38, s2, false ); + if ( sdi2_38.getDuplicationsSum() != 5 ) { + return false; + } + if ( sdi2_38.getSpeciationOrDuplicationEventsSum() != 0 ) { + return false; + } + if ( sdi2_38.getSpeciationsSum() != 0 ) { + return false; + } + final Phylogeny g2_100 = TestGSDI + .createPhylogeny( "(((e1[&&NHX:S=e1],f2[&&NHX:S=f2]),(d3[&&NHX:S=d3],g4[&&NHX:S=g4])),(((a1[&&NHX:S=a1],h2[&&NHX:S=h2]),c3[&&NHX:S=c3]),(i4[&&NHX:S=i4],b1[&&NHX:S=b1])))" ); + final GSDI sdi2_100 = new GSDI( g2_100, s2, false ); + if ( sdi2_100.getDuplicationsSum() != 4 ) { + return false; + } + if ( sdi2_100.getSpeciationOrDuplicationEventsSum() != 0 ) { + return false; + } + if ( sdi2_100.getSpeciationsSum() != 4 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_100, "e1", "f2" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_100, "d3", "g4" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_100, "e1", "d3" ).isDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_100, "a1", "h2" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_100, "a1", "c3" ).isDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_100, "i4", "b1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_100, "a1", "i4" ).isDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_100, "e1", "a1" ).isDuplication() ) { + return false; + } + final Phylogeny g2_101 = TestGSDI + .createPhylogeny( "(((e1[&&NHX:S=e1],f2[&&NHX:S=f2]),(d3[&&NHX:S=d3],g4[&&NHX:S=g4])),(((a1[&&NHX:S=a1],b2[&&NHX:S=b2]),c3[&&NHX:S=c3]),(i4[&&NHX:S=i4],j1[&&NHX:S=j1])))" ); + final GSDI sdi2_101 = new GSDI( g2_101, s2, false ); + if ( sdi2_101.getDuplicationsSum() != 2 ) { + return false; + } + if ( sdi2_101.getSpeciationOrDuplicationEventsSum() != 1 ) { + return false; + } + if ( sdi2_101.getSpeciationsSum() != 5 ) { + return false; + } + if ( !TestGSDI.getEvent( g2_101, "e1", "f2" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_101, "d3", "g4" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_101, "e1", "d3" ).isDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_101, "a1", "b2" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_101, "a1", "c3" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_101, "i4", "j1" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_101, "a1", "i4" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g2_101, "e1", "a1" ).isDuplication() ) { + return false; + } + final Phylogeny s_7_4 = DevelopmentTools.createBalancedPhylogeny( 7, 4 ); + DevelopmentTools.numberSpeciesInOrder( s_7_4 ); + final Phylogeny g_7_4_1 = TestGSDI + .createPhylogeny( "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "1[&&NHX:S=1],2[&&NHX:S=2]),3[&&NHX:S=3]),4[&&NHX:S=4]),5[&&NHX:S=5])," + + "6[&&NHX:S=6]),7[&&NHX:S=7]),8[&&NHX:S=8]),9[&&NHX:S=9]),10[&&NHX:S=10]),11[&&NHX:S=11])," + + "12[&&NHX:S=12]),13[&&NHX:S=13]),14[&&NHX:S=14]),15[&&NHX:S=15]),16[&&NHX:S=16]),17[&&NHX:S=17])," + + "18[&&NHX:S=18]),19[&&NHX:S=19]),20[&&NHX:S=20]),21[&&NHX:S=21]),22[&&NHX:S=22]),23[&&NHX:S=23])," + + "24[&&NHX:S=24]),25[&&NHX:S=25]),26[&&NHX:S=26]),27[&&NHX:S=27]),28[&&NHX:S=28]),29[&&NHX:S=29])," + + "30[&&NHX:S=30]),31[&&NHX:S=31]),32[&&NHX:S=32]),33[&&NHX:S=33]),34[&&NHX:S=34]),35[&&NHX:S=35])," + + "36[&&NHX:S=36]),37[&&NHX:S=37]),38[&&NHX:S=38]),39[&&NHX:S=39]),40[&&NHX:S=40]),41[&&NHX:S=41])," + + "42[&&NHX:S=42]),43[&&NHX:S=43]),44[&&NHX:S=44]),45[&&NHX:S=45]),46[&&NHX:S=46]),47[&&NHX:S=47])," + + "48[&&NHX:S=48]),49[&&NHX:S=49]),50[&&NHX:S=50]),51[&&NHX:S=51]),52[&&NHX:S=52]),53[&&NHX:S=53])," + + "54[&&NHX:S=54]),55[&&NHX:S=55]),56[&&NHX:S=56]),57[&&NHX:S=57]),58[&&NHX:S=58]),59[&&NHX:S=59])," + + "60[&&NHX:S=60]),61[&&NHX:S=61]),62[&&NHX:S=62]),63[&&NHX:S=63]),64[&&NHX:S=64]),65[&&NHX:S=65])" ); + final GSDI sdi7_4_1 = new GSDI( g_7_4_1, s_7_4, false ); + if ( sdi7_4_1.getDuplicationsSum() != 54 ) { + return false; + } + if ( sdi7_4_1.getSpeciationOrDuplicationEventsSum() != 6 ) { + return false; + } + if ( sdi7_4_1.getSpeciationsSum() != 4 ) { + return false; + } + if ( !TestGSDI.getEvent( g_7_4_1, "1", "2" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g_7_4_1, "1", "3" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g_7_4_1, "1", "4" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g_7_4_1, "1", "5" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g_7_4_1, "1", "6" ).isDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g_7_4_1, "1", "9" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g_7_4_1, "1", "13" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g_7_4_1, "1", "17" ).isSpeciation() ) { + return false; + } + if ( !TestGSDI.getEvent( g_7_4_1, "1", "33" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g_7_4_1, "1", "49" ).isSpeciationOrDuplication() ) { + return false; + } + if ( !TestGSDI.getEvent( g_7_4_1, "1", "65" ).isSpeciation() ) { + return false; + } + final Phylogeny g_7_4_2 = TestGSDI + .createPhylogeny( "(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "1[&&NHX:S=1],2[&&NHX:S=2]),3[&&NHX:S=3]),4[&&NHX:S=4]),5[&&NHX:S=5])," + + "6[&&NHX:S=6]),7[&&NHX:S=7]),8[&&NHX:S=8]),9[&&NHX:S=9]),10[&&NHX:S=10]),11[&&NHX:S=11])," + + "12[&&NHX:S=12]),13[&&NHX:S=13]),14[&&NHX:S=14]),15[&&NHX:S=15]),16[&&NHX:S=16]),17[&&NHX:S=17])," + + "18[&&NHX:S=18]),19[&&NHX:S=19]),20[&&NHX:S=20]),21[&&NHX:S=21]),22[&&NHX:S=22]),23[&&NHX:S=23])," + + "24[&&NHX:S=24]),25[&&NHX:S=25]),26[&&NHX:S=26]),27[&&NHX:S=27]),28[&&NHX:S=28]),29[&&NHX:S=29])," + + "30[&&NHX:S=30]),31[&&NHX:S=31]),32[&&NHX:S=32]),33[&&NHX:S=33]),34[&&NHX:S=34]),35[&&NHX:S=35])," + + "36[&&NHX:S=36]),37[&&NHX:S=37]),38[&&NHX:S=38]),39[&&NHX:S=39]),40[&&NHX:S=40]),41[&&NHX:S=41])," + + "42[&&NHX:S=42]),43[&&NHX:S=43]),44[&&NHX:S=44]),45[&&NHX:S=45]),46[&&NHX:S=46]),47[&&NHX:S=47])," + + "48[&&NHX:S=48]),49[&&NHX:S=49]),50[&&NHX:S=50]),51[&&NHX:S=51]),52[&&NHX:S=52]),53[&&NHX:S=53])," + + "54[&&NHX:S=54]),55[&&NHX:S=55]),56[&&NHX:S=56]),57[&&NHX:S=57]),58[&&NHX:S=58]),59[&&NHX:S=59])," + + "60[&&NHX:S=60]),61[&&NHX:S=61]),62[&&NHX:S=62]),63[&&NHX:S=63]),64[&&NHX:S=64]),65[&&NHX:S=65])," + + "66[&&NHX:S=66]),257[&&NHX:S=257]),258[&&NHX:S=258]),513[&&NHX:S=513]),514[&&NHX:S=514]),769[&&NHX:S=769]),770[&&NHX:S=770])" ); + final GSDI sdi7_4_2 = new GSDI( g_7_4_2, s_7_4, false ); + if ( sdi7_4_2.getDuplicationsSum() != 58 ) { + return false; + } + if ( sdi7_4_2.getSpeciationOrDuplicationEventsSum() != 8 ) { + return false; + } + if ( sdi7_4_2.getSpeciationsSum() != 5 ) { + return false; + } //--------------------- -// final String g2_0_ = -// "(([&&NHX:S=a1],[&&NHX:S=a2]),([&&NHX:S=o2],[&&NHX:S=o4]))"; -// final Phylogeny g2_0 = factory.create( g2_0_, new NHXParser() )[ -// 0 ]; -// g2_0.setRooted( true ); -// final GSDI sdi2_0 = new GSDI( g2_0, s2, false ); -// if ( sdi2_0.getDuplicationsSum() != 0 ) { -// return false; -// } -// final String g2_1_= ""; -// final Phylogeny g2_1 = factory.create( g2_1_, new NHXParser() )[ -// 0 ]; -// g2_1.setRooted( true ); -// final GSDI sdi2_1 = new GSDI( g2_1, s2, false ); -// if ( sdi2_1.getDuplicationsSum() != 0 ) { -// return false; -// } + // final String g2_0_ = + // "(([&&NHX:S=a1],[&&NHX:S=a2]),([&&NHX:S=o2],[&&NHX:S=o4]))"; + // final Phylogeny g2_0 = factory.create( g2_0_, new NHXParser() )[ + // 0 ]; + // g2_0.setRooted( true ); + // final GSDI sdi2_0 = new GSDI( g2_0, s2, false ); + // if ( sdi2_0.getDuplicationsSum() != 0 ) { + // return false; + // } + // final String g2_1_= ""; + // final Phylogeny g2_1 = factory.create( g2_1_, new NHXParser() )[ + // 0 ]; + // g2_1.setRooted( true ); + // final GSDI sdi2_1 = new GSDI( g2_1, s2, false ); + // if ( sdi2_1.getDuplicationsSum() != 0 ) { + // return false; + // } } catch ( final Exception e ) { e.printStackTrace( System.out ); diff --git a/forester/java/src/org/forester/test/Test.java b/forester/java/src/org/forester/test/Test.java index d1ab3bb..452be95 100644 --- a/forester/java/src/org/forester/test/Test.java +++ b/forester/java/src/org/forester/test/Test.java @@ -2123,7 +2123,7 @@ public final class Test { return false; } t2.setIdentifier( new Identifier( "ecoli" ) ); - t2.setTaxonomyCode( "other" ); + t2.setTaxonomyCode( "OTHER" ); t2.setScientificName( "what" ); t2.setCommonName( "something" ); if ( !t1.isEqual( t2 ) ) { @@ -4706,69 +4706,81 @@ public final class Test { 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( "" ) ) { - 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( "" ) ) { - return false; - } - final PhylogenyNode c1 = PhylogenyNode - .createInstanceFromNhxString( "n10_BOVIN_1/1000-2000", - PhylogenyMethods.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", - PhylogenyMethods.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", - 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", 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 c1 = PhylogenyNode + .createInstanceFromNhxString( "n10_BOVIN_1/1000-2000", + PhylogenyMethods.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", + PhylogenyMethods.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", 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 e2 = PhylogenyNode + .createInstanceFromNhxString( "n10_RAT1", PhylogenyMethods.TAXONOMY_EXTRACTION.YES ); + if ( !e2.getName().equals( "n10_RAT1" ) ) { + return false; + } + if ( !PhylogenyMethods.getSpecies( e2 ).equals( "RAT" ) ) { + return false; + } + final PhylogenyNode e3 = PhylogenyNode + .createInstanceFromNhxString( "n10_RAT~", PhylogenyMethods.TAXONOMY_EXTRACTION.YES ); + 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", @@ -4794,6 +4806,22 @@ public final class Test { if ( PhylogenyMethods.getSpecies( n12 ).length() > 0 ) { return false; } + final PhylogenyNode m = PhylogenyNode + .createInstanceFromNhxString( "n10_MOUSEa", PhylogenyMethods.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_", PhylogenyMethods.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" ) ) { @@ -4878,7 +4906,7 @@ public final class Test { 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 -- 1.7.10.2