X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fsurfacing%2FTestSurfacing.java;h=72141d22cee47970d132b5f4f16b4e3943f19244;hb=5cad5dbd4f9e8cf09a123d4ee490cf314c05fd2f;hp=1ccaf709a04f918ac4e92f873f0974a110671ae4;hpb=ed149d1b26c50c0673b5491fc639cdcb6afdde2f;p=jalview.git diff --git a/forester/java/src/org/forester/surfacing/TestSurfacing.java b/forester/java/src/org/forester/surfacing/TestSurfacing.java index 1ccaf70..72141d2 100644 --- a/forester/java/src/org/forester/surfacing/TestSurfacing.java +++ b/forester/java/src/org/forester/surfacing/TestSurfacing.java @@ -42,7 +42,6 @@ import org.forester.evoinference.matrix.character.CharacterStateMatrix; import org.forester.evoinference.matrix.character.CharacterStateMatrix.BinaryStates; import org.forester.evoinference.matrix.character.CharacterStateMatrix.GainLossStates; import org.forester.io.parsers.HmmPfamOutputParser; -import org.forester.io.parsers.nexus.PaupLogParser; import org.forester.io.parsers.nhx.NHXParser; import org.forester.phylogeny.Phylogeny; import org.forester.phylogeny.PhylogenyNode; @@ -176,12 +175,7 @@ public class TestSurfacing { return false; } System.out.println( "OK." ); - System.out.print( " Paup log parser: " ); - if ( !TestSurfacing.testPaupLogParser( test_dir ) ) { - System.out.println( "failed." ); - return false; - } - System.out.println( "OK." ); + System.out.print( " Binary state matrix to gain loss matrix: " ); if ( !TestSurfacing.testBinaryStateMatrixToGainLossMatrix( test_dir ) ) { System.out.println( "failed." ); @@ -1315,7 +1309,7 @@ public class TestSurfacing { final BinaryStates O = BinaryStates.ABSENT; try { final CharacterStateMatrix binary_states_matrix_0 = new BasicCharacterStateMatrix( 7, - 6 ); + 6 ); binary_states_matrix_0.setIdentifier( 0, "A" ); binary_states_matrix_0.setIdentifier( 1, "B" ); binary_states_matrix_0.setIdentifier( 2, "C" ); @@ -1821,7 +1815,7 @@ public class TestSurfacing { final GenomeWideCombinableDomains gwcd_1 = BasicGenomeWideCombinableDomains .createInstance( list_1, false, new BasicSpecies( "1" ), DomainCombinationType.DIRECTED ); if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "A", - "B" ) ) ) { + "B" ) ) ) { return false; } if ( gwcd_1.toBinaryDomainCombinations() @@ -1833,7 +1827,7 @@ public class TestSurfacing { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "A", - "C" ) ) ) { + "C" ) ) ) { return false; } if ( gwcd_1.toBinaryDomainCombinations() @@ -1841,27 +1835,27 @@ public class TestSurfacing { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "B", - "C" ) ) ) { + "C" ) ) ) { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "C", - "X" ) ) ) { + "X" ) ) ) { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "C", - "Y" ) ) ) { + "Y" ) ) ) { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "A", - "X" ) ) ) { + "X" ) ) ) { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "A", - "Y" ) ) ) { + "Y" ) ) ) { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "Y", - "A" ) ) ) { + "A" ) ) ) { return false; } if ( gwcd_1.toBinaryDomainCombinations() @@ -1873,19 +1867,19 @@ public class TestSurfacing { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "X", - "Y" ) ) ) { + "Y" ) ) ) { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "Y", - "X" ) ) ) { + "X" ) ) ) { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "A", - "Y" ) ) ) { + "Y" ) ) ) { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "A", - "X" ) ) ) { + "X" ) ) ) { return false; } if ( gwcd_1.toBinaryDomainCombinations() @@ -1893,19 +1887,19 @@ public class TestSurfacing { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "M", - "N" ) ) ) { + "N" ) ) ) { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "N", - "M" ) ) ) { + "M" ) ) ) { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "N", - "P" ) ) ) { + "P" ) ) ) { return false; } if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "M", - "P" ) ) ) { + "P" ) ) ) { return false; } if ( gwcd_1.toBinaryDomainCombinations() @@ -1917,11 +1911,11 @@ public class TestSurfacing { return false; } if ( gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "XX", - "YY" ) ) ) { + "YY" ) ) ) { return false; } if ( gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "YY", - "XX" ) ) ) { + "XX" ) ) ) { return false; } if ( gwcd_1.toBinaryDomainCombinations() @@ -1941,7 +1935,7 @@ public class TestSurfacing { // if ( matrix_bc.getState( 0, 0 ) != X ) { // return false; // } - // + // // // final BasicCharacterStateMatrix dm = new BasicCharacterStateMatrix( new BinaryStates[][] { // { X, X, X, X, X, X }, { X, X, X, X, X, X } } ); @@ -3226,23 +3220,23 @@ public class TestSurfacing { return false; } if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "v", - "u" ) ) ) { + "u" ) ) ) { return false; } if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "w", - "v" ) ) ) { + "v" ) ) ) { return false; } if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "w", - "x" ) ) ) { + "x" ) ) ) { return false; } if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "w", - "u" ) ) ) { + "u" ) ) ) { return false; } if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "z", - "y" ) ) ) { + "y" ) ) ) { return false; } calc_u.setAllowDomainsToBeIgnored( true ); @@ -3333,23 +3327,23 @@ public class TestSurfacing { return false; } if ( calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "v", - "u" ) ) ) { + "u" ) ) ) { return false; } if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "w", - "v" ) ) ) { + "v" ) ) ) { return false; } if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "w", - "x" ) ) ) { + "x" ) ) ) { return false; } if ( calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "w", - "u" ) ) ) { + "u" ) ) ) { return false; } if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "z", - "y" ) ) ) { + "y" ) ) ) { return false; } calc_u.setAllowDomainsToBeIgnored( false ); @@ -3431,7 +3425,7 @@ public class TestSurfacing { return false; } if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "z", - "y" ) ) ) { + "y" ) ) ) { return false; } if ( !isEqual( calc_u.calculateSharedBinaryDomainCombinationBasedGenomeSimilarityScore(), @@ -3476,7 +3470,7 @@ public class TestSurfacing { private static boolean testDomainCombinationCounting( final File test_dir ) { try { final HmmPfamOutputParser parser = new HmmPfamOutputParser( new File( test_dir - + ForesterUtil.getFileSeparator() + "hmmpfam_output2" ), "human", "ls" ); + + ForesterUtil.getFileSeparator() + "hmmpfam_output2" ), "human", "ls" ); parser.setEValueMaximum( 0.2 ); parser.setIgnoreDufs( true ); parser.setReturnType( HmmPfamOutputParser.ReturnType.UNORDERED_PROTEIN_DOMAIN_COLLECTION_PER_PROTEIN ); @@ -4549,7 +4543,7 @@ public class TestSurfacing { private static boolean testHmmPfamOutputParser( final File test_dir ) { try { final HmmPfamOutputParser parser = new HmmPfamOutputParser( new File( test_dir - + ForesterUtil.getFileSeparator() + "hmmpfam_output" ), "human", "ls" ); + + ForesterUtil.getFileSeparator() + "hmmpfam_output" ), "human", "ls" ); parser.setEValueMaximum( 0.2 ); parser.setIgnoreDufs( true ); parser.setReturnType( HmmPfamOutputParser.ReturnType.UNORDERED_PROTEIN_DOMAIN_COLLECTION_PER_PROTEIN ); @@ -4627,7 +4621,7 @@ public class TestSurfacing { return false; } final HmmPfamOutputParser parser2 = new HmmPfamOutputParser( new File( test_dir - + ForesterUtil.getFileSeparator() + "hmmpfam_output_short" ), "human", "ls" ); + + ForesterUtil.getFileSeparator() + "hmmpfam_output_short" ), "human", "ls" ); parser2.setEValueMaximum( 0.2 ); parser2.setIgnoreDufs( true ); parser2.setReturnType( HmmPfamOutputParser.ReturnType.UNORDERED_PROTEIN_DOMAIN_COLLECTION_PER_PROTEIN ); @@ -4718,7 +4712,7 @@ public class TestSurfacing { private static boolean testHmmPfamOutputParserWithFilter( final File test_dir ) { try { HmmPfamOutputParser parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() - + "hmmpfam_output3" ), "human", "ls" ); + + "hmmpfam_output3" ), "human", "ls" ); parser.setEValueMaximum( 0.2 ); parser.setIgnoreDufs( true ); parser.setReturnType( HmmPfamOutputParser.ReturnType.UNORDERED_PROTEIN_DOMAIN_COLLECTION_PER_PROTEIN ); @@ -5432,73 +5426,5 @@ public class TestSurfacing { return true; } - private static boolean testPaupLogParser( final File test_dir ) { - try { - final PaupLogParser parser = new PaupLogParser(); - parser.setSource( new File( test_dir + ForesterUtil.getFileSeparator() + "paup_log_test_1" ) ); - final CharacterStateMatrix matrix = parser.parse(); - if ( matrix.getNumberOfIdentifiers() != 8 ) { - return false; - } - if ( !matrix.getIdentifier( 0 ).equals( "MOUSE" ) ) { - return false; - } - if ( !matrix.getIdentifier( 1 ).equals( "NEMVE" ) ) { - return false; - } - if ( !matrix.getIdentifier( 2 ).equals( "MONBE" ) ) { - return false; - } - if ( !matrix.getIdentifier( 3 ).equals( "DICDI" ) ) { - return false; - } - if ( !matrix.getIdentifier( 4 ).equals( "ARATH" ) ) { - return false; - } - if ( !matrix.getIdentifier( 5 ).equals( "6" ) ) { - return false; - } - if ( !matrix.getIdentifier( 6 ).equals( "7" ) ) { - return false; - } - if ( !matrix.getIdentifier( 7 ).equals( "8" ) ) { - return false; - } - if ( matrix.getNumberOfCharacters() != ( 66 + 66 + 28 ) ) { - return false; - } - if ( matrix.getState( 0, 4 ) != BinaryStates.ABSENT ) { - return false; - } - if ( matrix.getState( 0, 5 ) != BinaryStates.PRESENT ) { - return false; - } - if ( matrix.getState( 1, 5 ) != BinaryStates.PRESENT ) { - return false; - } - if ( matrix.getState( 7, 154 ) != BinaryStates.ABSENT ) { - return false; - } - if ( matrix.getState( 7, 155 ) != BinaryStates.PRESENT ) { - return false; - } - if ( matrix.getState( 7, 156 ) != BinaryStates.PRESENT ) { - return false; - } - if ( matrix.getState( 7, 157 ) != BinaryStates.ABSENT ) { - return false; - } - if ( matrix.getState( 7, 158 ) != BinaryStates.PRESENT ) { - return false; - } - if ( matrix.getState( 7, 159 ) != BinaryStates.ABSENT ) { - return false; - } - } - catch ( final Exception e ) { - e.printStackTrace( System.out ); - return false; - } - return true; - } + }