X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fsurfacing%2FTestSurfacing.java;h=168b6a47a89fd461bf25dc5fc0fc0b09fe2f4d27;hb=380f98efacccdaeff5a86ba6b9b05367df133b79;hp=8301b9b44944d693ba0a7f562e05342f6dbf98bd;hpb=757f42e63a33c5935b68af1d02a02c76d475fe79;p=jalview.git diff --git a/forester/java/src/org/forester/surfacing/TestSurfacing.java b/forester/java/src/org/forester/surfacing/TestSurfacing.java index 8301b9b..168b6a4 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,7 +48,15 @@ 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.surfacing.BinaryDomainCombination.DomainCombinationType; +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.Protein; +import org.forester.protein.ProteinId; +import org.forester.species.BasicSpecies; +import org.forester.species.Species; import org.forester.test.Test; import org.forester.util.ForesterUtil; @@ -61,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." ); @@ -182,18 +147,6 @@ public class TestSurfacing { return false; } System.out.println( "OK." ); - System.out.print( " Overlap removal: " ); - if ( !TestSurfacing.testOverlapRemoval() ) { - System.out.println( "failed." ); - return false; - } - System.out.println( "OK." ); - System.out.print( " Engulfing overlap removal: " ); - if ( !TestSurfacing.testEngulfingOverlapRemoval() ) { - System.out.println( "failed." ); - return false; - } - System.out.println( "OK." ); System.out.print( " Binary domain combination: " ); if ( !TestSurfacing.testBinaryDomainCombination() ) { System.out.println( "failed." ); @@ -239,62 +192,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() { @@ -351,10 +259,10 @@ public class TestSurfacing { if ( !TestSurfacing.isEqual( X.getPerSequenceScore(), -12 ) ) { return false; } - final Protein mouse_1 = new BasicProtein( "1", "mouse" ); - final Protein rabbit_1 = new BasicProtein( "1", "rabbit" ); - final Protein ciona_1 = new BasicProtein( "1", "ciona" ); - final Protein nemve_1 = new BasicProtein( "1", "nemve" ); + final Protein mouse_1 = new BasicProtein( "1", "mouse", 0 ); + final Protein rabbit_1 = new BasicProtein( "1", "rabbit", 0 ); + final Protein ciona_1 = new BasicProtein( "1", "ciona", 0 ); + final Protein nemve_1 = new BasicProtein( "1", "nemve", 0 ); mouse_1.addProteinDomain( A ); mouse_1.addProteinDomain( B ); mouse_1.addProteinDomain( C ); @@ -407,7 +315,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, @@ -415,7 +324,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 ) { @@ -433,8 +342,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 ) ) ) { @@ -456,7 +365,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 ) { @@ -490,7 +399,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 ) { @@ -505,7 +414,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 ) ) { @@ -557,7 +466,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, @@ -565,7 +475,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 ) { @@ -583,8 +493,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 ) ) ) { @@ -605,7 +515,7 @@ public class TestSurfacing { if ( sa2.getMaximalDifferenceInCounts() != 3 ) { return false; } - final Protein ciona_2 = new BasicProtein( "2", "ciona" ); + final Protein ciona_2 = new BasicProtein( "2", "ciona", 0 ); ciona_2.addProteinDomain( A ); ciona_2.addProteinDomain( A ); ciona_2.addProteinDomain( A ); @@ -618,7 +528,7 @@ public class TestSurfacing { ciona_2.addProteinDomain( F ); ciona_2.addProteinDomain( G ); ciona_2.addProteinDomain( X ); - final Protein ciona_3 = new BasicProtein( "3", "ciona" ); + final Protein ciona_3 = new BasicProtein( "3", "ciona", 0 ); ciona_3.addProteinDomain( A ); ciona_3.addProteinDomain( A ); ciona_3.addProteinDomain( A ); @@ -644,7 +554,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, @@ -652,23 +563,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(); @@ -687,7 +598,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, @@ -695,46 +607,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 ) { @@ -747,35 +660,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 ) { @@ -804,52 +718,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 ) { @@ -871,35 +786,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 ) { @@ -937,52 +853,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 ) { @@ -1004,35 +921,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 ) { @@ -1067,10 +985,10 @@ public class TestSurfacing { if ( !TestSurfacing.isEqual( X.getPerSequenceScore(), -12 ) ) { return false; } - final Protein mouse_1 = new BasicProtein( "1", "mouse" ); - final Protein rabbit_1 = new BasicProtein( "1", "rabbit" ); - final Protein ciona_1 = new BasicProtein( "1", "ciona" ); - final Protein nemve_1 = new BasicProtein( "1", "nemve" ); + final Protein mouse_1 = new BasicProtein( "1", "mouse", 0 ); + final Protein rabbit_1 = new BasicProtein( "1", "rabbit", 0 ); + final Protein ciona_1 = new BasicProtein( "1", "ciona", 0 ); + final Protein nemve_1 = new BasicProtein( "1", "nemve", 0 ); mouse_1.addProteinDomain( A ); mouse_1.addProteinDomain( D ); mouse_1.addProteinDomain( E ); @@ -1112,7 +1030,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, @@ -1120,7 +1039,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 ) { @@ -1151,7 +1070,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 ) { @@ -1167,7 +1086,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 ) { @@ -1185,10 +1104,10 @@ public class TestSurfacing { try { final Domain A = new BasicDomain( "A", 1, 2, ( short ) 1, ( short ) 1, 0.15, -12 ); final Domain B = new BasicDomain( "B", 1, 2, ( short ) 1, ( short ) 1, 0.2, -12 ); - final Protein mouse_1 = new BasicProtein( "1", "mouse" ); - final Protein rabbit_1 = new BasicProtein( "1", "rabbit" ); - final Protein ciona_1 = new BasicProtein( "1", "ciona" ); - final Protein nemve_1 = new BasicProtein( "1", "nemve" ); + final Protein mouse_1 = new BasicProtein( "1", "mouse", 0 ); + final Protein rabbit_1 = new BasicProtein( "1", "rabbit", 0 ); + final Protein ciona_1 = new BasicProtein( "1", "ciona", 0 ); + final Protein nemve_1 = new BasicProtein( "1", "nemve", 0 ); mouse_1.addProteinDomain( A ); rabbit_1.addProteinDomain( A ); ciona_1.addProteinDomain( A ); @@ -1220,7 +1139,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, @@ -1231,7 +1151,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 ) { @@ -1257,10 +1177,10 @@ public class TestSurfacing { if ( sims_ns.size() != 0 ) { return false; } - final Protein mouse_2 = new BasicProtein( "1", "mouse" ); - final Protein rabbit_2 = new BasicProtein( "1", "rabbit" ); - final Protein ciona_2 = new BasicProtein( "1", "ciona" ); - final Protein nemve_2 = new BasicProtein( "1", "nemve" ); + final Protein mouse_2 = new BasicProtein( "1", "mouse", 0 ); + final Protein rabbit_2 = new BasicProtein( "1", "rabbit", 0 ); + final Protein ciona_2 = new BasicProtein( "1", "ciona", 0 ); + final Protein nemve_2 = new BasicProtein( "1", "nemve", 0 ); mouse_2.addProteinDomain( A ); rabbit_2.addProteinDomain( A ); ciona_2.addProteinDomain( A ); @@ -1307,280 +1227,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" ); - 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" ); @@ -1592,7 +1238,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; @@ -1624,17 +1270,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" ); @@ -1987,7 +1634,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 ) ) { @@ -2005,7 +1652,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 ) ) { @@ -2151,11 +1798,11 @@ public class TestSurfacing { final GainLossStates L = GainLossStates.LOSS; final GainLossStates A = GainLossStates.UNCHANGED_ABSENT; final GainLossStates P = GainLossStates.UNCHANGED_PRESENT; - final Protein one_1 = new BasicProtein( "one", "1" ); - final Protein two_1 = new BasicProtein( "two", "1" ); - final Protein three_1 = new BasicProtein( "three", "1" ); - final Protein four_1 = new BasicProtein( "four", "1" ); - final Protein five_1 = new BasicProtein( "five", "1" ); + final Protein one_1 = new BasicProtein( "one", "1", 0 ); + final Protein two_1 = new BasicProtein( "two", "1", 0 ); + final Protein three_1 = new BasicProtein( "three", "1", 0 ); + final Protein four_1 = new BasicProtein( "four", "1", 0 ); + final Protein five_1 = new BasicProtein( "five", "1", 0 ); one_1.addProteinDomain( new BasicDomain( "B", 12, 14, ( short ) 1, ( short ) 4, 0.1, -12 ) ); one_1.addProteinDomain( new BasicDomain( "C", 13, 14, ( short ) 1, ( short ) 4, 0.1, -12 ) ); one_1.addProteinDomain( new BasicDomain( "A", 11, 12, ( short ) 1, ( short ) 4, 0.1, -12 ) ); @@ -2726,11 +2373,11 @@ public class TestSurfacing { private static boolean testDirectednessAndAdjacency() { try { - final Protein one_1 = new BasicProtein( "one", "1" ); - final Protein two_1 = new BasicProtein( "two", "1" ); - final Protein three_1 = new BasicProtein( "three", "1" ); - final Protein four_1 = new BasicProtein( "four", "1" ); - final Protein five_1 = new BasicProtein( "five", "1" ); + final Protein one_1 = new BasicProtein( "one", "1", 0 ); + final Protein two_1 = new BasicProtein( "two", "1", 0 ); + final Protein three_1 = new BasicProtein( "three", "1", 0 ); + final Protein four_1 = new BasicProtein( "four", "1", 0 ); + final Protein five_1 = new BasicProtein( "five", "1", 0 ); one_1.addProteinDomain( new BasicDomain( "B", 12, 14, ( short ) 1, ( short ) 4, 0.1, -12 ) ); one_1.addProteinDomain( new BasicDomain( "C", 13, 14, ( short ) 1, ( short ) 4, 0.1, -12 ) ); one_1.addProteinDomain( new BasicDomain( "A", 11, 12, ( short ) 1, ( short ) 4, 0.1, -12 ) ); @@ -2891,21 +2538,21 @@ public class TestSurfacing { final Domain l = new BasicDomain( "l", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); final Domain m = new BasicDomain( "m", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); final Domain n = new BasicDomain( "n", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); - final Protein eel_0 = new BasicProtein( "0", "eel" ); - final Protein eel_1 = new BasicProtein( "1", "eel" ); - final Protein eel_2 = new BasicProtein( "2", "eel" ); - final Protein eel_3 = new BasicProtein( "3", "eel" ); - final Protein eel_4 = new BasicProtein( "4", "eel" ); - final Protein eel_5 = new BasicProtein( "5", "eel" ); - final Protein eel_6 = new BasicProtein( "6", "eel" ); - final Protein rat_0 = new BasicProtein( "0", "rat" ); - final Protein rat_1 = new BasicProtein( "1", "rat" ); - final Protein rat_2 = new BasicProtein( "2", "rat" ); - final Protein rat_3 = new BasicProtein( "3", "rat" ); - final Protein rat_4 = new BasicProtein( "4", "rat" ); - final Protein rat_5 = new BasicProtein( "5", "rat" ); - final Protein rat_6 = new BasicProtein( "6", "rat" ); - final Protein rat_7 = new BasicProtein( "7", "rat" ); + final Protein eel_0 = new BasicProtein( "0", "eel", 0 ); + final Protein eel_1 = new BasicProtein( "1", "eel", 0 ); + final Protein eel_2 = new BasicProtein( "2", "eel", 0 ); + final Protein eel_3 = new BasicProtein( "3", "eel", 0 ); + final Protein eel_4 = new BasicProtein( "4", "eel", 0 ); + final Protein eel_5 = new BasicProtein( "5", "eel", 0 ); + final Protein eel_6 = new BasicProtein( "6", "eel", 0 ); + final Protein rat_0 = new BasicProtein( "0", "rat", 0 ); + final Protein rat_1 = new BasicProtein( "1", "rat", 0 ); + final Protein rat_2 = new BasicProtein( "2", "rat", 0 ); + final Protein rat_3 = new BasicProtein( "3", "rat", 0 ); + final Protein rat_4 = new BasicProtein( "4", "rat", 0 ); + final Protein rat_5 = new BasicProtein( "5", "rat", 0 ); + final Protein rat_6 = new BasicProtein( "6", "rat", 0 ); + final Protein rat_7 = new BasicProtein( "7", "rat", 0 ); eel_1.addProteinDomain( a ); eel_2.addProteinDomain( a ); eel_2.addProteinDomain( b ); @@ -3098,7 +2745,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; } @@ -3426,17 +3073,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 ); @@ -3445,11 +3092,11 @@ public class TestSurfacing { final Domain x = new BasicDomain( "x", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); final Domain y = new BasicDomain( "y", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); final Domain z = new BasicDomain( "z", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); - final Protein a_0 = new BasicProtein( "0", "a" ); - final Protein a_1 = new BasicProtein( "1", "a" ); - final Protein a_2 = new BasicProtein( "2", "a" ); - final Protein b_0 = new BasicProtein( "0", "b" ); - final Protein b_1 = new BasicProtein( "1", "b" ); + final Protein a_0 = new BasicProtein( "0", "a", 0 ); + final Protein a_1 = new BasicProtein( "1", "a", 0 ); + final Protein a_2 = new BasicProtein( "2", "a", 0 ); + final Protein b_0 = new BasicProtein( "0", "b", 0 ); + final Protein b_1 = new BasicProtein( "1", "b", 0 ); a_0.addProteinDomain( u ); a_0.addProteinDomain( v ); a_0.addProteinDomain( w ); @@ -3573,8 +3220,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; } @@ -3678,10 +3325,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; } @@ -3752,34 +3399,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; } } @@ -3800,7 +3447,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; } @@ -3849,7 +3496,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; } @@ -3898,7 +3545,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; } @@ -3944,7 +3591,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; } @@ -3954,7 +3601,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; } @@ -3964,7 +3611,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; } @@ -3974,7 +3621,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; } @@ -3984,7 +3631,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; } @@ -3994,22 +3641,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; } @@ -4022,7 +3669,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; } @@ -4032,7 +3679,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; } @@ -4042,7 +3689,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; } @@ -4055,7 +3702,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; } @@ -4065,7 +3712,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; } @@ -4078,7 +3725,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; } @@ -4088,10 +3735,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: @@ -4100,8 +3747,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; } @@ -4126,28 +3775,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; } @@ -4157,43 +3806,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; } @@ -4203,112 +3852,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; } @@ -4318,10 +3967,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; } @@ -4331,73 +3980,10 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "three" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "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 ) { - 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; } } @@ -4431,7 +4017,7 @@ public class TestSurfacing { -0.111 ); final Domain H7 = new BasicDomain( "H7", ( short ) 700, ( short ) 800, ( short ) 5, ( short ) 5, 0.7, -12 ); final Domain H8 = new BasicDomain( "H7", ( short ) 700, ( short ) 800, ( short ) 5, ( short ) 200, 0.7, -12 ); - final Protein protein = new BasicProtein( "00", "bat" ); + final Protein protein = new BasicProtein( "00", "bat", 0 ); protein.addProteinDomain( H5 ); protein.addProteinDomain( H2 ); protein.addProteinDomain( H7 ); @@ -4453,73 +4039,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 ) { @@ -4528,25 +4114,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 ) { @@ -4554,7 +4140,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 ) { @@ -4571,105 +4157,6 @@ public class TestSurfacing { return true; } - private static boolean testEngulfingOverlapRemoval() { - try { - final Domain d0 = new BasicDomain( "d0", 0, 8, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Domain d1 = new BasicDomain( "d1", 0, 1, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Domain d2 = new BasicDomain( "d2", 0, 2, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Domain d3 = new BasicDomain( "d3", 7, 8, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Domain d4 = new BasicDomain( "d4", 7, 9, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Domain d5 = new BasicDomain( "d4", 0, 9, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Domain d6 = new BasicDomain( "d4", 4, 5, ( short ) 1, ( short ) 1, 0.1, 1 ); - final List covered = new ArrayList(); - covered.add( true ); // 0 - covered.add( false ); // 1 - covered.add( true ); // 2 - covered.add( false ); // 3 - covered.add( true ); // 4 - covered.add( true ); // 5 - covered.add( false ); // 6 - covered.add( true ); // 7 - covered.add( true ); // 8 - if ( SurfacingUtil.isEngulfed( d0, covered ) ) { - return false; - } - if ( SurfacingUtil.isEngulfed( d1, covered ) ) { - return false; - } - if ( SurfacingUtil.isEngulfed( d2, covered ) ) { - return false; - } - if ( !SurfacingUtil.isEngulfed( d3, covered ) ) { - return false; - } - if ( SurfacingUtil.isEngulfed( d4, covered ) ) { - return false; - } - if ( SurfacingUtil.isEngulfed( d5, covered ) ) { - return false; - } - if ( !SurfacingUtil.isEngulfed( d6, covered ) ) { - return false; - } - final Domain a = new BasicDomain( "a", 0, 10, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Domain b = new BasicDomain( "b", 8, 20, ( short ) 1, ( short ) 1, 0.2, 1 ); - final Domain c = new BasicDomain( "c", 15, 16, ( short ) 1, ( short ) 1, 0.3, 1 ); - final Protein abc = new BasicProtein( "abc", "nemve" ); - abc.addProteinDomain( a ); - abc.addProteinDomain( b ); - abc.addProteinDomain( c ); - final Protein abc_r1 = SurfacingUtil.removeOverlappingDomains( 3, false, abc ); - final Protein abc_r2 = SurfacingUtil.removeOverlappingDomains( 3, true, abc ); - if ( abc.getNumberOfProteinDomains() != 3 ) { - return false; - } - if ( abc_r1.getNumberOfProteinDomains() != 3 ) { - return false; - } - if ( abc_r2.getNumberOfProteinDomains() != 2 ) { - return false; - } - if ( !abc_r2.getProteinDomain( 0 ).getDomainId().getId().equals( "a" ) ) { - return false; - } - if ( !abc_r2.getProteinDomain( 1 ).getDomainId().getId().equals( "b" ) ) { - return false; - } - final Domain d = new BasicDomain( "d", 0, 10, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Domain e = new BasicDomain( "e", 8, 20, ( short ) 1, ( short ) 1, 0.3, 1 ); - final Domain f = new BasicDomain( "f", 15, 16, ( short ) 1, ( short ) 1, 0.2, 1 ); - final Protein def = new BasicProtein( "def", "nemve" ); - def.addProteinDomain( d ); - def.addProteinDomain( e ); - def.addProteinDomain( f ); - final Protein def_r1 = SurfacingUtil.removeOverlappingDomains( 5, false, def ); - final Protein def_r2 = SurfacingUtil.removeOverlappingDomains( 5, true, def ); - if ( def.getNumberOfProteinDomains() != 3 ) { - return false; - } - if ( def_r1.getNumberOfProteinDomains() != 3 ) { - return false; - } - if ( def_r2.getNumberOfProteinDomains() != 3 ) { - return false; - } - if ( !def_r2.getProteinDomain( 0 ).getDomainId().getId().equals( "d" ) ) { - return false; - } - if ( !def_r2.getProteinDomain( 1 ).getDomainId().getId().equals( "f" ) ) { - return false; - } - if ( !def_r2.getProteinDomain( 2 ).getDomainId().getId().equals( "e" ) ) { - return false; - } - } - catch ( final Exception e ) { - e.printStackTrace( System.out ); - return false; - } - return true; - } - private static boolean testGenomeWideCombinableDomains() { try { final Domain a = new BasicDomain( "a", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); @@ -4681,13 +4168,13 @@ public class TestSurfacing { final Domain g = new BasicDomain( "g", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); final Domain h = new BasicDomain( "h", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); final Domain x = new BasicDomain( "x", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); - final Protein eel_0 = new BasicProtein( "0", "eel" ); - final Protein eel_1 = new BasicProtein( "1", "eel" ); - final Protein eel_2 = new BasicProtein( "2", "eel" ); - final Protein eel_3 = new BasicProtein( "3", "eel" ); - final Protein eel_4 = new BasicProtein( "4", "eel" ); - final Protein eel_5 = new BasicProtein( "5", "eel" ); - final Protein eel_6 = new BasicProtein( "6", "eel" ); + final Protein eel_0 = new BasicProtein( "0", "eel", 0 ); + final Protein eel_1 = new BasicProtein( "1", "eel", 0 ); + final Protein eel_2 = new BasicProtein( "2", "eel", 0 ); + final Protein eel_3 = new BasicProtein( "3", "eel", 0 ); + final Protein eel_4 = new BasicProtein( "4", "eel", 0 ); + final Protein eel_5 = new BasicProtein( "5", "eel", 0 ); + final Protein eel_6 = new BasicProtein( "6", "eel", 0 ); eel_1.addProteinDomain( a ); eel_2.addProteinDomain( a ); eel_2.addProteinDomain( b ); @@ -4719,58 +4206,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 ) { @@ -4779,52 +4266,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 ) { @@ -5068,9 +4555,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; } @@ -5081,14 +4568,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 ) { @@ -5155,9 +4642,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; } @@ -5168,14 +4655,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 ) { @@ -5217,9 +4704,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", @@ -5237,9 +4724,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", @@ -5257,10 +4744,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", @@ -5278,11 +4765,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", @@ -5300,10 +4787,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", @@ -5321,8 +4808,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", @@ -5343,8 +4830,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", @@ -5365,9 +4852,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", @@ -5401,160 +4888,6 @@ public class TestSurfacing { return true; } - private static boolean testOverlapRemoval() { - try { - final Domain d0 = new BasicDomain( "d0", ( short ) 2, ( short ) 5, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Domain d1 = new BasicDomain( "d1", ( short ) 7, ( short ) 10, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Domain d2 = new BasicDomain( "d2", ( short ) 0, ( short ) 20, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Domain d3 = new BasicDomain( "d3", ( short ) 9, ( short ) 10, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Domain d4 = new BasicDomain( "d4", ( short ) 7, ( short ) 8, ( short ) 1, ( short ) 1, 0.1, 1 ); - final List covered = new ArrayList(); - covered.add( true ); // 0 - covered.add( false ); // 1 - covered.add( true ); // 2 - covered.add( false ); // 3 - covered.add( true ); // 4 - covered.add( true ); // 5 - covered.add( false ); // 6 - covered.add( true ); // 7 - covered.add( true ); // 8 - if ( SurfacingUtil.calculateOverlap( d0, covered ) != 3 ) { - return false; - } - if ( SurfacingUtil.calculateOverlap( d1, covered ) != 2 ) { - return false; - } - if ( SurfacingUtil.calculateOverlap( d2, covered ) != 6 ) { - return false; - } - if ( SurfacingUtil.calculateOverlap( d3, covered ) != 0 ) { - return false; - } - if ( SurfacingUtil.calculateOverlap( d4, covered ) != 2 ) { - return false; - } - final Domain a = new BasicDomain( "a", ( short ) 2, ( short ) 5, ( short ) 1, ( short ) 1, 0.01, 1 ); - final Domain b = new BasicDomain( "b", ( short ) 2, ( short ) 10, ( short ) 1, ( short ) 1, 0.1, 1 ); - final Protein ab = new BasicProtein( "ab", "varanus" ); - ab.addProteinDomain( a ); - ab.addProteinDomain( b ); - final Protein ab_s0 = SurfacingUtil.removeOverlappingDomains( 3, false, ab ); - if ( ab.getNumberOfProteinDomains() != 2 ) { - return false; - } - if ( ab_s0.getNumberOfProteinDomains() != 1 ) { - return false; - } - if ( !ab_s0.getProteinDomain( 0 ).getDomainId().getId().equals( "a" ) ) { - return false; - } - final Protein ab_s1 = SurfacingUtil.removeOverlappingDomains( 4, false, ab ); - if ( ab.getNumberOfProteinDomains() != 2 ) { - return false; - } - if ( ab_s1.getNumberOfProteinDomains() != 2 ) { - return false; - } - final Domain c = new BasicDomain( "c", ( short ) 20000, ( short ) 20500, ( short ) 1, ( short ) 1, 10, 1 ); - final Domain d = new BasicDomain( "d", - ( short ) 10000, - ( short ) 10500, - ( short ) 1, - ( short ) 1, - 0.0000001, - 1 ); - final Domain e = new BasicDomain( "e", ( short ) 5000, ( short ) 5500, ( short ) 1, ( short ) 1, 0.0001, 1 ); - final Protein cde = new BasicProtein( "cde", "varanus" ); - cde.addProteinDomain( c ); - cde.addProteinDomain( d ); - cde.addProteinDomain( e ); - final Protein cde_s0 = SurfacingUtil.removeOverlappingDomains( 0, false, cde ); - if ( cde.getNumberOfProteinDomains() != 3 ) { - return false; - } - if ( cde_s0.getNumberOfProteinDomains() != 3 ) { - return false; - } - final Domain f = new BasicDomain( "f", ( short ) 10, ( short ) 20, ( short ) 1, ( short ) 1, 10, 1 ); - final Domain g = new BasicDomain( "g", ( short ) 10, ( short ) 20, ( short ) 1, ( short ) 1, 0.01, 1 ); - final Domain h = new BasicDomain( "h", ( short ) 10, ( short ) 20, ( short ) 1, ( short ) 1, 0.0001, 1 ); - final Domain i = new BasicDomain( "i", ( short ) 10, ( short ) 20, ( short ) 1, ( short ) 1, 0.5, 1 ); - final Domain i2 = new BasicDomain( "i", ( short ) 5, ( short ) 30, ( short ) 1, ( short ) 1, 0.5, 10 ); - final Protein fghi = new BasicProtein( "fghi", "varanus" ); - fghi.addProteinDomain( f ); - fghi.addProteinDomain( g ); - fghi.addProteinDomain( h ); - fghi.addProteinDomain( i ); - fghi.addProteinDomain( i ); - fghi.addProteinDomain( i ); - fghi.addProteinDomain( i2 ); - final Protein fghi_s0 = SurfacingUtil.removeOverlappingDomains( 10, false, fghi ); - if ( fghi.getNumberOfProteinDomains() != 7 ) { - return false; - } - if ( fghi_s0.getNumberOfProteinDomains() != 1 ) { - return false; - } - if ( !fghi_s0.getProteinDomain( 0 ).getDomainId().getId().equals( "h" ) ) { - return false; - } - final Protein fghi_s1 = SurfacingUtil.removeOverlappingDomains( 11, false, fghi ); - if ( fghi.getNumberOfProteinDomains() != 7 ) { - return false; - } - if ( fghi_s1.getNumberOfProteinDomains() != 7 ) { - return false; - } - final Domain j = new BasicDomain( "j", ( short ) 10, ( short ) 20, ( short ) 1, ( short ) 1, 10, 1 ); - final Domain k = new BasicDomain( "k", ( short ) 10, ( short ) 20, ( short ) 1, ( short ) 1, 0.01, 1 ); - final Domain l = new BasicDomain( "l", ( short ) 10, ( short ) 20, ( short ) 1, ( short ) 1, 0.0001, 1 ); - final Domain m = new BasicDomain( "m", ( short ) 10, ( short ) 20, ( short ) 1, ( short ) 4, 0.5, 1 ); - final Domain m0 = new BasicDomain( "m", ( short ) 10, ( short ) 20, ( short ) 2, ( short ) 4, 0.5, 1 ); - final Domain m1 = new BasicDomain( "m", ( short ) 10, ( short ) 20, ( short ) 3, ( short ) 4, 0.5, 1 ); - final Domain m2 = new BasicDomain( "m", ( short ) 5, ( short ) 30, ( short ) 4, ( short ) 4, 0.5, 10 ); - final Protein jklm = new BasicProtein( "jklm", "varanus" ); - jklm.addProteinDomain( j ); - jklm.addProteinDomain( k ); - jklm.addProteinDomain( l ); - jklm.addProteinDomain( m ); - jklm.addProteinDomain( m0 ); - jklm.addProteinDomain( m1 ); - jklm.addProteinDomain( m2 ); - final Protein jklm_s0 = SurfacingUtil.removeOverlappingDomains( 10, false, jklm ); - if ( jklm.getNumberOfProteinDomains() != 7 ) { - return false; - } - if ( jklm_s0.getNumberOfProteinDomains() != 1 ) { - return false; - } - if ( !jklm_s0.getProteinDomain( 0 ).getDomainId().getId().equals( "l" ) ) { - return false; - } - final Protein jklm_s1 = SurfacingUtil.removeOverlappingDomains( 11, false, jklm ); - if ( jklm.getNumberOfProteinDomains() != 7 ) { - return false; - } - if ( jklm_s1.getNumberOfProteinDomains() != 7 ) { - return false; - } - final Domain only = new BasicDomain( "only", ( short ) 5, ( short ) 30, ( short ) 4, ( short ) 4, 0.5, 10 ); - final Protein od = new BasicProtein( "od", "varanus" ); - od.addProteinDomain( only ); - final Protein od_s0 = SurfacingUtil.removeOverlappingDomains( 0, false, od ); - if ( od.getNumberOfProteinDomains() != 1 ) { - return false; - } - if ( od_s0.getNumberOfProteinDomains() != 1 ) { - return false; - } - } - catch ( final Exception e ) { - e.printStackTrace( System.out ); - return false; - } - return true; - } - private static boolean testParsimony() { try { final BinaryStates X = BinaryStates.PRESENT; @@ -5592,58 +4925,58 @@ public class TestSurfacing { // 2 a b c e f g i n o // 3 a b d e f g j p q // 4 a b d p r - final Protein aa1 = new BasicProtein( "aa1", "one" ); + final Protein aa1 = new BasicProtein( "aa1", "one", 0 ); aa1.addProteinDomain( a ); aa1.addProteinDomain( a ); - final Protein ab1 = new BasicProtein( "ab1", "one" ); + final Protein ab1 = new BasicProtein( "ab1", "one", 0 ); ab1.addProteinDomain( a ); ab1.addProteinDomain( b ); - final Protein ac1 = new BasicProtein( "ac1", "one" ); + final Protein ac1 = new BasicProtein( "ac1", "one", 0 ); ac1.addProteinDomain( a ); ac1.addProteinDomain( c ); - final Protein efgh1 = new BasicProtein( "efgh1", "one" ); + final Protein efgh1 = new BasicProtein( "efgh1", "one", 0 ); efgh1.addProteinDomain( e ); efgh1.addProteinDomain( f ); efgh1.addProteinDomain( g ); efgh1.addProteinDomain( h ); - final Protein lm1 = new BasicProtein( "lm1", "one" ); + final Protein lm1 = new BasicProtein( "lm1", "one", 0 ); lm1.addProteinDomain( l ); lm1.addProteinDomain( m ); - final Protein ab2 = new BasicProtein( "ab2", "two" ); + final Protein ab2 = new BasicProtein( "ab2", "two", 0 ); ab2.addProteinDomain( a ); ab2.addProteinDomain( b ); - final Protein ac2 = new BasicProtein( "ac2", "two" ); + final Protein ac2 = new BasicProtein( "ac2", "two", 0 ); ac2.addProteinDomain( a ); ac2.addProteinDomain( c ); - final Protein efgi2 = new BasicProtein( "efgi2", "two" ); + final Protein efgi2 = new BasicProtein( "efgi2", "two", 0 ); efgi2.addProteinDomain( e ); efgi2.addProteinDomain( f ); efgi2.addProteinDomain( g ); efgi2.addProteinDomain( i ); - final Protein no2 = new BasicProtein( "no2", "two" ); + final Protein no2 = new BasicProtein( "no2", "two", 0 ); no2.addProteinDomain( n ); no2.addProteinDomain( o ); - final Protein ab3 = new BasicProtein( "ab3", "three" ); + final Protein ab3 = new BasicProtein( "ab3", "three", 0 ); ab3.addProteinDomain( a ); ab3.addProteinDomain( b ); - final Protein ad3 = new BasicProtein( "ad3", "three" ); + final Protein ad3 = new BasicProtein( "ad3", "three", 0 ); ad3.addProteinDomain( a ); ad3.addProteinDomain( d ); - final Protein efgj3 = new BasicProtein( "efgj3", "three" ); + final Protein efgj3 = new BasicProtein( "efgj3", "three", 0 ); efgj3.addProteinDomain( e ); efgj3.addProteinDomain( f ); efgj3.addProteinDomain( g ); efgj3.addProteinDomain( j ); - final Protein pq3 = new BasicProtein( "pq3", "three" ); + final Protein pq3 = new BasicProtein( "pq3", "three", 0 ); pq3.addProteinDomain( p ); pq3.addProteinDomain( q ); - final Protein ab4 = new BasicProtein( "ab4", "four" ); + final Protein ab4 = new BasicProtein( "ab4", "four", 0 ); ab4.addProteinDomain( a ); ab4.addProteinDomain( b ); - final Protein ad4 = new BasicProtein( "ad4", "four" ); + final Protein ad4 = new BasicProtein( "ad4", "four", 0 ); ad4.addProteinDomain( a ); ad4.addProteinDomain( d ); - final Protein pr4 = new BasicProtein( "pr4", "four" ); + final Protein pr4 = new BasicProtein( "pr4", "four", 0 ); pr4.addProteinDomain( p ); pr4.addProteinDomain( r ); final List one_list = new ArrayList(); @@ -5875,58 +5208,58 @@ public class TestSurfacing { // 2 a b c e f g i n o // 3 a b d e f g j p q // 4 a b d p r - final Protein aa1 = new BasicProtein( "aa1", "one" ); + final Protein aa1 = new BasicProtein( "aa1", "one", 0 ); aa1.addProteinDomain( a ); aa1.addProteinDomain( a ); - final Protein ab1 = new BasicProtein( "ab1", "one" ); + final Protein ab1 = new BasicProtein( "ab1", "one", 0 ); ab1.addProteinDomain( a ); ab1.addProteinDomain( b ); - final Protein ac1 = new BasicProtein( "ac1", "one" ); + final Protein ac1 = new BasicProtein( "ac1", "one", 0 ); ac1.addProteinDomain( a ); ac1.addProteinDomain( c ); - final Protein efgh1 = new BasicProtein( "efgh1", "one" ); + final Protein efgh1 = new BasicProtein( "efgh1", "one", 0 ); efgh1.addProteinDomain( e ); efgh1.addProteinDomain( f ); efgh1.addProteinDomain( g ); efgh1.addProteinDomain( h ); - final Protein lm1 = new BasicProtein( "lm1", "one" ); + final Protein lm1 = new BasicProtein( "lm1", "one", 0 ); lm1.addProteinDomain( l ); lm1.addProteinDomain( m ); - final Protein ab2 = new BasicProtein( "ab2", "two" ); + final Protein ab2 = new BasicProtein( "ab2", "two", 0 ); ab2.addProteinDomain( a ); ab2.addProteinDomain( b ); - final Protein ac2 = new BasicProtein( "ac2", "two" ); + final Protein ac2 = new BasicProtein( "ac2", "two", 0 ); ac2.addProteinDomain( a ); ac2.addProteinDomain( c ); - final Protein efgi2 = new BasicProtein( "efgi2", "two" ); + final Protein efgi2 = new BasicProtein( "efgi2", "two", 0 ); efgi2.addProteinDomain( e ); efgi2.addProteinDomain( f ); efgi2.addProteinDomain( g ); efgi2.addProteinDomain( i ); - final Protein no2 = new BasicProtein( "no2", "two" ); + final Protein no2 = new BasicProtein( "no2", "two", 0 ); no2.addProteinDomain( n ); no2.addProteinDomain( o ); - final Protein ab3 = new BasicProtein( "ab3", "three" ); + final Protein ab3 = new BasicProtein( "ab3", "three", 0 ); ab3.addProteinDomain( a ); ab3.addProteinDomain( b ); - final Protein ad3 = new BasicProtein( "ad3", "three" ); + final Protein ad3 = new BasicProtein( "ad3", "three", 0 ); ad3.addProteinDomain( a ); ad3.addProteinDomain( d ); - final Protein efgj3 = new BasicProtein( "efgj3", "three" ); + final Protein efgj3 = new BasicProtein( "efgj3", "three", 0 ); efgj3.addProteinDomain( e ); efgj3.addProteinDomain( f ); efgj3.addProteinDomain( g ); efgj3.addProteinDomain( j ); - final Protein pq3 = new BasicProtein( "pq3", "three" ); + final Protein pq3 = new BasicProtein( "pq3", "three", 0 ); pq3.addProteinDomain( p ); pq3.addProteinDomain( q ); - final Protein ab4 = new BasicProtein( "ab4", "four" ); + final Protein ab4 = new BasicProtein( "ab4", "four", 0 ); ab4.addProteinDomain( a ); ab4.addProteinDomain( b ); - final Protein ad4 = new BasicProtein( "ad4", "four" ); + final Protein ad4 = new BasicProtein( "ad4", "four", 0 ); ad4.addProteinDomain( a ); ad4.addProteinDomain( d ); - final Protein pr4 = new BasicProtein( "pr4", "four" ); + final Protein pr4 = new BasicProtein( "pr4", "four", 0 ); pr4.addProteinDomain( p ); pr4.addProteinDomain( r ); final List one_list = new ArrayList(); @@ -5962,7 +5295,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(); @@ -6149,130 +5482,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; - } }