inprogress
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 27 Nov 2013 06:26:45 +0000 (06:26 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Wed, 27 Nov 2013 06:26:45 +0000 (06:26 +0000)
17 files changed:
forester/java/src/org/forester/application/surfacing.java
forester/java/src/org/forester/io/parsers/HmmPfamOutputParser.java
forester/java/src/org/forester/io/parsers/HmmscanPerDomainTableParser.java
forester/java/src/org/forester/protein/BasicDomain.java
forester/java/src/org/forester/protein/BinaryDomainCombination.java
forester/java/src/org/forester/protein/Domain.java
forester/java/src/org/forester/surfacing/AdjactantDirectedBinaryDomainCombination.java
forester/java/src/org/forester/surfacing/AdjactantDirectedCombinableDomains.java
forester/java/src/org/forester/surfacing/BasicBinaryDomainCombination.java
forester/java/src/org/forester/surfacing/BasicCombinableDomains.java
forester/java/src/org/forester/surfacing/DirectedBinaryDomainCombination.java
forester/java/src/org/forester/surfacing/DirectedCombinableDomains.java
forester/java/src/org/forester/surfacing/DomainParsimonyCalculator.java
forester/java/src/org/forester/surfacing/SimpleDomain.java
forester/java/src/org/forester/surfacing/SurfacingUtil.java
forester/java/src/org/forester/surfacing/TestSurfacing.java
forester/java/src/org/forester/test/Test.java

index 162ef57..40fc471 100644 (file)
@@ -171,7 +171,8 @@ public class surfacing {
     final static private String                                     DOMAIN_COUNT_SORT_COMBINATIONS_COUNT                                          = "comb";
     final static private String                                     CUTOFF_SCORE_FILE_OPTION                                                      = "cos";
     final static private String                                     NOT_IGNORE_DUFS_OPTION                                                        = "dufs";
-    final static private String                                     MAX_E_VALUE_OPTION                                                            = "e";
+    final static private String                                     MAX_FS_E_VALUE_OPTION                                                         = "fs_e";
+    final static private String                                     MAX_I_E_VALUE_OPTION                                                          = "ie";
     final static private String                                     MAX_ALLOWED_OVERLAP_OPTION                                                    = "mo";
     final static private String                                     NO_ENGULFING_OVERLAP_OPTION                                                   = "no_eo";
     final static private String                                     IGNORE_COMBINATION_WITH_SAME_OPTION                                           = "ignore_self_comb";
@@ -213,8 +214,8 @@ public class surfacing {
     final static private String                                     INPUT_GENOMES_FILE_OPTION                                                     = "genomes";
     final static private String                                     INPUT_SPECIES_TREE_OPTION                                                     = "species_tree";
     final static private String                                     SEQ_EXTRACT_OPTION                                                            = "prot_extract";
-    final static private String                                     PRG_VERSION                                                                   = "2.401";
-    final static private String                                     PRG_DATE                                                                      = "131125";
+    final static private String                                     PRG_VERSION                                                                   = "2.402";
+    final static private String                                     PRG_DATE                                                                      = "131126";
     final static private String                                     E_MAIL                                                                        = "czmasek@burnham.org";
     final static private String                                     WWW                                                                           = "https://sites.google.com/site/cmzmasek/home/software/forester/surfacing";
     final static private boolean                                    IGNORE_DUFS_DEFAULT                                                           = true;
@@ -254,6 +255,7 @@ public class surfacing {
     private static final String                                     DATA_FILE_SUFFIX                                                              = "_domain_combination_data.txt";
     private static final String                                     DATA_FILE_DESC                                                                = "#SPECIES\tPRTEIN_ID\tN_TERM_DOMAIN\tC_TERM_DOMAIN\tN_TERM_DOMAIN_PER_DOMAIN_E_VALUE\tC_TERM_DOMAIN_PER_DOMAIN_E_VALUE\tN_TERM_DOMAIN_COUNTS_PER_PROTEIN\tC_TERM_DOMAIN_COUNTS_PER_PROTEIN";
     private static final String                                     WRITE_TO_NEXUS_OPTION                                                         = "nexus";
+    private static final String                                     PERFORM_DC_FITCH                                                              = "dc_pars";
     private static final INDIVIDUAL_SCORE_CUTOFF                    INDIVIDUAL_SCORE_CUTOFF_DEFAULT                                               = INDIVIDUAL_SCORE_CUTOFF.FULL_SEQUENCE;                                                                                                                                                      //TODO look at me! change?
     public static final String                                      INDEPENDENT_DC_GAINS_FITCH_PARS_COUNTS_OUTPUT_SUFFIX                          = "_indep_dc_gains_fitch_counts.txt";
     public static final String                                      INDEPENDENT_DC_GAINS_FITCH_PARS_DC_OUTPUT_SUFFIX                              = "_indep_dc_gains_fitch_lists.txt";
@@ -301,7 +303,8 @@ public class surfacing {
         }
         final List<String> allowed_options = new ArrayList<String>();
         allowed_options.add( surfacing.NOT_IGNORE_DUFS_OPTION );
-        allowed_options.add( surfacing.MAX_E_VALUE_OPTION );
+        allowed_options.add( surfacing.MAX_FS_E_VALUE_OPTION );
+        allowed_options.add( surfacing.MAX_I_E_VALUE_OPTION );
         allowed_options.add( surfacing.DETAILEDNESS_OPTION );
         allowed_options.add( surfacing.OUTPUT_FILE_OPTION );
         allowed_options.add( surfacing.DOMAIN_SIMILARITY_SORT_OPTION );
@@ -339,9 +342,11 @@ public class surfacing {
         allowed_options.add( PERFORM_DC_REGAIN_PROTEINS_STATS_OPTION );
         allowed_options.add( DA_ANALYSIS_OPTION );
         allowed_options.add( USE_LAST_IN_FITCH_OPTION );
+        allowed_options.add( PERFORM_DC_FITCH );
         boolean ignore_dufs = surfacing.IGNORE_DUFS_DEFAULT;
         boolean ignore_combination_with_same = surfacing.IGNORE_COMBINATION_WITH_SAME_DEFAULLT;
-        double e_value_max = surfacing.MAX_E_VALUE_DEFAULT;
+        double fs_e_value_max = surfacing.MAX_E_VALUE_DEFAULT;
+        double ie_value_max = surfacing.MAX_E_VALUE_DEFAULT;
         int max_allowed_overlap = surfacing.MAX_ALLOWED_OVERLAP_DEFAULT;
         final String dissallowed_options = cla.validateAllowedOptionsAsString( allowed_options );
         if ( dissallowed_options.length() > 0 ) {
@@ -355,6 +360,10 @@ public class surfacing {
         if ( cla.isOptionSet( WRITE_TO_NEXUS_OPTION ) ) {
             write_to_nexus = true;
         }
+        boolean perform_dc_fich = false;
+        if ( cla.isOptionSet( PERFORM_DC_FITCH ) ) {
+            perform_dc_fich = true;
+        }
         boolean perform_dc_regain_proteins_stats = false;
         if ( cla.isOptionSet( PERFORM_DC_REGAIN_PROTEINS_STATS_OPTION ) ) {
             perform_dc_regain_proteins_stats = true;
@@ -367,9 +376,17 @@ public class surfacing {
         if ( cla.isOptionSet( DOMAIN_COMBINITONS_OUTPUT_OPTION_FOR_GRAPH_ANALYSIS ) ) {
             output_binary_domain_combinationsfor_graph_analysis = true;
         }
-        if ( cla.isOptionSet( surfacing.MAX_E_VALUE_OPTION ) ) {
+        if ( cla.isOptionSet( surfacing.MAX_FS_E_VALUE_OPTION ) ) {
+            try {
+                fs_e_value_max = cla.getOptionValueAsDouble( surfacing.MAX_FS_E_VALUE_OPTION );
+            }
+            catch ( final Exception e ) {
+                ForesterUtil.fatalError( surfacing.PRG_NAME, "no acceptable value for E-value maximum" );
+            }
+        }
+        if ( cla.isOptionSet( surfacing.MAX_I_E_VALUE_OPTION ) ) {
             try {
-                e_value_max = cla.getOptionValueAsDouble( surfacing.MAX_E_VALUE_OPTION );
+                ie_value_max = cla.getOptionValueAsDouble( surfacing.MAX_I_E_VALUE_OPTION );
             }
             catch ( final Exception e ) {
                 ForesterUtil.fatalError( surfacing.PRG_NAME, "no acceptable value for E-value maximum" );
@@ -1037,9 +1054,13 @@ public class surfacing {
             System.out.println( "Cutoff scores file          : " + cutoff_scores_file );
             html_desc.append( "<tr><td>Cutoff scores file:</td><td>" + cutoff_scores_file + "</td></tr>" + nl );
         }
-        if ( e_value_max >= 0.0 ) {
-            System.out.println( "E-value maximum (inclusive) : " + e_value_max );
-            html_desc.append( "<tr><td>E-value maximum (inclusive):</td><td>" + e_value_max + "</td></tr>" + nl );
+        if ( ie_value_max >= 0.0 ) {
+            System.out.println( "iE-value maximum (incl)     : " + ie_value_max );
+            html_desc.append( "<tr><td>iE-value maximum (inclusive):</td><td>" + ie_value_max + "</td></tr>" + nl );
+        }
+        if ( fs_e_value_max >= 0.0 ) {
+            System.out.println( "FS E-value maximum (incl)   : " + fs_e_value_max );
+            html_desc.append( "<tr><td>FS E-value maximum (inclusive):</td><td>" + fs_e_value_max + "</td></tr>" + nl );
         }
         if ( output_protein_lists_for_all_domains ) {
             System.out.println( "Domain E-value max          : " + output_list_of_all_proteins_per_domain_e_value_max );
@@ -1084,14 +1105,20 @@ public class surfacing {
                     + ( dc_type == BinaryDomainCombination.DomainCombinationType.DIRECTED_ADJACTANT ) + "</td></tr>"
                     + nl );
         }
-        System.out.println( "Use last in Fitch parimony  : " + use_last_in_fitch_parsimony );
-        html_desc.append( "<tr><td>Use last in Fitch parimon:</td><td>" + use_last_in_fitch_parsimony + "</td></tr>"
-                + nl );
+        System.out.println( "Fitch parsimony of DCs      : " + perform_dc_fich );
+        html_desc.append( "<tr><td>Fitch parsimony of DCs:</td><td>" + perform_dc_fich + "</td></tr>" + nl );
+        if ( perform_dc_fich ) {
+            System.out.println( "Use last in Fitch parsimony : " + use_last_in_fitch_parsimony );
+            html_desc.append( "<tr><td>Use last in Fitch parsimony:</td><td>" + use_last_in_fitch_parsimony
+                    + "</td></tr>" + nl );
+        }
         System.out.println( "Write to Nexus files        : " + write_to_nexus );
         html_desc.append( "<tr><td>Write to Nexus files:</td><td>" + write_to_nexus + "</td></tr>" + nl );
-        System.out.println( "DC regain prot stats        : " + perform_dc_regain_proteins_stats );
-        html_desc.append( "<tr><td>DC regain prot stats:</td><td>" + perform_dc_regain_proteins_stats + "</td></tr>"
-                + nl );
+        if ( perform_dc_fich ) {
+            System.out.println( "DC regain prot stats        : " + perform_dc_regain_proteins_stats );
+            html_desc.append( "<tr><td>DC regain prot stats:</td><td>" + perform_dc_regain_proteins_stats
+                    + "</td></tr>" + nl );
+        }
         System.out.println( "DA analysis                 : " + da_analysis );
         html_desc.append( "<tr><td>DA analysis :</td><td>" + da_analysis + "</td></tr>" + nl );
         System.out.print( "Domain counts sort order    : " );
@@ -1310,7 +1337,8 @@ public class surfacing {
             }
         } // if ( perform_pwc ) {
         System.out.println();
-        html_desc.append( "<tr><td>Command line:</td><td>\n" + cla.getCommandLineArgsAsString() + "\n</td></tr>" + nl );
+        html_desc.append( "<tr><td>Command line:</td><td>" + nl + nl + cla.getCommandLineArgsAsString() + nl + nl
+                + "</td></tr>" + nl );
         System.out.println( "Command line                : " + cla.getCommandLineArgsAsString() );
         BufferedWriter[] query_domains_writer_ary = null;
         List<String>[] query_domain_ids_array = null;
@@ -1469,8 +1497,11 @@ public class surfacing {
                                                           ind_score_cutoff,
                                                           true );
             }
-            if ( e_value_max >= 0.0 ) {
-                parser.setEValueMaximum( e_value_max );
+            if ( fs_e_value_max >= 0.0 ) {
+                parser.setFsEValueMaximum( fs_e_value_max );
+            }
+            if ( ie_value_max >= 0.0 ) {
+                parser.setIEValueMaximum( ie_value_max );
             }
             parser.setIgnoreDufs( ignore_dufs );
             parser.setIgnoreVirusLikeIds( ignore_virus_like_ids );
@@ -1533,10 +1564,15 @@ public class surfacing {
             SurfacingUtil.log( "Domains ignored due to individual score cutoffs: "
                                        + parser.getDomainsIgnoredDueToIndividualScoreCutoff(),
                                log_writer );
-            System.out.println( "Domains ignored due to E-value                 : "
-                    + parser.getDomainsIgnoredDueToEval() );
-            SurfacingUtil.log( "Domains ignored due to E-value                 : "
-                                       + parser.getDomainsIgnoredDueToEval(),
+            System.out.println( "Domains ignored due to FS E-value              : "
+                    + parser.getDomainsIgnoredDueToFsEval() );
+            SurfacingUtil.log( "Domains ignored due to FS E-value              : "
+                                       + parser.getDomainsIgnoredDueToFsEval(),
+                               log_writer );
+            System.out.println( "Domains ignored due to iE-value                : "
+                    + parser.getDomainsIgnoredDueToIEval() );
+            SurfacingUtil.log( "Domains ignored due to iE-value                : "
+                                       + parser.getDomainsIgnoredDueToIEval(),
                                log_writer );
             System.out.println( "Domains ignored due to DUF designation         : "
                     + parser.getDomainsIgnoredDueToDuf() );
@@ -1908,7 +1944,8 @@ public class surfacing {
         }
         if ( ( ( intrees != null ) && ( intrees.length > 0 ) ) && ( number_of_genomes > 2 ) ) {
             final StringBuilder parameters_sb = SurfacingUtil.createParametersAsString( ignore_dufs,
-                                                                                        e_value_max,
+                                                                                        ie_value_max,
+                                                                                        fs_e_value_max,
                                                                                         max_allowed_overlap,
                                                                                         no_engulfing_overlaps,
                                                                                         cutoff_scores_file,
@@ -1943,7 +1980,8 @@ public class surfacing {
                                                         domain_length_stats_by_domain,
                                                         tax_code_to_id_map,
                                                         write_to_nexus,
-                                                        use_last_in_fitch_parsimony );
+                                                        use_last_in_fitch_parsimony,
+                                                        perform_dc_fich );
                 // Listing of all domain combinations gained is only done if only one input tree is used. 
                 if ( ( domain_id_to_secondary_features_maps != null )
                         && ( domain_id_to_secondary_features_maps.length > 0 ) ) {
@@ -2075,7 +2113,8 @@ public class surfacing {
         System.out.println( surfacing.DOMAIN_SIMILARITY_SORT_OPTION + ": sorting for similarities (default: "
                 + DOMAIN_SORT_FILD_DEFAULT + ")" );
         System.out.println( surfacing.OUTPUT_FILE_OPTION + ": name for (main) output file (mandatory)" );
-        System.out.println( surfacing.MAX_E_VALUE_OPTION + ": max (inclusive) E-value" );
+        System.out.println( surfacing.MAX_I_E_VALUE_OPTION + ": max (inclusive) iE-value" );
+        System.out.println( surfacing.MAX_FS_E_VALUE_OPTION + ": max (inclusive) FS E-value" );
         System.out.println( surfacing.MAX_ALLOWED_OVERLAP_OPTION + ": maximal allowed domain overlap" );
         System.out.println( surfacing.NO_ENGULFING_OVERLAP_OPTION + ": to ignore engulfed lower confidence domains" );
         System.out.println( surfacing.SPECIES_MATRIX_OPTION + ": species matrix" );
@@ -2125,6 +2164,7 @@ public class surfacing {
                 + ": e value max per domain for output of all proteins per domain" );
         System.out.println( surfacing.USE_LAST_IN_FITCH_OPTION + ": to use last in Fitch parsimony" );
         System.out.println( surfacing.WRITE_TO_NEXUS_OPTION + ": to output in Nexus format" );
+        System.out.println( PERFORM_DC_FITCH + ": to perform DC Fitch parsimony" );
         System.out.println( PERFORM_DC_REGAIN_PROTEINS_STATS_OPTION + ": to perform DC regain protein statistics" );
         System.out.println( DA_ANALYSIS_OPTION + ": to do DA analysis" );
         System.out.println();
@@ -2136,7 +2176,7 @@ public class surfacing {
         System.out.println( "Example 2: java -Xms128m -Xmx512m -cp path/to/forester.jar"
                 + " org.forester.application.surfacing -detail=punctilious -o=TEST.html -pwc=TEST"
                 + " -cos=Pfam_ls_22_TC2 -p2g=pfam2go -obo=gene_ontology_edit.obo "
-                + "-dc_sort=dom -ignore_with_self -no_singles -e=0.001 -mo=1 -no_eo -genomes=eukaryotes.txt "
+                + "-dc_sort=dom -ignore_with_self -no_singles -ie=0.001 -mo=1 -no_eo -genomes=eukaryotes.txt "
                 + "-ds_output=detailed_html -scoring=domains -sort=alpha " );
         System.out.println();
     }
index eda7e55..534eadc 100644 (file)
@@ -64,7 +64,6 @@ public final class HmmPfamOutputParser {
     private final FilterType        _filter_type;
     private final File              _input_file;
     private final String            _species;
-    private final String            _model_type;
     private double                  _e_value_maximum;
     private Map<String, String>     _individual_domain_score_cutoffs;
     private boolean                 _ignore_dufs;
@@ -93,7 +92,6 @@ public final class HmmPfamOutputParser {
     public HmmPfamOutputParser( final File input_file, final String species, final String model_type ) {
         _input_file = input_file;
         _species = species;
-        _model_type = model_type;
         _filter = null;
         _filter_type = FilterType.NONE;
         init();
@@ -101,12 +99,10 @@ public final class HmmPfamOutputParser {
 
     public HmmPfamOutputParser( final File input_file,
                                 final String species,
-                                final String model_type,
                                 final Set<String> filter,
                                 final FilterType filter_type ) {
         _input_file = input_file;
         _species = species;
-        _model_type = model_type;
         _filter = filter;
         _filter_type = filter_type;
         init();
@@ -218,10 +214,6 @@ public final class HmmPfamOutputParser {
         return _max_allowed_overlap;
     }
 
-    private String getModelType() {
-        return _model_type;
-    }
-
     public int getProteinsEncountered() {
         return _proteins_encountered;
     }
@@ -436,8 +428,6 @@ public final class HmmPfamOutputParser {
                 int to = -1;
                 double e_value = -1;
                 double score = -1;
-                boolean is_complete_hmm_match = false;
-                boolean is_complete_query_match = false;
                 try {
                     from = Integer.valueOf( from_str ).intValue();
                 }
@@ -467,7 +457,7 @@ public final class HmmPfamOutputParser {
                             + "] in [" + getInputFile().getCanonicalPath() + "]" );
                 }
                 if ( hmm_match_str.equals( "[]" ) ) {
-                    is_complete_hmm_match = true;
+                    //is_complete_hmm_match = true;
                 }
                 else if ( !( hmm_match_str.equals( ".]" ) || hmm_match_str.equals( "[." ) || hmm_match_str
                         .equals( ".." ) ) ) {
@@ -475,7 +465,7 @@ public final class HmmPfamOutputParser {
                             + line_number + "] in [" + getInputFile().getCanonicalPath() + "]" );
                 }
                 if ( query_match_str.equals( ".." ) ) {
-                    is_complete_query_match = true;
+                    // is_complete_query_match = true;
                 }
                 else if ( !( query_match_str.equals( ".]" ) || query_match_str.equals( "[." ) || query_match_str
                         .equals( "[]" ) ) ) {
index f595349..f063866 100644 (file)
@@ -68,7 +68,8 @@ public final class HmmscanPerDomainTableParser {
     private final FilterType              _filter_type;
     private final File                    _input_file;
     private final String                  _species;
-    private double                        _e_value_maximum;
+    private double                        _fs_e_value_maximum;
+    private double                        _i_e_value_maximum;
     private Map<String, Double>           _individual_score_cutoffs;
     private boolean                       _ignore_dufs;
     private boolean                       _ignore_virus_like_ids;
@@ -81,7 +82,8 @@ public final class HmmscanPerDomainTableParser {
     private int                           _domains_encountered;
     private int                           _domains_ignored_due_to_duf;
     private int                           _domains_ignored_due_to_overlap;
-    private int                           _domains_ignored_due_to_e_value;
+    private int                           _domains_ignored_due_to_fs_e_value;
+    private int                           _domains_ignored_due_to_i_e_value;
     private int                           _domains_ignored_due_to_individual_score_cutoff;
     private int                           _domains_stored;
     private SortedSet<String>             _domains_stored_set;
@@ -207,8 +209,12 @@ public final class HmmscanPerDomainTableParser {
         return _domains_ignored_due_to_duf;
     }
 
-    public int getDomainsIgnoredDueToEval() {
-        return _domains_ignored_due_to_e_value;
+    public int getDomainsIgnoredDueToIEval() {
+        return _domains_ignored_due_to_i_e_value;
+    }
+
+    public int getDomainsIgnoredDueToFsEval() {
+        return _domains_ignored_due_to_fs_e_value;
     }
 
     public int getDomainsIgnoredDueToIndividualScoreCutoff() {
@@ -243,8 +249,12 @@ public final class HmmscanPerDomainTableParser {
         return _domains_stored_set;
     }
 
-    private double getEValueMaximum() {
-        return _e_value_maximum;
+    private double getFsEValueMaximum() {
+        return _fs_e_value_maximum;
+    }
+
+    private double getIEValueMaximum() {
+        return _i_e_value_maximum;
     }
 
     private Set<String> getFilter() {
@@ -296,7 +306,8 @@ public final class HmmscanPerDomainTableParser {
     }
 
     private void init() {
-        _e_value_maximum = HmmscanPerDomainTableParser.E_VALUE_MAXIMUM_DEFAULT;
+        _fs_e_value_maximum = HmmscanPerDomainTableParser.E_VALUE_MAXIMUM_DEFAULT;
+        _i_e_value_maximum = HmmscanPerDomainTableParser.E_VALUE_MAXIMUM_DEFAULT;
         setIgnoreDufs( HmmscanPerDomainTableParser.IGNORE_DUFS_DEFAULT );
         setReturnType( HmmscanPerDomainTableParser.RETURN_TYPE_DEFAULT );
         _max_allowed_overlap = HmmscanPerDomainTableParser.MAX_ALLOWED_OVERLAP_DEFAULT;
@@ -313,7 +324,8 @@ public final class HmmscanPerDomainTableParser {
         setProteinsIgnoredDueToFilter( 0 );
         setDomainsIgnoredDueToNegativeFilter( 0 );
         setDomainsIgnoredDueToDuf( 0 );
-        setDomainsIgnoredDueToEval( 0 );
+        setDomainsIgnoredDueToFsEval( 0 );
+        setDomainsIgnoredDueToIEval( 0 );
         setDomainsIgnoredDueToIndividualScoreCutoff( 0 );
         setDomainsIgnoredDueToVirusLikeId( 0 );
         setDomainsIgnoredDueToOverlap( 0 );
@@ -440,9 +452,13 @@ public final class HmmscanPerDomainTableParser {
             else if ( ali_from == ali_to ) {
                 //Ignore
             }
-            else if ( ( getEValueMaximum() != HmmscanPerDomainTableParser.E_VALUE_MAXIMUM_DEFAULT )
-                    && ( fs_e_value > getEValueMaximum() ) ) {
-                ++_domains_ignored_due_to_e_value;
+            else if ( ( getFsEValueMaximum() != HmmscanPerDomainTableParser.E_VALUE_MAXIMUM_DEFAULT )
+                    && ( fs_e_value > getFsEValueMaximum() ) ) {
+                ++_domains_ignored_due_to_fs_e_value;
+            }
+            else if ( ( getIEValueMaximum() != HmmscanPerDomainTableParser.E_VALUE_MAXIMUM_DEFAULT )
+                    && ( i_e_value > getIEValueMaximum() ) ) {
+                ++_domains_ignored_due_to_i_e_value;
             }
             else if ( isIgnoreDufs() && uc_id.startsWith( "DUF" ) ) {
                 ++_domains_ignored_due_to_duf;
@@ -471,8 +487,6 @@ public final class HmmscanPerDomainTableParser {
                                                        ali_to,
                                                        ( short ) domain_number,
                                                        ( short ) total_domains,
-                                                       fs_e_value,
-                                                       fs_score,
                                                        i_e_value,
                                                        domain_score );
                     current_protein.addProteinDomain( pd );
@@ -524,8 +538,12 @@ public final class HmmscanPerDomainTableParser {
         _domains_ignored_due_to_duf = domains_ignored_due_to_duf;
     }
 
-    private void setDomainsIgnoredDueToEval( final int domains_ignored_due_to_e_value ) {
-        _domains_ignored_due_to_e_value = domains_ignored_due_to_e_value;
+    private void setDomainsIgnoredDueToFsEval( final int domains_ignored_due_to_fs_e_value ) {
+        _domains_ignored_due_to_fs_e_value = domains_ignored_due_to_fs_e_value;
+    }
+
+    private void setDomainsIgnoredDueToIEval( final int domains_ignored_due_to_i_e_value ) {
+        _domains_ignored_due_to_i_e_value = domains_ignored_due_to_i_e_value;
     }
 
     private void setDomainsIgnoredDueToIndividualScoreCutoff( final int domains_ignored_due_to_individual_score_cutoff ) {
@@ -560,11 +578,18 @@ public final class HmmscanPerDomainTableParser {
         _domains_stored_set = _storeddomains_stored;
     }
 
-    public void setEValueMaximum( final double e_value_maximum ) {
-        if ( e_value_maximum < 0.0 ) {
+    public void setFsEValueMaximum( final double fs_e_value_maximum ) {
+        if ( fs_e_value_maximum < 0.0 ) {
+            throw new IllegalArgumentException( "attempt to set the maximum E-value to a negative value" );
+        }
+        _fs_e_value_maximum = fs_e_value_maximum;
+    }
+
+    public void setIEValueMaximum( final double i_e_value_maximum ) {
+        if ( i_e_value_maximum < 0.0 ) {
             throw new IllegalArgumentException( "attempt to set the maximum E-value to a negative value" );
         }
-        _e_value_maximum = e_value_maximum;
+        _i_e_value_maximum = i_e_value_maximum;
     }
 
     public void setIgnoreDufs( final boolean ignore_dufs ) {
index 171b0d0..c4d1a0e 100644 (file)
 
 package org.forester.protein;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.forester.util.ForesterUtil;
 
 public class BasicDomain implements Domain {
 
-    final private String _id;
-    final private int    _from;
-    final private int    _to;
-    final private short  _number;
-    final private short  _total_count;
-    final private double _per_sequence_evalue;
-    final private double _per_sequence_score;
-    final private double _per_domain_evalue;
-    final private double _per_domain_score;
+    private static short                    COUNT        = 0;
+    private final static Map<Short, String> ID_TO_STRING = new HashMap<Short, String>();
+    private final static Map<String, Short> STRING_TO_ID = new HashMap<String, Short>();
+    final private int                       _from;
+    final private short                     _id;
+    final private short                     _number;
+    final private double                    _per_domain_evalue;
+    final private double                    _per_domain_score;
+    final private int                       _to;
+    final private short                     _total_count;
 
     public BasicDomain( final String id ) {
         if ( ForesterUtil.isEmpty( id ) ) {
             throw new IllegalArgumentException( "attempt to create protein domain with null or empty id" );
         }
-        _id = id;
+        _id = obtainIdAsShort( id );
         _from = -1;
         _to = -1;
         _number = -1;
         _total_count = -1;
-        _per_sequence_evalue = -1;
-        _per_sequence_score = -1;
         _per_domain_evalue = -1;
         _per_domain_score = -1;
     }
@@ -60,18 +62,6 @@ public class BasicDomain implements Domain {
                         final int to,
                         final short number,
                         final short total_count,
-                        final double per_sequence_evalue,
-                        final double per_sequence_score ) {
-        this( id, from, to, number, total_count, per_sequence_evalue, per_sequence_score, 0, 0 );
-    }
-
-    public BasicDomain( final String id,
-                        final int from,
-                        final int to,
-                        final short number,
-                        final short total_count,
-                        final double per_sequence_evalue,
-                        final double per_sequence_score,
                         final double per_domain_evalue,
                         final double per_domain_score ) {
         if ( ( from >= to ) || ( from < 0 ) ) {
@@ -84,24 +74,18 @@ public class BasicDomain implements Domain {
             throw new IllegalArgumentException( "attempt to create protein domain number " + number + " out of "
                     + total_count );
         }
-        if ( ( per_sequence_evalue < 0.0 ) || ( per_domain_evalue < 0.0 ) ) {
+        if ( per_domain_evalue < 0.0 ) {
             throw new IllegalArgumentException( "attempt to create protein domain with negative E-value" );
         }
-        _id = id;
+        _id = obtainIdAsShort( id );
         _from = from;
         _to = to;
         _number = number;
         _total_count = total_count;
-        _per_sequence_evalue = per_sequence_evalue;
-        _per_sequence_score = per_sequence_score;
         _per_domain_evalue = per_domain_evalue;
         _per_domain_score = per_domain_score;
     }
 
-    // ^^     @Override
-    // ^^    public void addGoId( final GoId go_id ) {
-    // ^^       getDomainId().getGoIds().add( go_id );
-    // ^^   }
     /**
      * Basic domains are compared/sorted based upon their identifiers (case
      * insensitive) and their numbers.
@@ -143,7 +127,7 @@ public class BasicDomain implements Domain {
 
     @Override
     public String getDomainId() {
-        return _id;
+        return obtainIdFromShort( _id );
     }
 
     @Override
@@ -151,19 +135,16 @@ public class BasicDomain implements Domain {
         return _from;
     }
 
-    // ^^  @Override
-    // ^^   public GoId getGoId( final int i ) {
-    // ^^       return getDomainId().getGoIds().get( i );
-    // ^^   }
+    @Override
+    public int getLength() {
+        return ( 1 + getTo() ) - getFrom();
+    }
+
     @Override
     public short getNumber() {
         return _number;
     }
 
-    // ^^  @Override
-    // ^^    public int getNumberOfGoIds() {
-    // ^^        return getDomainId().getGoIds().size();
-    // ^^   }
     @Override
     public double getPerDomainEvalue() {
         return _per_domain_evalue;
@@ -175,16 +156,6 @@ public class BasicDomain implements Domain {
     }
 
     @Override
-    public double getPerSequenceEvalue() {
-        return _per_sequence_evalue;
-    }
-
-    @Override
-    public double getPerSequenceScore() {
-        return _per_sequence_score;
-    }
-
-    @Override
     public int getTo() {
         return _to;
     }
@@ -208,8 +179,19 @@ public class BasicDomain implements Domain {
         return new StringBuffer( getDomainId() );
     }
 
-    @Override
-    public int getLength() {
-        return ( 1 + getTo() ) - getFrom();
+    public final static short obtainIdAsShort( final String id ) {
+        if ( !STRING_TO_ID.containsKey( id ) ) {
+            if ( COUNT >= ( Short.MAX_VALUE - 2 ) ) {
+                throw new RuntimeException( "too many domain ids!" );
+            }
+            ID_TO_STRING.put( COUNT, id );
+            STRING_TO_ID.put( id, COUNT );
+            ++COUNT;
+        }
+        return STRING_TO_ID.get( id );
+    }
+
+    public final static String obtainIdFromShort( final short id ) {
+        return ID_TO_STRING.get( id );
     }
 }
index 191e51b..4013904 100644 (file)
@@ -33,19 +33,13 @@ public interface BinaryDomainCombination extends Comparable<BinaryDomainCombinat
 
     public String getId1();
 
-    public abstract StringBuffer toGraphDescribingLanguage( final OutputFormat format,
-                                                            final String node_attribute,
-                                                            String edge_attribute );
-
-    /**
-     * This has to return a String representation
-     * in the following format:
-     * id0 - id1
-     * 
-     * @return a String representation in the form id0 - id1
-     */
-    @Override
-    public String toString();
+    short getId0Code();
+
+    short getId1Code();
+
+    public StringBuffer toGraphDescribingLanguage( final OutputFormat format,
+                                                   final String node_attribute,
+                                                   String edge_attribute );
 
     public static enum DomainCombinationType {
         BASIC, DIRECTED, DIRECTED_ADJACTANT;
index a4ab80e..b1f720a 100644 (file)
@@ -28,25 +28,18 @@ package org.forester.protein;
 
 public interface Domain extends Comparable<Domain> {
 
-    // ^^  public void addGoId( GoId go_id );
     public String getDomainId();
 
     public int getLength();
 
     public int getFrom();
 
-    // ^^   public GoId getGoId( int i );
     public short getNumber();
 
-    // ^^  public int getNumberOfGoIds();
     public double getPerDomainEvalue();
 
     public double getPerDomainScore();
 
-    public double getPerSequenceEvalue();
-
-    public double getPerSequenceScore();
-
     public int getTo();
 
     public short getTotalCount();
index 7ec6cb4..9b5ae80 100644 (file)
 
 package org.forester.surfacing;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import org.forester.protein.BasicDomain;
 import org.forester.protein.BinaryDomainCombination;
 
 public class AdjactantDirectedBinaryDomainCombination extends BasicBinaryDomainCombination {
 
-    public AdjactantDirectedBinaryDomainCombination( final String n_terminal, final String c_terminal ) {
+    final private static Map<Integer, AdjactantDirectedBinaryDomainCombination> ADDC_POOL = new HashMap<Integer, AdjactantDirectedBinaryDomainCombination>();
+
+    private AdjactantDirectedBinaryDomainCombination( final String n_terminal, final String c_terminal ) {
         super();
         if ( ( n_terminal == null ) || ( c_terminal == null ) ) {
             throw new IllegalArgumentException( "attempt to create binary domain combination using null" );
         }
-        // _id0 = n_terminal;
-        // _id1 = c_terminal;
-       // _data = n_terminal + SEPARATOR + c_terminal;
-        _id0 = getId( n_terminal );
-        _id1 = getId( c_terminal );
+        _id0 = BasicDomain.obtainIdAsShort( n_terminal );
+        _id1 = BasicDomain.obtainIdAsShort( c_terminal );
     }
 
-    public static AdjactantDirectedBinaryDomainCombination createInstance( final String ids ) {
+    public final static AdjactantDirectedBinaryDomainCombination obtainInstance( final String ids ) {
         if ( ids.indexOf( BinaryDomainCombination.SEPARATOR ) < 1 ) {
             throw new IllegalArgumentException( "Unexpected format for binary domain combination [" + ids + "]" );
         }
@@ -50,6 +53,20 @@ public class AdjactantDirectedBinaryDomainCombination extends BasicBinaryDomainC
         if ( ids_ary.length != 2 ) {
             throw new IllegalArgumentException( "Unexpected format for binary domain combination [" + ids + "]" );
         }
-        return new AdjactantDirectedBinaryDomainCombination( ids_ary[ 0 ], ids_ary[ 1 ] );
+        return AdjactantDirectedBinaryDomainCombination.obtainInstance( ids_ary[ 0 ], ids_ary[ 1 ] );
+    }
+
+    public final static AdjactantDirectedBinaryDomainCombination obtainInstance( final String n_terminal,
+                                                                                 final String c_terminal ) {
+        final int code = calcCode( BasicDomain.obtainIdAsShort( n_terminal ), BasicDomain.obtainIdAsShort( c_terminal ) );
+        if ( ADDC_POOL.containsKey( code ) ) {
+            return ADDC_POOL.get( code );
+        }
+        else {
+            final AdjactantDirectedBinaryDomainCombination dc = new AdjactantDirectedBinaryDomainCombination( n_terminal,
+                                                                                                              c_terminal );
+            ADDC_POOL.put( code, dc );
+            return dc;
+        }
     }
 }
index eb4f9f1..6fd94f6 100644 (file)
@@ -45,7 +45,7 @@ public class AdjactantDirectedCombinableDomains extends BasicCombinableDomains {
         for( final String domain : getCombiningDomains().keySet() ) {
             // Precondition (!): key domain is most upstream domain.
             //TODO ensure this is true.
-            binary_combinations.add( new AdjactantDirectedBinaryDomainCombination( getKeyDomain(), domain ) );
+            binary_combinations.add( AdjactantDirectedBinaryDomainCombination.obtainInstance( getKeyDomain(), domain ) );
         }
         return binary_combinations;
     }
index e84c94a..47b4024 100644 (file)
@@ -29,34 +29,23 @@ package org.forester.surfacing;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.forester.protein.BasicDomain;
 import org.forester.protein.BinaryDomainCombination;
 import org.forester.util.ForesterUtil;
 
 public class BasicBinaryDomainCombination implements BinaryDomainCombination {
 
-    final static Map<Short, String> id2str = new HashMap<Short, String>();
-    final static Map<String, Short> str2id = new HashMap<String, Short>();
-    static short                    count  = 0;
-    short                           _id0;
-    short                           _id1;
+    final private static Map<Integer, BasicBinaryDomainCombination> DC_POOL = new HashMap<Integer, BasicBinaryDomainCombination>();
+    final private static Map<Integer, String>                       S_POOL  = new HashMap<Integer, String>();
+    short                                                           _id0;
+    short                                                           _id1;
 
-    static short getId( final String id ) {
-        if ( !str2id.containsKey( id ) ) {
-            if ( count >= Short.MAX_VALUE ) {
-                throw new RuntimeException( "too many domain ids!" );
-            }
-            id2str.put( count, id );
-            str2id.put( id, count );
-            ++count;
-        }
-        return  str2id.get( id ) ;
-    }
-
-     static String getStr( final short id ) {
-        return id2str.get( id );
+    BasicBinaryDomainCombination() {
+        _id0 = -1;
+        _id1 = -1;
     }
 
-    public BasicBinaryDomainCombination( final String id0, final String id1 ) {
+    private BasicBinaryDomainCombination( final String id0, final String id1 ) {
         if ( ( id0 == null ) || ( id1 == null ) ) {
             throw new IllegalArgumentException( "attempt to create binary domain combination using null" );
         }
@@ -64,23 +53,17 @@ public class BasicBinaryDomainCombination implements BinaryDomainCombination {
             throw new IllegalArgumentException( "ill formatted domain id: " + id0 + ", " + id1 );
         }
         if ( id0.toLowerCase().compareTo( id1.toLowerCase() ) < 0 ) {
-           _id0 = getId( id0 );
-           _id1 = getId( id1 );
+            _id0 = BasicDomain.obtainIdAsShort( id0 );
+            _id1 = BasicDomain.obtainIdAsShort( id1 );
         }
         else {
-            // _data = id1 + SEPARATOR + id0;
-            _id0 = getId( id1 );
-            _id1 = getId( id0 );
+            _id0 = BasicDomain.obtainIdAsShort( id1 );
+            _id1 = BasicDomain.obtainIdAsShort( id0 );
         }
     }
 
-    BasicBinaryDomainCombination() {
-        _id0 = -1;
-        _id1 = -1;
-    }
-
     @Override
-    public int compareTo( final BinaryDomainCombination binary_domain_combination ) {
+    final public int compareTo( final BinaryDomainCombination binary_domain_combination ) {
         if ( binary_domain_combination.getClass() != this.getClass() ) {
             throw new IllegalArgumentException( "attempt to compare [" + binary_domain_combination.getClass() + "] to "
                     + "[" + this.getClass() + "]" );
@@ -98,7 +81,7 @@ public class BasicBinaryDomainCombination implements BinaryDomainCombination {
     }
 
     @Override
-    public boolean equals( final Object o ) {
+    final public boolean equals( final Object o ) {
         if ( this == o ) {
             return true;
         }
@@ -110,32 +93,40 @@ public class BasicBinaryDomainCombination implements BinaryDomainCombination {
                     + o.getClass() + "]" );
         }
         else {
-            return ( getId0().equals( ( ( BinaryDomainCombination ) o ).getId0() ) )
-                    && ( getId1().equals( ( ( BinaryDomainCombination ) o ).getId1() ) );
+            return ( getId0Code() == ( ( BinaryDomainCombination ) o ).getId0Code() )
+                    && ( getId1Code() == ( ( BinaryDomainCombination ) o ).getId1Code() );
         }
     }
 
     @Override
-    public String getId0() {
-        //return _data.substring( 0, _data.indexOf( SEPARATOR ) );
-        return getStr( _id0 );
+    final public String getId0() {
+        return BasicDomain.obtainIdFromShort( _id0 );
+    }
+
+    @Override
+    final public short getId0Code() {
+        return _id0;
+    }
+
+    @Override
+    final public String getId1() {
+        return BasicDomain.obtainIdFromShort( _id1 );
     }
 
     @Override
-    public String getId1() {
-        //return _data.substring( _data.indexOf( SEPARATOR ) + 1 );
-        return getStr( _id1 );
+    final public short getId1Code() {
+        return _id1;
     }
 
     @Override
-    public int hashCode() {
-        return getAsStr().hashCode();
+    final public int hashCode() {
+        return calcCode( _id0, _id1 );
     }
 
     @Override
-    public StringBuffer toGraphDescribingLanguage( final OutputFormat format,
-                                                   final String node_attribute,
-                                                   final String edge_attribute ) {
+    final public StringBuffer toGraphDescribingLanguage( final OutputFormat format,
+                                                         final String node_attribute,
+                                                         final String edge_attribute ) {
         final StringBuffer sb = new StringBuffer();
         switch ( format ) {
             case DOT:
@@ -177,15 +168,22 @@ public class BasicBinaryDomainCombination implements BinaryDomainCombination {
     }
 
     @Override
-    public String toString() {
-        return getAsStr();
-    }
-
-    private String getAsStr() {
-        return getId0() + SEPARATOR + getId1();
+    final public String toString() {
+        final int code = calcCode( _id0, _id1 );
+        if ( S_POOL.containsKey( code ) ) {
+            return S_POOL.get( code );
+        }
+        else {
+            final String s = getId0() + SEPARATOR + getId1();
+            S_POOL.put( code, s );
+            if ( S_POOL.size() % 100 == 0 ) {
+                System.out.println( "ss=" + S_POOL.size() );
+            }
+            return s;
+        }
     }
 
-    public static BinaryDomainCombination createInstance( final String ids ) {
+    public static BinaryDomainCombination obtainInstance( final String ids ) {
         if ( ids.indexOf( BinaryDomainCombination.SEPARATOR ) < 1 ) {
             throw new IllegalArgumentException( "Unexpected format for binary domain combination [" + ids + "]" );
         }
@@ -193,6 +191,31 @@ public class BasicBinaryDomainCombination implements BinaryDomainCombination {
         if ( ids_ary.length != 2 ) {
             throw new IllegalArgumentException( "Unexpected format for binary domain combination [" + ids + "]" );
         }
-        return new BasicBinaryDomainCombination( ids_ary[ 0 ], ids_ary[ 1 ] );
+        return BasicBinaryDomainCombination.obtainInstance( ids_ary[ 0 ], ids_ary[ 1 ] );
+    }
+
+    public static BasicBinaryDomainCombination obtainInstance( final String id0, final String id1 ) {
+        int code;
+        if ( id0.toLowerCase().compareTo( id1.toLowerCase() ) < 0 ) {
+            code = calcCode( BasicDomain.obtainIdAsShort( id0 ), BasicDomain.obtainIdAsShort( id1 ) );
+        }
+        else {
+            code = calcCode( BasicDomain.obtainIdAsShort( id1 ), BasicDomain.obtainIdAsShort( id0 ) );
+        }
+        if ( DC_POOL.containsKey( code ) ) {
+            return DC_POOL.get( code );
+        }
+        else {
+            final BasicBinaryDomainCombination dc = new BasicBinaryDomainCombination( id0, id1 );
+            DC_POOL.put( code, dc );
+            if ( DC_POOL.size() % 100 == 0 ) {
+                System.out.println( "s=" + DC_POOL.size() );
+            }
+            return dc;
+        }
+    }
+
+    final static int calcCode( final int id0, final int id1 ) {
+        return ( id0 * ( Short.MAX_VALUE + 1 ) ) + id1;
     }
 }
index 2f48a64..02a8278 100644 (file)
@@ -171,7 +171,8 @@ public class BasicCombinableDomains implements CombinableDomains {
     public List<BinaryDomainCombination> toBinaryDomainCombinations() {
         final List<BinaryDomainCombination> binary_combinations = new ArrayList<BinaryDomainCombination>( getNumberOfCombinableDomains() );
         for( final String domain : getCombiningDomains().keySet() ) {
-            binary_combinations.add( new BasicBinaryDomainCombination( getKeyDomain(), domain ) );
+            // binary_combinations.add( new BasicBinaryDomainCombination( getKeyDomain(), domain ) );
+            binary_combinations.add( BasicBinaryDomainCombination.obtainInstance( getKeyDomain(), domain ) );
         }
         return binary_combinations;
     }
index 68e570d..75abce7 100644 (file)
 
 package org.forester.surfacing;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import org.forester.protein.BasicDomain;
 import org.forester.protein.BinaryDomainCombination;
 
 public class DirectedBinaryDomainCombination extends BasicBinaryDomainCombination {
 
-    public DirectedBinaryDomainCombination( final String n_terminal, final String c_terminal ) {
+    final private static Map<Integer, DirectedBinaryDomainCombination> DDC_POOL = new HashMap<Integer, DirectedBinaryDomainCombination>();
+
+    private DirectedBinaryDomainCombination( final String n_terminal, final String c_terminal ) {
         super();
         if ( ( n_terminal == null ) || ( c_terminal == null ) ) {
             throw new IllegalArgumentException( "attempt to create binary domain combination using null" );
         }
-        //_id0 = n_terminal;
-        //_id1 = c_terminal;
-       // _data = n_terminal + SEPARATOR + c_terminal;
-        _id0 = getId( n_terminal );
-        _id1 = getId( c_terminal );
+        _id0 = BasicDomain.obtainIdAsShort( n_terminal );
+        _id1 = BasicDomain.obtainIdAsShort( c_terminal );
     }
 
-    public static BinaryDomainCombination createInstance( final String ids ) {
+    public final static BinaryDomainCombination obtainInstance( final String ids ) {
         if ( ids.indexOf( BinaryDomainCombination.SEPARATOR ) < 1 ) {
             throw new IllegalArgumentException( "Unexpected format for binary domain combination [" + ids + "]" );
         }
@@ -50,6 +53,18 @@ public class DirectedBinaryDomainCombination extends BasicBinaryDomainCombinatio
         if ( ids_ary.length != 2 ) {
             throw new IllegalArgumentException( "Unexpected format for binary domain combination [" + ids + "]" );
         }
-        return new DirectedBinaryDomainCombination( ids_ary[ 0 ], ids_ary[ 1 ] );
+        return DirectedBinaryDomainCombination.obtainInstance( ids_ary[ 0 ], ids_ary[ 1 ] );
+    }
+
+    public final static DirectedBinaryDomainCombination obtainInstance( final String n_terminal, final String c_terminal ) {
+        final int code = calcCode( BasicDomain.obtainIdAsShort( n_terminal ), BasicDomain.obtainIdAsShort( c_terminal ) );
+        if ( DDC_POOL.containsKey( code ) ) {
+            return DDC_POOL.get( code );
+        }
+        else {
+            final DirectedBinaryDomainCombination dc = new DirectedBinaryDomainCombination( n_terminal, c_terminal );
+            DDC_POOL.put( code, dc );
+            return dc;
+        }
     }
 }
index 9955eec..35f73f8 100644 (file)
@@ -44,7 +44,7 @@ public class DirectedCombinableDomains extends BasicCombinableDomains {
         for( final String domain : getCombiningDomains().keySet() ) {
             // Precondition (!): key domain is most upstream domain.
             //TODO ensure this is true.
-            binary_combinations.add( new DirectedBinaryDomainCombination( getKeyDomain(), domain ) );
+            binary_combinations.add( DirectedBinaryDomainCombination.obtainInstance( getKeyDomain(), domain ) );
         }
         return binary_combinations;
     }
index e667d39..bffe413 100644 (file)
@@ -579,13 +579,13 @@ public final class DomainParsimonyCalculator {
             for( int ci = 0; ci < matrix.getNumberOfCharacters(); ++ci ) {
                 BinaryDomainCombination bc = null;
                 if ( gwcd.getDomainCombinationType() == DomainCombinationType.DIRECTED_ADJACTANT ) {
-                    bc = AdjactantDirectedBinaryDomainCombination.createInstance( matrix.getCharacter( ci ) );
+                    bc = AdjactantDirectedBinaryDomainCombination.obtainInstance( matrix.getCharacter( ci ) );
                 }
                 else if ( gwcd.getDomainCombinationType() == DomainCombinationType.DIRECTED ) {
-                    bc = DirectedBinaryDomainCombination.createInstance( matrix.getCharacter( ci ) );
+                    bc = DirectedBinaryDomainCombination.obtainInstance( matrix.getCharacter( ci ) );
                 }
                 else {
-                    bc = BasicBinaryDomainCombination.createInstance( matrix.getCharacter( ci ) );
+                    bc = BasicBinaryDomainCombination.obtainInstance( matrix.getCharacter( ci ) );
                 }
                 if ( binary_combinations_per_genome[ identifier_index ].contains( bc ) ) {
                     matrix.setState( identifier_index, ci, CharacterStateMatrix.BinaryStates.PRESENT );
@@ -713,13 +713,13 @@ public final class DomainParsimonyCalculator {
             for( int ci = 0; ci < matrix.getNumberOfCharacters(); ++ci ) {
                 BinaryDomainCombination bc = null;
                 if ( gwcd.getDomainCombinationType() == DomainCombinationType.DIRECTED_ADJACTANT ) {
-                    bc = AdjactantDirectedBinaryDomainCombination.createInstance( matrix.getCharacter( ci ) );
+                    bc = AdjactantDirectedBinaryDomainCombination.obtainInstance( matrix.getCharacter( ci ) );
                 }
                 else if ( gwcd.getDomainCombinationType() == DomainCombinationType.DIRECTED ) {
-                    bc = DirectedBinaryDomainCombination.createInstance( matrix.getCharacter( ci ) );
+                    bc = DirectedBinaryDomainCombination.obtainInstance( matrix.getCharacter( ci ) );
                 }
                 else {
-                    bc = BasicBinaryDomainCombination.createInstance( matrix.getCharacter( ci ) );
+                    bc = BasicBinaryDomainCombination.obtainInstance( matrix.getCharacter( ci ) );
                 }
                 if ( binary_combinations_per_genome_mapped[ identifier_index ].contains( bc ) ) {
                     matrix.setState( identifier_index, ci, CharacterStateMatrix.BinaryStates.PRESENT );
@@ -877,6 +877,7 @@ public final class DomainParsimonyCalculator {
         else {
             id1 = domain_id_to_second_features_map.get( bc.getId1() );
         }
-        return new BasicBinaryDomainCombination( id0, id1 );
+        //   return new BasicBinaryDomainCombination( id0, id1 );
+        return BasicBinaryDomainCombination.obtainInstance( id0, id1 );
     }
 }
index 2d1826e..782ce20 100644 (file)
@@ -26,6 +26,7 @@
 
 package org.forester.surfacing;
 
+import org.forester.protein.BasicDomain;
 import org.forester.protein.Domain;
 import org.forester.util.ForesterUtil;
 
@@ -35,19 +36,15 @@ import org.forester.util.ForesterUtil;
  */
 public class SimpleDomain implements Domain {
 
-    final private String _id;
+    final private short _id;
 
     public SimpleDomain( final String id ) {
         if ( ForesterUtil.isEmpty( id ) ) {
             throw new IllegalArgumentException( "attempt to create protein domain with null or empty id" );
         }
-        _id = id;
+        _id = BasicDomain.obtainIdAsShort( id );
     }
 
-    // ^^  @Override
-    // ^^  public void addGoId( final GoId go_id ) {
-    // ^^     throw new RuntimeException( "method not implemented" );
-    // ^^ }
     @Override
     public int compareTo( final Domain domain ) {
         if ( this == domain ) {
@@ -58,7 +55,7 @@ public class SimpleDomain implements Domain {
 
     @Override
     public String getDomainId() {
-        return _id;
+        return BasicDomain.obtainIdFromShort( _id );
     }
 
     @Override
@@ -66,10 +63,6 @@ public class SimpleDomain implements Domain {
         throw new RuntimeException( "method not implemented" );
     }
 
-    // ^^   @Override
-    // ^^   public GoId getGoId( final int i ) {
-    // ^^      throw new RuntimeException( "method not implemented" );
-    // ^^  }
     @Override
     public int getLength() {
         throw new RuntimeException( "method not implemented" );
@@ -80,10 +73,6 @@ public class SimpleDomain implements Domain {
         throw new RuntimeException( "method not implemented" );
     }
 
-    // ^^   @Override
-    // ^^  public int getNumberOfGoIds() {
-    // ^^      throw new RuntimeException( "method not implemented" );
-    // ^^ }
     @Override
     public double getPerDomainEvalue() {
         throw new RuntimeException( "method not implemented" );
@@ -95,20 +84,6 @@ public class SimpleDomain implements Domain {
     }
 
     @Override
-    public double getPerSequenceEvalue() {
-        throw new RuntimeException( "method not implemented" );
-    }
-
-    @Override
-    public double getPerSequenceScore() {
-        throw new RuntimeException( "method not implemented" );
-    }
-
-    public String getSearchParameter() {
-        throw new RuntimeException( "method not implemented" );
-    }
-
-    @Override
     public int getTo() {
         throw new RuntimeException( "method not implemented" );
     }
@@ -117,12 +92,4 @@ public class SimpleDomain implements Domain {
     public short getTotalCount() {
         throw new RuntimeException( "method not implemented" );
     }
-
-    public boolean isCompleteQueryMatch() {
-        throw new RuntimeException( "method not implemented" );
-    }
-
-    public boolean isCompleteTargetMatch() {
-        throw new RuntimeException( "method not implemented" );
-    }
 }
index 55bfb6f..1433d70 100644 (file)
@@ -107,13 +107,12 @@ public final class SurfacingUtil {
                                                                                   @Override
                                                                                   public int compare( final Domain d1,
                                                                                                       final Domain d2 ) {
-                                                                                      if ( d1.getPerSequenceEvalue() < d2
-                                                                                              .getPerSequenceEvalue() ) {
+                                                                                      if ( d1.getPerDomainEvalue() < d2
+                                                                                              .getPerDomainEvalue() ) {
                                                                                           return -1;
                                                                                       }
-                                                                                      else if ( d1
-                                                                                              .getPerSequenceEvalue() > d2
-                                                                                              .getPerSequenceEvalue() ) {
+                                                                                      else if ( d1.getPerDomainEvalue() > d2
+                                                                                              .getPerDomainEvalue() ) {
                                                                                           return 1;
                                                                                       }
                                                                                       else {
@@ -199,14 +198,14 @@ public final class SurfacingUtil {
                         || ( !get_gains && ( matrix.getState( id, c ) == CharacterStateMatrix.GainLossStates.LOSS ) ) ) {
                     if ( dc_type == BinaryDomainCombination.DomainCombinationType.DIRECTED_ADJACTANT ) {
                         all_binary_domains_combination_gained.add( AdjactantDirectedBinaryDomainCombination
-                                .createInstance( matrix.getCharacter( c ) ) );
+                                .obtainInstance( matrix.getCharacter( c ) ) );
                     }
                     else if ( dc_type == BinaryDomainCombination.DomainCombinationType.DIRECTED ) {
                         all_binary_domains_combination_gained.add( DirectedBinaryDomainCombination
-                                .createInstance( matrix.getCharacter( c ) ) );
+                                .obtainInstance( matrix.getCharacter( c ) ) );
                     }
                     else {
-                        all_binary_domains_combination_gained.add( BasicBinaryDomainCombination.createInstance( matrix
+                        all_binary_domains_combination_gained.add( BasicBinaryDomainCombination.obtainInstance( matrix
                                 .getCharacter( c ) ) );
                     }
                 }
@@ -249,13 +248,15 @@ public final class SurfacingUtil {
     }
 
     public static StringBuilder createParametersAsString( final boolean ignore_dufs,
-                                                          final double e_value_max,
+                                                          final double ie_value_max,
+                                                          final double fs_e_value_max,
                                                           final int max_allowed_overlap,
                                                           final boolean no_engulfing_overlaps,
                                                           final File cutoff_scores_file,
                                                           final BinaryDomainCombination.DomainCombinationType dc_type ) {
         final StringBuilder parameters_sb = new StringBuilder();
-        parameters_sb.append( "E-value: " + e_value_max );
+        parameters_sb.append( "iE-value: " + ie_value_max );
+        parameters_sb.append( ", FS E-value: " + fs_e_value_max );
         if ( cutoff_scores_file != null ) {
             parameters_sb.append( ", Cutoff-scores-file: " + cutoff_scores_file );
         }
@@ -667,6 +668,7 @@ public final class SurfacingUtil {
      * 
      * @param all_binary_domains_combination_lost_fitch 
      * @param use_last_in_fitch_parsimony 
+     * @param perform_dc_fich 
      * @param consider_directedness_and_adjacency_for_bin_combinations 
      * @param all_binary_domains_combination_gained if null ignored, otherwise this is to list all binary domain combinations
      * which were gained under unweighted (Fitch) parsimony.
@@ -691,7 +693,8 @@ public final class SurfacingUtil {
                                                  final Map<String, DescriptiveStatistics> domain_length_stats_by_domain,
                                                  final Map<String, Integer> tax_code_to_id_map,
                                                  final boolean write_to_nexus,
-                                                 final boolean use_last_in_fitch_parsimony ) {
+                                                 final boolean use_last_in_fitch_parsimony,
+                                                 final boolean perform_dc_fich ) {
         final String sep = ForesterUtil.LINE_SEPARATOR + "###################" + ForesterUtil.LINE_SEPARATOR;
         final String date_time = ForesterUtil.getCurrentDateTime();
         final SortedSet<String> all_pfams_encountered = new TreeSet<String>();
@@ -794,7 +797,7 @@ public final class SurfacingUtil {
             e.printStackTrace();
             ForesterUtil.fatalError( surfacing.PRG_NAME, e.getLocalizedMessage() );
         }
-        if ( domain_parsimony.calculateNumberOfBinaryDomainCombination() > 0 ) {
+        if ( perform_dc_fich && ( domain_parsimony.calculateNumberOfBinaryDomainCombination() > 0 ) ) {
             // FITCH DOMAIN COMBINATIONS
             // -------------------------
             local_phylogeny_l = phylogeny.copy();
@@ -1957,7 +1960,7 @@ public final class SurfacingUtil {
                                     .getState( id, c ) == CharacterStateMatrix.GainLossStates.UNCHANGED_PRESENT ) ) ) ) {
                         BinaryDomainCombination bdc = null;
                         try {
-                            bdc = BasicBinaryDomainCombination.createInstance( matrix.getCharacter( c ) );
+                            bdc = BasicBinaryDomainCombination.obtainInstance( matrix.getCharacter( c ) );
                         }
                         catch ( final Exception e ) {
                             ForesterUtil.fatalError( surfacing.PRG_NAME, e.getLocalizedMessage() );
index 168b6a4..1ccaf70 100644 (file)
@@ -57,7 +57,6 @@ 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;
 
 @SuppressWarnings( "unused")
@@ -256,9 +255,6 @@ public class TestSurfacing {
             final Domain F = new BasicDomain( "F", 1, 2, ( short ) 1, ( short ) 1, 0.01, -12 );
             final Domain G = new BasicDomain( "G", 1, 2, ( short ) 1, ( short ) 1, 0.001, -12 );
             final Domain X = new BasicDomain( "X", 1, 2, ( short ) 1, ( short ) 1, 0.0001, -12 );
-            if ( !TestSurfacing.isEqual( X.getPerSequenceScore(), -12 ) ) {
-                return false;
-            }
             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 );
@@ -982,9 +978,6 @@ public class TestSurfacing {
             final Domain F = new BasicDomain( "F", 1, 2, ( short ) 1, ( short ) 1, 0.01, -12 );
             final Domain G = new BasicDomain( "G", 1, 2, ( short ) 1, ( short ) 1, 0.001, -12 );
             final Domain X = new BasicDomain( "X", 1, 2, ( short ) 1, ( short ) 1, 0.0001, -12 );
-            if ( !TestSurfacing.isEqual( X.getPerSequenceScore(), -12 ) ) {
-                return false;
-            }
             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 );
@@ -1229,16 +1222,16 @@ public class TestSurfacing {
 
     private static boolean testBinaryDomainCombination() {
         try {
-            final BasicBinaryDomainCombination s0 = new BasicBinaryDomainCombination( "a", "a" );
-            final BasicBinaryDomainCombination s1 = new BasicBinaryDomainCombination( "b", "a" );
-            final BasicBinaryDomainCombination s2 = new BasicBinaryDomainCombination( "a", "b" );
-            final BasicBinaryDomainCombination s3 = new BasicBinaryDomainCombination( "B", "A" );
-            final BasicBinaryDomainCombination s4 = new BasicBinaryDomainCombination( "A", "B" );
-            final BasicBinaryDomainCombination s5 = new BasicBinaryDomainCombination( "c", "a" );
-            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 BasicBinaryDomainCombination s0 = BasicBinaryDomainCombination.obtainInstance( "a", "a" );
+            final BasicBinaryDomainCombination s1 = BasicBinaryDomainCombination.obtainInstance( "b", "a" );
+            final BasicBinaryDomainCombination s2 = BasicBinaryDomainCombination.obtainInstance( "a", "b" );
+            final BasicBinaryDomainCombination s3 = BasicBinaryDomainCombination.obtainInstance( "B", "A" );
+            final BasicBinaryDomainCombination s4 = BasicBinaryDomainCombination.obtainInstance( "A", "B" );
+            final BasicBinaryDomainCombination s5 = BasicBinaryDomainCombination.obtainInstance( "c", "a" );
+            final BasicBinaryDomainCombination s6 = BasicBinaryDomainCombination.obtainInstance( "b", "c" );
+            final BasicBinaryDomainCombination s7 = BasicBinaryDomainCombination.obtainInstance( "d", "a" );
+            final BasicBinaryDomainCombination s8 = BasicBinaryDomainCombination.obtainInstance( "b", "d" );
+            final BinaryDomainCombination s9 = BasicBinaryDomainCombination.obtainInstance( "z-z=a-aa" );
             if ( !s9.toString().equals( "a-aa=z-z" ) ) {
                 System.out.println( s9.toString() );
                 return false;
@@ -1284,10 +1277,10 @@ public class TestSurfacing {
                 System.out.println( sorted.size() );
                 return false;
             }
-            final DirectedBinaryDomainCombination aa = new DirectedBinaryDomainCombination( "a", "a" );
-            final DirectedBinaryDomainCombination ba = new DirectedBinaryDomainCombination( "b", "a" );
-            final DirectedBinaryDomainCombination ab = new DirectedBinaryDomainCombination( "a", "b" );
-            final DirectedBinaryDomainCombination bb = new DirectedBinaryDomainCombination( "b", "b" );
+            final DirectedBinaryDomainCombination aa = DirectedBinaryDomainCombination.obtainInstance( "a", "a" );
+            final DirectedBinaryDomainCombination ba = DirectedBinaryDomainCombination.obtainInstance( "b", "a" );
+            final DirectedBinaryDomainCombination ab = DirectedBinaryDomainCombination.obtainInstance( "a", "b" );
+            final DirectedBinaryDomainCombination bb = DirectedBinaryDomainCombination.obtainInstance( "b", "b" );
             if ( !aa.equals( aa ) ) {
                 return false;
             }
@@ -1477,11 +1470,11 @@ public class TestSurfacing {
             if ( cd0.toBinaryDomainCombinations().size() != 3 ) {
                 return false;
             }
-            final BasicBinaryDomainCombination s0 = new BasicBinaryDomainCombination( "key0", "a" );
-            final BasicBinaryDomainCombination s1 = new BasicBinaryDomainCombination( "b", "key0" );
-            final BasicBinaryDomainCombination s2 = new BasicBinaryDomainCombination( "key0", "c" );
-            final BasicBinaryDomainCombination s3 = new BasicBinaryDomainCombination( "key0", "cc" );
-            final BasicBinaryDomainCombination s4 = new BasicBinaryDomainCombination( "c", "key0" );
+            final BasicBinaryDomainCombination s0 = BasicBinaryDomainCombination.obtainInstance( "key0", "a" );
+            final BasicBinaryDomainCombination s1 = BasicBinaryDomainCombination.obtainInstance( "b", "key0" );
+            final BasicBinaryDomainCombination s2 = BasicBinaryDomainCombination.obtainInstance( "key0", "c" );
+            final BasicBinaryDomainCombination s3 = BasicBinaryDomainCombination.obtainInstance( "key0", "cc" );
+            final BasicBinaryDomainCombination s4 = BasicBinaryDomainCombination.obtainInstance( "c", "key0" );
             if ( !cd0.toBinaryDomainCombinations().contains( s0 ) ) {
                 return false;
             }
@@ -1527,7 +1520,7 @@ public class TestSurfacing {
             if ( cd1.toBinaryDomainCombinations().size() != 4 ) {
                 return false;
             }
-            final BasicBinaryDomainCombination kk = new BasicBinaryDomainCombination( "key1", "key1" );
+            final BasicBinaryDomainCombination kk = BasicBinaryDomainCombination.obtainInstance( "key1", "key1" );
             if ( !cd1.toBinaryDomainCombinations().contains( kk ) ) {
                 return false;
             }
@@ -1712,15 +1705,15 @@ public class TestSurfacing {
             if ( cd0.toBinaryDomainCombinations().size() != 3 ) {
                 return false;
             }
-            final BinaryDomainCombination s0 = new DirectedBinaryDomainCombination( "key0", "a" );
-            final BinaryDomainCombination s1 = new DirectedBinaryDomainCombination( "b", "key0" );
-            final BinaryDomainCombination s2 = new DirectedBinaryDomainCombination( "key0", "c" );
-            final BinaryDomainCombination s3 = new DirectedBinaryDomainCombination( "key0", "cc" );
-            final BinaryDomainCombination s4 = new DirectedBinaryDomainCombination( "a", "b" );
-            final BinaryDomainCombination s5 = new DirectedBinaryDomainCombination( "b", "a" );
-            final BinaryDomainCombination s6 = new DirectedBinaryDomainCombination( "key0", "b" );
-            final BinaryDomainCombination s7 = new DirectedBinaryDomainCombination( "a", "key0" );
-            final BinaryDomainCombination s8 = new DirectedBinaryDomainCombination( "c", "key0" );
+            final BinaryDomainCombination s0 = DirectedBinaryDomainCombination.obtainInstance( "key0", "a" );
+            final BinaryDomainCombination s1 = DirectedBinaryDomainCombination.obtainInstance( "b", "key0" );
+            final BinaryDomainCombination s2 = DirectedBinaryDomainCombination.obtainInstance( "key0", "c" );
+            final BinaryDomainCombination s3 = DirectedBinaryDomainCombination.obtainInstance( "key0", "cc" );
+            final BinaryDomainCombination s4 = DirectedBinaryDomainCombination.obtainInstance( "a", "b" );
+            final BinaryDomainCombination s5 = DirectedBinaryDomainCombination.obtainInstance( "b", "a" );
+            final BinaryDomainCombination s6 = DirectedBinaryDomainCombination.obtainInstance( "key0", "b" );
+            final BinaryDomainCombination s7 = DirectedBinaryDomainCombination.obtainInstance( "a", "key0" );
+            final BinaryDomainCombination s8 = DirectedBinaryDomainCombination.obtainInstance( "c", "key0" );
             if ( !cd0.toBinaryDomainCombinations().contains( s0 ) ) {
                 return false;
             }
@@ -1778,7 +1771,7 @@ public class TestSurfacing {
             if ( cd1.toBinaryDomainCombinations().size() != 4 ) {
                 return false;
             }
-            final BinaryDomainCombination kk = new DirectedBinaryDomainCombination( "key1", "key1" );
+            final BinaryDomainCombination kk = DirectedBinaryDomainCombination.obtainInstance( "key1", "key1" );
             if ( !cd1.toBinaryDomainCombinations().contains( kk ) ) {
                 return false;
             }
@@ -1827,85 +1820,112 @@ public class TestSurfacing {
             list_1.add( five_1 );
             final GenomeWideCombinableDomains gwcd_1 = BasicGenomeWideCombinableDomains
                     .createInstance( list_1, false, new BasicSpecies( "1" ), DomainCombinationType.DIRECTED );
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "A", "B" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "A",
+                                                                                                                "B" ) ) ) {
                 return false;
             }
-            if ( gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "B", "A" ) ) ) {
+            if ( gwcd_1.toBinaryDomainCombinations()
+                    .contains( DirectedBinaryDomainCombination.obtainInstance( "B", "A" ) ) ) {
                 return false;
             }
-            if ( gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "A", "A" ) ) ) {
+            if ( gwcd_1.toBinaryDomainCombinations()
+                    .contains( DirectedBinaryDomainCombination.obtainInstance( "A", "A" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "A", "C" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "A",
+                                                                                                                "C" ) ) ) {
                 return false;
             }
-            if ( gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "C", "A" ) ) ) {
+            if ( gwcd_1.toBinaryDomainCombinations()
+                    .contains( DirectedBinaryDomainCombination.obtainInstance( "C", "A" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "B", "C" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "B",
+                                                                                                                "C" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "C", "X" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "C",
+                                                                                                                "X" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "C", "Y" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "C",
+                                                                                                                "Y" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "A", "X" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "A",
+                                                                                                                "X" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "A", "Y" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "A",
+                                                                                                                "Y" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "Y", "A" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "Y",
+                                                                                                                "A" ) ) ) {
                 return false;
             }
-            if ( gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "X", "A" ) ) ) {
+            if ( gwcd_1.toBinaryDomainCombinations()
+                    .contains( DirectedBinaryDomainCombination.obtainInstance( "X", "A" ) ) ) {
                 return false;
             }
-            if ( gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "C", "B" ) ) ) {
+            if ( gwcd_1.toBinaryDomainCombinations()
+                    .contains( DirectedBinaryDomainCombination.obtainInstance( "C", "B" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "X", "Y" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "X",
+                                                                                                                "Y" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "Y", "X" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "Y",
+                                                                                                                "X" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "A", "Y" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "A",
+                                                                                                                "Y" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "A", "X" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "A",
+                                                                                                                "X" ) ) ) {
                 return false;
             }
-            if ( gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "Y", "C" ) ) ) {
+            if ( gwcd_1.toBinaryDomainCombinations()
+                    .contains( DirectedBinaryDomainCombination.obtainInstance( "Y", "C" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "M", "N" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "M",
+                                                                                                                "N" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "N", "M" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "N",
+                                                                                                                "M" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "N", "P" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "N",
+                                                                                                                "P" ) ) ) {
                 return false;
             }
-            if ( !gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "M", "P" ) ) ) {
+            if ( !gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "M",
+                                                                                                                "P" ) ) ) {
                 return false;
             }
-            if ( gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "P", "N" ) ) ) {
+            if ( gwcd_1.toBinaryDomainCombinations()
+                    .contains( DirectedBinaryDomainCombination.obtainInstance( "P", "N" ) ) ) {
                 return false;
             }
-            if ( gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "P", "M" ) ) ) {
+            if ( gwcd_1.toBinaryDomainCombinations()
+                    .contains( DirectedBinaryDomainCombination.obtainInstance( "P", "M" ) ) ) {
                 return false;
             }
-            if ( gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "XX", "YY" ) ) ) {
+            if ( gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "XX",
+                                                                                                               "YY" ) ) ) {
                 return false;
             }
-            if ( gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "YY", "XX" ) ) ) {
+            if ( gwcd_1.toBinaryDomainCombinations().contains( DirectedBinaryDomainCombination.obtainInstance( "YY",
+                                                                                                               "XX" ) ) ) {
                 return false;
             }
-            if ( gwcd_1.toBinaryDomainCombinations().contains( new DirectedBinaryDomainCombination( "B", "B" ) ) ) {
+            if ( gwcd_1.toBinaryDomainCombinations()
+                    .contains( DirectedBinaryDomainCombination.obtainInstance( "B", "B" ) ) ) {
                 return false;
             }
             //            final List<GenomeWideCombinableDomains> gwcd_list = new ArrayList<GenomeWideCombinableDomains>();
@@ -2403,115 +2423,115 @@ public class TestSurfacing {
             final GenomeWideCombinableDomains gwcd_1 = BasicGenomeWideCombinableDomains
                     .createInstance( list_1, false, new BasicSpecies( "1" ), DomainCombinationType.DIRECTED_ADJACTANT );
             if ( !gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "A", "B" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "A", "B" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "B", "A" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "B", "A" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "A", "A" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "A", "A" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "A", "C" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "A", "C" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "C", "A" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "C", "A" ) ) ) {
                 return false;
             }
             if ( !gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "B", "C" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "B", "C" ) ) ) {
                 return false;
             }
             if ( !gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "C", "X" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "C", "X" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "C", "Y" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "C", "Y" ) ) ) {
                 return false;
             }
             if ( !gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "X", "Y" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "X", "Y" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "A", "X" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "A", "X" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "A", "Y" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "A", "Y" ) ) ) {
                 return false;
             }
             if ( !gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "Y", "A" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "Y", "A" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "X", "A" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "X", "A" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "C", "B" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "C", "B" ) ) ) {
                 return false;
             }
             if ( !gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "X", "Y" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "X", "Y" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "Y", "X" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "Y", "X" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "A", "Y" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "A", "Y" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "A", "X" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "A", "X" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "Y", "C" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "Y", "C" ) ) ) {
                 return false;
             }
             if ( !gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "M", "N" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "M", "N" ) ) ) {
                 return false;
             }
             if ( !gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "N", "M" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "N", "M" ) ) ) {
                 return false;
             }
             if ( !gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "N", "P" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "N", "P" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "M", "P" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "M", "P" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "P", "N" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "P", "N" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "P", "M" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "P", "M" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "XX", "YY" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "XX", "YY" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "YY", "XX" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "YY", "XX" ) ) ) {
                 return false;
             }
             if ( gwcd_1.toBinaryDomainCombinations()
-                    .contains( new AdjactantDirectedBinaryDomainCombination( "B", "B" ) ) ) {
+                    .contains( AdjactantDirectedBinaryDomainCombination.obtainInstance( "B", "B" ) ) ) {
                 return false;
             }
         }
@@ -2820,256 +2840,256 @@ public class TestSurfacing {
             if ( shared_i.size() != 3 ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "a", "a" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "a" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "b", "a" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "b", "a" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "a", "c" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "c" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "a", "d" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "d" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "a", "e" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "e" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "b", "c" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "b", "c" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "b", "d" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "b", "d" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "b", "e" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "b", "e" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "c", "d" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "c", "d" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "c", "e" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "c", "e" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "d", "e" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "d", "e" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "e", "f" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "e", "f" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "g", "h" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "g", "h" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "f", "f" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "f", "f" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "e", "e" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "e", "e" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "a", "i" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "i" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "a", "l" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "l" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "b", "i" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "b", "i" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "b", "l" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "b", "l" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "c", "i" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "c", "i" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "c", "l" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "c", "l" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "i", "l" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "i", "l" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "i", "f" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "i", "f" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "m", "n" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "m", "n" ) ) ) {
                 return false;
             }
-            if ( !a_ni.contains( new BasicBinaryDomainCombination( "j", "k" ) ) ) {
+            if ( !a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "j", "k" ) ) ) {
                 return false;
             }
-            if ( a_ni.contains( new BasicBinaryDomainCombination( "a", "g" ) ) ) {
+            if ( a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "g" ) ) ) {
                 return false;
             }
-            if ( a_ni.contains( new BasicBinaryDomainCombination( "a", "m" ) ) ) {
+            if ( a_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "m" ) ) ) {
                 return false;
             }
-            if ( a_i.contains( new BasicBinaryDomainCombination( "a", "a" ) ) ) {
+            if ( a_i.contains( BasicBinaryDomainCombination.obtainInstance( "a", "a" ) ) ) {
                 return false;
             }
-            if ( a_i.contains( new BasicBinaryDomainCombination( "f", "f" ) ) ) {
+            if ( a_i.contains( BasicBinaryDomainCombination.obtainInstance( "f", "f" ) ) ) {
                 return false;
             }
-            if ( a_i.contains( new BasicBinaryDomainCombination( "e", "e" ) ) ) {
+            if ( a_i.contains( BasicBinaryDomainCombination.obtainInstance( "e", "e" ) ) ) {
                 return false;
             }
-            if ( !shared_ni.contains( new BasicBinaryDomainCombination( "a", "a" ) ) ) {
+            if ( !shared_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "a" ) ) ) {
                 return false;
             }
-            if ( !shared_ni.contains( new BasicBinaryDomainCombination( "a", "b" ) ) ) {
+            if ( !shared_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "b" ) ) ) {
                 return false;
             }
-            if ( !shared_ni.contains( new BasicBinaryDomainCombination( "a", "c" ) ) ) {
+            if ( !shared_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "c" ) ) ) {
                 return false;
             }
-            if ( !shared_ni.contains( new BasicBinaryDomainCombination( "b", "c" ) ) ) {
+            if ( !shared_ni.contains( BasicBinaryDomainCombination.obtainInstance( "b", "c" ) ) ) {
                 return false;
             }
-            if ( !shared_ni.contains( new BasicBinaryDomainCombination( "f", "f" ) ) ) {
+            if ( !shared_ni.contains( BasicBinaryDomainCombination.obtainInstance( "f", "f" ) ) ) {
                 return false;
             }
-            if ( shared_ni.contains( new BasicBinaryDomainCombination( "m", "n" ) ) ) {
+            if ( shared_ni.contains( BasicBinaryDomainCombination.obtainInstance( "m", "n" ) ) ) {
                 return false;
             }
-            if ( shared_i.contains( new BasicBinaryDomainCombination( "a", "a" ) ) ) {
+            if ( shared_i.contains( BasicBinaryDomainCombination.obtainInstance( "a", "a" ) ) ) {
                 return false;
             }
-            if ( !shared_i.contains( new BasicBinaryDomainCombination( "a", "b" ) ) ) {
+            if ( !shared_i.contains( BasicBinaryDomainCombination.obtainInstance( "a", "b" ) ) ) {
                 return false;
             }
-            if ( !shared_i.contains( new BasicBinaryDomainCombination( "a", "c" ) ) ) {
+            if ( !shared_i.contains( BasicBinaryDomainCombination.obtainInstance( "a", "c" ) ) ) {
                 return false;
             }
-            if ( !shared_i.contains( new BasicBinaryDomainCombination( "b", "c" ) ) ) {
+            if ( !shared_i.contains( BasicBinaryDomainCombination.obtainInstance( "b", "c" ) ) ) {
                 return false;
             }
-            if ( shared_i.contains( new BasicBinaryDomainCombination( "f", "f" ) ) ) {
+            if ( shared_i.contains( BasicBinaryDomainCombination.obtainInstance( "f", "f" ) ) ) {
                 return false;
             }
-            if ( shared_i.contains( new BasicBinaryDomainCombination( "m", "n" ) ) ) {
+            if ( shared_i.contains( BasicBinaryDomainCombination.obtainInstance( "m", "n" ) ) ) {
                 return false;
             }
-            if ( !s_0_ni.contains( new BasicBinaryDomainCombination( "a", "d" ) ) ) {
+            if ( !s_0_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "d" ) ) ) {
                 return false;
             }
-            if ( !s_0_ni.contains( new BasicBinaryDomainCombination( "a", "e" ) ) ) {
+            if ( !s_0_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "e" ) ) ) {
                 return false;
             }
-            if ( !s_0_ni.contains( new BasicBinaryDomainCombination( "b", "d" ) ) ) {
+            if ( !s_0_ni.contains( BasicBinaryDomainCombination.obtainInstance( "b", "d" ) ) ) {
                 return false;
             }
-            if ( !s_0_ni.contains( new BasicBinaryDomainCombination( "b", "e" ) ) ) {
+            if ( !s_0_ni.contains( BasicBinaryDomainCombination.obtainInstance( "b", "e" ) ) ) {
                 return false;
             }
-            if ( !s_0_ni.contains( new BasicBinaryDomainCombination( "c", "d" ) ) ) {
+            if ( !s_0_ni.contains( BasicBinaryDomainCombination.obtainInstance( "c", "d" ) ) ) {
                 return false;
             }
-            if ( !s_0_ni.contains( new BasicBinaryDomainCombination( "c", "e" ) ) ) {
+            if ( !s_0_ni.contains( BasicBinaryDomainCombination.obtainInstance( "c", "e" ) ) ) {
                 return false;
             }
-            if ( !s_0_ni.contains( new BasicBinaryDomainCombination( "d", "e" ) ) ) {
+            if ( !s_0_ni.contains( BasicBinaryDomainCombination.obtainInstance( "d", "e" ) ) ) {
                 return false;
             }
-            if ( !s_0_ni.contains( new BasicBinaryDomainCombination( "e", "f" ) ) ) {
+            if ( !s_0_ni.contains( BasicBinaryDomainCombination.obtainInstance( "e", "f" ) ) ) {
                 return false;
             }
-            if ( !s_0_ni.contains( new BasicBinaryDomainCombination( "g", "h" ) ) ) {
+            if ( !s_0_ni.contains( BasicBinaryDomainCombination.obtainInstance( "g", "h" ) ) ) {
                 return false;
             }
-            if ( !s_0_ni.contains( new BasicBinaryDomainCombination( "e", "e" ) ) ) {
+            if ( !s_0_ni.contains( BasicBinaryDomainCombination.obtainInstance( "e", "e" ) ) ) {
                 return false;
             }
-            if ( !s_0_i.contains( new BasicBinaryDomainCombination( "a", "d" ) ) ) {
+            if ( !s_0_i.contains( BasicBinaryDomainCombination.obtainInstance( "a", "d" ) ) ) {
                 return false;
             }
-            if ( !s_0_i.contains( new BasicBinaryDomainCombination( "a", "e" ) ) ) {
+            if ( !s_0_i.contains( BasicBinaryDomainCombination.obtainInstance( "a", "e" ) ) ) {
                 return false;
             }
-            if ( !s_0_i.contains( new BasicBinaryDomainCombination( "b", "d" ) ) ) {
+            if ( !s_0_i.contains( BasicBinaryDomainCombination.obtainInstance( "b", "d" ) ) ) {
                 return false;
             }
-            if ( !s_0_i.contains( new BasicBinaryDomainCombination( "b", "e" ) ) ) {
+            if ( !s_0_i.contains( BasicBinaryDomainCombination.obtainInstance( "b", "e" ) ) ) {
                 return false;
             }
-            if ( !s_0_i.contains( new BasicBinaryDomainCombination( "c", "d" ) ) ) {
+            if ( !s_0_i.contains( BasicBinaryDomainCombination.obtainInstance( "c", "d" ) ) ) {
                 return false;
             }
-            if ( !s_0_i.contains( new BasicBinaryDomainCombination( "c", "e" ) ) ) {
+            if ( !s_0_i.contains( BasicBinaryDomainCombination.obtainInstance( "c", "e" ) ) ) {
                 return false;
             }
-            if ( !s_0_i.contains( new BasicBinaryDomainCombination( "d", "e" ) ) ) {
+            if ( !s_0_i.contains( BasicBinaryDomainCombination.obtainInstance( "d", "e" ) ) ) {
                 return false;
             }
-            if ( !s_0_i.contains( new BasicBinaryDomainCombination( "e", "f" ) ) ) {
+            if ( !s_0_i.contains( BasicBinaryDomainCombination.obtainInstance( "e", "f" ) ) ) {
                 return false;
             }
-            if ( !s_0_i.contains( new BasicBinaryDomainCombination( "g", "h" ) ) ) {
+            if ( !s_0_i.contains( BasicBinaryDomainCombination.obtainInstance( "g", "h" ) ) ) {
                 return false;
             }
-            if ( s_0_i.contains( new BasicBinaryDomainCombination( "e", "e" ) ) ) {
+            if ( s_0_i.contains( BasicBinaryDomainCombination.obtainInstance( "e", "e" ) ) ) {
                 return false;
             }
-            if ( !s_1_ni.contains( new BasicBinaryDomainCombination( "a", "i" ) ) ) {
+            if ( !s_1_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "i" ) ) ) {
                 return false;
             }
-            if ( !s_1_ni.contains( new BasicBinaryDomainCombination( "a", "l" ) ) ) {
+            if ( !s_1_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "l" ) ) ) {
                 return false;
             }
-            if ( !s_1_ni.contains( new BasicBinaryDomainCombination( "b", "i" ) ) ) {
+            if ( !s_1_ni.contains( BasicBinaryDomainCombination.obtainInstance( "b", "i" ) ) ) {
                 return false;
             }
-            if ( !s_1_ni.contains( new BasicBinaryDomainCombination( "b", "l" ) ) ) {
+            if ( !s_1_ni.contains( BasicBinaryDomainCombination.obtainInstance( "b", "l" ) ) ) {
                 return false;
             }
-            if ( !s_1_ni.contains( new BasicBinaryDomainCombination( "c", "i" ) ) ) {
+            if ( !s_1_ni.contains( BasicBinaryDomainCombination.obtainInstance( "c", "i" ) ) ) {
                 return false;
             }
-            if ( !s_1_ni.contains( new BasicBinaryDomainCombination( "c", "l" ) ) ) {
+            if ( !s_1_ni.contains( BasicBinaryDomainCombination.obtainInstance( "c", "l" ) ) ) {
                 return false;
             }
-            if ( !s_1_ni.contains( new BasicBinaryDomainCombination( "l", "i" ) ) ) {
+            if ( !s_1_ni.contains( BasicBinaryDomainCombination.obtainInstance( "l", "i" ) ) ) {
                 return false;
             }
-            if ( !s_1_ni.contains( new BasicBinaryDomainCombination( "i", "f" ) ) ) {
+            if ( !s_1_ni.contains( BasicBinaryDomainCombination.obtainInstance( "i", "f" ) ) ) {
                 return false;
             }
-            if ( !s_1_ni.contains( new BasicBinaryDomainCombination( "m", "n" ) ) ) {
+            if ( !s_1_ni.contains( BasicBinaryDomainCombination.obtainInstance( "m", "n" ) ) ) {
                 return false;
             }
-            if ( !s_1_ni.contains( new BasicBinaryDomainCombination( "j", "k" ) ) ) {
+            if ( !s_1_ni.contains( BasicBinaryDomainCombination.obtainInstance( "j", "k" ) ) ) {
                 return false;
             }
-            if ( s_1_ni.contains( new BasicBinaryDomainCombination( "a", "b" ) ) ) {
+            if ( s_1_ni.contains( BasicBinaryDomainCombination.obtainInstance( "a", "b" ) ) ) {
                 return false;
             }
-            if ( !s_1_i.contains( new BasicBinaryDomainCombination( "a", "i" ) ) ) {
+            if ( !s_1_i.contains( BasicBinaryDomainCombination.obtainInstance( "a", "i" ) ) ) {
                 return false;
             }
-            if ( !s_1_i.contains( new BasicBinaryDomainCombination( "a", "l" ) ) ) {
+            if ( !s_1_i.contains( BasicBinaryDomainCombination.obtainInstance( "a", "l" ) ) ) {
                 return false;
             }
-            if ( !s_1_i.contains( new BasicBinaryDomainCombination( "b", "i" ) ) ) {
+            if ( !s_1_i.contains( BasicBinaryDomainCombination.obtainInstance( "b", "i" ) ) ) {
                 return false;
             }
-            if ( !s_1_i.contains( new BasicBinaryDomainCombination( "b", "l" ) ) ) {
+            if ( !s_1_i.contains( BasicBinaryDomainCombination.obtainInstance( "b", "l" ) ) ) {
                 return false;
             }
-            if ( !s_1_i.contains( new BasicBinaryDomainCombination( "c", "i" ) ) ) {
+            if ( !s_1_i.contains( BasicBinaryDomainCombination.obtainInstance( "c", "i" ) ) ) {
                 return false;
             }
-            if ( !s_1_i.contains( new BasicBinaryDomainCombination( "c", "l" ) ) ) {
+            if ( !s_1_i.contains( BasicBinaryDomainCombination.obtainInstance( "c", "l" ) ) ) {
                 return false;
             }
-            if ( !s_1_i.contains( new BasicBinaryDomainCombination( "l", "i" ) ) ) {
+            if ( !s_1_i.contains( BasicBinaryDomainCombination.obtainInstance( "l", "i" ) ) ) {
                 return false;
             }
-            if ( !s_1_i.contains( new BasicBinaryDomainCombination( "i", "f" ) ) ) {
+            if ( !s_1_i.contains( BasicBinaryDomainCombination.obtainInstance( "i", "f" ) ) ) {
                 return false;
             }
-            if ( !s_1_i.contains( new BasicBinaryDomainCombination( "m", "n" ) ) ) {
+            if ( !s_1_i.contains( BasicBinaryDomainCombination.obtainInstance( "m", "n" ) ) ) {
                 return false;
             }
-            if ( !s_1_i.contains( new BasicBinaryDomainCombination( "j", "k" ) ) ) {
+            if ( !s_1_i.contains( BasicBinaryDomainCombination.obtainInstance( "j", "k" ) ) ) {
                 return false;
             }
-            if ( s_1_i.contains( new BasicBinaryDomainCombination( "a", "b" ) ) ) {
+            if ( s_1_i.contains( BasicBinaryDomainCombination.obtainInstance( "a", "b" ) ) ) {
                 return false;
             }
             if ( !isEqual( calc_ni.calculateSharedBinaryDomainCombinationBasedGenomeSimilarityScore(),
@@ -3186,36 +3206,43 @@ public class TestSurfacing {
                 return false;
             }
             if ( !calc_u.getBinaryDomainCombinationsSpecificToGenome0()
-                    .contains( new BasicBinaryDomainCombination( "v", "u" ) ) ) {
+                    .contains( BasicBinaryDomainCombination.obtainInstance( "v", "u" ) ) ) {
                 return false;
             }
             if ( !calc_u.getBinaryDomainCombinationsSpecificToGenome0()
-                    .contains( new BasicBinaryDomainCombination( "w", "v" ) ) ) {
+                    .contains( BasicBinaryDomainCombination.obtainInstance( "w", "v" ) ) ) {
                 return false;
             }
             if ( !calc_u.getBinaryDomainCombinationsSpecificToGenome0()
-                    .contains( new BasicBinaryDomainCombination( "w", "x" ) ) ) {
+                    .contains( BasicBinaryDomainCombination.obtainInstance( "w", "x" ) ) ) {
                 return false;
             }
-            if ( !calc_u.getSharedBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "w", "u" ) ) ) {
+            if ( !calc_u.getSharedBinaryDomainCombinations()
+                    .contains( BasicBinaryDomainCombination.obtainInstance( "w", "u" ) ) ) {
                 return false;
             }
-            if ( !calc_u.getSharedBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "z", "y" ) ) ) {
+            if ( !calc_u.getSharedBinaryDomainCombinations()
+                    .contains( BasicBinaryDomainCombination.obtainInstance( "z", "y" ) ) ) {
                 return false;
             }
-            if ( !calc_u.getAllBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "v", "u" ) ) ) {
+            if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "v",
+                                                                                                                 "u" ) ) ) {
                 return false;
             }
-            if ( !calc_u.getAllBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "w", "v" ) ) ) {
+            if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "w",
+                                                                                                                 "v" ) ) ) {
                 return false;
             }
-            if ( !calc_u.getAllBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "w", "x" ) ) ) {
+            if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "w",
+                                                                                                                 "x" ) ) ) {
                 return false;
             }
-            if ( !calc_u.getAllBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "w", "u" ) ) ) {
+            if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "w",
+                                                                                                                 "u" ) ) ) {
                 return false;
             }
-            if ( !calc_u.getAllBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "z", "y" ) ) ) {
+            if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "z",
+                                                                                                                 "y" ) ) ) {
                 return false;
             }
             calc_u.setAllowDomainsToBeIgnored( true );
@@ -3286,36 +3313,43 @@ public class TestSurfacing {
                 return false;
             }
             if ( calc_u.getBinaryDomainCombinationsSpecificToGenome0()
-                    .contains( new BasicBinaryDomainCombination( "v", "u" ) ) ) {
+                    .contains( BasicBinaryDomainCombination.obtainInstance( "v", "u" ) ) ) {
                 return false;
             }
             if ( !calc_u.getBinaryDomainCombinationsSpecificToGenome0()
-                    .contains( new BasicBinaryDomainCombination( "w", "v" ) ) ) {
+                    .contains( BasicBinaryDomainCombination.obtainInstance( "w", "v" ) ) ) {
                 return false;
             }
             if ( !calc_u.getBinaryDomainCombinationsSpecificToGenome0()
-                    .contains( new BasicBinaryDomainCombination( "w", "x" ) ) ) {
+                    .contains( BasicBinaryDomainCombination.obtainInstance( "w", "x" ) ) ) {
                 return false;
             }
-            if ( calc_u.getSharedBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "w", "u" ) ) ) {
+            if ( calc_u.getSharedBinaryDomainCombinations()
+                    .contains( BasicBinaryDomainCombination.obtainInstance( "w", "u" ) ) ) {
                 return false;
             }
-            if ( !calc_u.getSharedBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "z", "y" ) ) ) {
+            if ( !calc_u.getSharedBinaryDomainCombinations()
+                    .contains( BasicBinaryDomainCombination.obtainInstance( "z", "y" ) ) ) {
                 return false;
             }
-            if ( calc_u.getAllBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "v", "u" ) ) ) {
+            if ( calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "v",
+                                                                                                                "u" ) ) ) {
                 return false;
             }
-            if ( !calc_u.getAllBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "w", "v" ) ) ) {
+            if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "w",
+                                                                                                                 "v" ) ) ) {
                 return false;
             }
-            if ( !calc_u.getAllBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "w", "x" ) ) ) {
+            if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "w",
+                                                                                                                 "x" ) ) ) {
                 return false;
             }
-            if ( calc_u.getAllBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "w", "u" ) ) ) {
+            if ( calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "w",
+                                                                                                                "u" ) ) ) {
                 return false;
             }
-            if ( !calc_u.getAllBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "z", "y" ) ) ) {
+            if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "z",
+                                                                                                                 "y" ) ) ) {
                 return false;
             }
             calc_u.setAllowDomainsToBeIgnored( false );
@@ -3392,10 +3426,12 @@ public class TestSurfacing {
             if ( calc_u.getAllBinaryDomainCombinations().size() != 1 ) {
                 return false;
             }
-            if ( !calc_u.getSharedBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "y", "z" ) ) ) {
+            if ( !calc_u.getSharedBinaryDomainCombinations()
+                    .contains( BasicBinaryDomainCombination.obtainInstance( "y", "z" ) ) ) {
                 return false;
             }
-            if ( !calc_u.getAllBinaryDomainCombinations().contains( new BasicBinaryDomainCombination( "z", "y" ) ) ) {
+            if ( !calc_u.getAllBinaryDomainCombinations().contains( BasicBinaryDomainCombination.obtainInstance( "z",
+                                                                                                                 "y" ) ) ) {
                 return false;
             }
             if ( !isEqual( calc_u.calculateSharedBinaryDomainCombinationBasedGenomeSimilarityScore(),
@@ -4378,128 +4414,128 @@ public class TestSurfacing {
             if ( bc0.size() != 15 ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "a", "a" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "a", "a" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "a", "b" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "a", "b" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "b", "a" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "b", "a" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "a", "c" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "a", "c" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "a", "d" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "a", "d" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "a", "e" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "a", "e" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "b", "c" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "b", "c" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "b", "d" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "b", "d" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "b", "e" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "b", "e" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "c", "d" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "c", "d" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "c", "e" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "c", "e" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "d", "e" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "d", "e" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "e", "f" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "e", "f" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "e", "e" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "e", "e" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "f", "f" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "f", "f" ) ) ) {
                 return false;
             }
-            if ( !bc0.contains( new BasicBinaryDomainCombination( "g", "h" ) ) ) {
+            if ( !bc0.contains( BasicBinaryDomainCombination.obtainInstance( "g", "h" ) ) ) {
                 return false;
             }
-            if ( bc0.contains( new BasicBinaryDomainCombination( "f", "a" ) ) ) {
+            if ( bc0.contains( BasicBinaryDomainCombination.obtainInstance( "f", "a" ) ) ) {
                 return false;
             }
-            if ( bc0.contains( new BasicBinaryDomainCombination( "f", "b" ) ) ) {
+            if ( bc0.contains( BasicBinaryDomainCombination.obtainInstance( "f", "b" ) ) ) {
                 return false;
             }
-            if ( bc0.contains( new BasicBinaryDomainCombination( "a", "h" ) ) ) {
+            if ( bc0.contains( BasicBinaryDomainCombination.obtainInstance( "a", "h" ) ) ) {
                 return false;
             }
-            if ( bc0.contains( new BasicBinaryDomainCombination( "a", "g" ) ) ) {
+            if ( bc0.contains( BasicBinaryDomainCombination.obtainInstance( "a", "g" ) ) ) {
                 return false;
             }
             final SortedSet<BinaryDomainCombination> bc1 = eel_ignore.toBinaryDomainCombinations();
             if ( bc1.size() != 12 ) {
                 return false;
             }
-            if ( bc1.contains( new BasicBinaryDomainCombination( "a", "a" ) ) ) {
+            if ( bc1.contains( BasicBinaryDomainCombination.obtainInstance( "a", "a" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "a", "b" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "a", "b" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "b", "a" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "b", "a" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "a", "c" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "a", "c" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "a", "d" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "a", "d" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "a", "e" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "a", "e" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "b", "c" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "b", "c" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "b", "d" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "b", "d" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "b", "e" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "b", "e" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "c", "d" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "c", "d" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "c", "e" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "c", "e" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "d", "e" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "d", "e" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "e", "f" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "e", "f" ) ) ) {
                 return false;
             }
-            if ( !bc1.contains( new BasicBinaryDomainCombination( "g", "h" ) ) ) {
+            if ( !bc1.contains( BasicBinaryDomainCombination.obtainInstance( "g", "h" ) ) ) {
                 return false;
             }
-            if ( bc1.contains( new BasicBinaryDomainCombination( "e", "e" ) ) ) {
+            if ( bc1.contains( BasicBinaryDomainCombination.obtainInstance( "e", "e" ) ) ) {
                 return false;
             }
-            if ( bc1.contains( new BasicBinaryDomainCombination( "f", "f" ) ) ) {
+            if ( bc1.contains( BasicBinaryDomainCombination.obtainInstance( "f", "f" ) ) ) {
                 return false;
             }
-            if ( bc1.contains( new BasicBinaryDomainCombination( "f", "a" ) ) ) {
+            if ( bc1.contains( BasicBinaryDomainCombination.obtainInstance( "f", "a" ) ) ) {
                 return false;
             }
-            if ( bc1.contains( new BasicBinaryDomainCombination( "f", "b" ) ) ) {
+            if ( bc1.contains( BasicBinaryDomainCombination.obtainInstance( "f", "b" ) ) ) {
                 return false;
             }
-            if ( bc1.contains( new BasicBinaryDomainCombination( "a", "g" ) ) ) {
+            if ( bc1.contains( BasicBinaryDomainCombination.obtainInstance( "a", "g" ) ) ) {
                 return false;
             }
-            if ( bc1.contains( new BasicBinaryDomainCombination( "b", "g" ) ) ) {
+            if ( bc1.contains( BasicBinaryDomainCombination.obtainInstance( "b", "g" ) ) ) {
                 return false;
             }
         }
@@ -4590,12 +4626,6 @@ public class TestSurfacing {
             if ( uba_domain.getTo() != 57 ) {
                 return false;
             }
-            if ( !Test.isEqual( uba_domain.getPerSequenceEvalue(), 0.00084 ) ) {
-                return false;
-            }
-            if ( !Test.isEqual( uba_domain.getPerSequenceScore(), 23.2 ) ) {
-                return false;
-            }
             final HmmPfamOutputParser parser2 = new HmmPfamOutputParser( new File( test_dir
                     + ForesterUtil.getFileSeparator() + "hmmpfam_output_short" ), "human", "ls" );
             parser2.setEValueMaximum( 0.2 );
@@ -4677,9 +4707,6 @@ public class TestSurfacing {
             if ( uba_domain2.getTo() != 57 ) {
                 return false;
             }
-            if ( !Test.isEqual( uba_domain2.getPerSequenceEvalue(), 0.00084 ) ) {
-                return false;
-            }
         }
         catch ( final Exception e ) {
             e.printStackTrace( System.out );
@@ -4709,7 +4736,6 @@ public class TestSurfacing {
             filter.add( "strange" );
             parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ),
                                               "human",
-                                              "ls",
                                               filter,
                                               HmmPfamOutputParser.FilterType.NEGATIVE_PROTEIN );
             parser.setEValueMaximum( 0.2 );
@@ -4729,7 +4755,6 @@ public class TestSurfacing {
             filter.add( "strange" );
             parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ),
                                               "human",
-                                              "ls",
                                               filter,
                                               HmmPfamOutputParser.FilterType.POSITIVE_PROTEIN );
             parser.setEValueMaximum( 0.2 );
@@ -4750,7 +4775,6 @@ public class TestSurfacing {
             filter.add( "C" );
             parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ),
                                               "human",
-                                              "ls",
                                               filter,
                                               HmmPfamOutputParser.FilterType.POSITIVE_PROTEIN );
             parser.setEValueMaximum( 0.2 );
@@ -4772,7 +4796,6 @@ public class TestSurfacing {
             filter.add( "X" );
             parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ),
                                               "human",
-                                              "ls",
                                               filter,
                                               HmmPfamOutputParser.FilterType.NEGATIVE_DOMAIN );
             parser.setEValueMaximum( 0.2 );
@@ -4793,7 +4816,6 @@ public class TestSurfacing {
             filter.add( "C" );
             parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ),
                                               "human",
-                                              "ls",
                                               filter,
                                               HmmPfamOutputParser.FilterType.NEGATIVE_PROTEIN );
             parser.setEValueMaximum( 0.2 );
@@ -4812,7 +4834,6 @@ public class TestSurfacing {
             filter.add( "UIM" );
             parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ),
                                               "human",
-                                              "ls",
                                               filter,
                                               HmmPfamOutputParser.FilterType.NEGATIVE_PROTEIN );
             parser.setEValueMaximum( 0.2 );
@@ -4834,7 +4855,6 @@ public class TestSurfacing {
             filter.add( "UIM" );
             parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ),
                                               "human",
-                                              "ls",
                                               filter,
                                               HmmPfamOutputParser.FilterType.POSITIVE_PROTEIN );
             parser.setEValueMaximum( 0.2 );
@@ -4857,7 +4877,6 @@ public class TestSurfacing {
             filter.add( "C" );
             parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ),
                                               "human",
-                                              "ls",
                                               filter,
                                               HmmPfamOutputParser.FilterType.POSITIVE_PROTEIN );
             parser.setEValueMaximum( 0.2 );
index b1a9cd1..cd648f8 100644 (file)
@@ -175,8 +175,8 @@ public final class Test {
             if ( ForesterUtil.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 Domain a = new BasicDomain( "a", ( short ) 2, ( short ) 5, ( short ) 1, ( short ) 1, 1, -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", 0 );
             ab.addProteinDomain( a );
             ab.addProteinDomain( b );
@@ -187,7 +187,7 @@ public final class Test {
             if ( ab_s0.getNumberOfProteinDomains() != 1 ) {
                 return false;
             }
-            if ( !ab_s0.getProteinDomain( 0 ).getDomainId().equals( "a" ) ) {
+            if ( !ab_s0.getProteinDomain( 0 ).getDomainId().equals( "b" ) ) {
                 return false;
             }
             final Protein ab_s1 = ForesterUtil.removeOverlappingDomains( 4, false, ab );
@@ -5103,7 +5103,10 @@ public final class Test {
             if ( parser2.getDomainsIgnoredDueToDuf() != 0 ) {
                 return false;
             }
-            if ( parser2.getDomainsIgnoredDueToEval() != 0 ) {
+            if ( parser2.getDomainsIgnoredDueToFsEval() != 0 ) {
+                return false;
+            }
+            if ( parser2.getDomainsIgnoredDueToIEval() != 0 ) {
                 return false;
             }
             final Protein p1 = proteins.get( 0 );
@@ -5143,12 +5146,6 @@ public final class Test {
             if ( !Test.isEqual( p4.getProteinDomain( 0 ).getPerDomainScore(), 135.7 ) ) {
                 return false;
             }
-            if ( !Test.isEqual( p4.getProteinDomain( 0 ).getPerSequenceEvalue(), 8.3e-40 ) ) {
-                return false;
-            }
-            if ( !Test.isEqual( p4.getProteinDomain( 0 ).getPerSequenceScore(), 136.3 ) ) {
-                return false;
-            }
             if ( !Test.isEqual( p4.getProteinDomain( 0 ).getNumber(), 1 ) ) {
                 return false;
             }