+ if ( !t1_rt.isRooted() ) {
+ return false;
+ }
+ if ( t1_rt.isRerootable() ) {
+ return false;
+ }
+ if ( !t1_rt.getType().equals( "gene_tree" ) ) {
+ return false;
+ }
+ final StringBuffer t2_sb = new StringBuffer( phylogenies_0[ 1 ].toPhyloXML( 0 ) );
+ final Phylogeny[] phylogenies_t2 = factory.create( t2_sb, xml_parser );
+ final Phylogeny t2_rt = phylogenies_t2[ 0 ];
+ if ( t2_rt.getNode( "node a" ).getNodeData().getTaxonomies().size() != 2 ) {
+ return false;
+ }
+ if ( !t2_rt.getNode( "node a" ).getNodeData().getTaxonomy( 0 ).getCommonName().equals( "some parasite" ) ) {
+ return false;
+ }
+ if ( !t2_rt.getNode( "node a" ).getNodeData().getTaxonomy( 1 ).getCommonName().equals( "the host" ) ) {
+ return false;
+ }
+ if ( t2_rt.getNode( "node a" ).getNodeData().getSequences().size() != 2 ) {
+ return false;
+ }
+ if ( !t2_rt.getNode( "node a" ).getNodeData().getSequence( 0 ).getMolecularSequence()
+ .startsWith( "actgtgggggt" ) ) {
+ return false;
+ }
+ if ( !t2_rt.getNode( "node a" ).getNodeData().getSequence( 1 ).getMolecularSequence()
+ .startsWith( "ctgtgatgcat" ) ) {
+ return false;
+ }
+ final StringBuffer t3_sb_0 = new StringBuffer( phylogenies_0[ 2 ].toPhyloXML( 0 ) );
+ final Phylogeny[] phylogenies_1_0 = factory.create( t3_sb_0, xml_parser );
+ final StringBuffer t3_sb = new StringBuffer( phylogenies_1_0[ 0 ].toPhyloXML( 0 ) );
+ final Phylogeny[] phylogenies_1 = factory.create( t3_sb, xml_parser );
+ if ( phylogenies_1.length != 1 ) {
+ return false;
+ }
+ final Phylogeny t3_rt = phylogenies_1[ 0 ];
+ if ( !t3_rt.getName().equals( "t3" ) ) {
+ return false;
+ }
+ if ( t3_rt.getNumberOfExternalNodes() != 4 ) {
+ return false;
+ }
+ if ( !t3_rt.getIdentifier().getValue().equals( "1-1" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getIdentifier().getProvider().equals( "treebank" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "root node" ).getNodeData().getSequence().getType().equals( "protein" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "root node" ).getNodeData().getSequence().getName()
+ .equals( "Apoptosis facilitator Bcl-2-like 14 protein" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "root node" ).getNodeData().getSequence().getSymbol().equals( "BCL2L14" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "root node" ).getNodeData().getSequence().getAccession().getValue()
+ .equals( "Q9BZR8" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "root node" ).getNodeData().getSequence().getAccession().getSource()
+ .equals( "UniProtKB" ) ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getDesc()
+ .equals( "apoptosis" ) ) {
+ return false;
+ }
+ 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( 2 ) ).getSource()
+ .equals( "UniProtKB" ) ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getEvidence()
+ .equals( "experimental" ) ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getType()
+ .equals( "function" ) ) {
+ return false;
+ }
+ if ( ( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getConfidence()
+ .getValue() != 1 ) {
+ return false;
+ }
+ 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( 2 ) ).getDesc()
+ .equals( "apoptosis" ) ) {
+ return false;
+ }
+ if ( ( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
+ .getProperties( "AFFY:expression" ).get( 0 ).getAppliesTo() != AppliesTo.ANNOTATION ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
+ .getProperties( "AFFY:expression" ).get( 0 ).getDataType().equals( "xsd:double" ) ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
+ .getProperties( "AFFY:expression" ).get( 0 ).getRef().equals( "AFFY:expression" ) ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
+ .getProperties( "AFFY:expression" ).get( 0 ).getUnit().equals( "AFFY:x" ) ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
+ .getProperties( "AFFY:expression" ).get( 0 ).getValue().equals( "0.2" ) ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getAnnotation( 2 ) ).getProperties()
+ .getProperties( "MED:disease" ).get( 0 ).getValue().equals( "lymphoma" ) ) {
+ return false;
+ }
+ 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( 0 ) ).getDesc()
+ .equals( "intracellular organelle" ) ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getUri( 0 ).getType()
+ .equals( "source" ) ) ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getUri( 0 ).getDescription()
+ .equals( "UniProt link" ) ) ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getSequence().getLocation().equals( "12p13-p12" ) ) ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getReference().getDoi()
+ .equals( "10.1038/387489a0" ) ) ) {
+ return false;
+ }
+ if ( !( t3_rt.getNode( "root node" ).getNodeData().getReference().getDescription()
+ .equals( "Aguinaldo, A. M. A.; J. M. Turbeville, L. S. Linford, M. C. Rivera, J. R. Garey, R. A. Raff, & J. A. Lake (1997). \"Evidence for a clade of nematodes, arthropods and other moulting animals\". Nature 387 (6632): 489–493." ) ) ) {
+ System.out.println( t3_rt.getNode( "root node" ).getNodeData().getReference().getDescription() );
+ return false;
+ }
+ if ( !t3_rt.getNode( "root node" ).getNodeData().getTaxonomy().getTaxonomyCode().equals( "ECDYS" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "root node" ).getNodeData().getTaxonomy().getScientificName().equals( "ecdysozoa" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "root node" ).getNodeData().getTaxonomy().getCommonName()
+ .equals( "molting animals" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "root node" ).getNodeData().getTaxonomy().getIdentifier().getValue().equals( "1" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "root node" ).getNodeData().getTaxonomy().getIdentifier().getProvider()
+ .equals( "ncbi" ) ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture()
+ .getTotalLength() != 124 ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getDomain( 0 )
+ .getName().equals( "B" ) ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getDomain( 0 )
+ .getFrom() != 21 ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getDomain( 0 )
+ .getTo() != 44 ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getDomain( 0 )
+ .getLength() != 24 ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getDomain( 0 )
+ .getConfidence() != 0 ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "node bc" ).getNodeData().getSequence().getDomainArchitecture().getDomain( 0 ).getId()
+ .equals( "pfam" ) ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node bb" ).getNodeData().getBinaryCharacters().getGainedCharacters().size() != 3 ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node bb" ).getNodeData().getBinaryCharacters().getPresentCharacters().size() != 2 ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node bb" ).getNodeData().getBinaryCharacters().getLostCharacters().size() != 1 ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "node bb" ).getNodeData().getBinaryCharacters().getType().equals( "domains" ) ) {
+ return false;
+ }
+ final Taxonomy taxbb = t3_rt.getNode( "node bb" ).getNodeData().getTaxonomy();
+ if ( !taxbb.getAuthority().equals( "Stephenson, 1935" ) ) {
+ return false;
+ }
+ if ( !taxbb.getCommonName().equals( "starlet sea anemone" ) ) {
+ return false;
+ }
+ if ( !taxbb.getIdentifier().getProvider().equals( "EOL" ) ) {
+ return false;
+ }
+ if ( !taxbb.getIdentifier().getValue().equals( "704294" ) ) {
+ return false;
+ }
+ if ( !taxbb.getTaxonomyCode().equals( "NEMVE" ) ) {
+ return false;
+ }
+ if ( !taxbb.getScientificName().equals( "Nematostella vectensis" ) ) {
+ return false;
+ }
+ if ( taxbb.getSynonyms().size() != 2 ) {
+ return false;
+ }
+ if ( !taxbb.getSynonyms().contains( "Nematostella vectensis Stephenson1935" ) ) {
+ return false;
+ }
+ if ( !taxbb.getSynonyms().contains( "See Anemone" ) ) {
+ return false;
+ }
+ if ( !taxbb.getUri( 0 ).getDescription().equals( "EOL" ) ) {
+ return false;
+ }
+ if ( !taxbb.getUri( 0 ).getType().equals( "linkout" ) ) {
+ return false;
+ }
+ if ( !taxbb.getUri( 0 ).getValue().toString().equals( "http://www.eol.org/pages/704294" ) ) {
+ return false;
+ }
+ if ( ( ( BinaryCharacters ) t3_rt.getNode( "node bb" ).getNodeData().getBinaryCharacters().copy() )
+ .getLostCount() != BinaryCharacters.COUNT_DEFAULT ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node b" ).getNodeData().getBinaryCharacters().getGainedCount() != 1 ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node b" ).getNodeData().getBinaryCharacters().getGainedCharacters().size() != 1 ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node b" ).getNodeData().getBinaryCharacters().getLostCount() != 3 ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node b" ).getNodeData().getBinaryCharacters().getLostCharacters().size() != 3 ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node b" ).getNodeData().getBinaryCharacters().getPresentCount() != 2 ) {
+ return false;
+ }
+ if ( t3_rt.getNode( "node b" ).getNodeData().getBinaryCharacters().getPresentCharacters().size() != 2 ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "node b" ).getNodeData().getBinaryCharacters().getType().equals( "characters" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "node ba" ).getNodeData().getDate().getDesc().equals( "Silurian" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "node ba" ).getNodeData().getDate().getValue().toPlainString()
+ .equalsIgnoreCase( "435" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "node ba" ).getNodeData().getDate().getMin().toPlainString()
+ .equalsIgnoreCase( "416" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "node ba" ).getNodeData().getDate().getMax().toPlainString()
+ .equalsIgnoreCase( "443.7" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "node ba" ).getNodeData().getDate().getUnit().equals( "mya" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "node bb" ).getNodeData().getDate().getDesc().equals( "Triassic" ) ) {
+ return false;
+ }
+ if ( !t3_rt.getNode( "node bc" ).getNodeData().getDate().getValue().toPlainString()
+ .equalsIgnoreCase( "433" ) ) {
+ return false;
+ }
+ final SortedSet<Accession> x = t3_rt.getNode( "root node" ).getNodeData().getSequence()
+ .getCrossReferences();
+ if ( x.size() != 4 ) {
+ return false;
+ }
+ int c = 0;
+ for( final Accession acc : x ) {
+ if ( c == 0 ) {
+ if ( !acc.getSource().equals( "KEGG" ) ) {
+ return false;
+ }
+ if ( !acc.getValue().equals( "hsa:596" ) ) {
+ return false;
+ }
+ }
+ c++;
+ }
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace( System.out );
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean testBasicPhyloXMLparsingValidating() {
+ try {
+ final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+ PhyloXmlParser xml_parser = null;
+ try {
+ xml_parser = PhyloXmlParser.createPhyloXmlParserXsdValidating();
+ }
+ catch ( final Exception e ) {
+ // Do nothing -- means were not running from jar.
+ }
+ if ( xml_parser == null ) {
+ xml_parser = PhyloXmlParser.createPhyloXmlParser();
+ if ( USE_LOCAL_PHYLOXML_SCHEMA ) {
+ xml_parser.setValidateAgainstSchema( PHYLOXML_LOCAL_XSD );
+ }
+ else {
+ xml_parser.setValidateAgainstSchema( PHYLOXML_REMOTE_XSD );
+ }
+ }
+ final Phylogeny[] phylogenies_0 = factory
+ .create( new File( Test.PATH_TO_TEST_DATA + "phyloxml_test_t1.xml" ), xml_parser );
+ if ( xml_parser.getErrorCount() > 0 ) {
+ System.out.println( xml_parser.getErrorMessages().toString() );
+ return false;
+ }
+ if ( phylogenies_0.length != 4 ) {
+ return false;
+ }
+ final Phylogeny t1 = phylogenies_0[ 0 ];
+ final Phylogeny t2 = phylogenies_0[ 1 ];
+ final Phylogeny t3 = phylogenies_0[ 2 ];
+ final Phylogeny t4 = phylogenies_0[ 3 ];
+ if ( !t1.getName().equals( "t1" ) ) {
+ return false;
+ }
+ if ( !t2.getName().equals( "t2" ) ) {
+ return false;
+ }
+ if ( !t3.getName().equals( "t3" ) ) {
+ return false;
+ }
+ if ( !t4.getName().equals( "t4" ) ) {
+ return false;
+ }
+ if ( t1.getNumberOfExternalNodes() != 1 ) {
+ return false;
+ }
+ if ( t2.getNumberOfExternalNodes() != 2 ) {
+ return false;
+ }
+ if ( t3.getNumberOfExternalNodes() != 4 ) {
+ return false;
+ }
+ final String x2 = Test.PATH_TO_TEST_DATA + "phyloxml_test_t1.xml";
+ final Phylogeny[] phylogenies_1 = factory.create( new File( x2 ), xml_parser );
+ if ( xml_parser.getErrorCount() > 0 ) {
+ System.out.println( "errors:" );
+ System.out.println( xml_parser.getErrorMessages().toString() );
+ return false;
+ }
+ if ( phylogenies_1.length != 4 ) {
+ return false;
+ }
+ final Phylogeny[] phylogenies_2 = factory
+ .create( new File( Test.PATH_TO_TEST_DATA + "phyloxml_test_t3.xml" ), xml_parser );
+ if ( xml_parser.getErrorCount() > 0 ) {
+ System.out.println( "errors:" );
+ System.out.println( xml_parser.getErrorMessages().toString() );
+ return false;
+ }
+ if ( phylogenies_2.length != 1 ) {
+ return false;
+ }
+ if ( phylogenies_2[ 0 ].getNumberOfExternalNodes() != 2 ) {
+ return false;
+ }
+ final Phylogeny[] phylogenies_3 = factory
+ .create( new File( 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_3.length != 2 ) {
+ return false;
+ }
+ final Phylogeny a = phylogenies_3[ 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;
+ }
+ final Phylogeny[] phylogenies_4 = factory
+ .create( new File( Test.PATH_TO_TEST_DATA + "special_characters.xml" ), xml_parser );
+ if ( xml_parser.getErrorCount() > 0 ) {
+ System.out.println( xml_parser.getErrorMessages().toString() );
+ return false;
+ }
+ if ( phylogenies_4.length != 1 ) {
+ return false;
+ }
+ final Phylogeny s = phylogenies_4[ 0 ];
+ if ( s.getNumberOfExternalNodes() != 6 ) {
+ return false;
+ }
+ s.getNode( "first" );
+ s.getNode( "<>" );
+ s.getNode( "\"<a'b&c'd\">\"" );
+ s.getNode( "'''\"" );
+ s.getNode( "\"\"\"" );
+ s.getNode( "dick & doof" );
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace( System.out );
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean testPhyloXMLparsingValidating() {
+ try {
+ final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
+ PhyloXmlParser xml_parser = null;
+ try {
+ xml_parser = PhyloXmlParser.createPhyloXmlParserXsdValidating();
+ }
+ catch ( final Exception e ) {
+ // Do nothing -- means were not running from jar.
+ }
+ if ( xml_parser == null ) {
+ xml_parser = PhyloXmlParser.createPhyloXmlParser();
+ if ( USE_LOCAL_PHYLOXML_SCHEMA ) {
+ xml_parser.setValidateAgainstSchema( PHYLOXML_LOCAL_XSD );
+ }
+ else {
+ xml_parser.setValidateAgainstSchema( PHYLOXML_REMOTE_XSD );
+ }
+ }
+ final Phylogeny[] phylogenies_0 = factory
+ .create( new File( Test.PATH_TO_TEST_DATA + "phyloxml_test_1.xml" ), xml_parser );
+ if ( xml_parser.getErrorCount() > 0 ) {
+ System.out.println( xml_parser.getErrorMessages().toString() );
+ return false;
+ }
+ if ( phylogenies_0.length != 3 ) {
+ return false;
+ }
+ }
+ catch ( final Exception e ) {
+ e.printStackTrace( System.out );
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean testBasicProtein() {
+ try {
+ final BasicProtein p0 = new BasicProtein( "p0", "owl", 0 );
+ final Domain a = new BasicDomain( "a", 1, 10, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain b = new BasicDomain( "b", 11, 20, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain c = new BasicDomain( "c", 9, 23, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain d = new BasicDomain( "d", 15, 30, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain e = new BasicDomain( "e", 60, 70, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain x = new BasicDomain( "x", 100, 110, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain y = new BasicDomain( "y", 100, 110, ( short ) 1, ( short ) 5, 0.1, -12 );
+ p0.addProteinDomain( y );
+ p0.addProteinDomain( e );
+ p0.addProteinDomain( b );
+ p0.addProteinDomain( c );
+ p0.addProteinDomain( d );
+ p0.addProteinDomain( a );
+ p0.addProteinDomain( x );
+ if ( !p0.toDomainArchitectureString( "~" ).equals( "a~b~c~d~e~x~y" ) ) {
+ return false;
+ }
+ if ( !p0.toDomainArchitectureString( "~", 3, "=" ).equals( "a~b~c~d~e~x~y" ) ) {
+ return false;
+ }
+ //
+ final BasicProtein aa0 = new BasicProtein( "aa", "owl", 0 );
+ final Domain a1 = new BasicDomain( "a", 1, 10, ( short ) 1, ( short ) 5, 0.1, -12 );
+ aa0.addProteinDomain( a1 );
+ if ( !aa0.toDomainArchitectureString( "~" ).equals( "a" ) ) {
+ return false;
+ }
+ if ( !aa0.toDomainArchitectureString( "~", 3, "" ).equals( "a" ) ) {
+ return false;
+ }
+ //
+ final BasicProtein aa1 = new BasicProtein( "aa", "owl", 0 );
+ final Domain a11 = new BasicDomain( "a", 1, 10, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain a12 = new BasicDomain( "a", 2, 20, ( short ) 1, ( short ) 5, 0.1, -12 );
+ aa1.addProteinDomain( a11 );
+ aa1.addProteinDomain( a12 );
+ if ( !aa1.toDomainArchitectureString( "~" ).equals( "a~a" ) ) {
+ return false;
+ }
+ if ( !aa1.toDomainArchitectureString( "~", 3, "" ).equals( "a~a" ) ) {
+ return false;
+ }
+ aa1.addProteinDomain( new BasicDomain( "a", 20, 30, ( short ) 1, ( short ) 5, 0.1, -12 ) );
+ if ( !aa1.toDomainArchitectureString( "~" ).equals( "a~a~a" ) ) {
+ return false;
+ }
+ if ( !aa1.toDomainArchitectureString( "~", 3, "" ).equals( "aaa" ) ) {
+ return false;
+ }
+ if ( !aa1.toDomainArchitectureString( "~", 4, "" ).equals( "a~a~a" ) ) {
+ return false;
+ }
+ aa1.addProteinDomain( new BasicDomain( "a", 30, 40, ( short ) 1, ( short ) 5, 0.1, -12 ) );
+ if ( !aa1.toDomainArchitectureString( "~" ).equals( "a~a~a~a" ) ) {
+ return false;
+ }
+ if ( !aa1.toDomainArchitectureString( "~", 3, "" ).equals( "aaa" ) ) {
+ return false;
+ }
+ if ( !aa1.toDomainArchitectureString( "~", 4, "" ).equals( "aaa" ) ) {
+ return false;
+ }
+ if ( !aa1.toDomainArchitectureString( "~", 5, "" ).equals( "a~a~a~a" ) ) {
+ return false;
+ }
+ aa1.addProteinDomain( new BasicDomain( "b", 32, 40, ( short ) 1, ( short ) 5, 0.1, -12 ) );
+ if ( !aa1.toDomainArchitectureString( "~" ).equals( "a~a~a~a~b" ) ) {
+ return false;
+ }
+ if ( !aa1.toDomainArchitectureString( "~", 3, "" ).equals( "aaa~b" ) ) {
+ return false;
+ }
+ if ( !aa1.toDomainArchitectureString( "~", 4, "" ).equals( "aaa~b" ) ) {
+ return false;
+ }
+ if ( !aa1.toDomainArchitectureString( "~", 5, "" ).equals( "a~a~a~a~b" ) ) {
+ return false;
+ }
+ aa1.addProteinDomain( new BasicDomain( "c", 1, 2, ( short ) 1, ( short ) 5, 0.1, -12 ) );
+ if ( !aa1.toDomainArchitectureString( "~" ).equals( "c~a~a~a~a~b" ) ) {
+ return false;
+ }
+ if ( !aa1.toDomainArchitectureString( "~", 3, "" ).equals( "c~aaa~b" ) ) {
+ return false;
+ }
+ if ( !aa1.toDomainArchitectureString( "~", 4, "" ).equals( "c~aaa~b" ) ) {
+ return false;
+ }
+ if ( !aa1.toDomainArchitectureString( "~", 5, "" ).equals( "c~a~a~a~a~b" ) ) {
+ return false;
+ }
+ //
+ final BasicProtein p00 = new BasicProtein( "p0", "owl", 0 );
+ final Domain a0 = new BasicDomain( "a", 1, 10, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain b0 = new BasicDomain( "b", 11, 20, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain c0 = new BasicDomain( "c", 9, 23, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain d0 = new BasicDomain( "d", 15, 30, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain e0 = new BasicDomain( "e", 60, 70, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain e1 = new BasicDomain( "e", 61, 71, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain e2 = new BasicDomain( "e", 62, 72, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain e3 = new BasicDomain( "e", 63, 73, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain e4 = new BasicDomain( "e", 64, 74, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain e5 = new BasicDomain( "e", 65, 75, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain x0 = new BasicDomain( "x", 100, 110, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain y0 = new BasicDomain( "y", 100, 110, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain y1 = new BasicDomain( "y", 120, 130, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain y2 = new BasicDomain( "y", 140, 150, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain y3 = new BasicDomain( "y", 160, 170, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain z0 = new BasicDomain( "z", 200, 210, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain z1 = new BasicDomain( "z", 300, 310, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain z2 = new BasicDomain( "z", 400, 410, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain zz0 = new BasicDomain( "Z", 500, 510, ( short ) 1, ( short ) 5, 0.1, -12 );
+ final Domain zz1 = new BasicDomain( "Z", 600, 610, ( short ) 1, ( short ) 5, 0.1, -12 );
+ p00.addProteinDomain( y0 );
+ p00.addProteinDomain( e0 );
+ p00.addProteinDomain( b0 );
+ p00.addProteinDomain( c0 );
+ p00.addProteinDomain( d0 );
+ p00.addProteinDomain( a0 );
+ p00.addProteinDomain( x0 );
+ p00.addProteinDomain( y1 );
+ p00.addProteinDomain( y2 );
+ p00.addProteinDomain( y3 );
+ p00.addProteinDomain( e1 );
+ p00.addProteinDomain( e2 );
+ p00.addProteinDomain( e3 );
+ p00.addProteinDomain( e4 );
+ p00.addProteinDomain( e5 );
+ p00.addProteinDomain( z0 );
+ p00.addProteinDomain( z1 );
+ p00.addProteinDomain( z2 );
+ p00.addProteinDomain( zz0 );
+ p00.addProteinDomain( zz1 );
+ if ( !p00.toDomainArchitectureString( "~", 3, "" ).equals( "a~b~c~d~eee~x~yyy~zzz~Z~Z" ) ) {
+ return false;
+ }
+ if ( !p00.toDomainArchitectureString( "~", 4, "" ).equals( "a~b~c~d~eee~x~yyy~z~z~z~Z~Z" ) ) {
+ return false;
+ }
+ if ( !p00.toDomainArchitectureString( "~", 5, "" ).equals( "a~b~c~d~eee~x~y~y~y~y~z~z~z~Z~Z" ) ) {
+ return false;
+ }
+ if ( !p00.toDomainArchitectureString( "~", 6, "" ).equals( "a~b~c~d~eee~x~y~y~y~y~z~z~z~Z~Z" ) ) {
+ return false;
+ }
+ if ( !p00.toDomainArchitectureString( "~", 7, "" ).equals( "a~b~c~d~e~e~e~e~e~e~x~y~y~y~y~z~z~z~Z~Z" ) ) {
+ return false;
+ }
+ // A0 A10 B15 A20 B25 A30 B35 B40 C50 A60 C70 D80
+ final Domain A0 = new BasicDomain( "A", 0, 25, ( short ) 1, ( short ) 4, 0.1, -12 );
+ final Domain A10 = new BasicDomain( "A", 10, 11, ( short ) 1, ( short ) 4, 0.1, -12 );
+ final Domain B15 = new BasicDomain( "B", 11, 16, ( short ) 1, ( short ) 4, 0.1, -12 );
+ final Domain A20 = new BasicDomain( "A", 20, 100, ( short ) 1, ( short ) 4, 0.1, -12 );
+ final Domain B25 = new BasicDomain( "B", 25, 26, ( short ) 1, ( short ) 4, 0.1, -12 );
+ final Domain A30 = new BasicDomain( "A", 30, 31, ( short ) 1, ( short ) 4, 0.1, -12 );
+ final Domain B35 = new BasicDomain( "B", 31, 40, ( short ) 1, ( short ) 4, 0.1, -12 );
+ final Domain B40 = new BasicDomain( "B", 40, 600, ( short ) 1, ( short ) 4, 0.1, -12 );
+ final Domain C50 = new BasicDomain( "C", 50, 59, ( short ) 1, ( short ) 4, 0.1, -12 );
+ final Domain A60 = new BasicDomain( "A", 60, 395, ( short ) 1, ( short ) 4, 0.1, -12 );
+ final Domain C70 = new BasicDomain( "C", 70, 71, ( short ) 1, ( short ) 4, 0.1, -12 );
+ final Domain D80 = new BasicDomain( "D", 80, 81, ( short ) 1, ( short ) 4, 0.1, -12 );
+ final BasicProtein p = new BasicProtein( "p", "owl", 0 );
+ p.addProteinDomain( B15 );
+ p.addProteinDomain( C50 );
+ p.addProteinDomain( A60 );
+ p.addProteinDomain( A30 );
+ p.addProteinDomain( C70 );
+ p.addProteinDomain( B35 );
+ p.addProteinDomain( B40 );
+ p.addProteinDomain( A0 );
+ p.addProteinDomain( A10 );
+ p.addProteinDomain( A20 );
+ p.addProteinDomain( B25 );
+ p.addProteinDomain( D80 );
+ List<String> domains_ids = new ArrayList<String>();
+ domains_ids.add( "A" );
+ domains_ids.add( "B" );
+ domains_ids.add( "C" );
+ if ( !p.contains( domains_ids, false ) ) {
+ return false;
+ }
+ if ( !p.contains( domains_ids, true ) ) {
+ return false;
+ }
+ domains_ids.add( "X" );
+ if ( p.contains( domains_ids, false ) ) {
+ return false;
+ }
+ if ( p.contains( domains_ids, true ) ) {
+ return false;
+ }
+ domains_ids = new ArrayList<String>();
+ domains_ids.add( "A" );
+ domains_ids.add( "C" );
+ domains_ids.add( "D" );
+ if ( !p.contains( domains_ids, false ) ) {
+ return false;
+ }
+ if ( !p.contains( domains_ids, true ) ) {
+ return false;
+ }
+ domains_ids = new ArrayList<String>();
+ domains_ids.add( "A" );
+ domains_ids.add( "D" );
+ domains_ids.add( "C" );
+ if ( !p.contains( domains_ids, false ) ) {
+ return false;
+ }
+ if ( p.contains( domains_ids, true ) ) {
+ return false;
+ }
+ domains_ids = new ArrayList<String>();
+ domains_ids.add( "A" );
+ domains_ids.add( "A" );
+ domains_ids.add( "B" );
+ if ( !p.contains( domains_ids, false ) ) {
+ return false;
+ }
+ if ( !p.contains( domains_ids, true ) ) {
+ return false;
+ }
+ domains_ids = new ArrayList<String>();
+ domains_ids.add( "A" );
+ domains_ids.add( "A" );
+ domains_ids.add( "A" );
+ domains_ids.add( "B" );
+ domains_ids.add( "B" );
+ if ( !p.contains( domains_ids, false ) ) {
+ return false;
+ }
+ if ( !p.contains( domains_ids, true ) ) {