X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fsurfacing%2FTestSurfacing.java;h=c2b857c2a602d901bfc4437cf0242ae539aba570;hb=f47b5de663d2ca59a4d53587ea8d5cd20c594db2;hp=8d4186c4b33514cea299fdaf8f3064780906cfdd;hpb=73c5b11c1a00e539afb246e345ebf3f042dded78;p=jalview.git diff --git a/forester/java/src/org/forester/surfacing/TestSurfacing.java b/forester/java/src/org/forester/surfacing/TestSurfacing.java index 8d4186c..c2b857c 100644 --- a/forester/java/src/org/forester/surfacing/TestSurfacing.java +++ b/forester/java/src/org/forester/surfacing/TestSurfacing.java @@ -22,7 +22,7 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA // // Contact: phylosoft @ gmail . com -// WWW: www.phylosoft.org/forester +// WWW: https://sites.google.com/site/cmzmasek/home/software/forester package org.forester.surfacing; @@ -48,11 +48,11 @@ import org.forester.phylogeny.Phylogeny; import org.forester.phylogeny.PhylogenyNode; import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; import org.forester.phylogeny.factories.PhylogenyFactory; +import org.forester.protein.BasicDomain; import org.forester.protein.BasicProtein; import org.forester.protein.BinaryDomainCombination; import org.forester.protein.BinaryDomainCombination.DomainCombinationType; import org.forester.protein.Domain; -import org.forester.protein.DomainId; import org.forester.protein.Protein; import org.forester.protein.ProteinId; import org.forester.species.BasicSpecies; @@ -69,50 +69,7 @@ public class TestSurfacing { return ( ( Math.abs( a - b ) ) < TestSurfacing.ZERO_DIFF ); } - private static StringBuffer mapToStringBuffer( final Map map ) { - final StringBuffer sb = new StringBuffer(); - for( final PhylogenyNode key : map.keySet() ) { - if ( !key.isExternal() ) { - sb.append( key.getName() ); - sb.append( " : " ); - sb.append( map.get( key ).toString() ); - sb.append( ForesterUtil.getLineSeparator() ); - } - } - return sb; - } - public static boolean test( final File test_dir ) { - System.out.print( " Domain id: " ); - if ( !TestSurfacing.testDomainId() ) { - System.out.println( "failed." ); - return false; - } - System.out.println( "OK." ); - System.out.print( " Protein id: " ); - if ( !TestSurfacing.testProteinId() ) { - System.out.println( "failed." ); - return false; - } - System.out.println( "OK." ); - System.out.print( " Species: " ); - if ( !TestSurfacing.testSpecies() ) { - System.out.println( "failed." ); - return false; - } - System.out.println( "OK." ); - System.out.print( " Basic domain: " ); - if ( !TestSurfacing.testBasicDomain() ) { - System.out.println( "failed." ); - return false; - } - System.out.println( "OK." ); - System.out.print( " Basic protein: " ); - if ( !TestSurfacing.testBasicProtein() ) { - System.out.println( "failed." ); - return false; - } - System.out.println( "OK." ); System.out.print( " Combinable domains: " ); if ( !TestSurfacing.testCombinableDomains() ) { System.out.println( "failed." ); @@ -247,62 +204,17 @@ public class TestSurfacing { return true; } - private static boolean testBasicDomain() { - try { - final Domain pd = new BasicDomain( "id", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); - if ( !pd.getDomainId().getId().equals( "id" ) ) { - return false; - } - if ( pd.getNumber() != 1 ) { - return false; - } - if ( pd.getTotalCount() != 4 ) { - return false; - } - if ( !pd.equals( new BasicDomain( "id", 22, 111, ( short ) 1, ( short ) 4, 0.2, -12 ) ) ) { - return false; - } - final Domain a1 = new BasicDomain( "a", 1, 10, ( short ) 1, ( short ) 4, 0.1, -12 ); - final BasicDomain a1_copy = new BasicDomain( "a", 1, 10, ( short ) 1, ( short ) 4, 0.1, -12 ); - final BasicDomain a1_equal = new BasicDomain( "a", 524, 743994, ( short ) 1, ( short ) 300, 3.0005, 230 ); - final BasicDomain a2 = new BasicDomain( "a", 1, 10, ( short ) 2, ( short ) 4, 0.1, -12 ); - final BasicDomain a3 = new BasicDomain( "A", 1, 10, ( short ) 1, ( short ) 4, 0.1, -12 ); - if ( !a1.equals( a1 ) ) { - return false; - } - if ( !a1.equals( a1_copy ) ) { - return false; - } - if ( !a1.equals( a1_equal ) ) { - return false; - } - if ( !a1.equals( a2 ) ) { - return false; - } - if ( a1.equals( a3 ) ) { - return false; - } - if ( a1.compareTo( a1 ) != 0 ) { - return false; - } - if ( a1.compareTo( a1_copy ) != 0 ) { - return false; - } - if ( a1.compareTo( a1_equal ) != 0 ) { - return false; - } - if ( a1.compareTo( a2 ) != 0 ) { - return false; - } - if ( a1.compareTo( a3 ) != 0 ) { - return false; + private static StringBuffer mapToStringBuffer( final Map map ) { + final StringBuffer sb = new StringBuffer(); + for( final PhylogenyNode key : map.keySet() ) { + if ( !key.isExternal() ) { + sb.append( key.getName() ); + sb.append( " : " ); + sb.append( map.get( key ).toString() ); + sb.append( ForesterUtil.getLineSeparator() ); } } - catch ( final Exception e ) { - e.printStackTrace( System.out ); - return false; - } - return true; + return sb; } private static boolean testBasicDomainSimilarityCalculator() { @@ -415,7 +327,8 @@ public class TestSurfacing { new BasicSpecies( "nemve" ) ) ); final DomainSimilarityCalculator calc = new BasicDomainSimilarityCalculator( DomainSimilarity.DomainSimilaritySortField.DOMAIN_ID, false, - false ); + false, + true ); final SortedSet sims = calc .calculateSimilarities( new CombinationsBasedPairwiseDomainSimilarityCalculator(), cdc_list, @@ -423,7 +336,7 @@ public class TestSurfacing { true ); final Iterator sims_it = sims.iterator(); final DomainSimilarity sa = sims_it.next(); - if ( !sa.getDomainId().getId().equals( "A" ) ) { + if ( !sa.getDomainId().equals( "A" ) ) { return false; } if ( sa.getSpeciesData().size() != 4 ) { @@ -441,8 +354,8 @@ public class TestSurfacing { if ( !sa.getSpecies().contains( new BasicSpecies( "rabbit" ) ) ) { return false; } - if ( !TestSurfacing.isEqual( sa.getMeanSimilarityScore(), - ( 2.0 / 5 + 0 + 2.0 / 3 + 1.0 / 5 + 1.0 / 2 + 2.0 / 7 ) / 6 ) ) { + if ( !TestSurfacing.isEqual( sa.getMeanSimilarityScore(), ( ( 2.0 / 5 ) + 0 + ( 2.0 / 3 ) + ( 1.0 / 5 ) + + ( 1.0 / 2 ) + ( 2.0 / 7 ) ) / 6 ) ) { return false; } if ( !TestSurfacing.isEqual( sa.getStandardDeviationOfSimilarityScore(), ( 0.23410788192183737 ) ) ) { @@ -464,7 +377,7 @@ public class TestSurfacing { return false; } final DomainSimilarity sb = sims_it.next(); - if ( !sb.getDomainId().getId().equals( "B" ) ) { + if ( !sb.getDomainId().equals( "B" ) ) { return false; } if ( sb.getSpeciesData().size() != 2 ) { @@ -498,7 +411,7 @@ public class TestSurfacing { return false; } final DomainSimilarity sc = sims_it.next(); - if ( !sc.getDomainId().getId().equals( "C" ) ) { + if ( !sc.getDomainId().equals( "C" ) ) { return false; } if ( sc.getSpeciesData().size() != 3 ) { @@ -513,7 +426,7 @@ public class TestSurfacing { if ( !sc.getSpecies().contains( new BasicSpecies( "nemve" ) ) ) { return false; } - if ( !TestSurfacing.isEqual( sc.getMeanSimilarityScore(), ( 2.0 / 5 + 2.0 / 3 + 1.0 / 2 ) / 3 ) ) { + if ( !TestSurfacing.isEqual( sc.getMeanSimilarityScore(), ( ( 2.0 / 5 ) + ( 2.0 / 3 ) + ( 1.0 / 2 ) ) / 3 ) ) { return false; } if ( !TestSurfacing.isEqual( sc.getStandardDeviationOfSimilarityScore(), 0.13471506281091264 ) ) { @@ -565,7 +478,8 @@ public class TestSurfacing { new BasicSpecies( "nemve" ) ) ); final DomainSimilarityCalculator calc2 = new BasicDomainSimilarityCalculator( DomainSimilarity.DomainSimilaritySortField.DOMAIN_ID, false, - false ); + false, + true ); final SortedSet sims2 = calc2 .calculateSimilarities( new CombinationsBasedPairwiseDomainSimilarityCalculator(), cdc_list2, @@ -573,7 +487,7 @@ public class TestSurfacing { true ); final Iterator sims_it2 = sims2.iterator(); final DomainSimilarity sa2 = sims_it2.next(); - if ( !sa2.getDomainId().getId().equals( "A" ) ) { + if ( !sa2.getDomainId().equals( "A" ) ) { return false; } if ( sa2.getSpeciesData().size() != 4 ) { @@ -591,8 +505,8 @@ public class TestSurfacing { if ( !sa2.getSpeciesData().keySet().contains( new BasicSpecies( "rabbit" ) ) ) { return false; } - if ( !TestSurfacing.isEqual( sa2.getMeanSimilarityScore(), - ( 2.0 / 5 + 0 + 2.0 / 3 + 1.0 / 6 + 1.0 / 2 + 2.0 / 8 ) / 6 ) ) { + if ( !TestSurfacing.isEqual( sa2.getMeanSimilarityScore(), ( ( 2.0 / 5 ) + 0 + ( 2.0 / 3 ) + ( 1.0 / 6 ) + + ( 1.0 / 2 ) + ( 2.0 / 8 ) ) / 6 ) ) { return false; } if ( !TestSurfacing.isEqual( sa2.getStandardDeviationOfSimilarityScore(), ( 0.2404663678647683 ) ) ) { @@ -652,7 +566,8 @@ public class TestSurfacing { new BasicSpecies( "nemve" ) ) ); final DomainSimilarityCalculator calc3 = new BasicDomainSimilarityCalculator( DomainSimilarity.DomainSimilaritySortField.DOMAIN_ID, false, - false ); + false, + true ); final SortedSet sims3 = calc3 .calculateSimilarities( new CombinationsBasedPairwiseDomainSimilarityCalculator(), cdc_list3, @@ -660,23 +575,23 @@ public class TestSurfacing { true ); final Iterator sims_it3 = sims3.iterator(); final DomainSimilarity sa3 = sims_it3.next(); - if ( !sa3.getDomainId().getId().equals( "A" ) ) { + if ( !sa3.getDomainId().equals( "A" ) ) { return false; } - final SpeciesSpecificDomainSimilariyData ssdsd = sa3.getSpeciesData().get( new BasicSpecies( "ciona" ) ); + final SpeciesSpecificDcData ssdsd = sa3.getSpeciesData().get( new BasicSpecies( "ciona" ) ); if ( ssdsd.getCombinableDomainIdToCountsMap().size() != 4 ) { return false; } - if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "B" ) ) != 2 ) { + if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( "B" ) != 2 ) { return false; } - if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "F" ) ) != 2 ) { + if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( "F" ) != 2 ) { return false; } - if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "G" ) ) != 2 ) { + if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( "G" ) != 2 ) { return false; } - if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "X" ) ) != 3 ) { + if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( "X" ) != 3 ) { return false; } final List cdc_list4 = new ArrayList(); @@ -695,7 +610,8 @@ public class TestSurfacing { new BasicSpecies( "nemve" ) ) ); final DomainSimilarityCalculator calc4 = new BasicDomainSimilarityCalculator( DomainSimilarity.DomainSimilaritySortField.DOMAIN_ID, true, - false ); + false, + true ); final SortedSet sims4 = calc4 .calculateSimilarities( new CombinationsBasedPairwiseDomainSimilarityCalculator(), cdc_list4, @@ -703,46 +619,47 @@ public class TestSurfacing { true ); final Iterator sims_it4 = sims4.iterator(); final DomainSimilarity sa4 = sims_it4.next(); - if ( !sa4.getDomainId().getId().equals( "A" ) ) { + if ( !sa4.getDomainId().equals( "A" ) ) { return false; } - final SpeciesSpecificDomainSimilariyData ssdsd4 = sa4.getSpeciesData().get( new BasicSpecies( "ciona" ) ); + final SpeciesSpecificDcData ssdsd4 = sa4.getSpeciesData().get( new BasicSpecies( "ciona" ) ); if ( ssdsd4.getCombinableDomainIdToCountsMap().size() != 5 ) { return false; } - if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "A" ) ) != 3 ) { + if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( "A" ) != 3 ) { return false; } - if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "B" ) ) != 2 ) { + if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( "B" ) != 2 ) { return false; } - if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "F" ) ) != 2 ) { + if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( "F" ) != 2 ) { return false; } - if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "G" ) ) != 2 ) { + if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( "G" ) != 2 ) { return false; } - if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "X" ) ) != 3 ) { + if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( "X" ) != 3 ) { return false; } final SortedSet sims4_d = calc4 .calculateSimilarities( new DomainCountsBasedPairwiseSimilarityCalculator(), cdc_list4, false, true ); final Iterator sims_it4_d = sims4_d.iterator(); final DomainSimilarity sa4_d = sims_it4_d.next(); - if ( !sa4_d.getDomainId().getId().equals( "A" ) ) { + if ( !sa4_d.getDomainId().equals( "A" ) ) { return false; } if ( sa4_d.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).size() != 5 ) { return false; } - if ( !TestSurfacing.isEqual( sa4_d.getMeanSimilarityScore(), ( 1 + 1 - 11.0 / 13 + 1 - 11.0 / 13 + 1 + 1 - + 1 - 11.0 / 13 ) / 6.0 ) ) { + if ( !TestSurfacing + .isEqual( sa4_d.getMeanSimilarityScore(), + ( ( ( ( ( ( 1 + 1 ) - ( 11.0 / 13 ) ) + 1 ) - ( 11.0 / 13 ) ) + 1 + 1 + 1 ) - ( 11.0 / 13 ) ) / 6.0 ) ) { return false; } if ( !TestSurfacing.isEqual( sa4_d.getMaximalSimilarityScore(), 1.0 ) ) { return false; } - if ( !TestSurfacing.isEqual( sa4_d.getMinimalSimilarityScore(), ( 1 - 11.0 / 13 ) ) ) { + if ( !TestSurfacing.isEqual( sa4_d.getMinimalSimilarityScore(), ( 1 - ( 11.0 / 13 ) ) ) ) { return false; } if ( sa4_d.getN() != 6 ) { @@ -755,35 +672,36 @@ public class TestSurfacing { true ); final Iterator sims_it4_p = sims4_p.iterator(); final DomainSimilarity sa4_p = sims_it4_p.next(); - if ( !sa4_p.getDomainId().getId().equals( "A" ) ) { + if ( !sa4_p.getDomainId().equals( "A" ) ) { return false; } if ( sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).size() != 5 ) { return false; } - if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( new DomainId( "A" ) ) ) { + if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( "A" ) ) { return false; } - if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( new DomainId( "B" ) ) ) { + if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( "B" ) ) { return false; } - if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( new DomainId( "F" ) ) ) { + if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( "F" ) ) { return false; } - if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( new DomainId( "G" ) ) ) { + if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( "G" ) ) { return false; } - if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( new DomainId( "X" ) ) ) { + if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( "X" ) ) { return false; } - if ( !TestSurfacing.isEqual( sa4_p.getMeanSimilarityScore(), - ( 1 + 1 - 2.0 / 4 + 1 - 2.0 / 4 + 1 + 1 + 1 - 2.0 / 4 ) / 6.0 ) ) { + if ( !TestSurfacing + .isEqual( sa4_p.getMeanSimilarityScore(), + ( ( ( ( ( ( 1 + 1 ) - ( 2.0 / 4 ) ) + 1 ) - ( 2.0 / 4 ) ) + 1 + 1 + 1 ) - ( 2.0 / 4 ) ) / 6.0 ) ) { return false; } if ( !TestSurfacing.isEqual( sa4_p.getMaximalSimilarityScore(), 1 ) ) { return false; } - if ( !TestSurfacing.isEqual( sa4_p.getMinimalSimilarityScore(), ( 1 - 2.0 / 4 ) ) ) { + if ( !TestSurfacing.isEqual( sa4_p.getMinimalSimilarityScore(), ( 1 - ( 2.0 / 4 ) ) ) ) { return false; } if ( sa4_p.getN() != 6 ) { @@ -812,52 +730,53 @@ public class TestSurfacing { if ( !sa5_d.getSpecies().last().equals( new BasicSpecies( "rabbit" ) ) ) { return false; } - final SpeciesSpecificDomainSimilariyData ssdsd5 = sa5_d.getSpeciesData().get( new BasicSpecies( "ciona" ) ); + final SpeciesSpecificDcData ssdsd5 = sa5_d.getSpeciesData().get( new BasicSpecies( "ciona" ) ); if ( ssdsd5.getCombinableDomainIdToCountsMap().size() != 4 ) { return false; } - if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "B" ) ) != 2 ) { + if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( "B" ) != 2 ) { return false; } - if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "F" ) ) != 2 ) { + if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( "F" ) != 2 ) { return false; } - if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "G" ) ) != 2 ) { + if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( "G" ) != 2 ) { return false; } - if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "X" ) ) != 3 ) { + if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( "X" ) != 3 ) { return false; } - if ( !sa5_d.getDomainId().getId().equals( "A" ) ) { + if ( !sa5_d.getDomainId().equals( "A" ) ) { return false; } final Species ciona = new BasicSpecies( "ciona" ); if ( sa5_d.getCombinableDomainIds( ciona ).size() != 4 ) { return false; } - if ( sa5_d.getCombinableDomainIds( ciona ).contains( new DomainId( "A" ) ) ) { + if ( sa5_d.getCombinableDomainIds( ciona ).contains( "A" ) ) { return false; } - if ( !sa5_d.getCombinableDomainIds( ciona ).contains( new DomainId( "B" ) ) ) { + if ( !sa5_d.getCombinableDomainIds( ciona ).contains( "B" ) ) { return false; } - if ( !sa5_d.getCombinableDomainIds( ciona ).contains( new DomainId( "F" ) ) ) { + if ( !sa5_d.getCombinableDomainIds( ciona ).contains( "F" ) ) { return false; } - if ( !sa5_d.getCombinableDomainIds( ciona ).contains( new DomainId( "G" ) ) ) { + if ( !sa5_d.getCombinableDomainIds( ciona ).contains( "G" ) ) { return false; } - if ( !sa5_d.getCombinableDomainIds( ciona ).contains( new DomainId( "X" ) ) ) { + if ( !sa5_d.getCombinableDomainIds( ciona ).contains( "X" ) ) { return false; } - if ( !TestSurfacing.isEqual( sa5_d.getMeanSimilarityScore(), ( 1 + 1 - 11.0 / 13 + 1 - 11.0 / 13 + 1 + 1 - + 1 - 11.0 / 13 ) / 6.0 ) ) { + if ( !TestSurfacing + .isEqual( sa5_d.getMeanSimilarityScore(), + ( ( ( ( ( ( 1 + 1 ) - ( 11.0 / 13 ) ) + 1 ) - ( 11.0 / 13 ) ) + 1 + 1 + 1 ) - ( 11.0 / 13 ) ) / 6.0 ) ) { return false; } if ( !TestSurfacing.isEqual( sa5_d.getMaximalSimilarityScore(), 1.0 ) ) { return false; } - if ( !TestSurfacing.isEqual( sa5_d.getMinimalSimilarityScore(), ( 1 - 11.0 / 13 ) ) ) { + if ( !TestSurfacing.isEqual( sa5_d.getMinimalSimilarityScore(), ( 1 - ( 11.0 / 13 ) ) ) ) { return false; } if ( sa5_d.getN() != 6 ) { @@ -879,35 +798,36 @@ public class TestSurfacing { true ); final Iterator sims_it5_p = sims5_p.iterator(); final DomainSimilarity sa5_p = sims_it5_p.next(); - if ( !sa5_p.getDomainId().getId().equals( "A" ) ) { + if ( !sa5_p.getDomainId().equals( "A" ) ) { return false; } if ( sa5_p.getCombinableDomainIds( ciona ).size() != 4 ) { return false; } - if ( sa5_p.getCombinableDomainIds( ciona ).contains( new DomainId( "A" ) ) ) { + if ( sa5_p.getCombinableDomainIds( ciona ).contains( "A" ) ) { return false; } - if ( !sa5_p.getCombinableDomainIds( ciona ).contains( new DomainId( "B" ) ) ) { + if ( !sa5_p.getCombinableDomainIds( ciona ).contains( "B" ) ) { return false; } - if ( !sa5_p.getCombinableDomainIds( ciona ).contains( new DomainId( "F" ) ) ) { + if ( !sa5_p.getCombinableDomainIds( ciona ).contains( "F" ) ) { return false; } - if ( !sa5_p.getCombinableDomainIds( ciona ).contains( new DomainId( "G" ) ) ) { + if ( !sa5_p.getCombinableDomainIds( ciona ).contains( "G" ) ) { return false; } - if ( !sa5_p.getCombinableDomainIds( ciona ).contains( new DomainId( "X" ) ) ) { + if ( !sa5_p.getCombinableDomainIds( ciona ).contains( "X" ) ) { return false; } - if ( !TestSurfacing.isEqual( sa5_p.getMeanSimilarityScore(), - ( 1 + 1 - 2.0 / 4 + 1 - 2.0 / 4 + 1 + 1 + 1 - 2.0 / 4 ) / 6.0 ) ) { + if ( !TestSurfacing + .isEqual( sa5_p.getMeanSimilarityScore(), + ( ( ( ( ( ( 1 + 1 ) - ( 2.0 / 4 ) ) + 1 ) - ( 2.0 / 4 ) ) + 1 + 1 + 1 ) - ( 2.0 / 4 ) ) / 6.0 ) ) { return false; } if ( !TestSurfacing.isEqual( sa5_p.getMaximalSimilarityScore(), 1 ) ) { return false; } - if ( !TestSurfacing.isEqual( sa5_p.getMinimalSimilarityScore(), ( 1 - 2.0 / 4 ) ) ) { + if ( !TestSurfacing.isEqual( sa5_p.getMinimalSimilarityScore(), ( 1 - ( 2.0 / 4 ) ) ) ) { return false; } if ( sa5_p.getN() != 6 ) { @@ -945,52 +865,53 @@ public class TestSurfacing { if ( !sa6_d.getSpecies().last().equals( new BasicSpecies( "rabbit" ) ) ) { return false; } - final SpeciesSpecificDomainSimilariyData ssdsd6 = sa6_d.getSpeciesData().get( new BasicSpecies( "ciona" ) ); + final SpeciesSpecificDcData ssdsd6 = sa6_d.getSpeciesData().get( new BasicSpecies( "ciona" ) ); if ( ssdsd6.getCombinableDomainIdToCountsMap().size() != 5 ) { return false; } - if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "B" ) ) != 2 ) { + if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( "B" ) != 2 ) { return false; } - if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "F" ) ) != 2 ) { + if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( "F" ) != 2 ) { return false; } - if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "G" ) ) != 2 ) { + if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( "G" ) != 2 ) { return false; } - if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "X" ) ) != 3 ) { + if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( "X" ) != 3 ) { return false; } - if ( !sa5_d.getDomainId().getId().equals( "A" ) ) { + if ( !sa5_d.getDomainId().equals( "A" ) ) { return false; } final Species ciona6 = new BasicSpecies( "ciona" ); if ( sa6_d.getCombinableDomainIds( ciona6 ).size() != 5 ) { return false; } - if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( new DomainId( "A" ) ) ) { + if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( "A" ) ) { return false; } - if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( new DomainId( "B" ) ) ) { + if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( "B" ) ) { return false; } - if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( new DomainId( "F" ) ) ) { + if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( "F" ) ) { return false; } - if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( new DomainId( "G" ) ) ) { + if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( "G" ) ) { return false; } - if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( new DomainId( "X" ) ) ) { + if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( "X" ) ) { return false; } - if ( !TestSurfacing.isEqual( sa6_d.getMeanSimilarityScore(), ( 1 + 1 - 11.0 / 13 + 1 - 11.0 / 13 + 1 + 1 - + 1 - 11.0 / 13 ) / 6.0 ) ) { + if ( !TestSurfacing + .isEqual( sa6_d.getMeanSimilarityScore(), + ( ( ( ( ( ( 1 + 1 ) - ( 11.0 / 13 ) ) + 1 ) - ( 11.0 / 13 ) ) + 1 + 1 + 1 ) - ( 11.0 / 13 ) ) / 6.0 ) ) { return false; } if ( !TestSurfacing.isEqual( sa6_d.getMaximalSimilarityScore(), 1.0 ) ) { return false; } - if ( !TestSurfacing.isEqual( sa6_d.getMinimalSimilarityScore(), ( 1 - 11.0 / 13 ) ) ) { + if ( !TestSurfacing.isEqual( sa6_d.getMinimalSimilarityScore(), ( 1 - ( 11.0 / 13 ) ) ) ) { return false; } if ( sa6_d.getN() != 6 ) { @@ -1012,35 +933,36 @@ public class TestSurfacing { true ); final Iterator sims_it6_p = sims6_p.iterator(); final DomainSimilarity sa6_p = sims_it6_p.next(); - if ( !sa6_p.getDomainId().getId().equals( "A" ) ) { + if ( !sa6_p.getDomainId().equals( "A" ) ) { return false; } if ( sa6_p.getCombinableDomainIds( ciona ).size() != 5 ) { return false; } - if ( !sa6_p.getCombinableDomainIds( ciona ).contains( new DomainId( "A" ) ) ) { + if ( !sa6_p.getCombinableDomainIds( ciona ).contains( "A" ) ) { return false; } - if ( !sa6_p.getCombinableDomainIds( ciona ).contains( new DomainId( "B" ) ) ) { + if ( !sa6_p.getCombinableDomainIds( ciona ).contains( "B" ) ) { return false; } - if ( !sa6_p.getCombinableDomainIds( ciona ).contains( new DomainId( "F" ) ) ) { + if ( !sa6_p.getCombinableDomainIds( ciona ).contains( "F" ) ) { return false; } - if ( !sa6_p.getCombinableDomainIds( ciona ).contains( new DomainId( "G" ) ) ) { + if ( !sa6_p.getCombinableDomainIds( ciona ).contains( "G" ) ) { return false; } - if ( !sa6_p.getCombinableDomainIds( ciona ).contains( new DomainId( "X" ) ) ) { + if ( !sa6_p.getCombinableDomainIds( ciona ).contains( "X" ) ) { return false; } - if ( !TestSurfacing.isEqual( sa6_p.getMeanSimilarityScore(), - ( 1 + 1 - 2.0 / 4 + 1 - 2.0 / 4 + 1 + 1 + 1 - 2.0 / 4 ) / 6.0 ) ) { + if ( !TestSurfacing + .isEqual( sa6_p.getMeanSimilarityScore(), + ( ( ( ( ( ( 1 + 1 ) - ( 2.0 / 4 ) ) + 1 ) - ( 2.0 / 4 ) ) + 1 + 1 + 1 ) - ( 2.0 / 4 ) ) / 6.0 ) ) { return false; } if ( !TestSurfacing.isEqual( sa6_p.getMaximalSimilarityScore(), 1 ) ) { return false; } - if ( !TestSurfacing.isEqual( sa6_p.getMinimalSimilarityScore(), ( 1 - 2.0 / 4 ) ) ) { + if ( !TestSurfacing.isEqual( sa6_p.getMinimalSimilarityScore(), ( 1 - ( 2.0 / 4 ) ) ) ) { return false; } if ( sa6_p.getN() != 6 ) { @@ -1120,7 +1042,8 @@ public class TestSurfacing { new BasicSpecies( "nemve" ) ) ); final DomainSimilarityCalculator calc = new BasicDomainSimilarityCalculator( DomainSimilarity.DomainSimilaritySortField.DOMAIN_ID, false, - false ); + false, + true ); final SortedSet sims = calc .calculateSimilarities( new CombinationsBasedPairwiseDomainSimilarityCalculator(), cdc_list, @@ -1128,7 +1051,7 @@ public class TestSurfacing { false ); final Iterator sims_it = sims.iterator(); final DomainSimilarity sa = sims_it.next(); - if ( !sa.getDomainId().getId().equals( "A" ) ) { + if ( !sa.getDomainId().equals( "A" ) ) { return false; } if ( sa.getSpeciesData().size() != 1 ) { @@ -1159,7 +1082,7 @@ public class TestSurfacing { return false; } final DomainSimilarity sb = sims_it.next(); - if ( !sb.getDomainId().getId().equals( "B" ) ) { + if ( !sb.getDomainId().equals( "B" ) ) { return false; } if ( sb.getSpeciesData().size() != 1 ) { @@ -1175,7 +1098,7 @@ public class TestSurfacing { true ); final Iterator sims_it2 = sims2.iterator(); final DomainSimilarity sa2 = sims_it2.next(); - if ( !sa2.getDomainId().getId().equals( "D" ) ) { + if ( !sa2.getDomainId().equals( "D" ) ) { return false; } if ( sa2.getSpeciesData().size() != 2 ) { @@ -1228,7 +1151,8 @@ public class TestSurfacing { new BasicSpecies( "nemve" ) ) ); final DomainSimilarityCalculator calc = new BasicDomainSimilarityCalculator( DomainSimilarity.DomainSimilaritySortField.DOMAIN_ID, false, - false ); + false, + true ); final SortedSet sims = calc .calculateSimilarities( new CombinationsBasedPairwiseDomainSimilarityCalculator(), cdc_list, @@ -1239,7 +1163,7 @@ public class TestSurfacing { } final Iterator sims_it = sims.iterator(); final DomainSimilarity sa = sims_it.next(); - if ( !sa.getDomainId().getId().equals( "A" ) ) { + if ( !sa.getDomainId().equals( "A" ) ) { return false; } if ( sa.getSpeciesData().size() != 4 ) { @@ -1315,280 +1239,6 @@ public class TestSurfacing { return true; } - private static boolean testBasicProtein() { - try { - // 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 domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( !p.contains( domains_ids, true ) ) { - return false; - } - domains_ids.add( new DomainId( "X" ) ); - if ( p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( !p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "D" ) ); - domains_ids.add( new DomainId( "C" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( !p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( !p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( !p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( !p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( !p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( !p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - domains_ids.add( new DomainId( "X" ) ); - if ( p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "X" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - } - catch ( final Exception e ) { - e.printStackTrace( System.out ); - return false; - } - return true; - } - private static boolean testBinaryDomainCombination() { try { final BasicBinaryDomainCombination s0 = new BasicBinaryDomainCombination( "a", "a" ); @@ -1600,7 +1250,7 @@ public class TestSurfacing { final BasicBinaryDomainCombination s6 = new BasicBinaryDomainCombination( "b", "c" ); final BasicBinaryDomainCombination s7 = new BasicBinaryDomainCombination( "d", "a" ); final BasicBinaryDomainCombination s8 = new BasicBinaryDomainCombination( "b", "d" ); - final BinaryDomainCombination s9 = BasicBinaryDomainCombination.createInstance( " z-z=a-aa " ); + final BinaryDomainCombination s9 = BasicBinaryDomainCombination.createInstance( "z-z=a-aa" ); if ( !s9.toString().equals( "a-aa=z-z" ) ) { System.out.println( s9.toString() ); return false; @@ -1632,17 +1282,18 @@ public class TestSurfacing { final SortedSet sorted = new TreeSet(); sorted.add( s0 ); sorted.add( s1 ); - sorted.add( s2 ); - sorted.add( s3 ); + sorted.add( s2 );// sorted.add( s3 ); - sorted.add( s3 ); - sorted.add( s4 ); + sorted.add( s3 );// + sorted.add( s3 );// + sorted.add( s4 );// sorted.add( s5 ); sorted.add( s6 ); sorted.add( s7 ); - sorted.add( s7 ); + sorted.add( s7 );// sorted.add( s8 ); - if ( sorted.size() != 6 ) { + if ( sorted.size() != 7 ) { + System.out.println( sorted.size() ); return false; } final DirectedBinaryDomainCombination aa = new DirectedBinaryDomainCombination( "a", "a" ); @@ -1995,7 +1646,7 @@ public class TestSurfacing { two.setKeyDomainCount( 3 ); final PairwiseDomainSimilarityCalculator calc = new DomainCountsBasedPairwiseSimilarityCalculator(); PairwiseDomainSimilarity s1 = calc.calculateSimilarity( one, two ); - if ( !TestSurfacing.isEqual( s1.getSimilarityScore(), 1.0 - ( 3 - 2.0 ) / ( 2 + 3 ) ) ) { + if ( !TestSurfacing.isEqual( s1.getSimilarityScore(), 1.0 - ( ( 3 - 2.0 ) / ( 2 + 3 ) ) ) ) { return false; } if ( s1.getDifferenceInCounts() != ( 2 - 3 ) ) { @@ -2013,7 +1664,7 @@ public class TestSurfacing { one.setKeyDomainCount( 1 ); two.setKeyDomainCount( 1000 ); s1 = calc.calculateSimilarity( one, two ); - if ( !TestSurfacing.isEqual( s1.getSimilarityScore(), 1.0 - 999.0 / 1001 ) ) { + if ( !TestSurfacing.isEqual( s1.getSimilarityScore(), 1.0 - ( 999.0 / 1001 ) ) ) { return false; } if ( s1.getDifferenceInCounts() != ( 1 - 1000 ) ) { @@ -3106,7 +2757,7 @@ public class TestSurfacing { if ( !calc_i.getSharedDomains().contains( f.getDomainId() ) ) { return false; } - final Set all = calc_ni.getAllDomains(); + final Set all = calc_ni.getAllDomains(); if ( !all.contains( a.getDomainId() ) ) { return false; } @@ -3434,17 +3085,17 @@ public class TestSurfacing { return false; } if ( !isEqual( calc_ni.calculateSharedBinaryDomainCombinationBasedGenomeSimilarityScore(), - 1.0 - ( 25.0 - 5.0 ) / 25.0 ) ) { + 1.0 - ( ( 25.0 - 5.0 ) / 25.0 ) ) ) { return false; } if ( !isEqual( calc_i.calculateSharedBinaryDomainCombinationBasedGenomeSimilarityScore(), - 1.0 - ( 22.0 - 3.0 ) / 22.0 ) ) { + 1.0 - ( ( 22.0 - 3.0 ) / 22.0 ) ) ) { return false; } - if ( !isEqual( calc_ni.calculateSharedDomainsBasedGenomeSimilarityScore(), 1.0 - ( 14.0 - 4.0 ) / 14.0 ) ) { + if ( !isEqual( calc_ni.calculateSharedDomainsBasedGenomeSimilarityScore(), 1.0 - ( ( 14.0 - 4.0 ) / 14.0 ) ) ) { return false; } - if ( !isEqual( calc_i.calculateSharedDomainsBasedGenomeSimilarityScore(), 1.0 - ( 14.0 - 4.0 ) / 14.0 ) ) { + if ( !isEqual( calc_i.calculateSharedDomainsBasedGenomeSimilarityScore(), 1.0 - ( ( 14.0 - 4.0 ) / 14.0 ) ) ) { return false; } final Domain u = new BasicDomain( "u", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); @@ -3581,8 +3232,8 @@ public class TestSurfacing { } calc_u.setAllowDomainsToBeIgnored( true ); calc_u.addDomainIdToIgnore( u.getDomainId() ); - calc_u.addDomainIdToIgnore( new DomainId( "other" ) ); - calc_u.addDomainIdToIgnore( new DomainId( "other_too" ) ); + calc_u.addDomainIdToIgnore( "other" ); + calc_u.addDomainIdToIgnore( "other_too" ); if ( calc_u.getAllDomains().size() != 5 ) { return false; } @@ -3686,10 +3337,10 @@ public class TestSurfacing { //------------ calc_u.setAllowDomainsToBeIgnored( true ); calc_u.deleteAllDomainIdsToIgnore(); - calc_u.addDomainIdToIgnore( new DomainId( "v" ) ); - calc_u.addDomainIdToIgnore( new DomainId( "w" ) ); - calc_u.addDomainIdToIgnore( new DomainId( "other" ) ); - calc_u.addDomainIdToIgnore( new DomainId( "other_too" ) ); + calc_u.addDomainIdToIgnore( "v" ); + calc_u.addDomainIdToIgnore( "w" ); + calc_u.addDomainIdToIgnore( "other" ); + calc_u.addDomainIdToIgnore( "other_too" ); if ( calc_u.getAllDomains().size() != 4 ) { return false; } @@ -3760,34 +3411,34 @@ public class TestSurfacing { return false; } if ( !isEqual( calc_u.calculateSharedBinaryDomainCombinationBasedGenomeSimilarityScore(), - 1.0 - ( 1.0 - 1.0 ) / 1.0 ) ) { + 1.0 - ( ( 1.0 - 1.0 ) / 1.0 ) ) ) { return false; } - if ( !isEqual( calc_u.calculateSharedDomainsBasedGenomeSimilarityScore(), 1.0 - ( 4.0 - 3.0 ) / 4.0 ) ) { + if ( !isEqual( calc_u.calculateSharedDomainsBasedGenomeSimilarityScore(), 1.0 - ( ( 4.0 - 3.0 ) / 4.0 ) ) ) { return false; } calc_u.setAllowDomainsToBeIgnored( false ); if ( !isEqual( calc_u.calculateSharedBinaryDomainCombinationBasedGenomeSimilarityScore(), - 1.0 - ( 5.0 - 2.0 ) / 5.0 ) ) { + 1.0 - ( ( 5.0 - 2.0 ) / 5.0 ) ) ) { return false; } - if ( !isEqual( calc_u.calculateSharedDomainsBasedGenomeSimilarityScore(), 1.0 - ( 6.0 - 4.0 ) / 6.0 ) ) { + if ( !isEqual( calc_u.calculateSharedDomainsBasedGenomeSimilarityScore(), 1.0 - ( ( 6.0 - 4.0 ) / 6.0 ) ) ) { return false; } calc_u.setAllowDomainsToBeIgnored( true ); if ( !isEqual( calc_u.calculateSharedBinaryDomainCombinationBasedGenomeSimilarityScore(), - 1.0 - ( 1.0 - 1.0 ) / 1.0 ) ) { + 1.0 - ( ( 1.0 - 1.0 ) / 1.0 ) ) ) { return false; } - if ( !isEqual( calc_u.calculateSharedDomainsBasedGenomeSimilarityScore(), 1.0 - ( 4.0 - 3.0 ) / 4.0 ) ) { + if ( !isEqual( calc_u.calculateSharedDomainsBasedGenomeSimilarityScore(), 1.0 - ( ( 4.0 - 3.0 ) / 4.0 ) ) ) { return false; } calc_u.deleteAllDomainIdsToIgnore(); if ( !isEqual( calc_u.calculateSharedBinaryDomainCombinationBasedGenomeSimilarityScore(), - 1.0 - ( 5.0 - 2.0 ) / 5.0 ) ) { + 1.0 - ( ( 5.0 - 2.0 ) / 5.0 ) ) ) { return false; } - if ( !isEqual( calc_u.calculateSharedDomainsBasedGenomeSimilarityScore(), 1.0 - ( 6.0 - 4.0 ) / 6.0 ) ) { + if ( !isEqual( calc_u.calculateSharedDomainsBasedGenomeSimilarityScore(), 1.0 - ( ( 6.0 - 4.0 ) / 6.0 ) ) ) { return false; } } @@ -3808,7 +3459,7 @@ public class TestSurfacing { final List domain_collections = parser.parse(); final BasicGenomeWideCombinableDomains cdcc = BasicGenomeWideCombinableDomains .createInstance( domain_collections, false, new BasicSpecies( "human" ) ); - CombinableDomains cd = cdcc.get( new DomainId( "A" ) ); + CombinableDomains cd = cdcc.get( "A" ); if ( cd.getKeyDomainCount() != 9 ) { return false; } @@ -3857,7 +3508,7 @@ public class TestSurfacing { if ( cd.getKeyDomainCount() != 9 ) { return false; } - cd = cdcc.get( new DomainId( "B" ) ); + cd = cdcc.get( "B" ); if ( cd.getKeyDomainCount() != 12 ) { return false; } @@ -3906,7 +3557,7 @@ public class TestSurfacing { if ( cd.getKeyDomainCount() != 12 ) { return false; } - cd = cdcc.get( new DomainId( "C" ) ); + cd = cdcc.get( "C" ); if ( cd.getKeyDomainCount() != 10 ) { return false; } @@ -3952,7 +3603,7 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "NN" ).getDomainId() ) != 0 ) { return false; } - cd = cdcc.get( new DomainId( "D" ) ); + cd = cdcc.get( "D" ); if ( cd.getKeyDomainCount() != 15 ) { return false; } @@ -3962,7 +3613,7 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 11 ) { return false; } - cd = cdcc.get( new DomainId( "E" ) ); + cd = cdcc.get( "E" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } @@ -3972,7 +3623,7 @@ public class TestSurfacing { if ( cd.getKeyDomainProteinsCount() != 1 ) { return false; } - cd = cdcc.get( new DomainId( "U" ) ); + cd = cdcc.get( "U" ); if ( cd.getNumberOfCombinableDomains() != 11 ) { return false; } @@ -3982,7 +3633,7 @@ public class TestSurfacing { if ( cd.getKeyDomainProteinsCount() != 3 ) { return false; } - cd = cdcc.get( new DomainId( "V" ) ); + cd = cdcc.get( "V" ); if ( cd.getNumberOfCombinableDomains() != 11 ) { return false; } @@ -3992,7 +3643,7 @@ public class TestSurfacing { if ( cd.getKeyDomainProteinsCount() != 2 ) { return false; } - cd = cdcc.get( new DomainId( "W" ) ); + cd = cdcc.get( "W" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } @@ -4002,22 +3653,22 @@ public class TestSurfacing { if ( cd.getKeyDomainProteinsCount() != 2 ) { return false; } - cd = cdcc.get( new DomainId( "X" ) ); + cd = cdcc.get( "X" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } if ( cd.getKeyDomainCount() != 2 ) { return false; } - cd = cdcc.get( new DomainId( "Y" ) ); + cd = cdcc.get( "Y" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc.get( new DomainId( "Z" ) ); + cd = cdcc.get( "Z" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc.get( new DomainId( "NN" ) ); + cd = cdcc.get( "NN" ); if ( cd.getKeyDomainCount() != 1 ) { return false; } @@ -4030,7 +3681,7 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "NN" ).getDomainId() ) != 0 ) { return false; } - cd = cdcc.get( new DomainId( "MM" ) ); + cd = cdcc.get( "MM" ); if ( cd.getNumberOfCombinableDomains() != 1 ) { return false; } @@ -4040,7 +3691,7 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "OO" ).getDomainId() ) != 1 ) { return false; } - cd = cdcc.get( new DomainId( "OO" ) ); + cd = cdcc.get( "OO" ); if ( cd.getNumberOfCombinableDomains() != 2 ) { return false; } @@ -4050,7 +3701,7 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "MM" ).getDomainId() ) != 1 ) { return false; } - cd = cdcc.get( new DomainId( "QQ" ) ); + cd = cdcc.get( "QQ" ); if ( cd.getNumberOfCombinableDomains() != 1 ) { return false; } @@ -4063,7 +3714,7 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "QQ" ).getDomainId() ) != 3 ) { return false; } - cd = cdcc.get( new DomainId( "PP" ) ); + cd = cdcc.get( "PP" ); if ( cd.getNumberOfCombinableDomains() != 0 ) { return false; } @@ -4073,7 +3724,7 @@ public class TestSurfacing { if ( cd.getKeyDomainProteinsCount() != 2 ) { return false; } - cd = cdcc.get( new DomainId( "singlet" ) ); + cd = cdcc.get( "singlet" ); if ( cd.getKeyDomainCount() != 1 ) { return false; } @@ -4086,7 +3737,7 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "singlet" ).getDomainId() ) != 0 ) { return false; } - cd = cdcc.get( new DomainId( "three" ) ); + cd = cdcc.get( "three" ); if ( cd.getKeyDomainCount() != 3 ) { return false; } @@ -4096,10 +3747,10 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "three" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "three" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "so_far_so_bad" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "so_far_so_bad" ) != 0 ) { return false; } // Ignore combinations with same: @@ -4108,8 +3759,10 @@ public class TestSurfacing { true, new BasicSpecies( "human" ), null, - DomainCombinationType.BASIC ); - cd = cdcc2.get( new DomainId( "A" ) ); + DomainCombinationType.BASIC, + null, + null ); + cd = cdcc2.get( "A" ); if ( cd.getKeyDomainCount() != 9 ) { return false; } @@ -4134,28 +3787,28 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "E" ).getDomainId() ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "U" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "U" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "V" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "V" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "W" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "W" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "X" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "X" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "Y" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "Y" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "Z" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "Z" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "NN" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "NN" ) != 0 ) { return false; } - cd = cdcc2.get( new DomainId( "B" ) ); + cd = cdcc2.get( "B" ); if ( cd.getKeyDomainCount() != 12 ) { return false; } @@ -4165,43 +3818,43 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "A" ) ) != 6 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "A" ) != 6 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "B" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "B" ) != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "C" ) ) != 4 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "C" ) != 4 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "D" ) ) != 3 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "D" ) != 3 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "E" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "E" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "U" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "U" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "V" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "V" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "W" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "W" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "X" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "X" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "Y" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "Y" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "Z" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "Z" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "NN" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "NN" ) != 0 ) { return false; } - cd = cdcc2.get( new DomainId( "C" ) ); + cd = cdcc2.get( "C" ); if ( cd.getKeyDomainCount() != 10 ) { return false; } @@ -4211,112 +3864,112 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "A" ) ) != 4 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "A" ) != 4 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "B" ) ) != 4 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "B" ) != 4 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "C" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "C" ) != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "D" ) ) != 3 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "D" ) != 3 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "E" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "E" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "U" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "U" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "V" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "V" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "W" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "W" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "X" ) ) != 2 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "X" ) != 2 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "Y" ) ) != 2 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "Y" ) != 2 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "Z" ) ) != 2 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "Z" ) != 2 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "NN" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "NN" ) != 0 ) { return false; } - cd = cdcc2.get( new DomainId( "D" ) ); + cd = cdcc2.get( "D" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "E" ) ); + cd = cdcc2.get( "E" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } if ( cd.getKeyDomainCount() != 1 ) { return false; } - cd = cdcc2.get( new DomainId( "U" ) ); + cd = cdcc2.get( "U" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "V" ) ); + cd = cdcc2.get( "V" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "W" ) ); + cd = cdcc2.get( "W" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "X" ) ); + cd = cdcc2.get( "X" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "Y" ) ); + cd = cdcc2.get( "Y" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "Z" ) ); + cd = cdcc2.get( "Z" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "NN" ) ); + cd = cdcc2.get( "NN" ); if ( cd.getNumberOfCombinableDomains() != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "NN" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "NN" ) != 0 ) { return false; } - cd = cdcc2.get( new DomainId( "MM" ) ); + cd = cdcc2.get( "MM" ); if ( cd.getNumberOfCombinableDomains() != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "MM" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "MM" ) != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "OO" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "OO" ) != 1 ) { return false; } - cd = cdcc2.get( new DomainId( "OO" ) ); + cd = cdcc2.get( "OO" ); if ( cd.getNumberOfCombinableDomains() != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "OO" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "OO" ) != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "MM" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "MM" ) != 1 ) { return false; } - cd = cdcc2.get( new DomainId( "QQ" ) ); + cd = cdcc2.get( "QQ" ); if ( cd.getNumberOfCombinableDomains() != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "QQ" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "QQ" ) != 0 ) { return false; } - cd = cdcc2.get( new DomainId( "singlet" ) ); + cd = cdcc2.get( "singlet" ); if ( cd.getKeyDomainCount() != 1 ) { return false; } @@ -4326,10 +3979,10 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "singlet" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "singlet" ) != 0 ) { return false; } - cd = cdcc2.get( new DomainId( "three" ) ); + cd = cdcc2.get( "three" ); if ( cd.getKeyDomainCount() != 3 ) { return false; } @@ -4339,73 +3992,10 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "three" ) ) != 0 ) { - return false; - } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "so_far_so_bad" ) ) != 0 ) { - return false; - } - } - catch ( final Exception e ) { - e.printStackTrace( System.out ); - return false; - } - return true; - } - - private static boolean testDomainId() { - try { - final DomainId id1 = new DomainId( "a" ); - final DomainId id2 = new DomainId( "a" ); - final DomainId id3 = new DomainId( "A" ); - final DomainId id4 = new DomainId( "b" ); - if ( !id1.equals( id1 ) ) { - return false; - } - if ( id1.getId().equals( "x" ) ) { - return false; - } - if ( id1.getId().equals( null ) ) { - return false; - } - if ( !id1.equals( id2 ) ) { - return false; - } - if ( id1.equals( id3 ) ) { - return false; - } - if ( id1.hashCode() != id1.hashCode() ) { - return false; - } - if ( id1.hashCode() != id2.hashCode() ) { - return false; - } - if ( id1.hashCode() == id3.hashCode() ) { - return false; - } - if ( id1.compareTo( id1 ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "three" ) != 0 ) { return false; } - if ( id1.compareTo( id2 ) != 0 ) { - return false; - } - if ( id1.compareTo( id3 ) != 0 ) { - return false; - } - if ( id1.compareTo( id4 ) >= 0 ) { - return false; - } - if ( id4.compareTo( id1 ) <= 0 ) { - return false; - } - if ( !id4.getId().equals( "b" ) ) { - return false; - } - final DomainId id5 = new DomainId( " C " ); - if ( !id5.getId().equals( "C" ) ) { - return false; - } - if ( id5.equals( id1 ) ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "so_far_so_bad" ) != 0 ) { return false; } } @@ -4461,73 +4051,73 @@ public class TestSurfacing { if ( sorted.size() != 17 ) { return false; } - if ( !sorted.get( 0 ).getDomainId().getId().equals( "A" ) ) { + if ( !sorted.get( 0 ).getDomainId().equals( "A" ) ) { return false; } if ( sorted.get( 0 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 1 ).getDomainId().getId().equals( "B" ) ) { + if ( !sorted.get( 1 ).getDomainId().equals( "B" ) ) { return false; } if ( sorted.get( 1 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 2 ).getDomainId().getId().equals( "C" ) ) { + if ( !sorted.get( 2 ).getDomainId().equals( "C" ) ) { return false; } if ( sorted.get( 2 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 3 ).getDomainId().getId().equals( "D" ) ) { + if ( !sorted.get( 3 ).getDomainId().equals( "D" ) ) { return false; } if ( sorted.get( 3 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 4 ).getDomainId().getId().equals( "E" ) ) { + if ( !sorted.get( 4 ).getDomainId().equals( "E" ) ) { return false; } if ( sorted.get( 4 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 5 ).getDomainId().getId().equals( "F" ) ) { + if ( !sorted.get( 5 ).getDomainId().equals( "F" ) ) { return false; } if ( sorted.get( 5 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 6 ).getDomainId().getId().equals( "G" ) ) { + if ( !sorted.get( 6 ).getDomainId().equals( "G" ) ) { return false; } if ( sorted.get( 6 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 7 ).getDomainId().getId().equals( "H" ) ) { + if ( !sorted.get( 7 ).getDomainId().equals( "H" ) ) { return false; } if ( sorted.get( 7 ).getNumber() != 5 ) { return false; } - if ( !sorted.get( 8 ).getDomainId().getId().equals( "H" ) ) { + if ( !sorted.get( 8 ).getDomainId().equals( "H" ) ) { return false; } if ( sorted.get( 8 ).getNumber() != 2 ) { return false; } - if ( !sorted.get( 9 ).getDomainId().getId().equals( "H" ) ) { + if ( !sorted.get( 9 ).getDomainId().equals( "H" ) ) { return false; } if ( sorted.get( 9 ).getNumber() != 6 ) { return false; } - if ( !sorted.get( 10 ).getDomainId().getId().equals( "H" ) ) { + if ( !sorted.get( 10 ).getDomainId().equals( "H" ) ) { return false; } if ( sorted.get( 10 ).getNumber() != 4 ) { return false; } - if ( !sorted.get( 11 ).getDomainId().getId().equals( "H" ) ) { + if ( !sorted.get( 11 ).getDomainId().equals( "H" ) ) { return false; } if ( sorted.get( 11 ).getNumber() != 1 ) { @@ -4536,25 +4126,25 @@ public class TestSurfacing { if ( sorted.get( 11 ).getTotalCount() != 5 ) { return false; } - if ( !sorted.get( 12 ).getDomainId().getId().equals( "H" ) ) { + if ( !sorted.get( 12 ).getDomainId().equals( "H" ) ) { return false; } if ( sorted.get( 12 ).getNumber() != 3 ) { return false; } - if ( !sorted.get( 13 ).getDomainId().getId().equals( "H7" ) ) { + if ( !sorted.get( 13 ).getDomainId().equals( "H7" ) ) { return false; } if ( sorted.get( 13 ).getNumber() != 5 ) { return false; } - if ( !sorted.get( 14 ).getDomainId().getId().equals( "H7" ) ) { + if ( !sorted.get( 14 ).getDomainId().equals( "H7" ) ) { return false; } if ( sorted.get( 14 ).getNumber() != 5 ) { return false; } - if ( !sorted.get( 15 ).getDomainId().getId().equals( "H7" ) ) { + if ( !sorted.get( 15 ).getDomainId().equals( "H7" ) ) { return false; } if ( sorted.get( 15 ).getNumber() != 5 ) { @@ -4562,7 +4152,7 @@ public class TestSurfacing { } // To check if sorting is stable [as claimed by Sun for // Collections.sort( List )] - if ( !sorted.get( 16 ).getDomainId().getId().equals( "H7" ) ) { + if ( !sorted.get( 16 ).getDomainId().equals( "H7" ) ) { return false; } if ( sorted.get( 16 ).getNumber() != 5 ) { @@ -4637,10 +4227,10 @@ public class TestSurfacing { if ( abc_r2.getNumberOfProteinDomains() != 2 ) { return false; } - if ( !abc_r2.getProteinDomain( 0 ).getDomainId().getId().equals( "a" ) ) { + if ( !abc_r2.getProteinDomain( 0 ).getDomainId().equals( "a" ) ) { return false; } - if ( !abc_r2.getProteinDomain( 1 ).getDomainId().getId().equals( "b" ) ) { + if ( !abc_r2.getProteinDomain( 1 ).getDomainId().equals( "b" ) ) { return false; } final Domain d = new BasicDomain( "d", 0, 10, ( short ) 1, ( short ) 1, 0.1, 1 ); @@ -4661,13 +4251,13 @@ public class TestSurfacing { if ( def_r2.getNumberOfProteinDomains() != 3 ) { return false; } - if ( !def_r2.getProteinDomain( 0 ).getDomainId().getId().equals( "d" ) ) { + if ( !def_r2.getProteinDomain( 0 ).getDomainId().equals( "d" ) ) { return false; } - if ( !def_r2.getProteinDomain( 1 ).getDomainId().getId().equals( "f" ) ) { + if ( !def_r2.getProteinDomain( 1 ).getDomainId().equals( "f" ) ) { return false; } - if ( !def_r2.getProteinDomain( 2 ).getDomainId().getId().equals( "e" ) ) { + if ( !def_r2.getProteinDomain( 2 ).getDomainId().equals( "e" ) ) { return false; } } @@ -4727,58 +4317,58 @@ public class TestSurfacing { .createInstance( protein_list_eel, false, new BasicSpecies( "eel" ) ); final BasicGenomeWideCombinableDomains eel_ignore = BasicGenomeWideCombinableDomains .createInstance( protein_list_eel, true, new BasicSpecies( "eel" ) ); - if ( !eel_not_ignore.contains( new DomainId( "a" ) ) ) { + if ( !eel_not_ignore.contains( "a" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "b" ) ) ) { + if ( !eel_not_ignore.contains( "b" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "c" ) ) ) { + if ( !eel_not_ignore.contains( "c" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "d" ) ) ) { + if ( !eel_not_ignore.contains( "d" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "e" ) ) ) { + if ( !eel_not_ignore.contains( "e" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "f" ) ) ) { + if ( !eel_not_ignore.contains( "f" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "g" ) ) ) { + if ( !eel_not_ignore.contains( "g" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "h" ) ) ) { + if ( !eel_not_ignore.contains( "h" ) ) { return false; } - if ( eel_not_ignore.contains( new DomainId( "x" ) ) ) { + if ( eel_not_ignore.contains( "x" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "a" ) ) ) { + if ( !eel_ignore.contains( "a" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "b" ) ) ) { + if ( !eel_ignore.contains( "b" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "c" ) ) ) { + if ( !eel_ignore.contains( "c" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "d" ) ) ) { + if ( !eel_ignore.contains( "d" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "e" ) ) ) { + if ( !eel_ignore.contains( "e" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "f" ) ) ) { + if ( !eel_ignore.contains( "f" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "g" ) ) ) { + if ( !eel_ignore.contains( "g" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "h" ) ) ) { + if ( !eel_ignore.contains( "h" ) ) { return false; } - if ( eel_ignore.contains( new DomainId( "x" ) ) ) { + if ( eel_ignore.contains( "x" ) ) { return false; } if ( eel_not_ignore.getSize() != 8 ) { @@ -4787,52 +4377,52 @@ public class TestSurfacing { if ( eel_ignore.getSize() != 8 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "a" ) ).getCombinableDomainsIds().size() != 5 ) { + if ( eel_not_ignore.get( "a" ).getCombinableDomainsIds().size() != 5 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "b" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_not_ignore.get( "b" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "c" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_not_ignore.get( "c" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "d" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_not_ignore.get( "d" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "e" ) ).getCombinableDomainsIds().size() != 6 ) { + if ( eel_not_ignore.get( "e" ).getCombinableDomainsIds().size() != 6 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "f" ) ).getCombinableDomainsIds().size() != 2 ) { + if ( eel_not_ignore.get( "f" ).getCombinableDomainsIds().size() != 2 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "g" ) ).getCombinableDomainsIds().size() != 1 ) { + if ( eel_not_ignore.get( "g" ).getCombinableDomainsIds().size() != 1 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "h" ) ).getCombinableDomainsIds().size() != 1 ) { + if ( eel_not_ignore.get( "h" ).getCombinableDomainsIds().size() != 1 ) { return false; } - if ( eel_ignore.get( new DomainId( "a" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_ignore.get( "a" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_ignore.get( new DomainId( "b" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_ignore.get( "b" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_ignore.get( new DomainId( "c" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_ignore.get( "c" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_ignore.get( new DomainId( "d" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_ignore.get( "d" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_ignore.get( new DomainId( "e" ) ).getCombinableDomainsIds().size() != 5 ) { + if ( eel_ignore.get( "e" ).getCombinableDomainsIds().size() != 5 ) { return false; } - if ( eel_ignore.get( new DomainId( "f" ) ).getCombinableDomainsIds().size() != 1 ) { + if ( eel_ignore.get( "f" ).getCombinableDomainsIds().size() != 1 ) { return false; } - if ( eel_ignore.get( new DomainId( "g" ) ).getCombinableDomainsIds().size() != 1 ) { + if ( eel_ignore.get( "g" ).getCombinableDomainsIds().size() != 1 ) { return false; } - if ( eel_ignore.get( new DomainId( "h" ) ).getCombinableDomainsIds().size() != 1 ) { + if ( eel_ignore.get( "h" ).getCombinableDomainsIds().size() != 1 ) { return false; } if ( eel_not_ignore.getAllDomainIds().size() != 8 ) { @@ -5076,9 +4666,9 @@ public class TestSurfacing { .equals( "pep:known chromosome:NCBI36:21:16024215:16174248:1 gene:ENSG00000155313 transcript:ENST00000285681" ) ) { return false; } - final List uba = pdc.getProteinDomains( new DomainId( "UBA" ) ); - final List uim = pdc.getProteinDomains( new DomainId( "UIM" ) ); - final List uch = pdc.getProteinDomains( new DomainId( "UCH" ) ); + final List uba = pdc.getProteinDomains( "UBA" ); + final List uim = pdc.getProteinDomains( "UIM" ); + final List uch = pdc.getProteinDomains( "UCH" ); if ( uba.size() != 1 ) { return false; } @@ -5089,14 +4679,14 @@ public class TestSurfacing { return false; } final BasicDomain uim_domain = ( BasicDomain ) uim.get( 1 ); - if ( !uim_domain.getDomainId().equals( new DomainId( "UIM" ) ) ) { + if ( !uim_domain.getDomainId().equals( "UIM" ) ) { return false; } if ( uim_domain.getTotalCount() != 2 ) { return false; } final BasicDomain uba_domain = ( BasicDomain ) uba.get( 0 ); - if ( !uba_domain.getDomainId().equals( new DomainId( "UBA" ) ) ) { + if ( !uba_domain.getDomainId().equals( "UBA" ) ) { return false; } if ( uba_domain.getNumber() != 1 ) { @@ -5163,9 +4753,9 @@ public class TestSurfacing { if ( pdc2.getNumberOfProteinDomains() != 3 ) { return false; } - final List uba2 = pdc2.getProteinDomains( new DomainId( "UBA" ) ); - final List uim2 = pdc2.getProteinDomains( new DomainId( "UIM" ) ); - final List uch2 = pdc2.getProteinDomains( new DomainId( "UCH" ) ); + final List uba2 = pdc2.getProteinDomains( "UBA" ); + final List uim2 = pdc2.getProteinDomains( "UIM" ); + final List uch2 = pdc2.getProteinDomains( "UCH" ); if ( uba2.size() != 1 ) { return false; } @@ -5176,14 +4766,14 @@ public class TestSurfacing { return false; } final BasicDomain uim_domain2 = ( BasicDomain ) uim2.get( 1 ); - if ( !uim_domain2.getDomainId().getId().equals( "UIM" ) ) { + if ( !uim_domain2.getDomainId().equals( "UIM" ) ) { return false; } if ( uim_domain2.getTotalCount() != 2 ) { return false; } final BasicDomain uba_domain2 = ( BasicDomain ) uba2.get( 0 ); - if ( !uba_domain2.getDomainId().getId().equals( "UBA" ) ) { + if ( !uba_domain2.getDomainId().equals( "UBA" ) ) { return false; } if ( uba_domain2.getNumber() != 1 ) { @@ -5225,9 +4815,9 @@ public class TestSurfacing { return false; } // - Set filter = new TreeSet(); - filter.add( new DomainId( "beauty" ) ); - filter.add( new DomainId( "strange" ) ); + Set filter = new TreeSet(); + filter.add( "beauty" ); + filter.add( "strange" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -5245,9 +4835,9 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "beauty" ) ); - filter.add( new DomainId( "strange" ) ); + filter = new TreeSet(); + filter.add( "beauty" ); + filter.add( "strange" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -5265,10 +4855,10 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "UIM" ) ); - filter.add( new DomainId( "A" ) ); - filter.add( new DomainId( "C" ) ); + filter = new TreeSet(); + filter.add( "UIM" ); + filter.add( "A" ); + filter.add( "C" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -5286,11 +4876,11 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "UIM" ) ); - filter.add( new DomainId( "A" ) ); - filter.add( new DomainId( "C" ) ); - filter.add( new DomainId( "X" ) ); + filter = new TreeSet(); + filter.add( "UIM" ); + filter.add( "A" ); + filter.add( "C" ); + filter.add( "X" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -5308,10 +4898,10 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "UIM" ) ); - filter.add( new DomainId( "A" ) ); - filter.add( new DomainId( "C" ) ); + filter = new TreeSet(); + filter.add( "UIM" ); + filter.add( "A" ); + filter.add( "C" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -5329,8 +4919,8 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "UIM" ) ); + filter = new TreeSet(); + filter.add( "UIM" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -5351,8 +4941,8 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "UIM" ) ); + filter = new TreeSet(); + filter.add( "UIM" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -5373,9 +4963,9 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "A" ) ); - filter.add( new DomainId( "C" ) ); + filter = new TreeSet(); + filter.add( "A" ); + filter.add( "C" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -5453,7 +5043,7 @@ public class TestSurfacing { if ( ab_s0.getNumberOfProteinDomains() != 1 ) { return false; } - if ( !ab_s0.getProteinDomain( 0 ).getDomainId().getId().equals( "a" ) ) { + if ( !ab_s0.getProteinDomain( 0 ).getDomainId().equals( "a" ) ) { return false; } final Protein ab_s1 = SurfacingUtil.removeOverlappingDomains( 4, false, ab ); @@ -5503,7 +5093,7 @@ public class TestSurfacing { if ( fghi_s0.getNumberOfProteinDomains() != 1 ) { return false; } - if ( !fghi_s0.getProteinDomain( 0 ).getDomainId().getId().equals( "h" ) ) { + if ( !fghi_s0.getProteinDomain( 0 ).getDomainId().equals( "h" ) ) { return false; } final Protein fghi_s1 = SurfacingUtil.removeOverlappingDomains( 11, false, fghi ); @@ -5535,7 +5125,7 @@ public class TestSurfacing { if ( jklm_s0.getNumberOfProteinDomains() != 1 ) { return false; } - if ( !jklm_s0.getProteinDomain( 0 ).getDomainId().getId().equals( "l" ) ) { + if ( !jklm_s0.getProteinDomain( 0 ).getDomainId().equals( "l" ) ) { return false; } final Protein jklm_s1 = SurfacingUtil.removeOverlappingDomains( 11, false, jklm ); @@ -5970,7 +5560,7 @@ public class TestSurfacing { gwcd_list.add( two ); gwcd_list.add( three ); gwcd_list.add( four ); - final Map> map_same = new HashMap>(); + final Map> map_same = new HashMap>(); final HashSet a_s = new HashSet(); a_s.add( "AAA" ); final HashSet b_s = new HashSet(); @@ -6157,130 +5747,4 @@ public class TestSurfacing { } return true; } - - private static boolean testProteinId() { - try { - final ProteinId id1 = new ProteinId( "a" ); - final ProteinId id2 = new ProteinId( "a" ); - final ProteinId id3 = new ProteinId( "A" ); - final ProteinId id4 = new ProteinId( "b" ); - if ( !id1.equals( id1 ) ) { - return false; - } - if ( id1.getId().equals( "x" ) ) { - return false; - } - if ( id1.getId().equals( null ) ) { - return false; - } - if ( !id1.equals( id2 ) ) { - return false; - } - if ( id1.equals( id3 ) ) { - return false; - } - if ( id1.hashCode() != id1.hashCode() ) { - return false; - } - if ( id1.hashCode() != id2.hashCode() ) { - return false; - } - if ( id1.hashCode() == id3.hashCode() ) { - return false; - } - if ( id1.compareTo( id1 ) != 0 ) { - return false; - } - if ( id1.compareTo( id2 ) != 0 ) { - return false; - } - if ( id1.compareTo( id3 ) != 0 ) { - return false; - } - if ( id1.compareTo( id4 ) >= 0 ) { - return false; - } - if ( id4.compareTo( id1 ) <= 0 ) { - return false; - } - if ( !id4.getId().equals( "b" ) ) { - return false; - } - final ProteinId id5 = new ProteinId( " C " ); - if ( !id5.getId().equals( "C" ) ) { - return false; - } - if ( id5.equals( id1 ) ) { - return false; - } - } - catch ( final Exception e ) { - e.printStackTrace( System.out ); - return false; - } - return true; - } - - private static boolean testSpecies() { - try { - final Species s1 = new BasicSpecies( "a" ); - final Species s2 = new BasicSpecies( "a" ); - final Species s3 = new BasicSpecies( "A" ); - final Species s4 = new BasicSpecies( "b" ); - if ( !s1.equals( s1 ) ) { - return false; - } - if ( s1.getSpeciesId().equals( "x" ) ) { - return false; - } - if ( s1.getSpeciesId().equals( null ) ) { - return false; - } - if ( !s1.equals( s2 ) ) { - return false; - } - if ( s1.equals( s3 ) ) { - return false; - } - if ( s1.hashCode() != s1.hashCode() ) { - return false; - } - if ( s1.hashCode() != s2.hashCode() ) { - return false; - } - if ( s1.hashCode() == s3.hashCode() ) { - return false; - } - if ( s1.compareTo( s1 ) != 0 ) { - return false; - } - if ( s1.compareTo( s2 ) != 0 ) { - return false; - } - if ( s1.compareTo( s3 ) != 0 ) { - return false; - } - if ( s1.compareTo( s4 ) >= 0 ) { - return false; - } - if ( s4.compareTo( s1 ) <= 0 ) { - return false; - } - if ( !s4.getSpeciesId().equals( "b" ) ) { - return false; - } - final Species s5 = new BasicSpecies( " C " ); - if ( !s5.getSpeciesId().equals( "C" ) ) { - return false; - } - if ( s5.equals( s1 ) ) { - return false; - } - } - catch ( final Exception e ) { - e.printStackTrace( System.out ); - return false; - } - return true; - } }