From: cmzmasek@gmail.com Date: Tue, 2 Jul 2013 02:09:51 +0000 (+0000) Subject: inprogress X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=87d34f343d0262cd0c009c6f1da058a5a217bc64;p=jalview.git inprogress --- diff --git a/forester/java/src/org/forester/application/pfam2go_extractor.java b/forester/java/src/org/forester/application/pfam2go_extractor.java index d9f4cd3..6852d05 100644 --- a/forester/java/src/org/forester/application/pfam2go_extractor.java +++ b/forester/java/src/org/forester/application/pfam2go_extractor.java @@ -39,7 +39,6 @@ import org.forester.go.GoUtils; import org.forester.go.OBOparser; import org.forester.go.PfamToGoMapping; import org.forester.go.PfamToGoParser; -import org.forester.protein.DomainId; public class pfam2go_extractor { @@ -79,7 +78,7 @@ public class pfam2go_extractor { } final SortedSet pfams = new TreeSet(); for( final PfamToGoMapping pfam_to_go_mapping : pfam2go ) { - final DomainId domain_id = pfam_to_go_mapping.getKey(); + final String domain_id = pfam_to_go_mapping.getKey(); final GoId go_id = pfam_to_go_mapping.getValue(); final Set supers = GoUtils.getAllSuperGoIds( go_id, goid_to_term_map ); supers.add( go_id ); diff --git a/forester/java/src/org/forester/application/pfam_go.java b/forester/java/src/org/forester/application/pfam_go.java index 475b5d4..0da8a2d 100644 --- a/forester/java/src/org/forester/application/pfam_go.java +++ b/forester/java/src/org/forester/application/pfam_go.java @@ -78,7 +78,7 @@ public class pfam_go { encountered_domains.add( line ); boolean found = false; for( final PfamToGoMapping mapping : mappings ) { - if ( mapping.getKey().getId().equals( line ) ) { + if ( mapping.getKey().equals( line ) ) { System.out.println( mapping.getValue() ); found = true; } diff --git a/forester/java/src/org/forester/application/pfamacc2go.java b/forester/java/src/org/forester/application/pfamacc2go.java index ce34dc7..82ff0b8 100644 --- a/forester/java/src/org/forester/application/pfamacc2go.java +++ b/forester/java/src/org/forester/application/pfamacc2go.java @@ -82,7 +82,7 @@ public class pfamacc2go { total_pfam_ids++; boolean mapped = false; for( final PfamToGoMapping pfam_to_go_mapping : pfam2go ) { - if ( pfam_to_go_mapping.getKey().getId().equals( pfam_id ) ) { + if ( pfam_to_go_mapping.getKey().equals( pfam_id ) ) { mapped = true; System.out.println( pfam_to_go_mapping.getValue().toString() ); } diff --git a/forester/java/src/org/forester/application/surfacing.java b/forester/java/src/org/forester/application/surfacing.java index dbba361..d83fdf7 100644 --- a/forester/java/src/org/forester/application/surfacing.java +++ b/forester/java/src/org/forester/application/surfacing.java @@ -63,7 +63,6 @@ import org.forester.phylogeny.factories.ParserBasedPhylogenyFactory; import org.forester.phylogeny.iterators.PhylogenyNodeIterator; import org.forester.protein.BinaryDomainCombination; import org.forester.protein.Domain; -import org.forester.protein.DomainId; import org.forester.protein.Protein; import org.forester.species.BasicSpecies; import org.forester.species.Species; @@ -229,8 +228,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.270"; - final static private String PRG_DATE = "130628"; + final static private String PRG_VERSION = "2.280"; + final static private String PRG_DATE = "130701"; final static private String E_MAIL = "czmasek@burnham.org"; final static private String WWW = "www.phylosoft.org/forester/applications/surfacing"; final static private boolean IGNORE_DUFS_DEFAULT = true; @@ -369,8 +368,8 @@ public class surfacing { final Writer out = ForesterUtil.createBufferedWriter( output_file ); final SortedMap bdc_to_counts = ForesterUtil .listToSortedCountsMap( all_bin_domain_combinations_changed ); - final SortedSet all_domains_in_combination_changed_more_than_once = new TreeSet(); - final SortedSet all_domains_in_combination_changed_only_once = new TreeSet(); + final SortedSet all_domains_in_combination_changed_more_than_once = new TreeSet(); + final SortedSet all_domains_in_combination_changed_only_once = new TreeSet(); int above_one = 0; int one = 0; for( final Object bdc_object : bdc_to_counts.keySet() ) { @@ -438,7 +437,7 @@ public class surfacing { final List plus_minus_analysis_low_copy, final List gwcd_list, final SortedMap> protein_lists_per_species, - final Map> domain_id_to_go_ids_map, + final Map> domain_id_to_go_ids_map, final Map go_id_to_term_map, final List plus_minus_analysis_numbers ) { final Set all_spec = new HashSet(); @@ -1048,7 +1047,7 @@ public class surfacing { SurfacingUtil.checkForOutputFileWriteability( dcc_outfile ); } File pfam_to_go_file = null; - Map> domain_id_to_go_ids_map = null; + Map> domain_id_to_go_ids_map = null; int domain_id_to_go_ids_count = 0; if ( cla.isOptionSet( surfacing.PFAM_TO_GO_FILE_USE_OPTION ) ) { if ( !cla.isOptionValueSet( surfacing.PFAM_TO_GO_FILE_USE_OPTION ) ) { @@ -1237,10 +1236,10 @@ public class surfacing { } radomize_fitch_parsimony = true; } - SortedSet filter = null; + SortedSet filter = null; if ( ( positive_filter_file != null ) || ( negative_filter_file != null ) || ( negative_domains_filter_file != null ) ) { - filter = new TreeSet(); + filter = new TreeSet(); if ( positive_filter_file != null ) { processFilter( positive_filter_file, filter ); } @@ -1251,7 +1250,7 @@ public class surfacing { processFilter( negative_domains_filter_file, filter ); } } - Map>[] domain_id_to_secondary_features_maps = null; + Map>[] domain_id_to_secondary_features_maps = null; File[] secondary_features_map_files = null; final File domain_lengths_analysis_outfile = new File( out_dir + ForesterUtil.FILE_SEPARATOR + output_file + DOMAIN_LENGTHS_ANALYSIS_SUFFIX ); @@ -1606,8 +1605,8 @@ public class surfacing { if ( VERBOSE ) { System.out.println(); System.out.println( "Domain ids to secondary features map:" ); - for( final DomainId domain_id : domain_id_to_secondary_features_maps[ i ].keySet() ) { - System.out.print( domain_id.getId() ); + for( final String domain_id : domain_id_to_secondary_features_maps[ i ].keySet() ) { + System.out.print( domain_id ); System.out.print( " => " ); for( final String sec : domain_id_to_secondary_features_maps[ i ].get( domain_id ) ) { System.out.print( sec ); @@ -1623,7 +1622,7 @@ public class surfacing { html_desc.append( "Command line:\n" + cla.getCommandLineArgsAsString() + "\n" + nl ); System.out.println( "Command line : " + cla.getCommandLineArgsAsString() ); BufferedWriter[] query_domains_writer_ary = null; - List[] query_domain_ids_array = null; + List[] query_domain_ids_array = null; if ( query_domain_ids != null ) { final String[] query_domain_ids_str_array = query_domain_ids.split( "#" ); query_domain_ids_array = new ArrayList[ query_domain_ids_str_array.length ]; @@ -1631,9 +1630,9 @@ public class surfacing { for( int i = 0; i < query_domain_ids_str_array.length; i++ ) { String query_domain_ids_str = query_domain_ids_str_array[ i ]; final String[] query_domain_ids_str_ary = query_domain_ids_str.split( "~" ); - final List query = new ArrayList(); + final List query = new ArrayList(); for( final String element : query_domain_ids_str_ary ) { - query.add( new DomainId( element ) ); + query.add( element ); } query_domain_ids_array[ i ] = query; query_domain_ids_str = query_domain_ids_str.replace( '~', '_' ); @@ -1659,7 +1658,7 @@ public class surfacing { protein_lists_per_species = new TreeMap>(); } final List gwcd_list = new ArrayList( number_of_genomes ); - final SortedSet all_domains_encountered = new TreeSet(); + final SortedSet all_domains_encountered = new TreeSet(); final SortedSet all_bin_domain_combinations_encountered = new TreeSet(); List all_bin_domain_combinations_gained_fitch = null; List all_bin_domain_combinations_lost_fitch = null; @@ -2283,7 +2282,7 @@ public class surfacing { if ( ( domain_id_to_secondary_features_maps != null ) && ( domain_id_to_secondary_features_maps.length > 0 ) ) { int j = 0; - for( final Map> domain_id_to_secondary_features_map : domain_id_to_secondary_features_maps ) { + for( final Map> domain_id_to_secondary_features_map : domain_id_to_secondary_features_maps ) { final Map mapping_results_map = new TreeMap(); final DomainParsimonyCalculator secondary_features_parsimony = DomainParsimonyCalculator .createInstance( intree, gwcd_list, domain_id_to_secondary_features_map ); @@ -2604,7 +2603,7 @@ public class surfacing { System.out.println(); } - private static void processFilter( final File filter_file, final SortedSet filter ) { + private static void processFilter( final File filter_file, final SortedSet filter ) { SortedSet filter_str = null; try { filter_str = ForesterUtil.file2set( filter_file ); @@ -2614,13 +2613,13 @@ public class surfacing { } if ( filter_str != null ) { for( final String string : filter_str ) { - filter.add( new DomainId( string ) ); + filter.add( string ); } } if ( VERBOSE ) { System.out.println( "Filter:" ); - for( final DomainId domainId : filter ) { - System.out.println( domainId.getId() ); + for( final String domainId : filter ) { + System.out.println( domainId ); } } } @@ -2760,7 +2759,7 @@ public class surfacing { private static void writePresentToNexus( final File output_file, final File positive_filter_file, - final SortedSet filter, + final SortedSet filter, final List gwcd_list ) { try { SurfacingUtil @@ -2780,11 +2779,11 @@ public class surfacing { final SortedMap> protein_lists_per_species, final List gwcd_list, final double domain_e_cutoff ) { - final SortedSet all_domains = new TreeSet(); + final SortedSet all_domains = new TreeSet(); for( final GenomeWideCombinableDomains gwcd : gwcd_list ) { all_domains.addAll( gwcd.getAllDomainIds() ); } - for( final DomainId domain : all_domains ) { + for( final String domain : all_domains ) { final File out = new File( output_dir + ForesterUtil.FILE_SEPARATOR + domain + SEQ_EXTRACT_SUFFIX ); SurfacingUtil.checkForOutputFileWriteability( out ); try { diff --git a/forester/java/src/org/forester/go/PfamToGoMapping.java b/forester/java/src/org/forester/go/PfamToGoMapping.java index e11fde1..33815ab 100644 --- a/forester/java/src/org/forester/go/PfamToGoMapping.java +++ b/forester/java/src/org/forester/go/PfamToGoMapping.java @@ -25,14 +25,12 @@ package org.forester.go; -import org.forester.protein.DomainId; - public class PfamToGoMapping implements Mapping { - private final DomainId _pfam_domain_id; - private final GoId _go_id; + private final String _pfam_domain_id; + private final GoId _go_id; - public PfamToGoMapping( final DomainId pfam_domain_id, final GoId go_id ) { + public PfamToGoMapping( final String pfam_domain_id, final GoId go_id ) { _pfam_domain_id = pfam_domain_id; _go_id = go_id; } @@ -42,7 +40,7 @@ public class PfamToGoMapping implements Mapping { if ( this == m ) { return 0; } - return getKey().compareTo( ( DomainId ) m.getKey() ); + return getKey().compareTo( ( String ) m.getKey() ); } /** @@ -69,7 +67,7 @@ public class PfamToGoMapping implements Mapping { } @Override - public DomainId getKey() { + public String getKey() { return _pfam_domain_id; } diff --git a/forester/java/src/org/forester/go/PfamToGoParser.java b/forester/java/src/org/forester/go/PfamToGoParser.java index 8840b96..ca55c12 100644 --- a/forester/java/src/org/forester/go/PfamToGoParser.java +++ b/forester/java/src/org/forester/go/PfamToGoParser.java @@ -10,7 +10,6 @@ import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.forester.protein.DomainId; import org.forester.util.ForesterUtil; public class PfamToGoParser { @@ -78,7 +77,7 @@ public class PfamToGoParser { if ( ForesterUtil.isEmpty( pfam ) || ForesterUtil.isEmpty( go ) ) { throw new IOException( "unexpected format [\"" + line + "\"]" ); } - final PfamToGoMapping map = new PfamToGoMapping( new DomainId( pfam ), new GoId( go ) ); + final PfamToGoMapping map = new PfamToGoMapping( pfam, new GoId( go ) ); ++_mapping_count; mappings.add( map ); } diff --git a/forester/java/src/org/forester/go/TestGo.java b/forester/java/src/org/forester/go/TestGo.java index f8197ee..9d5f0c7 100644 --- a/forester/java/src/org/forester/go/TestGo.java +++ b/forester/java/src/org/forester/go/TestGo.java @@ -31,7 +31,6 @@ import java.util.List; import java.util.Map; import java.util.SortedSet; -import org.forester.protein.DomainId; import org.forester.util.ForesterUtil; public class TestGo { @@ -356,11 +355,11 @@ public class TestGo { private static boolean testPfamToGoMapping() { try { - final PfamToGoMapping pg0 = new PfamToGoMapping( new DomainId( "A" ), new GoId( "GO:0000001" ) ); - final PfamToGoMapping pg1 = new PfamToGoMapping( new DomainId( "A" ), new GoId( "GO:0000001" ) ); - final PfamToGoMapping pg2 = new PfamToGoMapping( new DomainId( "B" ), new GoId( "GO:0000001" ) ); - final PfamToGoMapping pg3 = new PfamToGoMapping( new DomainId( "A" ), new GoId( "GO:0000002" ) ); - final PfamToGoMapping pg4 = new PfamToGoMapping( new DomainId( "B" ), new GoId( "GO:0000002" ) ); + final PfamToGoMapping pg0 = new PfamToGoMapping( "A", new GoId( "GO:0000001" ) ); + final PfamToGoMapping pg1 = new PfamToGoMapping( "A", new GoId( "GO:0000001" ) ); + final PfamToGoMapping pg2 = new PfamToGoMapping( "B", new GoId( "GO:0000001" ) ); + final PfamToGoMapping pg3 = new PfamToGoMapping( "A", new GoId( "GO:0000002" ) ); + final PfamToGoMapping pg4 = new PfamToGoMapping( "B", new GoId( "GO:0000002" ) ); if ( !pg0.equals( pg0 ) ) { return false; } @@ -412,55 +411,55 @@ public class TestGo { final PfamToGoMapping m5 = mappings.get( 5 ); final PfamToGoMapping m424 = mappings.get( 424 ); final PfamToGoMapping m425 = mappings.get( 425 ); - if ( !m0.getKey().equals( new DomainId( "7tm_1" ) ) ) { + if ( !m0.getKey().equals( "7tm_1" ) ) { return false; } if ( !m0.getValue().equals( new GoId( "GO:0001584" ) ) ) { return false; } - if ( m0.getKey().equals( new DomainId( "7tm_x" ) ) ) { + if ( m0.getKey().equals( "7tm_x" ) ) { return false; } if ( m0.getValue().equals( new GoId( "GO:0001585" ) ) ) { return false; } - if ( !m1.getKey().equals( new DomainId( "7tm_1" ) ) ) { + if ( !m1.getKey().equals( "7tm_1" ) ) { return false; } if ( !m1.getValue().equals( new GoId( "GO:0007186" ) ) ) { return false; } - if ( !m2.getKey().equals( new DomainId( "7tm_1" ) ) ) { + if ( !m2.getKey().equals( "7tm_1" ) ) { return false; } if ( !m2.getValue().equals( new GoId( "GO:0016021" ) ) ) { return false; } - if ( !m3.getKey().equals( new DomainId( "7tm_2" ) ) ) { + if ( !m3.getKey().equals( "7tm_2" ) ) { return false; } if ( !m3.getValue().equals( new GoId( "GO:0004930" ) ) ) { return false; } - if ( !m4.getKey().equals( new DomainId( "7tm_2" ) ) ) { + if ( !m4.getKey().equals( "7tm_2" ) ) { return false; } if ( !m4.getValue().equals( new GoId( "GO:0016020" ) ) ) { return false; } - if ( !m5.getKey().equals( new DomainId( "7tm_3" ) ) ) { + if ( !m5.getKey().equals( "7tm_3" ) ) { return false; } if ( !m5.getValue().equals( new GoId( "GO:0008067" ) ) ) { return false; } - if ( !m424.getKey().equals( new DomainId( "OMPdecase" ) ) ) { + if ( !m424.getKey().equals( "OMPdecase" ) ) { return false; } if ( !m424.getValue().equals( new GoId( "GO:0006207" ) ) ) { return false; } - if ( !m425.getKey().equals( new DomainId( "Bac_DNA_binding" ) ) ) { + if ( !m425.getKey().equals( "Bac_DNA_binding" ) ) { return false; } if ( !m425.getValue().equals( new GoId( "GO:0003677" ) ) ) { diff --git a/forester/java/src/org/forester/go/etc/MetaOntologizer.java b/forester/java/src/org/forester/go/etc/MetaOntologizer.java index 32f841d..98bf943 100644 --- a/forester/java/src/org/forester/go/etc/MetaOntologizer.java +++ b/forester/java/src/org/forester/go/etc/MetaOntologizer.java @@ -51,7 +51,6 @@ import org.forester.go.GoTerm; import org.forester.go.GoUtils; import org.forester.go.OBOparser; import org.forester.go.PfamToGoMapping; -import org.forester.protein.DomainId; import org.forester.species.BasicSpecies; import org.forester.species.Species; import org.forester.surfacing.SurfacingConstants; @@ -85,12 +84,12 @@ public class MetaOntologizer { } private static StringBuilder obtainDomainsForGoId( final List pfam_to_go, - final SortedSet domains_per_species, + final SortedSet domains_per_species, final Map all_go_terms, final GoId query_go_id, - final Set found_domain_ids ) { + final Set found_domain_ids ) { final StringBuilder sb = new StringBuilder(); - D: for( final DomainId domain_id : domains_per_species ) { + D: for( final String domain_id : domains_per_species ) { for( final PfamToGoMapping ptg : pfam_to_go ) { if ( ptg.getKey().equals( domain_id ) ) { final GoId go_id = ptg.getValue(); @@ -128,13 +127,12 @@ public class MetaOntologizer { return species; } - private static SortedMap> parseDomainGainLossFile( final File input ) - throws IOException { + private static SortedMap> parseDomainGainLossFile( final File input ) throws IOException { final String error = ForesterUtil.isReadableFile( input ); if ( !ForesterUtil.isEmpty( error ) ) { throw new IOException( error ); } - final SortedMap> speciesto_to_domain_id = new TreeMap>(); + final SortedMap> speciesto_to_domain_id = new TreeMap>(); final BufferedReader br = new BufferedReader( new FileReader( input ) ); String line; int line_number = 0; @@ -148,7 +146,7 @@ public class MetaOntologizer { } else if ( line.startsWith( "#" ) ) { current_species = new BasicSpecies( line.substring( 1 ) ); - speciesto_to_domain_id.put( current_species, new TreeSet() ); + speciesto_to_domain_id.put( current_species, new TreeSet() ); if ( VERBOSE ) { ForesterUtil.programMessage( PRG_NAME, "saw " + current_species ); } @@ -157,7 +155,7 @@ public class MetaOntologizer { if ( current_species == null ) { throw new IOException( "parsing problem [at line " + line_number + "] in [" + input + "]" ); } - speciesto_to_domain_id.get( current_species ).add( new DomainId( line ) ); + speciesto_to_domain_id.get( current_species ).add( new String( line ) ); } } } @@ -178,9 +176,9 @@ public class MetaOntologizer { final SortedMap> species_to_results_map, final String species, final double p_adjusted_upper_limit, - final SortedSet domains_per_species, + final SortedSet domains_per_species, final List pfam_to_go, - final Set domain_ids_with_go_annot ) throws IOException { + final Set domain_ids_with_go_annot ) throws IOException { final SortedSet ontologizer_results = species_to_results_map.get( species ); for( final OntologizerResult ontologizer_result : ontologizer_results ) { final GoTerm go_term = go_id_to_terms.get( ontologizer_result.getGoId() ); @@ -230,7 +228,7 @@ public class MetaOntologizer { throw new IllegalArgumentException( "adjusted P values limit [" + p_adjusted_upper_limit + "] is out of range" ); } - SortedMap> speciesto_to_domain_id = null; + SortedMap> speciesto_to_domain_id = null; if ( domain_gain_loss_file != null ) { if ( !domain_gain_loss_file.exists() ) { throw new IllegalArgumentException( "[" + domain_gain_loss_file + "] does not exist" ); @@ -333,11 +331,11 @@ public class MetaOntologizer { GoNameSpace.GoNamespaceType.MOLECULAR_FUNCTION ) ) { writeHtmlSpecies( m_html_writer, species ); } - SortedSet domains_per_species = null; + SortedSet domains_per_species = null; if ( ( speciesto_to_domain_id != null ) && ( speciesto_to_domain_id.size() > 0 ) ) { domains_per_species = speciesto_to_domain_id.get( new BasicSpecies( species ) ); } - final Set domain_ids_with_go_annot = new HashSet(); + final Set domain_ids_with_go_annot = new HashSet(); processOneSpecies( go_id_to_terms, b_html_writer, b_tab_writer, @@ -398,12 +396,12 @@ public class MetaOntologizer { } private static void writeHtmlDomains( final Writer writer, - final SortedSet domains, - final Set domain_ids_with_go_annot ) throws IOException { + final SortedSet domains, + final Set domain_ids_with_go_annot ) throws IOException { writer.write( "" ); writer.write( "" ); if ( domains != null ) { - for( final DomainId domain : domains ) { + for( final String domain : domains ) { if ( !domain_ids_with_go_annot.contains( domain ) ) { writer.write( "[" + domain + "] " ); @@ -555,9 +553,9 @@ public class MetaOntologizer { final double p_adjusted_upper_limit, final String species, final Map go_id_to_terms, - final SortedSet domains_per_species, + final SortedSet domains_per_species, final List pfam_to_go, - final Set domain_ids_with_go_annot ) throws IOException { + final Set domain_ids_with_go_annot ) throws IOException { final Color p_adj_color = ForesterUtil.calcColor( ontologizer_result.getPAdjusted(), 0, p_adjusted_upper_limit, diff --git a/forester/java/src/org/forester/io/parsers/HmmPfamOutputParser.java b/forester/java/src/org/forester/io/parsers/HmmPfamOutputParser.java index 090a052..2fae940 100644 --- a/forester/java/src/org/forester/io/parsers/HmmPfamOutputParser.java +++ b/forester/java/src/org/forester/io/parsers/HmmPfamOutputParser.java @@ -43,7 +43,6 @@ import java.util.TreeSet; import org.forester.protein.BasicDomain; import org.forester.protein.BasicProtein; import org.forester.protein.Domain; -import org.forester.protein.DomainId; import org.forester.protein.Protein; import org.forester.surfacing.SurfacingUtil; import org.forester.util.ForesterUtil; @@ -62,7 +61,7 @@ public final class HmmPfamOutputParser { private static final ReturnType RETURN_TYPE_DEFAULT = ReturnType.UNORDERED_PROTEIN_DOMAIN_COLLECTION_PER_PROTEIN; private static final boolean IGNORE_DUFS_DEFAULT = false; private static final int MAX_ALLOWED_OVERLAP_DEFAULT = -1; - private final Set _filter; + private final Set _filter; private final FilterType _filter_type; private final File _input_file; private final String _species; @@ -85,7 +84,7 @@ public final class HmmPfamOutputParser { private int _domains_ignored_due_to_e_value; private int _domains_ignored_due_to_individual_score_cutoff; private int _domains_stored; - private SortedSet _domains_stored_set; + private SortedSet _domains_stored_set; private long _time; private int _domains_ignored_due_to_negative_domain_filter; private Map _domains_ignored_due_to_negative_domain_filter_counts_map; @@ -104,7 +103,7 @@ public final class HmmPfamOutputParser { public HmmPfamOutputParser( final File input_file, final String species, final String model_type, - final Set filter, + final Set filter, final FilterType filter_type ) { _input_file = input_file; _species = species; @@ -125,7 +124,7 @@ public final class HmmPfamOutputParser { private void addProtein( final List proteins, final Protein current_protein ) { if ( ( getFilterType() == FilterType.POSITIVE_PROTEIN ) || ( getFilterType() == FilterType.NEGATIVE_PROTEIN ) ) { - final Set domain_ids_in_protein = new HashSet(); + final Set domain_ids_in_protein = new HashSet(); for( final Domain d : current_protein.getProteinDomains() ) { domain_ids_in_protein.add( d.getDomainId() ); } @@ -192,7 +191,7 @@ public final class HmmPfamOutputParser { return _domains_stored; } - public SortedSet getDomainsStoredSet() { + public SortedSet getDomainsStoredSet() { return _domains_stored_set; } @@ -200,7 +199,7 @@ public final class HmmPfamOutputParser { return _e_value_maximum; } - private Set getFilter() { + private Set getFilter() { return _filter; } @@ -262,7 +261,7 @@ public final class HmmPfamOutputParser { } private void intitCounts() { - setDomainsStoredSet( new TreeSet() ); + setDomainsStoredSet( new TreeSet() ); setDomainsEncountered( 0 ); setProteinsEncountered( 0 ); setProteinsIgnoredDueToFilter( 0 ); @@ -539,8 +538,7 @@ public final class HmmPfamOutputParser { ForesterUtil.increaseCountingMap( getDomainsIgnoredDueToVirusLikeIdCountsMap(), id ); ++_domains_ignored_due_to_virus_like_id; } - else if ( ( getFilterType() == FilterType.NEGATIVE_DOMAIN ) - && getFilter().contains( new DomainId( id ) ) ) { + else if ( ( getFilterType() == FilterType.NEGATIVE_DOMAIN ) && getFilter().contains( id ) ) { ++_domains_ignored_due_to_negative_domain_filter; ForesterUtil.increaseCountingMap( getDomainsIgnoredDueToNegativeDomainFilterCountsMap(), id ); } @@ -608,7 +606,7 @@ public final class HmmPfamOutputParser { _domains_stored = domains_stored; } - private void setDomainsStoredSet( final SortedSet _storeddomains_stored ) { + private void setDomainsStoredSet( final SortedSet _storeddomains_stored ) { _domains_stored_set = _storeddomains_stored; } diff --git a/forester/java/src/org/forester/io/parsers/HmmscanPerDomainTableParser.java b/forester/java/src/org/forester/io/parsers/HmmscanPerDomainTableParser.java index ada802a..4495009 100644 --- a/forester/java/src/org/forester/io/parsers/HmmscanPerDomainTableParser.java +++ b/forester/java/src/org/forester/io/parsers/HmmscanPerDomainTableParser.java @@ -44,7 +44,6 @@ import java.util.TreeSet; import org.forester.protein.BasicDomain; import org.forester.protein.BasicProtein; import org.forester.protein.Domain; -import org.forester.protein.DomainId; import org.forester.protein.Protein; import org.forester.surfacing.SurfacingUtil; import org.forester.util.ForesterUtil; @@ -65,7 +64,7 @@ public final class HmmscanPerDomainTableParser { private static final boolean IGNORE_DUFS_DEFAULT = false; private static final int MAX_ALLOWED_OVERLAP_DEFAULT = -1; private static final boolean IGNORE_REPLACED_RRMS = false; - private final Set _filter; + private final Set _filter; private final FilterType _filter_type; private final File _input_file; private final String _species; @@ -85,7 +84,7 @@ public final class HmmscanPerDomainTableParser { private int _domains_ignored_due_to_e_value; private int _domains_ignored_due_to_individual_score_cutoff; private int _domains_stored; - private SortedSet _domains_stored_set; + private SortedSet _domains_stored_set; private long _time; private int _domains_ignored_due_to_negative_domain_filter; private Map _domains_ignored_due_to_negative_domain_filter_counts_map; @@ -121,7 +120,7 @@ public final class HmmscanPerDomainTableParser { public HmmscanPerDomainTableParser( final File input_file, final String species, - final Set filter, + final Set filter, final FilterType filter_type, final INDIVIDUAL_SCORE_CUTOFF individual_cutoff_applies_to ) { _input_file = input_file; @@ -135,7 +134,7 @@ public final class HmmscanPerDomainTableParser { public HmmscanPerDomainTableParser( final File input_file, final String species, - final Set filter, + final Set filter, final FilterType filter_type, final INDIVIDUAL_SCORE_CUTOFF individual_cutoff_applies_to, final boolean allow_proteins_with_same_name ) { @@ -173,7 +172,7 @@ public final class HmmscanPerDomainTableParser { _domains_ignored_due_to_overlap += domains_removed; } if ( ( getFilterType() == FilterType.POSITIVE_PROTEIN ) || ( getFilterType() == FilterType.NEGATIVE_PROTEIN ) ) { - final Set domain_ids_in_protein = new HashSet(); + final Set domain_ids_in_protein = new HashSet(); for( final Domain d : current_protein.getProteinDomains() ) { domain_ids_in_protein.add( d.getDomainId() ); } @@ -240,7 +239,7 @@ public final class HmmscanPerDomainTableParser { return _domains_stored; } - public SortedSet getDomainsStoredSet() { + public SortedSet getDomainsStoredSet() { return _domains_stored_set; } @@ -248,7 +247,7 @@ public final class HmmscanPerDomainTableParser { return _e_value_maximum; } - private Set getFilter() { + private Set getFilter() { return _filter; } @@ -308,7 +307,7 @@ public final class HmmscanPerDomainTableParser { } private void intitCounts() { - setDomainsStoredSet( new TreeSet() ); + setDomainsStoredSet( new TreeSet() ); setDomainsEncountered( 0 ); setProteinsEncountered( 0 ); setProteinsIgnoredDueToFilter( 0 ); @@ -459,8 +458,7 @@ public final class HmmscanPerDomainTableParser { ForesterUtil.increaseCountingMap( getDomainsIgnoredDueToVirusLikeIdCountsMap(), target_id ); ++_domains_ignored_due_to_virus_like_id; } - else if ( ( getFilterType() == FilterType.NEGATIVE_DOMAIN ) - && getFilter().contains( new DomainId( target_id ) ) ) { + else if ( ( getFilterType() == FilterType.NEGATIVE_DOMAIN ) && getFilter().contains( target_id ) ) { ++_domains_ignored_due_to_negative_domain_filter; ForesterUtil.increaseCountingMap( getDomainsIgnoredDueToNegativeDomainFilterCountsMap(), target_id ); } @@ -556,7 +554,7 @@ public final class HmmscanPerDomainTableParser { _domains_stored = domains_stored; } - private void setDomainsStoredSet( final SortedSet _storeddomains_stored ) { + private void setDomainsStoredSet( final SortedSet _storeddomains_stored ) { _domains_stored_set = _storeddomains_stored; } diff --git a/forester/java/src/org/forester/protein/BasicDomain.java b/forester/java/src/org/forester/protein/BasicDomain.java index 0232b91..171b0d0 100644 --- a/forester/java/src/org/forester/protein/BasicDomain.java +++ b/forester/java/src/org/forester/protein/BasicDomain.java @@ -26,26 +26,25 @@ package org.forester.protein; -import org.forester.go.GoId; import org.forester.util.ForesterUtil; public class BasicDomain implements Domain { - final private DomainId _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; - - public BasicDomain( final String id_str ) { - if ( ForesterUtil.isEmpty( id_str ) ) { + 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; + + public BasicDomain( final String id ) { + if ( ForesterUtil.isEmpty( id ) ) { throw new IllegalArgumentException( "attempt to create protein domain with null or empty id" ); } - _id = new DomainId( id_str ); + _id = id; _from = -1; _to = -1; _number = -1; @@ -56,17 +55,17 @@ public class BasicDomain implements Domain { _per_domain_score = -1; } - public BasicDomain( final String id_str, + 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 ) { - this( id_str, from, to, number, total_count, per_sequence_evalue, per_sequence_score, 0, 0 ); + this( id, from, to, number, total_count, per_sequence_evalue, per_sequence_score, 0, 0 ); } - public BasicDomain( final String id_str, + public BasicDomain( final String id, final int from, final int to, final short number, @@ -78,7 +77,7 @@ public class BasicDomain implements Domain { if ( ( from >= to ) || ( from < 0 ) ) { throw new IllegalArgumentException( "attempt to create protein domain from " + from + " to " + to ); } - if ( ForesterUtil.isEmpty( id_str ) ) { + if ( ForesterUtil.isEmpty( id ) ) { throw new IllegalArgumentException( "attempt to create protein domain with null or empty id" ); } if ( ( number > total_count ) || ( number < 0 ) ) { @@ -88,7 +87,7 @@ public class BasicDomain implements Domain { if ( ( per_sequence_evalue < 0.0 ) || ( per_domain_evalue < 0.0 ) ) { throw new IllegalArgumentException( "attempt to create protein domain with negative E-value" ); } - _id = new DomainId( id_str ); + _id = id; _from = from; _to = to; _number = number; @@ -99,11 +98,10 @@ public class BasicDomain implements Domain { _per_domain_score = per_domain_score; } - @Override - public void addGoId( final GoId go_id ) { - getDomainId().getGoIds().add( go_id ); - } - + // ^^ @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. @@ -144,7 +142,7 @@ public class BasicDomain implements Domain { } @Override - public DomainId getDomainId() { + public String getDomainId() { return _id; } @@ -153,21 +151,19 @@ public class BasicDomain implements Domain { return _from; } - @Override - public GoId getGoId( final int i ) { - return getDomainId().getGoIds().get( i ); - } - + // ^^ @Override + // ^^ public GoId getGoId( final int i ) { + // ^^ return getDomainId().getGoIds().get( i ); + // ^^ } @Override public short getNumber() { return _number; } - @Override - public int getNumberOfGoIds() { - return getDomainId().getGoIds().size(); - } - + // ^^ @Override + // ^^ public int getNumberOfGoIds() { + // ^^ return getDomainId().getGoIds().size(); + // ^^ } @Override public double getPerDomainEvalue() { return _per_domain_evalue; @@ -200,16 +196,16 @@ public class BasicDomain implements Domain { @Override public int hashCode() { - return getDomainId().getId().hashCode(); + return getDomainId().hashCode(); } @Override public String toString() { - return toStringBuffer().toString(); + return getDomainId(); } public StringBuffer toStringBuffer() { - return new StringBuffer( getDomainId().getId() ); + return new StringBuffer( getDomainId() ); } @Override diff --git a/forester/java/src/org/forester/protein/BasicProtein.java b/forester/java/src/org/forester/protein/BasicProtein.java index e17862f..c793c15 100644 --- a/forester/java/src/org/forester/protein/BasicProtein.java +++ b/forester/java/src/org/forester/protein/BasicProtein.java @@ -56,8 +56,8 @@ public class BasicProtein implements Protein { final int m1 = ( d1.getTo() + d1.getFrom() ); final int m2 = ( d2.getTo() + d2.getFrom() ); return m1 < m2 ? -1 : m1 > m2 ? 1 : d1 - .getDomainId().getId() - .compareTo( d2.getDomainId().getId() ); + .getDomainId() + .compareTo( d2.getDomainId() ); } }; @@ -96,9 +96,9 @@ public class BasicProtein implements Protein { * @param in_nc_order to consider order * @return */ - public boolean contains( final List query_domain_ids, final boolean in_nc_order ) { + public boolean contains( final List query_domain_ids, final boolean in_nc_order ) { if ( !in_nc_order ) { - for( final DomainId query_domain_id : query_domain_ids ) { + for( final String query_domain_id : query_domain_ids ) { if ( !getProteinDomainIds().contains( query_domain_id ) ) { return false; } @@ -107,7 +107,7 @@ public class BasicProtein implements Protein { } else { int current_start_position = -1; - I: for( final DomainId query_domain_id : query_domain_ids ) { + I: for( final String query_domain_id : query_domain_ids ) { if ( getProteinDomainIds().contains( query_domain_id ) ) { final List found_domains = getProteinDomains( query_domain_id ); final SortedSet ordered_start_positions = new TreeSet(); @@ -171,7 +171,7 @@ public class BasicProtein implements Protein { } @Override - public int getProteinDomainCount( final DomainId domain_id ) { + public int getProteinDomainCount( final String domain_id ) { return getProteinDomains( domain_id ).size(); } @@ -181,7 +181,7 @@ public class BasicProtein implements Protein { } @Override - public List getProteinDomains( final DomainId domain_id ) { + public List getProteinDomains( final String domain_id ) { final List domains = new ArrayList(); for( final Domain domain : getProteinDomains() ) { if ( domain.getDomainId().equals( domain_id ) ) { @@ -223,7 +223,7 @@ public class BasicProtein implements Protein { else { sb.append( separator ); } - sb.append( d.getDomainId().getId() ); + sb.append( d.getDomainId() ); } return sb.toString(); } @@ -239,7 +239,7 @@ public class BasicProtein implements Protein { String prev_id = ""; int counter = 1; for( final Domain d : getDomainsSortedByPosition() ) { - final String id = d.getDomainId().getId(); + final String id = d.getDomainId(); if ( prev_id.equals( id ) ) { counter++; } @@ -272,8 +272,8 @@ public class BasicProtein implements Protein { return toDomainArchitectureString( "~" ); } - private List getProteinDomainIds() { - final List ids = new ArrayList( getProteinDomains().size() ); + private List getProteinDomainIds() { + final List ids = new ArrayList( getProteinDomains().size() ); for( final Domain domain : getProteinDomains() ) { ids.add( domain.getDomainId() ); } diff --git a/forester/java/src/org/forester/protein/BinaryDomainCombination.java b/forester/java/src/org/forester/protein/BinaryDomainCombination.java index 1098644..191e51b 100644 --- a/forester/java/src/org/forester/protein/BinaryDomainCombination.java +++ b/forester/java/src/org/forester/protein/BinaryDomainCombination.java @@ -29,9 +29,9 @@ public interface BinaryDomainCombination extends Comparable { - public void addGoId( GoId go_id ); - - public DomainId getDomainId(); + // ^^ public void addGoId( GoId go_id ); + public String getDomainId(); public int getLength(); public int getFrom(); - public GoId getGoId( int i ); - + // ^^ public GoId getGoId( int i ); public short getNumber(); - public int getNumberOfGoIds(); - + // ^^ public int getNumberOfGoIds(); public double getPerDomainEvalue(); public double getPerDomainScore(); diff --git a/forester/java/src/org/forester/protein/DomainId.java b/forester/java/src/org/forester/protein/DomainId.java index 89a23cf..8802283 100644 --- a/forester/java/src/org/forester/protein/DomainId.java +++ b/forester/java/src/org/forester/protein/DomainId.java @@ -26,18 +26,14 @@ package org.forester.protein; -import java.util.ArrayList; -import java.util.List; - -import org.forester.go.GoId; import org.forester.util.ForesterUtil; public class DomainId implements Comparable { final private String _id; - private List _go_ids; - public DomainId( final String id ) { + // private List _go_ids; + private DomainId( final String id ) { if ( ForesterUtil.isEmpty( id ) ) { throw new IllegalArgumentException( "attempt to create domain id from empty or null string" ); } @@ -50,16 +46,15 @@ public class DomainId implements Comparable { throw new IllegalArgumentException( "attempt to create domain id from string containing the separator character [" + BinaryDomainCombination.SEPARATOR + "] for domain combinations [" + _id + "]" ); } - setGoIds( null ); - } - - public void addGoId( final GoId go_id ) { - if ( getGoIds() == null ) { - setGoIds( new ArrayList() ); - } - getGoIds().add( go_id ); + ///////////////////////////// // setGoIds( null ); } + // public void addGoId( final GoId go_id ) { + // if ( getGoIds() == null ) { + // setGoIds( new ArrayList() ); + // } + // getGoIds().add( go_id ); + // } @Override public int compareTo( final DomainId domain_id ) { if ( this == domain_id ) { @@ -85,10 +80,9 @@ public class DomainId implements Comparable { } } - public GoId getGoId( final int i ) { - return getGoIds().get( i ); - } - + // public GoId getGoId( final int i ) { + // return getGoIds().get( i ); + //} // Note. // The fact that equals and compareTo do not behave the same in cases where ids only differ by their case // is not ideal. From Sun regarding Interface SortedSet: @@ -100,30 +94,27 @@ public class DomainId implements Comparable { // so two elements that are deemed equal by this method are, from the standpoint of the sorted set, // equal. The behavior of a sorted set is well-defined even if its ordering is inconsistent with equals; // it just fails to obey the general contract of the Set interface." - public List getGoIds() { - return _go_ids; - } - - public String getId() { + // public List getGoIds() { + // return _go_ids; + // } + private String getId() { return _id; } - public int getNumberOfGoIds() { - if ( getGoIds() == null ) { - return 0; - } - return getGoIds().size(); - } - + // public int getNumberOfGoIds() { + // if ( getGoIds() == null ) { + // return 0; + // } + // return getGoIds().size(); + // } @Override public int hashCode() { return getId().hashCode(); } - private void setGoIds( final List go_ids ) { - _go_ids = go_ids; - } - + // private void setGoIds( final List go_ids ) { + // _go_ids = go_ids; + // } @Override public String toString() { return getId(); diff --git a/forester/java/src/org/forester/protein/Protein.java b/forester/java/src/org/forester/protein/Protein.java index 6616361..4b81f46 100644 --- a/forester/java/src/org/forester/protein/Protein.java +++ b/forester/java/src/org/forester/protein/Protein.java @@ -46,7 +46,7 @@ public interface Protein { * @param in_nc_order to consider order * @return */ - public boolean contains( final List domains, final boolean in_nc_order ); + public boolean contains( final List domains, final boolean in_nc_order ); public String getAccession(); @@ -58,11 +58,11 @@ public interface Protein { public Domain getProteinDomain( final int index ); - public int getProteinDomainCount( final DomainId domain_id ); + public int getProteinDomainCount( final String domain_id ); public List getProteinDomains(); - public List getProteinDomains( final DomainId domain_id ); + public List getProteinDomains( final String domain_id ); public ProteinId getProteinId(); diff --git a/forester/java/src/org/forester/surfacing/AdjactantDirectedBinaryDomainCombination.java b/forester/java/src/org/forester/surfacing/AdjactantDirectedBinaryDomainCombination.java index 81cdf08..1bcbc60 100644 --- a/forester/java/src/org/forester/surfacing/AdjactantDirectedBinaryDomainCombination.java +++ b/forester/java/src/org/forester/surfacing/AdjactantDirectedBinaryDomainCombination.java @@ -27,24 +27,16 @@ package org.forester.surfacing; import org.forester.protein.BinaryDomainCombination; -import org.forester.protein.DomainId; public class AdjactantDirectedBinaryDomainCombination extends BasicBinaryDomainCombination { - public AdjactantDirectedBinaryDomainCombination( final DomainId n_terminal, final DomainId c_terminal ) { - super(); - if ( ( n_terminal == null ) || ( c_terminal == null ) ) { - throw new IllegalArgumentException( "attempt to create binary domain combination using null" ); - } - _data = n_terminal.getId() + BinaryDomainCombination.SEPARATOR + c_terminal.getId(); - } - public 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" ); } - _data = n_terminal + BinaryDomainCombination.SEPARATOR + c_terminal; + _id0 = n_terminal; + _id1 = c_terminal; } public static AdjactantDirectedBinaryDomainCombination createInstance( final String ids ) { diff --git a/forester/java/src/org/forester/surfacing/AdjactantDirectedCombinableDomains.java b/forester/java/src/org/forester/surfacing/AdjactantDirectedCombinableDomains.java index 20d88d9..eb4f9f1 100644 --- a/forester/java/src/org/forester/surfacing/AdjactantDirectedCombinableDomains.java +++ b/forester/java/src/org/forester/surfacing/AdjactantDirectedCombinableDomains.java @@ -31,19 +31,18 @@ import java.util.ArrayList; import java.util.List; import org.forester.protein.BinaryDomainCombination; -import org.forester.protein.DomainId; import org.forester.species.Species; public class AdjactantDirectedCombinableDomains extends BasicCombinableDomains { - public AdjactantDirectedCombinableDomains( final DomainId n_terminal_key_domain, final Species species ) { + public AdjactantDirectedCombinableDomains( final String n_terminal_key_domain, final Species species ) { super( n_terminal_key_domain, species ); } @Override public List toBinaryDomainCombinations() { final List binary_combinations = new ArrayList( getNumberOfCombinableDomains() ); - for( final DomainId domain : getCombiningDomains().keySet() ) { + 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 ) ); diff --git a/forester/java/src/org/forester/surfacing/BasicBinaryDomainCombination.java b/forester/java/src/org/forester/surfacing/BasicBinaryDomainCombination.java index da009b5..1413feb 100644 --- a/forester/java/src/org/forester/surfacing/BasicBinaryDomainCombination.java +++ b/forester/java/src/org/forester/surfacing/BasicBinaryDomainCombination.java @@ -27,33 +27,41 @@ package org.forester.surfacing; import org.forester.protein.BinaryDomainCombination; -import org.forester.protein.DomainId; import org.forester.util.ForesterUtil; public class BasicBinaryDomainCombination implements BinaryDomainCombination { - String _data; + String _id0; + String _id1; + String _str; BasicBinaryDomainCombination() { - _data = null; + _id0 = null; + _id1 = null; + _str = null; } - public BasicBinaryDomainCombination( final String id_0, final String id_1 ) { - if ( ( id_0 == null ) || ( id_1 == null ) ) { + private String getAsStr() { + if ( _str == null ) { + _str = _id0 + SEPARATOR + _id1; + } + return _str; + } + + public BasicBinaryDomainCombination( final String id0, final String id1 ) { + if ( ( id0 == null ) || ( id1 == null ) ) { throw new IllegalArgumentException( "attempt to create binary domain combination using null" ); } - if ( id_0.toLowerCase().compareTo( id_1.toLowerCase() ) < 0 ) { - _data = id_0 + BinaryDomainCombination.SEPARATOR + id_1; + if ( id0.toLowerCase().compareTo( id1.toLowerCase() ) < 0 ) { + _id0 = id0; + _id1 = id1; } else { - _data = id_1 + BinaryDomainCombination.SEPARATOR + id_0; + _id0 = id1; + _id1 = id0; } } - public BasicBinaryDomainCombination( final DomainId id_0, final DomainId id_1 ) { - this( id_0.getId(), id_1.getId() ); - } - @Override public int compareTo( final BinaryDomainCombination binary_domain_combination ) { if ( binary_domain_combination.getClass() != this.getClass() ) { @@ -91,18 +99,18 @@ public class BasicBinaryDomainCombination implements BinaryDomainCombination { } @Override - public DomainId getId0() { - return new DomainId( _data.split( BinaryDomainCombination.SEPARATOR )[ 0 ] ); + public String getId0() { + return _id0; } @Override - public DomainId getId1() { - return new DomainId( _data.split( BinaryDomainCombination.SEPARATOR )[ 1 ] ); + public String getId1() { + return _id1; } @Override public int hashCode() { - return _data.hashCode(); + return getAsStr().hashCode(); } @Override @@ -151,7 +159,7 @@ public class BasicBinaryDomainCombination implements BinaryDomainCombination { @Override public String toString() { - return _data; + return getAsStr(); } public static BinaryDomainCombination createInstance( final String ids ) { diff --git a/forester/java/src/org/forester/surfacing/BasicCombinableDomains.java b/forester/java/src/org/forester/surfacing/BasicCombinableDomains.java index 300a4ed..84408dc 100644 --- a/forester/java/src/org/forester/surfacing/BasicCombinableDomains.java +++ b/forester/java/src/org/forester/surfacing/BasicCombinableDomains.java @@ -33,28 +33,27 @@ import java.util.SortedMap; import java.util.TreeMap; import org.forester.protein.BinaryDomainCombination; -import org.forester.protein.DomainId; import org.forester.species.Species; import org.forester.util.DescriptiveStatistics; public class BasicCombinableDomains implements CombinableDomains { - final private DomainId _key_domain; - private int _key_domain_count; - private int _key_domain_proteins_count; - final private Species _species; - final private TreeMap _combining_domains; - private DescriptiveStatistics _key_domain_confidence_statistics; + final private String _key_domain; + private int _key_domain_count; + private int _key_domain_proteins_count; + final private Species _species; + final private TreeMap _combining_domains; + private DescriptiveStatistics _key_domain_confidence_statistics; - public BasicCombinableDomains( final DomainId key_domain, final Species species ) { + public BasicCombinableDomains( final String key_domain, final Species species ) { _key_domain = key_domain; _species = species; - _combining_domains = new TreeMap(); + _combining_domains = new TreeMap(); init(); } @Override - public void addCombinableDomain( final DomainId protein_domain ) { + public void addCombinableDomain( final String protein_domain ) { if ( getCombiningDomains().containsKey( protein_domain ) ) { getCombiningDomains().put( protein_domain, getCombiningDomains().get( protein_domain ) + 1 ); } @@ -64,8 +63,8 @@ public class BasicCombinableDomains implements CombinableDomains { } @Override - public List getAllDomains() { - final List domains = getCombinableDomains(); + public List getAllDomains() { + final List domains = getCombinableDomains(); if ( !domains.contains( getKeyDomain() ) ) { domains.add( getKeyDomain() ); } @@ -73,19 +72,19 @@ public class BasicCombinableDomains implements CombinableDomains { } @Override - public List getCombinableDomains() { - final List domains = new ArrayList( getNumberOfCombinableDomains() ); - for( final DomainId domain : getCombiningDomains().keySet() ) { + public List getCombinableDomains() { + final List domains = new ArrayList( getNumberOfCombinableDomains() ); + for( final String domain : getCombiningDomains().keySet() ) { domains.add( domain ); } return domains; } @Override - public SortedMap getCombinableDomainsIds() { - final SortedMap ids = new TreeMap(); - for( final DomainId domain : getCombiningDomains().keySet() ) { - final DomainId pd = domain; + public SortedMap getCombinableDomainsIds() { + final SortedMap ids = new TreeMap(); + for( final String domain : getCombiningDomains().keySet() ) { + final String pd = domain; ids.put( pd, getCombiningDomains().get( pd ) ); } return ids; @@ -94,8 +93,8 @@ public class BasicCombinableDomains implements CombinableDomains { @Override public StringBuilder getCombiningDomainIdsAsStringBuilder() { final StringBuilder sb = new StringBuilder(); - for( final Iterator iter = getCombiningDomains().keySet().iterator(); iter.hasNext(); ) { - final DomainId key = iter.next(); + for( final Iterator iter = getCombiningDomains().keySet().iterator(); iter.hasNext(); ) { + final String key = iter.next(); sb.append( key.toString() ); sb.append( " [" ); final int count = getCombiningDomains().get( key ); @@ -108,12 +107,12 @@ public class BasicCombinableDomains implements CombinableDomains { return sb; } - protected TreeMap getCombiningDomains() { + protected TreeMap getCombiningDomains() { return _combining_domains; } @Override - public DomainId getKeyDomain() { + public String getKeyDomain() { return _key_domain; } @@ -138,7 +137,7 @@ public class BasicCombinableDomains implements CombinableDomains { } @Override - public int getNumberOfProteinsExhibitingCombination( final DomainId protein_domain ) { + public int getNumberOfProteinsExhibitingCombination( final String protein_domain ) { if ( getCombiningDomains().containsKey( protein_domain ) ) { return getCombiningDomains().get( protein_domain ); } @@ -159,7 +158,7 @@ public class BasicCombinableDomains implements CombinableDomains { } @Override - public boolean isCombinable( final DomainId protein_domain ) { + public boolean isCombinable( final String protein_domain ) { return getCombiningDomains().containsKey( protein_domain ); } @@ -181,7 +180,7 @@ public class BasicCombinableDomains implements CombinableDomains { @Override public List toBinaryDomainCombinations() { final List binary_combinations = new ArrayList( getNumberOfCombinableDomains() ); - for( final DomainId domain : getCombiningDomains().keySet() ) { + for( final String domain : getCombiningDomains().keySet() ) { binary_combinations.add( new BasicBinaryDomainCombination( getKeyDomain(), domain ) ); } return binary_combinations; diff --git a/forester/java/src/org/forester/surfacing/BasicDomainSimilarityCalculator.java b/forester/java/src/org/forester/surfacing/BasicDomainSimilarityCalculator.java index 9a9bbfb..846aa7a 100644 --- a/forester/java/src/org/forester/surfacing/BasicDomainSimilarityCalculator.java +++ b/forester/java/src/org/forester/surfacing/BasicDomainSimilarityCalculator.java @@ -34,7 +34,6 @@ import java.util.SortedSet; import java.util.TreeMap; import java.util.TreeSet; -import org.forester.protein.DomainId; import org.forester.species.Species; import org.forester.util.BasicDescriptiveStatistics; import org.forester.util.DescriptiveStatistics; @@ -62,11 +61,11 @@ public class BasicDomainSimilarityCalculator implements DomainSimilarityCalculat throw new IllegalArgumentException( "attempt to calculate multiple combinable domains similarity for less than two combinale domains collections" ); } final SortedSet similarities = new TreeSet(); - final SortedSet keys = new TreeSet(); + final SortedSet keys = new TreeSet(); for( final GenomeWideCombinableDomains cdc : cdc_list ) { keys.addAll( ( cdc ).getAllCombinableDomainsIds().keySet() ); } - for( final DomainId key : keys ) { + for( final String key : keys ) { final List same_id_cd_list = new ArrayList( cdc_list.size() ); final List species_with_key_id_domain = new ArrayList(); for( final GenomeWideCombinableDomains cdc : cdc_list ) { @@ -238,7 +237,7 @@ public class BasicDomainSimilarityCalculator implements DomainSimilarityCalculat cd.getKeyDomainCount(), cd.getNumberOfCombinableDomains(), cd.getKeyDomainConfidenceDescriptiveStatistics() ); - for( final DomainId domain : cd.getCombinableDomains() ) { + for( final String domain : cd.getCombinableDomains() ) { sd.addProteinsExhibitingCombinationCount( domain, cd.getNumberOfProteinsExhibitingCombination( domain ) ); } return sd; diff --git a/forester/java/src/org/forester/surfacing/BasicGenomeWideCombinableDomains.java b/forester/java/src/org/forester/surfacing/BasicGenomeWideCombinableDomains.java index ef98751..c6d205f 100644 --- a/forester/java/src/org/forester/surfacing/BasicGenomeWideCombinableDomains.java +++ b/forester/java/src/org/forester/surfacing/BasicGenomeWideCombinableDomains.java @@ -20,7 +20,6 @@ import org.forester.go.GoId; import org.forester.protein.BinaryDomainCombination; import org.forester.protein.BinaryDomainCombination.DomainCombinationType; import org.forester.protein.Domain; -import org.forester.protein.DomainId; import org.forester.protein.Protein; import org.forester.species.Species; import org.forester.util.BasicDescriptiveStatistics; @@ -29,115 +28,109 @@ import org.forester.util.ForesterUtil; public class BasicGenomeWideCombinableDomains implements GenomeWideCombinableDomains { - private final static NumberFormat FORMATTER = new DecimalFormat( "0.0E0" ); - private static final Comparator DESCENDING_KEY_DOMAIN_COUNT_ORDER = new Comparator() { + private final static NumberFormat FORMATTER = new DecimalFormat( "0.0E0" ); + private static final Comparator DESCENDING_KEY_DOMAIN_COUNT_ORDER = new Comparator() { - @Override - public int compare( final CombinableDomains d1, - final CombinableDomains d2 ) { - if ( d1.getKeyDomainCount() < d2 - .getKeyDomainCount() ) { - return 1; - } - else if ( d1 - .getKeyDomainCount() > d2 - .getKeyDomainCount() ) { - return -1; - } - else { - return d1 - .getKeyDomain() - .getId() - .compareTo( d2 - .getKeyDomain() - .getId() ); - } - } - }; - private static final Comparator DESCENDING_KEY_DOMAIN_PROTEINS_COUNT_ORDER = new Comparator() { + @Override + public int compare( final CombinableDomains d1, + final CombinableDomains d2 ) { + if ( d1.getKeyDomainCount() < d2 + .getKeyDomainCount() ) { + return 1; + } + else if ( d1 + .getKeyDomainCount() > d2 + .getKeyDomainCount() ) { + return -1; + } + else { + return d1 + .getKeyDomain() + .compareTo( d2 + .getKeyDomain() ); + } + } + }; + private static final Comparator DESCENDING_KEY_DOMAIN_PROTEINS_COUNT_ORDER = new Comparator() { - @Override - public int compare( final CombinableDomains d1, - final CombinableDomains d2 ) { - if ( d1.getKeyDomainProteinsCount() < d2 - .getKeyDomainProteinsCount() ) { - return 1; - } - else if ( d1 - .getKeyDomainProteinsCount() > d2 - .getKeyDomainProteinsCount() ) { - return -1; - } - else { - return d1 - .getKeyDomain() - .getId() - .compareTo( d2 - .getKeyDomain() - .getId() ); - } - } - }; - private static final Comparator DESCENDING_COMBINATIONS_COUNT_ORDER = new Comparator() { + @Override + public int compare( final CombinableDomains d1, + final CombinableDomains d2 ) { + if ( d1.getKeyDomainProteinsCount() < d2 + .getKeyDomainProteinsCount() ) { + return 1; + } + else if ( d1 + .getKeyDomainProteinsCount() > d2 + .getKeyDomainProteinsCount() ) { + return -1; + } + else { + return d1 + .getKeyDomain() + .compareTo( d2 + .getKeyDomain() ); + } + } + }; + private static final Comparator DESCENDING_COMBINATIONS_COUNT_ORDER = new Comparator() { - @Override - public int compare( final CombinableDomains d1, - final CombinableDomains d2 ) { - if ( d1.getNumberOfCombinableDomains() < d2 - .getNumberOfCombinableDomains() ) { - return 1; - } - else if ( d1 - .getNumberOfCombinableDomains() > d2 - .getNumberOfCombinableDomains() ) { - return -1; - } - else { - return d1 - .getKeyDomain() - .getId() - .compareTo( d2 - .getKeyDomain() - .getId() ); - } - } - }; - final private SortedMap _combinable_domains_map; - final private Species _species; - final private DomainCombinationType _dc_type; + @Override + public int compare( final CombinableDomains d1, + final CombinableDomains d2 ) { + if ( d1.getNumberOfCombinableDomains() < d2 + .getNumberOfCombinableDomains() ) { + return 1; + } + else if ( d1 + .getNumberOfCombinableDomains() > d2 + .getNumberOfCombinableDomains() ) { + return -1; + } + else { + return d1 + .getKeyDomain() + .compareTo( d2 + .getKeyDomain() ); + } + } + }; + final private SortedMap _combinable_domains_map; + final private Species _species; + final private DomainCombinationType _dc_type; private BasicGenomeWideCombinableDomains( final Species species, final DomainCombinationType dc_type ) { - _combinable_domains_map = new TreeMap(); + _combinable_domains_map = new TreeMap(); _species = species; _dc_type = dc_type; } - private void add( final DomainId key, final CombinableDomains cdc ) { + private void add( final String key, final CombinableDomains cdc ) { _combinable_domains_map.put( key, cdc ); } @Override - public boolean contains( final DomainId key_id ) { + public boolean contains( final String key_id ) { return _combinable_domains_map.containsKey( key_id ); } @Override - public CombinableDomains get( final DomainId key_id ) { + public CombinableDomains get( final String key_id ) { return _combinable_domains_map.get( key_id ); } @Override - public SortedMap getAllCombinableDomainsIds() { + public SortedMap getAllCombinableDomainsIds() { return _combinable_domains_map; } @Override - public SortedSet getAllDomainIds() { - final SortedSet domains = new TreeSet(); - for( final DomainId key : getAllCombinableDomainsIds().keySet() ) { + public SortedSet getAllDomainIds() { + final SortedSet domains = new TreeSet(); + for( final String key : getAllCombinableDomainsIds().keySet() ) { final CombinableDomains cb = getAllCombinableDomainsIds().get( key ); - final List ds = cb.getAllDomains(); - for( final DomainId d : ds ) { + final List ds = cb.getAllDomains(); + for( final String d : ds ) { domains.add( d ); } } @@ -150,10 +143,10 @@ public class BasicGenomeWideCombinableDomains implements GenomeWideCombinableDom } @Override - public SortedSet getMostPromiscuosDomain() { - final SortedSet doms = new TreeSet(); + public SortedSet getMostPromiscuosDomain() { + final SortedSet doms = new TreeSet(); final int max = ( int ) getPerGenomeDomainPromiscuityStatistics().getMax(); - for( final DomainId key : getAllCombinableDomainsIds().keySet() ) { + for( final String key : getAllCombinableDomainsIds().keySet() ) { final CombinableDomains cb = getAllCombinableDomainsIds().get( key ); if ( cb.getNumberOfCombinableDomains() == max ) { doms.add( key ); @@ -165,7 +158,7 @@ public class BasicGenomeWideCombinableDomains implements GenomeWideCombinableDom @Override public DescriptiveStatistics getPerGenomeDomainPromiscuityStatistics() { final DescriptiveStatistics stats = new BasicDescriptiveStatistics(); - for( final DomainId key : getAllCombinableDomainsIds().keySet() ) { + for( final String key : getAllCombinableDomainsIds().keySet() ) { final CombinableDomains cb = getAllCombinableDomainsIds().get( key ); stats.addValue( cb.getNumberOfCombinableDomains() ); } @@ -185,7 +178,7 @@ public class BasicGenomeWideCombinableDomains implements GenomeWideCombinableDom @Override public SortedSet toBinaryDomainCombinations() { final SortedSet binary_combinations = new TreeSet(); - for( final DomainId key : getAllCombinableDomainsIds().keySet() ) { + for( final String key : getAllCombinableDomainsIds().keySet() ) { final CombinableDomains cb = getAllCombinableDomainsIds().get( key ); for( final BinaryDomainCombination b : cb.toBinaryDomainCombinations() ) { binary_combinations.add( b ); @@ -205,7 +198,7 @@ public class BasicGenomeWideCombinableDomains implements GenomeWideCombinableDom public StringBuilder toStringBuilder( final GenomeWideCombinableDomainsSortOrder sort_order ) { final StringBuilder sb = new StringBuilder(); final List combinable_domains = new ArrayList(); - for( final DomainId key : getAllCombinableDomainsIds().keySet() ) { + for( final String key : getAllCombinableDomainsIds().keySet() ) { final CombinableDomains cb = getAllCombinableDomainsIds().get( key ); combinable_domains.add( cb ); } @@ -236,11 +229,11 @@ public class BasicGenomeWideCombinableDomains implements GenomeWideCombinableDom return sb; } - private static void countDomains( final Map domain_counts, - final Map domain_protein_counts, - final Map stats, - final Set saw_c, - final DomainId id_i, + private static void countDomains( final Map domain_counts, + final Map domain_protein_counts, + final Map stats, + final Set saw_c, + final String id_i, final double support ) { if ( domain_counts.containsKey( id_i ) ) { domain_counts.put( id_i, 1 + domain_counts.get( ( id_i ) ) ); @@ -279,24 +272,24 @@ public class BasicGenomeWideCombinableDomains implements GenomeWideCombinableDom public static BasicGenomeWideCombinableDomains createInstance( final List protein_list, final boolean ignore_combination_with_same_domain, final Species species, - final Map> domain_id_to_go_ids_map, + final Map> domain_id_to_go_ids_map, final DomainCombinationType dc_type, final Map protein_length_stats_by_dc, final Map domain_number_stats_by_dc ) { final BasicGenomeWideCombinableDomains instance = new BasicGenomeWideCombinableDomains( species, dc_type ); - final Map domain_counts = new HashMap(); - final Map domain_protein_counts = new HashMap(); - final Map stats = new HashMap(); + final Map domain_counts = new HashMap(); + final Map domain_protein_counts = new HashMap(); + final Map stats = new HashMap(); for( final Protein protein : protein_list ) { if ( !protein.getSpecies().equals( species ) ) { throw new IllegalArgumentException( "species (" + protein.getSpecies() + ") does not match species of combinable domains collection (" + species + ")" ); } - final Set saw_i = new HashSet(); - final Set saw_c = new HashSet(); + final Set saw_i = new HashSet(); + final Set saw_c = new HashSet(); for( int i = 0; i < protein.getProteinDomains().size(); ++i ) { final Domain pd_i = protein.getProteinDomain( i ); - final DomainId id_i = pd_i.getDomainId(); + final String id_i = pd_i.getDomainId(); final int current_start = pd_i.getFrom(); BasicGenomeWideCombinableDomains.countDomains( domain_counts, domain_protein_counts, @@ -322,16 +315,16 @@ public class BasicGenomeWideCombinableDomains implements GenomeWideCombinableDom else { domain_combination = new BasicCombinableDomains( pd_i.getDomainId(), species ); } - if ( ( domain_id_to_go_ids_map != null ) - && domain_id_to_go_ids_map.containsKey( pd_i.getDomainId() ) ) { - final List go_ids = domain_id_to_go_ids_map.get( pd_i.getDomainId() ); - for( final GoId go_id : go_ids ) { - domain_combination.getKeyDomain().addGoId( go_id ); - } - } + // ^^ if ( ( domain_id_to_go_ids_map != null ) + // ^^ && domain_id_to_go_ids_map.containsKey( pd_i.getDomainId() ) ) { + // ^^ final List go_ids = domain_id_to_go_ids_map.get( pd_i.getDomainId() ); + // ^^ for( final GoId go_id : go_ids ) { + // ^^ domain_combination.getKeyDomain().addGoId( go_id ); + // ^^ } + // ^^ } instance.add( id_i, domain_combination ); } - final Set saw_j = new HashSet(); + final Set saw_j = new HashSet(); if ( ignore_combination_with_same_domain ) { saw_j.add( id_i ); } @@ -342,7 +335,7 @@ public class BasicGenomeWideCombinableDomains implements GenomeWideCombinableDom continue; } if ( i != j ) { - final DomainId id = protein.getProteinDomain( j ).getDomainId(); + final String id = protein.getProteinDomain( j ).getDomainId(); if ( !saw_j.contains( id ) ) { saw_j.add( id ); if ( dc_type != DomainCombinationType.DIRECTED_ADJACTANT ) { @@ -389,7 +382,7 @@ public class BasicGenomeWideCombinableDomains implements GenomeWideCombinableDom } } } - for( final DomainId key_id : domain_counts.keySet() ) { + for( final String key_id : domain_counts.keySet() ) { instance.get( key_id ).setKeyDomainCount( domain_counts.get( key_id ) ); instance.get( key_id ).setKeyDomainProteinsCount( domain_protein_counts.get( key_id ) ); instance.get( key_id ).setKeyDomainConfidenceDescriptiveStatistics( stats.get( key_id ) ); diff --git a/forester/java/src/org/forester/surfacing/CombinableDomains.java b/forester/java/src/org/forester/surfacing/CombinableDomains.java index 28ca259..58b055d 100644 --- a/forester/java/src/org/forester/surfacing/CombinableDomains.java +++ b/forester/java/src/org/forester/surfacing/CombinableDomains.java @@ -30,7 +30,6 @@ import java.util.List; import java.util.SortedMap; import org.forester.protein.BinaryDomainCombination; -import org.forester.protein.DomainId; import org.forester.species.Species; import org.forester.util.DescriptiveStatistics; @@ -41,7 +40,7 @@ public interface CombinableDomains { * * @param protein_domain */ - public void addCombinableDomain( final DomainId protein_domain ); + public void addCombinableDomain( final String protein_domain ); /** * @@ -50,9 +49,9 @@ public interface CombinableDomains { * * @return all domains */ - List getAllDomains(); + List getAllDomains(); - List getCombinableDomains(); + List getCombinableDomains(); /** * Returns the combinable domain identifiers sorted in alphabetical manner: - @@ -61,7 +60,7 @@ public interface CombinableDomains { * * @return combining domain identifiers sorted in alphabetical manner */ - public SortedMap getCombinableDomainsIds(); + public SortedMap getCombinableDomainsIds(); public StringBuilder getCombiningDomainIdsAsStringBuilder(); @@ -71,7 +70,7 @@ public interface CombinableDomains { * * @return the domain identifier */ - public DomainId getKeyDomain(); + public String getKeyDomain(); /** * Gets descriptive statistics for the confidence (i.e. E-values) of the key @@ -100,7 +99,7 @@ public interface CombinableDomains { public int getNumberOfCombinableDomains(); - public int getNumberOfProteinsExhibitingCombination( final DomainId protein_domain ); + public int getNumberOfProteinsExhibitingCombination( final String protein_domain ); /** * Returns the species of this combinable domains. @@ -109,7 +108,7 @@ public interface CombinableDomains { */ public Species getSpecies(); - public boolean isCombinable( final DomainId protein_domain ); + public boolean isCombinable( final String protein_domain ); /** * This is to set descriptive statistics for the confidence (i.e. E-values) diff --git a/forester/java/src/org/forester/surfacing/CombinationsBasedPairwiseDomainSimilarityCalculator.java b/forester/java/src/org/forester/surfacing/CombinationsBasedPairwiseDomainSimilarityCalculator.java index 27327b6..feda0bc 100644 --- a/forester/java/src/org/forester/surfacing/CombinationsBasedPairwiseDomainSimilarityCalculator.java +++ b/forester/java/src/org/forester/surfacing/CombinationsBasedPairwiseDomainSimilarityCalculator.java @@ -29,8 +29,6 @@ package org.forester.surfacing; import java.util.List; -import org.forester.protein.DomainId; - public class CombinationsBasedPairwiseDomainSimilarityCalculator implements PairwiseDomainSimilarityCalculator { @Override @@ -39,11 +37,11 @@ public class CombinationsBasedPairwiseDomainSimilarityCalculator implements Pair if ( !domains_1.getKeyDomain().equals( domains_2.getKeyDomain() ) ) { throw new IllegalArgumentException( "attempt to calculate similarity between domain collection with different keys" ); } - final List d1 = domains_1.getCombinableDomains(); - final List d2 = domains_2.getCombinableDomains(); + final List d1 = domains_1.getCombinableDomains(); + final List d2 = domains_2.getCombinableDomains(); int same = 0; int different = 0; - for( final DomainId domain : d1 ) { + for( final String domain : d1 ) { if ( d2.contains( domain ) ) { same++; } @@ -51,7 +49,7 @@ public class CombinationsBasedPairwiseDomainSimilarityCalculator implements Pair different++; } } - for( final DomainId domain : d2 ) { + for( final String domain : d2 ) { if ( !( d1.contains( domain ) ) ) { different++; } diff --git a/forester/java/src/org/forester/surfacing/DirectedBinaryDomainCombination.java b/forester/java/src/org/forester/surfacing/DirectedBinaryDomainCombination.java index bfd7b2e..4716be8 100644 --- a/forester/java/src/org/forester/surfacing/DirectedBinaryDomainCombination.java +++ b/forester/java/src/org/forester/surfacing/DirectedBinaryDomainCombination.java @@ -27,24 +27,16 @@ package org.forester.surfacing; import org.forester.protein.BinaryDomainCombination; -import org.forester.protein.DomainId; public class DirectedBinaryDomainCombination extends BasicBinaryDomainCombination { - public DirectedBinaryDomainCombination( final DomainId n_terminal, final DomainId c_terminal ) { - super(); - if ( ( n_terminal == null ) || ( c_terminal == null ) ) { - throw new IllegalArgumentException( "attempt to create binary domain combination using null" ); - } - _data = n_terminal.getId() + BinaryDomainCombination.SEPARATOR + c_terminal.getId(); - } - public 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" ); } - _data = n_terminal + BinaryDomainCombination.SEPARATOR + c_terminal; + _id0 = n_terminal; + _id1 = c_terminal; } public static BinaryDomainCombination createInstance( final String ids ) { diff --git a/forester/java/src/org/forester/surfacing/DirectedCombinableDomains.java b/forester/java/src/org/forester/surfacing/DirectedCombinableDomains.java index 16c2940..9955eec 100644 --- a/forester/java/src/org/forester/surfacing/DirectedCombinableDomains.java +++ b/forester/java/src/org/forester/surfacing/DirectedCombinableDomains.java @@ -30,19 +30,18 @@ import java.util.ArrayList; import java.util.List; import org.forester.protein.BinaryDomainCombination; -import org.forester.protein.DomainId; import org.forester.species.Species; public class DirectedCombinableDomains extends BasicCombinableDomains { - public DirectedCombinableDomains( final DomainId n_terminal_key_domain, final Species species ) { + public DirectedCombinableDomains( final String n_terminal_key_domain, final Species species ) { super( n_terminal_key_domain, species ); } @Override public List toBinaryDomainCombinations() { final List binary_combinations = new ArrayList( getNumberOfCombinableDomains() ); - for( final DomainId domain : getCombiningDomains().keySet() ) { + 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 ) ); diff --git a/forester/java/src/org/forester/surfacing/DomainArchitectureBasedGenomeSimilarityCalculator.java b/forester/java/src/org/forester/surfacing/DomainArchitectureBasedGenomeSimilarityCalculator.java index cdc9416..caf6cb0 100644 --- a/forester/java/src/org/forester/surfacing/DomainArchitectureBasedGenomeSimilarityCalculator.java +++ b/forester/java/src/org/forester/surfacing/DomainArchitectureBasedGenomeSimilarityCalculator.java @@ -30,7 +30,6 @@ import java.util.HashSet; import java.util.Set; import org.forester.protein.BinaryDomainCombination; -import org.forester.protein.DomainId; public class DomainArchitectureBasedGenomeSimilarityCalculator { @@ -38,12 +37,12 @@ public class DomainArchitectureBasedGenomeSimilarityCalculator { public static final double MIN_SIMILARITY_SCORE = 0.0; final private GenomeWideCombinableDomains _combinable_domains_genome_0; final private GenomeWideCombinableDomains _combinable_domains_genome_1; - private Set _domain_ids_to_ignore; + private Set _domain_ids_to_ignore; private boolean _allow_domains_to_be_ignored; - private Set _all_domains; - private Set _shared_domains; - private Set _domains_specific_to_0; - private Set _domains_specific_to_1; + private Set _all_domains; + private Set _shared_domains; + private Set _domains_specific_to_0; + private Set _domains_specific_to_1; private Set _all_binary_domain_combinations; private Set _shared_binary_domain_combinations; private Set _binary_domain_combinations_specific_to_0; @@ -64,7 +63,7 @@ public class DomainArchitectureBasedGenomeSimilarityCalculator { forceRecalculation(); } - public void addDomainIdToIgnore( final DomainId domain_id_to_ignore ) { + public void addDomainIdToIgnore( final String domain_id_to_ignore ) { forceRecalculation(); getDomainIdsToIgnore().add( domain_id_to_ignore ); } @@ -113,7 +112,7 @@ public class DomainArchitectureBasedGenomeSimilarityCalculator { public void deleteAllDomainIdsToIgnore() { forceRecalculation(); - setDomainIdsToIgnore( new HashSet() ); + setDomainIdsToIgnore( new HashSet() ); } private void forceRecalculation() { @@ -155,9 +154,9 @@ public class DomainArchitectureBasedGenomeSimilarityCalculator { * * @return */ - public Set getAllDomains() { + public Set getAllDomains() { if ( _all_domains == null ) { - final Set all = new HashSet(); + final Set all = new HashSet(); all.addAll( getCombinableDomainsGenome0().getAllDomainIds() ); all.addAll( getCombinableDomainsGenome1().getAllDomainIds() ); if ( isAllowDomainsToBeIgnored() && !getDomainIdsToIgnore().isEmpty() ) { @@ -216,23 +215,23 @@ public class DomainArchitectureBasedGenomeSimilarityCalculator { return _combinable_domains_genome_1; } - private Set getDomainIdsToIgnore() { + private Set getDomainIdsToIgnore() { return _domain_ids_to_ignore; } - private Set getDomainsSpecificToGenome( final boolean specific_to_genome_0 ) { - final Set specific = new HashSet(); - final Set d0 = getCombinableDomainsGenome0().getAllDomainIds(); - final Set d1 = getCombinableDomainsGenome1().getAllDomainIds(); + private Set getDomainsSpecificToGenome( final boolean specific_to_genome_0 ) { + final Set specific = new HashSet(); + final Set d0 = getCombinableDomainsGenome0().getAllDomainIds(); + final Set d1 = getCombinableDomainsGenome1().getAllDomainIds(); if ( specific_to_genome_0 ) { - for( final DomainId domain0 : d0 ) { + for( final String domain0 : d0 ) { if ( !d1.contains( domain0 ) ) { specific.add( domain0 ); } } } else { - for( final DomainId domain1 : d1 ) { + for( final String domain1 : d1 ) { if ( !d0.contains( domain1 ) ) { specific.add( domain1 ); } @@ -244,14 +243,14 @@ public class DomainArchitectureBasedGenomeSimilarityCalculator { return specific; } - public Set getDomainsSpecificToGenome0() { + public Set getDomainsSpecificToGenome0() { if ( _domains_specific_to_0 == null ) { _domains_specific_to_0 = getDomainsSpecificToGenome( true ); } return _domains_specific_to_0; } - public Set getDomainsSpecificToGenome1() { + public Set getDomainsSpecificToGenome1() { if ( _domains_specific_to_1 == null ) { _domains_specific_to_1 = getDomainsSpecificToGenome( false ); } @@ -276,12 +275,12 @@ public class DomainArchitectureBasedGenomeSimilarityCalculator { return _shared_binary_domain_combinations; } - public Set getSharedDomains() { + public Set getSharedDomains() { if ( _shared_domains == null ) { - final Set shared = new HashSet(); - final Set d0 = getCombinableDomainsGenome0().getAllDomainIds(); - final Set d1 = getCombinableDomainsGenome1().getAllDomainIds(); - for( final DomainId domain0 : d0 ) { + final Set shared = new HashSet(); + final Set d0 = getCombinableDomainsGenome0().getAllDomainIds(); + final Set d1 = getCombinableDomainsGenome1().getAllDomainIds(); + for( final String domain0 : d0 ) { if ( d1.contains( domain0 ) ) { shared.add( domain0 ); } @@ -314,9 +313,9 @@ public class DomainArchitectureBasedGenomeSimilarityCalculator { return pruned; } - private Set pruneDomains( final Set all ) { - final Set pruned = new HashSet(); - for( final DomainId d : all ) { + private Set pruneDomains( final Set all ) { + final Set pruned = new HashSet(); + for( final String d : all ) { if ( !getDomainIdsToIgnore().contains( d ) ) { pruned.add( d ); } @@ -329,7 +328,7 @@ public class DomainArchitectureBasedGenomeSimilarityCalculator { _allow_domains_to_be_ignored = allow_domains_to_be_ignored; } - void setDomainIdsToIgnore( final Set domain_ids_to_ignore ) { + void setDomainIdsToIgnore( final Set domain_ids_to_ignore ) { forceRecalculation(); _domain_ids_to_ignore = domain_ids_to_ignore; } diff --git a/forester/java/src/org/forester/surfacing/DomainCountsDifferenceUtil.java b/forester/java/src/org/forester/surfacing/DomainCountsDifferenceUtil.java index 20a25d4..08f3989 100644 --- a/forester/java/src/org/forester/surfacing/DomainCountsDifferenceUtil.java +++ b/forester/java/src/org/forester/surfacing/DomainCountsDifferenceUtil.java @@ -48,7 +48,6 @@ import org.forester.application.surfacing; import org.forester.go.GoId; import org.forester.go.GoTerm; import org.forester.protein.BinaryDomainCombination; -import org.forester.protein.DomainId; import org.forester.protein.Protein; import org.forester.species.Species; import org.forester.util.BasicDescriptiveStatistics; @@ -86,8 +85,8 @@ public final class DomainCountsDifferenceUtil { } } - private static void addCounts( final SortedMap> copy_counts, - final DomainId domain, + private static void addCounts( final SortedMap> copy_counts, + final String domain, final GenomeWideCombinableDomains genome ) { if ( !copy_counts.containsKey( domain ) ) { copy_counts.put( domain, new ArrayList() ); @@ -100,8 +99,8 @@ public final class DomainCountsDifferenceUtil { } } - private static StringBuilder addGoInformation( final DomainId d, - final Map> domain_id_to_go_ids_map, + private static StringBuilder addGoInformation( final String d, + final Map> domain_id_to_go_ids_map, final Map go_id_to_term_map ) { final StringBuilder sb = new StringBuilder(); if ( ( domain_id_to_go_ids_map == null ) || domain_id_to_go_ids_map.isEmpty() @@ -116,7 +115,7 @@ public final class DomainCountsDifferenceUtil { sb.append( "
" ); } else { - sb.append( "go id \"" + go_id + "\" not found [" + d.getId() + "]" ); + sb.append( "go id \"" + go_id + "\" not found [" + d + "]" ); } } return sb; @@ -143,7 +142,7 @@ public final class DomainCountsDifferenceUtil { final File plain_output_dom, final File html_output_dom, final File html_output_dc, - final Map> domain_id_to_go_ids_map, + final Map> domain_id_to_go_ids_map, final Map go_id_to_term_map, final File all_domains_go_ids_out_dom, final File passing_domains_go_ids_out_dom, @@ -175,13 +174,13 @@ public final class DomainCountsDifferenceUtil { final Writer html_writer_dc = new BufferedWriter( new FileWriter( html_output_dc ) ); final Writer all_gos_writer = new BufferedWriter( new FileWriter( all_domains_go_ids_out_dom ) ); final Writer passing_gos_writer = new BufferedWriter( new FileWriter( passing_domains_go_ids_out_dom ) ); - final SortedMap high_copy_base_values = new TreeMap(); - final SortedMap high_copy_target_values = new TreeMap(); - final SortedMap low_copy_values = new TreeMap(); - final SortedMap> high_copy_base_copy_counts = new TreeMap>(); - final SortedMap> high_copy_target_copy_counts = new TreeMap>(); - final SortedMap> low_copy_copy_counts = new TreeMap>(); - final SortedSet all_domains = new TreeSet(); + final SortedMap high_copy_base_values = new TreeMap(); + final SortedMap high_copy_target_values = new TreeMap(); + final SortedMap low_copy_values = new TreeMap(); + final SortedMap> high_copy_base_copy_counts = new TreeMap>(); + final SortedMap> high_copy_target_copy_counts = new TreeMap>(); + final SortedMap> low_copy_copy_counts = new TreeMap>(); + final SortedSet all_domains = new TreeSet(); final SortedMap high_copy_base_values_dc = new TreeMap(); final SortedMap high_copy_target_values_dc = new TreeMap(); final SortedMap low_copy_values_dc = new TreeMap(); @@ -193,11 +192,11 @@ public final class DomainCountsDifferenceUtil { final SortedSet go_ids_of_passing_domains = new TreeSet(); final SortedSet go_ids_all = new TreeSet(); for( final GenomeWideCombinableDomains genome : genomes ) { - final SortedSet domains = genome.getAllDomainIds(); + final SortedSet domains = genome.getAllDomainIds(); final SortedSet dcs = genome.toBinaryDomainCombinations(); final String species = genome.getSpecies().getSpeciesId(); bdcs_per_genome.put( species, genome.toBinaryDomainCombinations() ); - for( final DomainId d : domains ) { + for( final String d : domains ) { all_domains.add( d ); if ( domain_id_to_go_ids_map.containsKey( d ) ) { go_ids_all.addAll( domain_id_to_go_ids_map.get( d ) ); @@ -207,7 +206,7 @@ public final class DomainCountsDifferenceUtil { all_dcs.add( dc ); } } - for( final DomainId domain : all_domains ) { + for( final String domain : all_domains ) { for( final GenomeWideCombinableDomains genome : genomes ) { final String species = genome.getSpecies().getSpeciesId(); if ( high_copy_base_species.contains( species ) ) { @@ -244,7 +243,7 @@ public final class DomainCountsDifferenceUtil { } } } - for( final DomainId domain : all_domains ) { + for( final String domain : all_domains ) { calculateDomainCountsBasedValue( high_copy_target_values, high_copy_target_copy_counts, domain, @@ -332,9 +331,9 @@ public final class DomainCountsDifferenceUtil { } } - private static void calculateDomainCountsBasedValue( final SortedMap copy_values, - final SortedMap> copy_counts, - final DomainId domain, + private static void calculateDomainCountsBasedValue( final SortedMap copy_values, + final SortedMap> copy_counts, + final String domain, final COPY_CALCULATION_MODE copy_calc_mode ) { if ( copy_counts.containsKey( domain ) ) { switch ( copy_calc_mode ) { @@ -372,9 +371,9 @@ public final class DomainCountsDifferenceUtil { results.put( bdc, ( double ) max ); } - private static void calculateMaxCount( final SortedMap results, - final SortedMap> copy_counts, - final DomainId domain ) { + private static void calculateMaxCount( final SortedMap results, + final SortedMap> copy_counts, + final String domain ) { final List counts = copy_counts.get( domain ); int max = 0; for( final Integer count : counts ) { @@ -396,9 +395,9 @@ public final class DomainCountsDifferenceUtil { results.put( bdc, ( ( double ) sum ) / ( ( double ) counts.size() ) ); } - private static void calculateMeanCount( final SortedMap results, - final SortedMap> copy_counts, - final DomainId domain ) { + private static void calculateMeanCount( final SortedMap results, + final SortedMap> copy_counts, + final String domain ) { final List counts = copy_counts.get( domain ); int sum = 0; for( final Integer count : counts ) { @@ -418,9 +417,9 @@ public final class DomainCountsDifferenceUtil { results.put( bdc, stats.median() ); } - private static void calculateMedianCount( final SortedMap results, - final SortedMap> copy_counts, - final DomainId domain ) { + private static void calculateMedianCount( final SortedMap results, + final SortedMap> copy_counts, + final String domain ) { final List counts = copy_counts.get( domain ); final DescriptiveStatistics stats = new BasicDescriptiveStatistics(); for( final Integer count : counts ) { @@ -442,9 +441,9 @@ public final class DomainCountsDifferenceUtil { results.put( bdc, ( double ) min ); } - private static void calculateMinCount( final SortedMap results, - final SortedMap> copy_counts, - final DomainId domain ) { + private static void calculateMinCount( final SortedMap results, + final SortedMap> copy_counts, + final String domain ) { final List counts = copy_counts.get( domain ); int min = Integer.MAX_VALUE; for( final Integer count : counts ) { @@ -506,8 +505,8 @@ public final class DomainCountsDifferenceUtil { html_writer.write( "" ); } - private static void writeCopyNumberValues( final SortedMap copy_means, - final DomainId domain, + private static void writeCopyNumberValues( final SortedMap copy_means, + final String domain, final GenomeWideCombinableDomains genome, final String species, final Writer plain_writer, @@ -660,15 +659,15 @@ public final class DomainCountsDifferenceUtil { final List low_copy_species, final int min_diff, final Double factor, - final Map> domain_id_to_go_ids_map, + final Map> domain_id_to_go_ids_map, final Map go_id_to_term_map, final Writer plain_writer, final Writer html_writer, final File proteins_file_base, - final SortedMap high_copy_base_values, - final SortedMap high_copy_target_values, - final SortedMap low_copy_values, - final SortedSet all_domains, + final SortedMap high_copy_base_values, + final SortedMap high_copy_target_values, + final SortedMap low_copy_values, + final SortedSet all_domains, final SortedSet go_ids_of_passing_domains, final SortedMap> protein_lists_per_species ) throws IOException { @@ -677,7 +676,7 @@ public final class DomainCountsDifferenceUtil { int not_total_absense_counter = 0; SurfacingUtil.addHtmlHead( html_writer, "Domain Copy Differences" ); html_writer.write( "" ); - for( final DomainId domain_id : all_domains ) { + for( final String domain_id : all_domains ) { if ( ( high_copy_base_values.get( domain_id ) > 0 ) && ( high_copy_target_values.get( domain_id ) > 0 ) && ( high_copy_base_values.get( domain_id ) >= low_copy_values.get( domain_id ) ) ) { if ( high_copy_target_values.get( domain_id ) >= ( min_diff + ( factor * low_copy_values @@ -693,10 +692,10 @@ public final class DomainCountsDifferenceUtil { if ( domain_id_to_go_ids_map.containsKey( domain_id ) ) { go_ids_of_passing_domains.addAll( domain_id_to_go_ids_map.get( domain_id ) ); } - plain_writer.write( domain_id.getId() ); + plain_writer.write( domain_id ); plain_writer.write( SurfacingConstants.NL ); - html_writer.write( "" ); } - if ( getGoAnnotationOutput() != DomainSimilarityCalculator.GoAnnotationOutput.NONE ) { - sb.append( "" ); - } + // ^^ if ( getGoAnnotationOutput() != DomainSimilarityCalculator.GoAnnotationOutput.NONE ) { + // ^^ sb.append( "" ); + // ^^ } if ( ( getSpeciesCustomOrder() == null ) || getSpeciesCustomOrder().isEmpty() ) { sb.append( "
" + domain_id.getId() + "" ); + html_writer.write( "
" + domain_id + "" ); html_writer.write( addGoInformation( domain_id, domain_id_to_go_ids_map, go_id_to_term_map ) .toString() ); html_writer.write( "" ); @@ -820,7 +819,7 @@ public final class DomainCountsDifferenceUtil { private static void writeProteinsToFile( final File proteins_file_base, final SortedMap> protein_lists_per_species, - final DomainId domain_id ) throws IOException { + final String domain_id ) throws IOException { final File my_proteins_file = new File( proteins_file_base.getParentFile() + ForesterUtil.FILE_SEPARATOR + domain_id + PLUS_MINUS_PROTEINS_FILE_DOM_SUFFIX ); SurfacingUtil.checkForOutputFileWriteability( my_proteins_file ); diff --git a/forester/java/src/org/forester/surfacing/DomainLengths.java b/forester/java/src/org/forester/surfacing/DomainLengths.java index 7e628ce..1018aea 100644 --- a/forester/java/src/org/forester/surfacing/DomainLengths.java +++ b/forester/java/src/org/forester/surfacing/DomainLengths.java @@ -31,17 +31,16 @@ import java.util.List; import java.util.SortedMap; import java.util.TreeMap; -import org.forester.protein.DomainId; import org.forester.species.Species; import org.forester.util.BasicDescriptiveStatistics; import org.forester.util.DescriptiveStatistics; public class DomainLengths { - final DomainId _domain_id; + final String _domain_id; final SortedMap _length_statistics; - public DomainLengths( final DomainId domain_id ) { + public DomainLengths( final String domain_id ) { _domain_id = domain_id; _length_statistics = new TreeMap(); } @@ -91,7 +90,7 @@ public class DomainLengths { return ( species_mean - population_mean ) / population_sd; } - public DomainId getDomainId() { + public String getDomainId() { return _domain_id; } diff --git a/forester/java/src/org/forester/surfacing/DomainLengthsTable.java b/forester/java/src/org/forester/surfacing/DomainLengthsTable.java index 9a9e0a7..44b6247 100644 --- a/forester/java/src/org/forester/surfacing/DomainLengthsTable.java +++ b/forester/java/src/org/forester/surfacing/DomainLengthsTable.java @@ -33,7 +33,6 @@ import java.util.SortedMap; import java.util.TreeMap; import org.forester.protein.Domain; -import org.forester.protein.DomainId; import org.forester.protein.Protein; import org.forester.species.Species; import org.forester.util.BasicDescriptiveStatistics; @@ -42,12 +41,12 @@ import org.forester.util.ForesterUtil; public class DomainLengthsTable { - private final static DecimalFormat DF = new DecimalFormat( "#.0" ); - final SortedMap _domain_lengths; - final List _species; + private final static DecimalFormat DF = new DecimalFormat( "#.0" ); + final SortedMap _domain_lengths; + final List _species; public DomainLengthsTable() { - _domain_lengths = new TreeMap(); + _domain_lengths = new TreeMap(); _species = new ArrayList(); } @@ -59,7 +58,7 @@ public class DomainLengthsTable { getDomainLengths().put( domain_lengths.getDomainId(), domain_lengths ); } - private void addLength( final DomainId domain_id, final Species species, final int domain_length ) { + private void addLength( final String domain_id, final Species species, final int domain_length ) { if ( !getDomainLengths().containsKey( domain_id ) ) { addDomainLengths( new DomainLengths( domain_id ) ); } @@ -87,7 +86,7 @@ public class DomainLengthsTable { return stats; } - public DescriptiveStatistics calculateMeanBasedStatisticsForDomain( final DomainId domain_id ) { + public DescriptiveStatistics calculateMeanBasedStatisticsForDomain( final String domain_id ) { return getDomainLengths( domain_id ).calculateMeanBasedStatistics(); } @@ -143,11 +142,11 @@ public class DomainLengthsTable { return sb; } - private SortedMap getDomainLengths() { + private SortedMap getDomainLengths() { return _domain_lengths; } - public DomainLengths getDomainLengths( final DomainId domain_id ) { + public DomainLengths getDomainLengths( final String domain_id ) { return getDomainLengths().get( domain_id ); } @@ -159,7 +158,7 @@ public class DomainLengthsTable { return list; } - public DescriptiveStatistics getLengthStatistic( final DomainId domain_id, final Species species ) { + public DescriptiveStatistics getLengthStatistic( final String domain_id, final Species species ) { return getDomainLengths( domain_id ).getLengthStatistic( species ); } diff --git a/forester/java/src/org/forester/surfacing/DomainParsimonyCalculator.java b/forester/java/src/org/forester/surfacing/DomainParsimonyCalculator.java index e2e0af3..e2db537 100644 --- a/forester/java/src/org/forester/surfacing/DomainParsimonyCalculator.java +++ b/forester/java/src/org/forester/surfacing/DomainParsimonyCalculator.java @@ -49,7 +49,6 @@ import org.forester.phylogeny.data.BinaryCharacters; import org.forester.phylogeny.iterators.PhylogenyNodeIterator; import org.forester.protein.BinaryDomainCombination; import org.forester.protein.BinaryDomainCombination.DomainCombinationType; -import org.forester.protein.DomainId; import org.forester.species.Species; import org.forester.util.ForesterUtil; @@ -64,8 +63,8 @@ public final class DomainParsimonyCalculator { private int _total_gains; private int _total_unchanged; private int _cost; - private Map> _domain_id_to_secondary_features_map; - private SortedSet _positive_filter; + private Map> _domain_id_to_secondary_features_map; + private SortedSet _positive_filter; private DomainParsimonyCalculator( final Phylogeny phylogeny ) { init(); @@ -81,7 +80,7 @@ public final class DomainParsimonyCalculator { private DomainParsimonyCalculator( final Phylogeny phylogeny, final List gwcd_list, - final Map> domain_id_to_secondary_features_map ) { + final Map> domain_id_to_secondary_features_map ) { init(); _phylogeny = phylogeny; _gwcd_list = gwcd_list; @@ -160,7 +159,7 @@ public final class DomainParsimonyCalculator { executeDolloParsimony( true ); } - public void executeDolloParsimonyOnDomainPresence( final SortedSet positive_filter ) { + public void executeDolloParsimonyOnDomainPresence( final SortedSet positive_filter ) { setPositiveFilter( positive_filter ); executeDolloParsimony( true ); setPositiveFilter( null ); @@ -231,14 +230,13 @@ public final class DomainParsimonyCalculator { fitch.setUseLast( use_last ); fitch.setReturnGainLossMatrix( true ); fitch.setReturnInternalStates( true ); - final Map> map = getDomainIdToSecondaryFeaturesMap(); - final Map newmap = new HashMap(); - final Iterator>> it = map.entrySet().iterator(); + final Map> map = getDomainIdToSecondaryFeaturesMap(); + final Map newmap = new HashMap(); + final Iterator>> it = map.entrySet().iterator(); while ( it.hasNext() ) { - final Map.Entry> pair = it.next(); + final Map.Entry> pair = it.next(); if ( pair.getValue().size() != 1 ) { - throw new IllegalArgumentException( pair.getKey().getId() + " mapps to " + pair.getValue().size() - + " items" ); + throw new IllegalArgumentException( pair.getKey() + " mapps to " + pair.getValue().size() + " items" ); } newmap.put( pair.getKey(), ( String ) pair.getValue().toArray()[ 0 ] ); } @@ -350,7 +348,7 @@ public final class DomainParsimonyCalculator { return _cost; } - private Map> getDomainIdToSecondaryFeaturesMap() { + private Map> getDomainIdToSecondaryFeaturesMap() { return _domain_id_to_secondary_features_map; } @@ -415,7 +413,7 @@ public final class DomainParsimonyCalculator { return _phylogeny; } - private SortedSet getPositiveFilter() { + private SortedSet getPositiveFilter() { return _positive_filter; } @@ -500,7 +498,7 @@ public final class DomainParsimonyCalculator { _cost = cost; } - private void setDomainIdToSecondaryFeaturesMap( final Map> domain_id_to_secondary_features_map ) { + private void setDomainIdToSecondaryFeaturesMap( final Map> domain_id_to_secondary_features_map ) { _domain_id_to_secondary_features_map = domain_id_to_secondary_features_map; } @@ -508,7 +506,7 @@ public final class DomainParsimonyCalculator { _gain_loss_matrix = gain_loss_matrix; } - private void setPositiveFilter( final SortedSet positive_filter ) { + private void setPositiveFilter( final SortedSet positive_filter ) { _positive_filter = positive_filter; } @@ -539,7 +537,7 @@ public final class DomainParsimonyCalculator { public static DomainParsimonyCalculator createInstance( final Phylogeny phylogeny, final List gwcd_list, - final Map> domain_id_to_secondary_features_map ) { + final Map> domain_id_to_secondary_features_map ) { if ( phylogeny.getNumberOfExternalNodes() != gwcd_list.size() ) { throw new IllegalArgumentException( "size of external nodes does not equal size of genome wide combinable domains list" ); } @@ -554,7 +552,7 @@ public final class DomainParsimonyCalculator { * @return */ static CharacterStateMatrix createMatrixOfSecondaryFeaturePresenceOrAbsence( final List gwcd_list, - final Map> domain_id_to_second_features_map, + final Map> domain_id_to_second_features_map, final Map mapping_results_map ) { if ( gwcd_list.isEmpty() ) { throw new IllegalArgumentException( "genome wide combinable domains list is empty" ); @@ -567,7 +565,7 @@ public final class DomainParsimonyCalculator { for( final GenomeWideCombinableDomains gwcd : gwcd_list ) { int mapped = 0; int not_mapped = 0; - for( final DomainId domain : gwcd.getAllDomainIds() ) { + for( final String domain : gwcd.getAllDomainIds() ) { if ( domain_id_to_second_features_map.containsKey( domain ) ) { all_secondary_features.addAll( domain_id_to_second_features_map.get( domain ) ); mapped++; @@ -601,7 +599,7 @@ public final class DomainParsimonyCalculator { all_identifiers.add( species_id ); matrix.setIdentifier( identifier_index, species_id ); final Set all_second_per_gwcd = new HashSet(); - for( final DomainId domain : gwcd.getAllDomainIds() ) { + for( final String domain : gwcd.getAllDomainIds() ) { if ( domain_id_to_second_features_map.containsKey( domain ) ) { all_second_per_gwcd.addAll( domain_id_to_second_features_map.get( domain ) ); } @@ -620,7 +618,7 @@ public final class DomainParsimonyCalculator { } public static CharacterStateMatrix createMatrixOfSecondaryFeatureBinaryDomainCombinationPresenceOrAbsence( final List gwcd_list, - final Map domain_id_to_second_features_map ) { + final Map domain_id_to_second_features_map ) { if ( gwcd_list.isEmpty() ) { throw new IllegalArgumentException( "genome wide combinable domains list is empty" ); } @@ -689,21 +687,21 @@ public final class DomainParsimonyCalculator { return matrix; } - private static BinaryDomainCombination mapBinaryDomainCombination( final Map domain_id_to_second_features_map, + private static BinaryDomainCombination mapBinaryDomainCombination( final Map domain_id_to_second_features_map, final BinaryDomainCombination bc, final SortedSet no_mappings ) { String id0 = ""; String id1 = ""; if ( !domain_id_to_second_features_map.containsKey( bc.getId0() ) ) { - no_mappings.add( bc.getId0().getId() ); - id0 = bc.getId0().getId(); + no_mappings.add( bc.getId0() ); + id0 = bc.getId0(); } else { id0 = domain_id_to_second_features_map.get( bc.getId0() ); } if ( !domain_id_to_second_features_map.containsKey( bc.getId1() ) ) { - no_mappings.add( bc.getId1().getId() ); - id1 = bc.getId1().getId(); + no_mappings.add( bc.getId1() ); + id1 = bc.getId1(); } else { id1 = domain_id_to_second_features_map.get( bc.getId1() ); @@ -771,7 +769,7 @@ public final class DomainParsimonyCalculator { } public static CharacterStateMatrix createMatrixOfDomainPresenceOrAbsence( final List gwcd_list, - final SortedSet positive_filter ) { + final SortedSet positive_filter ) { if ( gwcd_list.isEmpty() ) { throw new IllegalArgumentException( "genome wide combinable domains list is empty" ); } @@ -779,9 +777,9 @@ public final class DomainParsimonyCalculator { throw new IllegalArgumentException( "positive filter is empty" ); } final int number_of_identifiers = gwcd_list.size(); - final SortedSet all_domain_ids = new TreeSet(); + final SortedSet all_domain_ids = new TreeSet(); for( final GenomeWideCombinableDomains gwcd : gwcd_list ) { - for( final DomainId domain : gwcd.getAllDomainIds() ) { + for( final String domain : gwcd.getAllDomainIds() ) { all_domain_ids.add( domain ); } } @@ -789,7 +787,7 @@ public final class DomainParsimonyCalculator { if ( positive_filter != null ) { //number_of_characters = positive_filter.size(); -- bad if doms in filter but not in genomes number_of_characters = 0; - for( final DomainId id : all_domain_ids ) { + for( final String id : all_domain_ids ) { if ( positive_filter.contains( id ) ) { number_of_characters++; } @@ -798,13 +796,13 @@ public final class DomainParsimonyCalculator { final CharacterStateMatrix matrix = new BasicCharacterStateMatrix( number_of_identifiers, number_of_characters ); int character_index = 0; - for( final DomainId id : all_domain_ids ) { + for( final String id : all_domain_ids ) { if ( positive_filter == null ) { - matrix.setCharacter( character_index++, id.getId() ); + matrix.setCharacter( character_index++, id ); } else { if ( positive_filter.contains( id ) ) { - matrix.setCharacter( character_index++, id.getId() ); + matrix.setCharacter( character_index++, id ); } } } @@ -821,7 +819,7 @@ public final class DomainParsimonyCalculator { if ( ForesterUtil.isEmpty( matrix.getCharacter( ci ) ) ) { throw new RuntimeException( "this should not have happened: problem with character #" + ci ); } - final DomainId id = new DomainId( matrix.getCharacter( ci ) ); + final String id = matrix.getCharacter( ci ); if ( gwcd.contains( id ) ) { matrix.setState( identifier_index, ci, CharacterStateMatrix.BinaryStates.PRESENT ); } diff --git a/forester/java/src/org/forester/surfacing/DomainSimilarity.java b/forester/java/src/org/forester/surfacing/DomainSimilarity.java index b6ae576..0787439 100644 --- a/forester/java/src/org/forester/surfacing/DomainSimilarity.java +++ b/forester/java/src/org/forester/surfacing/DomainSimilarity.java @@ -30,7 +30,6 @@ import java.util.Map; import java.util.SortedMap; import java.util.SortedSet; -import org.forester.protein.DomainId; import org.forester.species.Species; import org.forester.surfacing.PrintableDomainSimilarity.PRINT_OPTION; @@ -48,9 +47,9 @@ public interface DomainSimilarity extends Comparable { MIN, MAX, SD, MEAN, ABS_MAX_COUNTS_DIFFERENCE, MAX_COUNTS_DIFFERENCE, MAX_DIFFERENCE, SPECIES_COUNT, DOMAIN_ID, } - public SortedSet getCombinableDomainIds( final Species species_of_combinable_domain );; + public SortedSet getCombinableDomainIds( final Species species_of_combinable_domain );; - public DomainId getDomainId(); + public String getDomainId(); /** * For pairwise similarities, this should return the "difference"; for example the difference in counts diff --git a/forester/java/src/org/forester/surfacing/GenomeWideCombinableDomains.java b/forester/java/src/org/forester/surfacing/GenomeWideCombinableDomains.java index f444ff7..4dbe718 100644 --- a/forester/java/src/org/forester/surfacing/GenomeWideCombinableDomains.java +++ b/forester/java/src/org/forester/surfacing/GenomeWideCombinableDomains.java @@ -32,28 +32,27 @@ import java.util.SortedSet; import org.forester.protein.BinaryDomainCombination; import org.forester.protein.BinaryDomainCombination.DomainCombinationType; -import org.forester.protein.DomainId; import org.forester.species.Species; import org.forester.util.DescriptiveStatistics; public interface GenomeWideCombinableDomains { - public boolean contains( DomainId key_id ); + public boolean contains( String key_id ); - public CombinableDomains get( DomainId key_id ); + public CombinableDomains get( String key_id ); - public SortedMap getAllCombinableDomainsIds(); + public SortedMap getAllCombinableDomainsIds(); /** * This should return all domains ids present in the genome. * * @return a sorted set of domains ids */ - public SortedSet getAllDomainIds(); + public SortedSet getAllDomainIds(); public DomainCombinationType getDomainCombinationType(); - SortedSet getMostPromiscuosDomain(); + SortedSet getMostPromiscuosDomain(); /** * This should return a statistic for per domain diff --git a/forester/java/src/org/forester/surfacing/PairwiseGenomeComparator.java b/forester/java/src/org/forester/surfacing/PairwiseGenomeComparator.java index a811450..0fd6c6d 100644 --- a/forester/java/src/org/forester/surfacing/PairwiseGenomeComparator.java +++ b/forester/java/src/org/forester/surfacing/PairwiseGenomeComparator.java @@ -43,7 +43,6 @@ import org.forester.evoinference.matrix.distance.DistanceMatrix; import org.forester.go.GoId; import org.forester.go.GoNameSpace; import org.forester.go.GoTerm; -import org.forester.protein.DomainId; import org.forester.species.Species; import org.forester.surfacing.DomainSimilarityCalculator.Detailedness; import org.forester.util.DescriptiveStatistics; @@ -90,7 +89,7 @@ public class PairwiseGenomeComparator { final DomainSimilarity.DomainSimilaritySortField domain_similarity_sort_field, final PrintableDomainSimilarity.PRINT_OPTION domain_similarity_print_option, final DomainSimilarity.DomainSimilarityScoring scoring, - final Map> domain_id_to_go_ids_map, + final Map> domain_id_to_go_ids_map, final Map go_id_to_term_map, final GoNameSpace go_namespace_limit, final Species[] species, @@ -268,7 +267,7 @@ public class PairwiseGenomeComparator { else if ( jacknife_ratio >= 1.0 ) { throw new IllegalArgumentException( "attempt to perform jacknife resampling with jacknife ratio 1.0 or more" ); } - final DomainId[] all_unique_domain_ids = getAllUniqueDomainIdAsArray( list_of_genome_wide_combinable_domains ); + final String[] all_unique_domain_ids = getAllUniqueDomainIdAsArray( list_of_genome_wide_combinable_domains ); if ( verbose ) { System.out.println(); System.out.println( "Jacknife: total of domains: " + all_unique_domain_ids.length ); @@ -281,9 +280,9 @@ public class PairwiseGenomeComparator { if ( verbose ) { System.out.print( " " + r ); } - final SortedSet domain_ids_to_ignore = randomlyPickDomainIds( all_unique_domain_ids, - jacknife_ratio, - generator ); + final SortedSet domain_ids_to_ignore = randomlyPickDomainIds( all_unique_domain_ids, + jacknife_ratio, + generator ); final BasicSymmetricalDistanceMatrix shared_domains_based_distances = new BasicSymmetricalDistanceMatrix( number_of_genomes ); final BasicSymmetricalDistanceMatrix shared_binary_combinations_based_distances = new BasicSymmetricalDistanceMatrix( number_of_genomes ); for( int i = 0; i < number_of_genomes; ++i ) { @@ -314,28 +313,28 @@ public class PairwiseGenomeComparator { } } - static private DomainId[] getAllUniqueDomainIdAsArray( final List list_of_genome_wide_combinable_domains ) { - DomainId[] all_domain_ids_array; - final SortedSet all_domain_ids = new TreeSet(); + static private String[] getAllUniqueDomainIdAsArray( final List list_of_genome_wide_combinable_domains ) { + String[] all_domain_ids_array; + final SortedSet all_domain_ids = new TreeSet(); for( final GenomeWideCombinableDomains genome_wide_combinable_domains : list_of_genome_wide_combinable_domains ) { - final SortedSet all_domains = genome_wide_combinable_domains.getAllDomainIds(); - for( final DomainId domain : all_domains ) { + final SortedSet all_domains = genome_wide_combinable_domains.getAllDomainIds(); + for( final String domain : all_domains ) { all_domain_ids.add( domain ); } } - all_domain_ids_array = new DomainId[ all_domain_ids.size() ]; + all_domain_ids_array = new String[ all_domain_ids.size() ]; int n = 0; - for( final DomainId domain_id : all_domain_ids ) { + for( final String domain_id : all_domain_ids ) { all_domain_ids_array[ n++ ] = domain_id; } return all_domain_ids_array; } - static private SortedSet randomlyPickDomainIds( final DomainId[] all_domain_ids_array, - final double jacknife_ratio, - final Random generator ) { + static private SortedSet randomlyPickDomainIds( final String[] all_domain_ids_array, + final double jacknife_ratio, + final Random generator ) { final int size = all_domain_ids_array.length; - final SortedSet random_domain_ids = new TreeSet(); + final SortedSet random_domain_ids = new TreeSet(); final int number_of_ids_pick = ForesterUtil.roundToInt( jacknife_ratio * size ); while ( random_domain_ids.size() < number_of_ids_pick ) { final int r = generator.nextInt( size ); diff --git a/forester/java/src/org/forester/surfacing/PrintableDomainSimilarity.java b/forester/java/src/org/forester/surfacing/PrintableDomainSimilarity.java index 31d0e55..2cf1a91 100644 --- a/forester/java/src/org/forester/surfacing/PrintableDomainSimilarity.java +++ b/forester/java/src/org/forester/surfacing/PrintableDomainSimilarity.java @@ -36,7 +36,6 @@ import org.forester.go.GoId; import org.forester.go.GoNameSpace; import org.forester.go.GoTerm; import org.forester.go.GoXRef; -import org.forester.protein.DomainId; import org.forester.species.Species; import org.forester.surfacing.DomainSimilarityCalculator.Detailedness; import org.forester.surfacing.DomainSimilarityCalculator.GoAnnotationOutput; @@ -139,52 +138,51 @@ public class PrintableDomainSimilarity implements DomainSimilarity { } } - private void addGoInformation( final StringBuffer sb, final boolean for_table, final boolean html ) { - if ( !for_table ) { - sb.append( "<" ); - } - switch ( getGoAnnotationOutput() ) { - case ALL: { - final int go_ids = getCombinableDomains().getKeyDomain().getNumberOfGoIds(); - boolean first = true; - for( int i = 0; i < go_ids; ++i ) { - final GoId go_id = getCombinableDomains().getKeyDomain().getGoId( i ); - if ( getGoIdToTermMap() != null ) { - if ( getGoIdToTermMap().containsKey( go_id ) ) { - first = appendGoTerm( sb, getGoIdToTermMap().get( go_id ), first, html ); - } - else { - sb.append( "go id \"" + go_id + "\" not found [" - + getCombinableDomains().getKeyDomain().getId() + "]" ); - } - } - else { - if ( !first ) { - sb.append( ", " ); - } - if ( html ) { - sb.append( "" + go_id + "" ); - } - else { - sb.append( go_id ); - } - first = false; - } - } - break; - } - case NONE: { - break; - } - default: - throw new RuntimeException( "unknown " + getGoAnnotationOutput() ); - } - if ( !for_table ) { - sb.append( ">: " ); - } - } - + // private void addGoInformation( final StringBuffer sb, final boolean for_table, final boolean html ) { + // if ( !for_table ) { + // sb.append( "<" ); + // } + // switch ( getGoAnnotationOutput() ) { + // case ALL: { + // final int go_ids = getCombinableDomains().getKeyDomain().getNumberOfGoIds(); + // boolean first = true; + // for( int i = 0; i < go_ids; ++i ) { + // final GoId go_id = getCombinableDomains().getKeyDomain().getGoId( i ); + // if ( getGoIdToTermMap() != null ) { + // if ( getGoIdToTermMap().containsKey( go_id ) ) { + // first = appendGoTerm( sb, getGoIdToTermMap().get( go_id ), first, html ); + // } + // else { + // sb.append( "go id \"" + go_id + "\" not found [" + // + getCombinableDomains().getKeyDomain().getId() + "]" ); + // } + // } + // else { + // if ( !first ) { + // sb.append( ", " ); + // } + // if ( html ) { + // sb.append( "" + go_id + "" ); + // } + // else { + // sb.append( go_id ); + // } + // first = false; + // } + // } + // break; + // } + // case NONE: { + // break; + // } + // default: + // throw new RuntimeException( "unknown " + getGoAnnotationOutput() ); + // } + // if ( !for_table ) { + // sb.append( ">: " ); + // } + // } private void addSpeciesSpecificDomainData( final StringBuffer sb, final Species species, final boolean html, @@ -426,10 +424,10 @@ public class PrintableDomainSimilarity implements DomainSimilarity { } @Override - public SortedSet getCombinableDomainIds( final Species species_of_combinable_domain ) { - final SortedSet sorted_ids = new TreeSet(); + public SortedSet getCombinableDomainIds( final Species species_of_combinable_domain ) { + final SortedSet sorted_ids = new TreeSet(); if ( getSpeciesData().containsKey( species_of_combinable_domain ) ) { - for( final DomainId id : getSpeciesData().get( species_of_combinable_domain ) + for( final String id : getSpeciesData().get( species_of_combinable_domain ) .getCombinableDomainIdToCountsMap().keySet() ) { sorted_ids.add( id ); } @@ -446,7 +444,7 @@ public class PrintableDomainSimilarity implements DomainSimilarity { } @Override - public DomainId getDomainId() { + public String getDomainId() { return getCombinableDomains().getKeyDomain(); } @@ -662,11 +660,11 @@ public class PrintableDomainSimilarity implements DomainSimilarity { } sb.append( "" ); - addGoInformation( sb, true, true ); - sb.append( "" ); + // ^^ addGoInformation( sb, true, true ); + // ^^ sb.append( "" ); sb.append( getSpeciesDataInAlphabeticalOrder( true, tax_code_to_id_map ) ); @@ -723,10 +721,10 @@ public class PrintableDomainSimilarity implements DomainSimilarity { default: throw new AssertionError( "Unknown sort method: " + getSortField() ); } - if ( getGoAnnotationOutput() != DomainSimilarityCalculator.GoAnnotationOutput.NONE ) { - sb.append( TAB ); - addGoInformation( sb, true, false ); - } + // ^^ if ( getGoAnnotationOutput() != DomainSimilarityCalculator.GoAnnotationOutput.NONE ) { + // ^^ sb.append( TAB ); + // ^^ addGoInformation( sb, true, false ); + // ^^ } return sb; } diff --git a/forester/java/src/org/forester/surfacing/PrintableSpeciesSpecificDomainSimilariyData.java b/forester/java/src/org/forester/surfacing/PrintableSpeciesSpecificDomainSimilariyData.java index 28ca512..d361573 100644 --- a/forester/java/src/org/forester/surfacing/PrintableSpeciesSpecificDomainSimilariyData.java +++ b/forester/java/src/org/forester/surfacing/PrintableSpeciesSpecificDomainSimilariyData.java @@ -33,13 +33,12 @@ import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; -import org.forester.protein.DomainId; import org.forester.util.DescriptiveStatistics; class PrintableSpeciesSpecificDomainSimilariyData implements SpeciesSpecificDomainSimilariyData { private final static NumberFormat FORMATTER = new DecimalFormat( "0.0E0" ); - final SortedMap _combinable_domain_id_to_count_map; + final SortedMap _combinable_domain_id_to_count_map; final private int _key_domain_proteins_count; final private int _key_domain_domains_count; final private int _combinable_domains_count; @@ -53,11 +52,11 @@ class PrintableSpeciesSpecificDomainSimilariyData implements SpeciesSpecificDoma _key_domain_domains_count = key_domain_domains_count; _combinable_domains_count = combinable_domains; _key_domain_confidence_descriptive_statistics = key_domain_confidence_descriptive_statistics; - _combinable_domain_id_to_count_map = new TreeMap(); + _combinable_domain_id_to_count_map = new TreeMap(); } @Override - public void addProteinsExhibitingCombinationCount( final DomainId domain_id, final int count ) { + public void addProteinsExhibitingCombinationCount( final String domain_id, final int count ) { if ( getCombinableDomainIdToCountsMap().containsKey( domain_id ) ) { throw new IllegalArgumentException( "Domain with id " + domain_id + " already exists" ); } @@ -65,7 +64,7 @@ class PrintableSpeciesSpecificDomainSimilariyData implements SpeciesSpecificDoma } @Override - public SortedMap getCombinableDomainIdToCountsMap() { + public SortedMap getCombinableDomainIdToCountsMap() { return _combinable_domain_id_to_count_map; } @@ -86,7 +85,7 @@ class PrintableSpeciesSpecificDomainSimilariyData implements SpeciesSpecificDoma } @Override - public int getNumberOfProteinsExhibitingCombinationWith( final DomainId domain_id ) { + public int getNumberOfProteinsExhibitingCombinationWith( final String domain_id ) { if ( !getCombinableDomainIdToCountsMap().containsKey( domain_id ) ) { throw new IllegalArgumentException( "Domain with id " + domain_id + " not found" ); } @@ -121,17 +120,17 @@ class PrintableSpeciesSpecificDomainSimilariyData implements SpeciesSpecificDoma sb.append( ":" ); } } - final Set ids = getCombinableDomainIdToCountsMap().keySet(); + final Set ids = getCombinableDomainIdToCountsMap().keySet(); int i = 0; - for( final DomainId domain_id : ids ) { + for( final String domain_id : ids ) { ++i; sb.append( " " ); if ( html ) { - sb.append( "" - + domain_id.getId() + "" ); + sb.append( "" + domain_id + + "" ); } else { - sb.append( domain_id.getId() ); + sb.append( domain_id ); } if ( detailedness == DomainSimilarityCalculator.Detailedness.PUNCTILIOUS ) { sb.append( ":" ); diff --git a/forester/java/src/org/forester/surfacing/SimpleDomain.java b/forester/java/src/org/forester/surfacing/SimpleDomain.java index 5182865..2d1826e 100644 --- a/forester/java/src/org/forester/surfacing/SimpleDomain.java +++ b/forester/java/src/org/forester/surfacing/SimpleDomain.java @@ -26,9 +26,7 @@ package org.forester.surfacing; -import org.forester.go.GoId; import org.forester.protein.Domain; -import org.forester.protein.DomainId; import org.forester.util.ForesterUtil; /* @@ -37,20 +35,19 @@ import org.forester.util.ForesterUtil; */ public class SimpleDomain implements Domain { - final private DomainId _id; + final private String _id; - public SimpleDomain( final String id_str ) { - if ( ForesterUtil.isEmpty( id_str ) ) { + public SimpleDomain( final String id ) { + if ( ForesterUtil.isEmpty( id ) ) { throw new IllegalArgumentException( "attempt to create protein domain with null or empty id" ); } - _id = new DomainId( id_str ); - } - - @Override - public void addGoId( final GoId go_id ) { - throw new RuntimeException( "method not implemented" ); + _id = 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 ) { @@ -60,7 +57,7 @@ public class SimpleDomain implements Domain { } @Override - public DomainId getDomainId() { + public String getDomainId() { return _id; } @@ -69,11 +66,10 @@ 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 GoId getGoId( final int i ) { + // ^^ throw new RuntimeException( "method not implemented" ); + // ^^ } @Override public int getLength() { throw new RuntimeException( "method not implemented" ); @@ -84,11 +80,10 @@ public class SimpleDomain implements Domain { throw new RuntimeException( "method not implemented" ); } - @Override - public int getNumberOfGoIds() { - 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" ); diff --git a/forester/java/src/org/forester/surfacing/SpeciesSpecificDomainSimilariyData.java b/forester/java/src/org/forester/surfacing/SpeciesSpecificDomainSimilariyData.java index d605344..0e45491 100644 --- a/forester/java/src/org/forester/surfacing/SpeciesSpecificDomainSimilariyData.java +++ b/forester/java/src/org/forester/surfacing/SpeciesSpecificDomainSimilariyData.java @@ -29,14 +29,12 @@ package org.forester.surfacing; import java.util.SortedMap; -import org.forester.protein.DomainId; - /* * A helper class for PrintableDomainSimilarity. */ interface SpeciesSpecificDomainSimilariyData { - public void addProteinsExhibitingCombinationCount( final DomainId domain_id, final int count ); + public void addProteinsExhibitingCombinationCount( final String domain_id, final int count ); /** * This should return a sorted map mapping domain ids to their corresponding @@ -44,9 +42,9 @@ interface SpeciesSpecificDomainSimilariyData { * * @return a sorted map mapping domain ids to their corresponding counts */ - public SortedMap getCombinableDomainIdToCountsMap(); + public SortedMap getCombinableDomainIdToCountsMap(); - public int getNumberOfProteinsExhibitingCombinationWith( final DomainId domain_id ); + public int getNumberOfProteinsExhibitingCombinationWith( final String domain_id ); public StringBuffer toStringBuffer( final DomainSimilarityCalculator.Detailedness detailedness, boolean html ); } diff --git a/forester/java/src/org/forester/surfacing/SurfacingUtil.java b/forester/java/src/org/forester/surfacing/SurfacingUtil.java index ebce1cc..49991d0 100644 --- a/forester/java/src/org/forester/surfacing/SurfacingUtil.java +++ b/forester/java/src/org/forester/surfacing/SurfacingUtil.java @@ -79,7 +79,6 @@ import org.forester.protein.BasicDomain; import org.forester.protein.BasicProtein; import org.forester.protein.BinaryDomainCombination; import org.forester.protein.Domain; -import org.forester.protein.DomainId; import org.forester.protein.Protein; import org.forester.species.Species; import org.forester.surfacing.DomainSimilarityCalculator.Detailedness; @@ -123,16 +122,16 @@ public final class SurfacingUtil { public static void addAllBinaryDomainCombinationToSet( final GenomeWideCombinableDomains genome, final SortedSet binary_domain_combinations ) { - final SortedMap all_cd = genome.getAllCombinableDomainsIds(); - for( final DomainId domain_id : all_cd.keySet() ) { + final SortedMap all_cd = genome.getAllCombinableDomainsIds(); + for( final String domain_id : all_cd.keySet() ) { binary_domain_combinations.addAll( all_cd.get( domain_id ).toBinaryDomainCombinations() ); } } public static void addAllDomainIdsToSet( final GenomeWideCombinableDomains genome, - final SortedSet domain_ids ) { - final SortedSet domains = genome.getAllDomainIds(); - for( final DomainId domain : domains ) { + final SortedSet domain_ids ) { + final SortedSet domains = genome.getAllDomainIds(); + for( final String domain : domains ) { domain_ids.add( domain ); } } @@ -220,9 +219,8 @@ public final class SurfacingUtil { } } - public static Map> createDomainIdToGoIdMap( final List pfam_to_go_mappings ) { - final Map> domain_id_to_go_ids_map = new HashMap>( pfam_to_go_mappings - .size() ); + public static Map> createDomainIdToGoIdMap( final List pfam_to_go_mappings ) { + final Map> domain_id_to_go_ids_map = new HashMap>( pfam_to_go_mappings.size() ); for( final PfamToGoMapping pfam_to_go : pfam_to_go_mappings ) { if ( !domain_id_to_go_ids_map.containsKey( pfam_to_go.getKey() ) ) { domain_id_to_go_ids_map.put( pfam_to_go.getKey(), new ArrayList() ); @@ -232,12 +230,12 @@ public final class SurfacingUtil { return domain_id_to_go_ids_map; } - public static Map> createDomainIdToSecondaryFeaturesMap( final File secondary_features_map_file ) + public static Map> createDomainIdToSecondaryFeaturesMap( final File secondary_features_map_file ) throws IOException { final BasicTable primary_table = BasicTableParser.parse( secondary_features_map_file, '\t' ); - final Map> map = new TreeMap>(); + final Map> map = new TreeMap>(); for( int r = 0; r < primary_table.getNumberOfRows(); ++r ) { - final DomainId domain_id = new DomainId( primary_table.getValue( 0, r ) ); + final String domain_id = primary_table.getValue( 0, r ); if ( !map.containsKey( domain_id ) ) { map.put( domain_id, new HashSet() ); } @@ -307,7 +305,7 @@ public final class SurfacingUtil { } public static void doit( final List proteins, - final List query_domain_ids_nc_order, + final List query_domain_ids_nc_order, final Writer out, final String separator, final String limit_to_species, @@ -321,7 +319,7 @@ public final class SurfacingUtil { out.write( protein.getProteinId().getId() ); out.write( separator ); out.write( "[" ); - final Set visited_domain_ids = new HashSet(); + final Set visited_domain_ids = new HashSet(); boolean first = true; for( final Domain domain : protein.getProteinDomains() ) { if ( !visited_domain_ids.contains( domain.getDomainId() ) ) { @@ -332,7 +330,7 @@ public final class SurfacingUtil { else { out.write( " " ); } - out.write( domain.getDomainId().getId() ); + out.write( domain.getDomainId() ); out.write( " {" ); out.write( "" + domain.getTotalCount() ); out.write( "}" ); @@ -378,7 +376,7 @@ public final class SurfacingUtil { 1 + all_genomes_domains_per_potein_histo.get( domains ) ); } if ( domains == 1 ) { - final String domain = protein.getProteinDomain( 0 ).getDomainId().getId(); + final String domain = protein.getProteinDomain( 0 ).getDomainId(); if ( !domains_which_are_sometimes_single_sometimes_not.contains( domain ) ) { if ( domains_which_never_single.contains( domain ) ) { domains_which_never_single.remove( domain ); @@ -391,7 +389,7 @@ public final class SurfacingUtil { } else if ( domains > 1 ) { for( final Domain d : protein.getProteinDomains() ) { - final String domain = d.getDomainId().getId(); + final String domain = d.getDomainId(); // System.out.println( domain ); if ( !domains_which_are_sometimes_single_sometimes_not.contains( domain ) ) { if ( domains_which_are_always_single.contains( domain ) ) { @@ -526,12 +524,12 @@ public final class SurfacingUtil { final String outfile_name, final DomainParsimonyCalculator domain_parsimony, final Phylogeny phylogeny, - final Map> domain_id_to_go_ids_map, + final Map> domain_id_to_go_ids_map, final Map go_id_to_term_map, final GoNameSpace go_namespace_limit, final String parameters_str, - final Map>[] domain_id_to_secondary_features_maps, - final SortedSet positive_filter, + final Map>[] domain_id_to_secondary_features_maps, + final SortedSet positive_filter, final boolean output_binary_domain_combinations_for_graphs, final List all_binary_domains_combination_gained_fitch, final List all_binary_domains_combination_lost_fitch, @@ -856,7 +854,7 @@ public final class SurfacingUtil { } public static void extractProteinNames( final List proteins, - final List query_domain_ids_nc_order, + final List query_domain_ids_nc_order, final Writer out, final String separator, final String limit_to_species ) throws IOException { @@ -869,7 +867,7 @@ public final class SurfacingUtil { out.write( protein.getProteinId().getId() ); out.write( separator ); out.write( "[" ); - final Set visited_domain_ids = new HashSet(); + final Set visited_domain_ids = new HashSet(); boolean first = true; for( final Domain domain : protein.getProteinDomains() ) { if ( !visited_domain_ids.contains( domain.getDomainId() ) ) { @@ -880,7 +878,7 @@ public final class SurfacingUtil { else { out.write( " " ); } - out.write( domain.getDomainId().getId() ); + out.write( domain.getDomainId() ); out.write( " {" ); out.write( "" + domain.getTotalCount() ); out.write( "}" ); @@ -905,7 +903,7 @@ public final class SurfacingUtil { } public static void extractProteinNames( final SortedMap> protein_lists_per_species, - final DomainId domain_id, + final String domain_id, final Writer out, final String separator, final String limit_to_species, @@ -980,10 +978,10 @@ public final class SurfacingUtil { out.flush(); } - public static SortedSet getAllDomainIds( final List gwcd_list ) { - final SortedSet all_domains_ids = new TreeSet(); + public static SortedSet getAllDomainIds( final List gwcd_list ) { + final SortedSet all_domains_ids = new TreeSet(); for( final GenomeWideCombinableDomains gwcd : gwcd_list ) { - final Set all_domains = gwcd.getAllDomainIds(); + final Set all_domains = gwcd.getAllDomainIds(); // for( final Domain domain : all_domains ) { all_domains_ids.addAll( all_domains ); // } @@ -996,7 +994,7 @@ public final class SurfacingUtil { for( final Protein protein_domain_collection : protein_domain_collections ) { for( final Object name : protein_domain_collection.getProteinDomains() ) { final BasicDomain protein_domain = ( BasicDomain ) name; - final String id = protein_domain.getDomainId().getId(); + final String id = protein_domain.getDomainId(); if ( map.containsKey( id ) ) { map.put( id, map.get( id ) + 1 ); } @@ -1136,7 +1134,7 @@ public final class SurfacingUtil { if ( domains.size() > 1 ) { final Map counts = new HashMap(); for( final Domain domain : domains ) { - final String id = domain.getDomainId().getId(); + final String id = domain.getDomainId(); if ( counts.containsKey( id ) ) { counts.put( id, counts.get( id ) + 1 ); } @@ -1153,24 +1151,24 @@ public final class SurfacingUtil { domain_n = domains.get( j ); domain_c = domains.get( i ); } - final String dc = domain_n.getDomainId().getId() + domain_c.getDomainId().getId(); + final String dc = domain_n.getDomainId() + domain_c.getDomainId(); if ( !dcs.contains( dc ) ) { dcs.add( dc ); sb.append( protein.getSpecies() ); sb.append( separator ); sb.append( protein_id ); sb.append( separator ); - sb.append( domain_n.getDomainId().getId() ); + sb.append( domain_n.getDomainId() ); sb.append( separator ); - sb.append( domain_c.getDomainId().getId() ); + sb.append( domain_c.getDomainId() ); sb.append( separator ); sb.append( domain_n.getPerDomainEvalue() ); sb.append( separator ); sb.append( domain_c.getPerDomainEvalue() ); sb.append( separator ); - sb.append( counts.get( domain_n.getDomainId().getId() ) ); + sb.append( counts.get( domain_n.getDomainId() ) ); sb.append( separator ); - sb.append( counts.get( domain_c.getDomainId().getId() ) ); + sb.append( counts.get( domain_c.getDomainId() ) ); sb.append( ForesterUtil.LINE_SEPARATOR ); } } @@ -1181,7 +1179,7 @@ public final class SurfacingUtil { sb.append( separator ); sb.append( protein_id ); sb.append( separator ); - sb.append( domains.get( 0 ).getDomainId().getId() ); + sb.append( domains.get( 0 ).getDomainId() ); sb.append( separator ); sb.append( separator ); sb.append( domains.get( 0 ).getPerDomainEvalue() ); @@ -1432,7 +1430,7 @@ public final class SurfacingUtil { ForesterUtil.programMessage( surfacing.PRG_NAME, "Wrote characters list: \"" + filename + "\"" ); } - public static void writeBinaryStatesMatrixToList( final Map> domain_id_to_go_ids_map, + public static void writeBinaryStatesMatrixToList( final Map> domain_id_to_go_ids_map, final Map go_id_to_term_map, final GoNameSpace go_namespace_limit, final boolean domain_combinations, @@ -1443,7 +1441,7 @@ public final class SurfacingUtil { final String character_separator, final String title_for_html, final String prefix_for_html, - final Map>[] domain_id_to_secondary_features_maps, + final Map>[] domain_id_to_secondary_features_maps, final SortedSet all_pfams_encountered, final SortedSet pfams_gained_or_lost, final String suffix_for_per_node_events_file, @@ -1648,9 +1646,9 @@ public final class SurfacingUtil { per_genome_domain_promiscuity_statistics_writer.write( ( int ) stats.getMin() + "\t" ); per_genome_domain_promiscuity_statistics_writer.write( ( int ) stats.getMax() + "\t" ); per_genome_domain_promiscuity_statistics_writer.write( stats.getN() + "\t" ); - final SortedSet mpds = gwcd.getMostPromiscuosDomain(); - for( final DomainId mpd : mpds ) { - per_genome_domain_promiscuity_statistics_writer.write( mpd.getId() + " " ); + final SortedSet mpds = gwcd.getMostPromiscuosDomain(); + for( final String mpd : mpds ) { + per_genome_domain_promiscuity_statistics_writer.write( mpd + " " ); } per_genome_domain_promiscuity_statistics_writer.write( ForesterUtil.LINE_SEPARATOR ); } @@ -1872,18 +1870,20 @@ public final class SurfacingUtil { } if ( single_writer != null ) { single_writer.write( similarity.toStringBuffer( print_option, tax_code_to_id_map ).toString() ); + single_writer.write( SurfacingConstants.NL ); } else { - Writer local_writer = split_writers.get( ( similarity.getDomainId().getId().charAt( 0 ) + "" ) - .toLowerCase().charAt( 0 ) ); + Writer local_writer = split_writers.get( ( similarity.getDomainId().charAt( 0 ) + "" ).toLowerCase() + .charAt( 0 ) ); if ( local_writer == null ) { local_writer = split_writers.get( '0' ); } local_writer.write( similarity.toStringBuffer( print_option, tax_code_to_id_map ).toString() ); + local_writer.write( SurfacingConstants.NL ); } - for( final Writer w : split_writers.values() ) { - w.write( SurfacingConstants.NL ); - } + // for( final Writer w : split_writers.values() ) { + //w.write( SurfacingConstants.NL ); + // } } switch ( print_option ) { case HTML: @@ -2370,9 +2370,9 @@ public final class SurfacingUtil { } private static SortedSet createSetOfAllBinaryDomainCombinationsPerGenome( final GenomeWideCombinableDomains gwcd ) { - final SortedMap cds = gwcd.getAllCombinableDomainsIds(); + final SortedMap cds = gwcd.getAllCombinableDomainsIds(); final SortedSet binary_combinations = new TreeSet(); - for( final DomainId domain_id : cds.keySet() ) { + for( final String domain_id : cds.keySet() ) { final CombinableDomains cd = cds.get( domain_id ); binary_combinations.addAll( cd.toBinaryDomainCombinations() ); } @@ -2392,7 +2392,7 @@ public final class SurfacingUtil { return l; } - private static void writeAllEncounteredPfamsToFile( final Map> domain_id_to_go_ids_map, + private static void writeAllEncounteredPfamsToFile( final Map> domain_id_to_go_ids_map, final Map go_id_to_term_map, final String outfile_name, final SortedSet all_pfams_encountered ) { @@ -2420,7 +2420,7 @@ public final class SurfacingUtil { for( final String pfam : all_pfams_encountered ) { all_pfams_encountered_writer.write( pfam ); all_pfams_encountered_writer.write( ForesterUtil.LINE_SEPARATOR ); - final DomainId domain_id = new DomainId( pfam ); + final String domain_id = new String( pfam ); if ( domain_id_to_go_ids_map.containsKey( domain_id ) ) { ++pfams_with_mappings_counter; all_pfams_encountered_with_go_annotation_writer.write( pfam ); @@ -2530,7 +2530,7 @@ public final class SurfacingUtil { } } - private static void writeDomainData( final Map> domain_id_to_go_ids_map, + private static void writeDomainData( final Map> domain_id_to_go_ids_map, final Map go_id_to_term_map, final GoNameSpace go_namespace_limit, final Writer out, @@ -2538,7 +2538,7 @@ public final class SurfacingUtil { final String domain_1, final String prefix_for_html, final String character_separator_for_non_html_output, - final Map>[] domain_id_to_secondary_features_maps, + final Map>[] domain_id_to_secondary_features_maps, final Set all_go_ids ) throws IOException { boolean any_go_annotation_present = false; boolean first_has_no_go = false; @@ -2551,22 +2551,20 @@ public final class SurfacingUtil { List go_ids = null; boolean go_annotation_present = false; if ( d == 0 ) { - final DomainId domain_id = new DomainId( domain_0 ); - if ( domain_id_to_go_ids_map.containsKey( domain_id ) ) { + if ( domain_id_to_go_ids_map.containsKey( domain_0 ) ) { go_annotation_present = true; any_go_annotation_present = true; - go_ids = domain_id_to_go_ids_map.get( domain_id ); + go_ids = domain_id_to_go_ids_map.get( domain_0 ); } else { first_has_no_go = true; } } else { - final DomainId domain_id = new DomainId( domain_1 ); - if ( domain_id_to_go_ids_map.containsKey( domain_id ) ) { + if ( domain_id_to_go_ids_map.containsKey( domain_1 ) ) { go_annotation_present = true; any_go_annotation_present = true; - go_ids = domain_id_to_go_ids_map.get( domain_id ); + go_ids = domain_id_to_go_ids_map.get( domain_1 ); } } if ( go_annotation_present ) { @@ -2639,7 +2637,7 @@ public final class SurfacingUtil { final String domain_0, final String domain_1, final String prefix_for_detailed_html, - final Map>[] domain_id_to_secondary_features_maps ) + final Map>[] domain_id_to_secondary_features_maps ) throws IOException { out.write( "" ); if ( !ForesterUtil.isEmpty( prefix_for_detailed_html ) ) { diff --git a/forester/java/src/org/forester/surfacing/TestSurfacing.java b/forester/java/src/org/forester/surfacing/TestSurfacing.java index 3efaccb..4ab0fb0 100644 --- a/forester/java/src/org/forester/surfacing/TestSurfacing.java +++ b/forester/java/src/org/forester/surfacing/TestSurfacing.java @@ -53,7 +53,6 @@ import org.forester.protein.BasicProtein; import org.forester.protein.BinaryDomainCombination; import org.forester.protein.BinaryDomainCombination.DomainCombinationType; import org.forester.protein.Domain; -import org.forester.protein.DomainId; import org.forester.protein.Protein; import org.forester.protein.ProteinId; import org.forester.species.BasicSpecies; @@ -336,7 +335,7 @@ public class TestSurfacing { true ); final Iterator sims_it = sims.iterator(); final DomainSimilarity sa = sims_it.next(); - if ( !sa.getDomainId().getId().equals( "A" ) ) { + if ( !sa.getDomainId().equals( "A" ) ) { return false; } if ( sa.getSpeciesData().size() != 4 ) { @@ -377,7 +376,7 @@ public class TestSurfacing { return false; } final DomainSimilarity sb = sims_it.next(); - if ( !sb.getDomainId().getId().equals( "B" ) ) { + if ( !sb.getDomainId().equals( "B" ) ) { return false; } if ( sb.getSpeciesData().size() != 2 ) { @@ -411,7 +410,7 @@ public class TestSurfacing { return false; } final DomainSimilarity sc = sims_it.next(); - if ( !sc.getDomainId().getId().equals( "C" ) ) { + if ( !sc.getDomainId().equals( "C" ) ) { return false; } if ( sc.getSpeciesData().size() != 3 ) { @@ -486,7 +485,7 @@ public class TestSurfacing { true ); final Iterator sims_it2 = sims2.iterator(); final DomainSimilarity sa2 = sims_it2.next(); - if ( !sa2.getDomainId().getId().equals( "A" ) ) { + if ( !sa2.getDomainId().equals( "A" ) ) { return false; } if ( sa2.getSpeciesData().size() != 4 ) { @@ -573,23 +572,23 @@ public class TestSurfacing { true ); final Iterator sims_it3 = sims3.iterator(); final DomainSimilarity sa3 = sims_it3.next(); - if ( !sa3.getDomainId().getId().equals( "A" ) ) { + if ( !sa3.getDomainId().equals( "A" ) ) { return false; } final SpeciesSpecificDomainSimilariyData ssdsd = sa3.getSpeciesData().get( new BasicSpecies( "ciona" ) ); if ( ssdsd.getCombinableDomainIdToCountsMap().size() != 4 ) { return false; } - if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "B" ) ) != 2 ) { + if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( "B" ) != 2 ) { return false; } - if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "F" ) ) != 2 ) { + if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( "F" ) != 2 ) { return false; } - if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "G" ) ) != 2 ) { + if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( "G" ) != 2 ) { return false; } - if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "X" ) ) != 3 ) { + if ( ssdsd.getNumberOfProteinsExhibitingCombinationWith( "X" ) != 3 ) { return false; } final List cdc_list4 = new ArrayList(); @@ -616,33 +615,33 @@ public class TestSurfacing { true ); final Iterator sims_it4 = sims4.iterator(); final DomainSimilarity sa4 = sims_it4.next(); - if ( !sa4.getDomainId().getId().equals( "A" ) ) { + if ( !sa4.getDomainId().equals( "A" ) ) { return false; } final SpeciesSpecificDomainSimilariyData ssdsd4 = sa4.getSpeciesData().get( new BasicSpecies( "ciona" ) ); if ( ssdsd4.getCombinableDomainIdToCountsMap().size() != 5 ) { return false; } - if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "A" ) ) != 3 ) { + if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( "A" ) != 3 ) { return false; } - if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "B" ) ) != 2 ) { + if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( "B" ) != 2 ) { return false; } - if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "F" ) ) != 2 ) { + if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( "F" ) != 2 ) { return false; } - if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "G" ) ) != 2 ) { + if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( "G" ) != 2 ) { return false; } - if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "X" ) ) != 3 ) { + if ( ssdsd4.getNumberOfProteinsExhibitingCombinationWith( "X" ) != 3 ) { return false; } final SortedSet sims4_d = calc4 .calculateSimilarities( new DomainCountsBasedPairwiseSimilarityCalculator(), cdc_list4, false, true ); final Iterator sims_it4_d = sims4_d.iterator(); final DomainSimilarity sa4_d = sims_it4_d.next(); - if ( !sa4_d.getDomainId().getId().equals( "A" ) ) { + if ( !sa4_d.getDomainId().equals( "A" ) ) { return false; } if ( sa4_d.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).size() != 5 ) { @@ -669,25 +668,25 @@ public class TestSurfacing { true ); final Iterator sims_it4_p = sims4_p.iterator(); final DomainSimilarity sa4_p = sims_it4_p.next(); - if ( !sa4_p.getDomainId().getId().equals( "A" ) ) { + if ( !sa4_p.getDomainId().equals( "A" ) ) { return false; } if ( sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).size() != 5 ) { return false; } - if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( new DomainId( "A" ) ) ) { + if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( "A" ) ) { return false; } - if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( new DomainId( "B" ) ) ) { + if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( "B" ) ) { return false; } - if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( new DomainId( "F" ) ) ) { + if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( "F" ) ) { return false; } - if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( new DomainId( "G" ) ) ) { + if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( "G" ) ) { return false; } - if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( new DomainId( "X" ) ) ) { + if ( !sa4_p.getCombinableDomainIds( new BasicSpecies( "ciona" ) ).contains( "X" ) ) { return false; } if ( !TestSurfacing @@ -731,38 +730,38 @@ public class TestSurfacing { if ( ssdsd5.getCombinableDomainIdToCountsMap().size() != 4 ) { return false; } - if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "B" ) ) != 2 ) { + if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( "B" ) != 2 ) { return false; } - if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "F" ) ) != 2 ) { + if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( "F" ) != 2 ) { return false; } - if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "G" ) ) != 2 ) { + if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( "G" ) != 2 ) { return false; } - if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "X" ) ) != 3 ) { + if ( ssdsd5.getNumberOfProteinsExhibitingCombinationWith( "X" ) != 3 ) { return false; } - if ( !sa5_d.getDomainId().getId().equals( "A" ) ) { + if ( !sa5_d.getDomainId().equals( "A" ) ) { return false; } final Species ciona = new BasicSpecies( "ciona" ); if ( sa5_d.getCombinableDomainIds( ciona ).size() != 4 ) { return false; } - if ( sa5_d.getCombinableDomainIds( ciona ).contains( new DomainId( "A" ) ) ) { + if ( sa5_d.getCombinableDomainIds( ciona ).contains( "A" ) ) { return false; } - if ( !sa5_d.getCombinableDomainIds( ciona ).contains( new DomainId( "B" ) ) ) { + if ( !sa5_d.getCombinableDomainIds( ciona ).contains( "B" ) ) { return false; } - if ( !sa5_d.getCombinableDomainIds( ciona ).contains( new DomainId( "F" ) ) ) { + if ( !sa5_d.getCombinableDomainIds( ciona ).contains( "F" ) ) { return false; } - if ( !sa5_d.getCombinableDomainIds( ciona ).contains( new DomainId( "G" ) ) ) { + if ( !sa5_d.getCombinableDomainIds( ciona ).contains( "G" ) ) { return false; } - if ( !sa5_d.getCombinableDomainIds( ciona ).contains( new DomainId( "X" ) ) ) { + if ( !sa5_d.getCombinableDomainIds( ciona ).contains( "X" ) ) { return false; } if ( !TestSurfacing @@ -795,25 +794,25 @@ public class TestSurfacing { true ); final Iterator sims_it5_p = sims5_p.iterator(); final DomainSimilarity sa5_p = sims_it5_p.next(); - if ( !sa5_p.getDomainId().getId().equals( "A" ) ) { + if ( !sa5_p.getDomainId().equals( "A" ) ) { return false; } if ( sa5_p.getCombinableDomainIds( ciona ).size() != 4 ) { return false; } - if ( sa5_p.getCombinableDomainIds( ciona ).contains( new DomainId( "A" ) ) ) { + if ( sa5_p.getCombinableDomainIds( ciona ).contains( "A" ) ) { return false; } - if ( !sa5_p.getCombinableDomainIds( ciona ).contains( new DomainId( "B" ) ) ) { + if ( !sa5_p.getCombinableDomainIds( ciona ).contains( "B" ) ) { return false; } - if ( !sa5_p.getCombinableDomainIds( ciona ).contains( new DomainId( "F" ) ) ) { + if ( !sa5_p.getCombinableDomainIds( ciona ).contains( "F" ) ) { return false; } - if ( !sa5_p.getCombinableDomainIds( ciona ).contains( new DomainId( "G" ) ) ) { + if ( !sa5_p.getCombinableDomainIds( ciona ).contains( "G" ) ) { return false; } - if ( !sa5_p.getCombinableDomainIds( ciona ).contains( new DomainId( "X" ) ) ) { + if ( !sa5_p.getCombinableDomainIds( ciona ).contains( "X" ) ) { return false; } if ( !TestSurfacing @@ -866,38 +865,38 @@ public class TestSurfacing { if ( ssdsd6.getCombinableDomainIdToCountsMap().size() != 5 ) { return false; } - if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "B" ) ) != 2 ) { + if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( "B" ) != 2 ) { return false; } - if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "F" ) ) != 2 ) { + if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( "F" ) != 2 ) { return false; } - if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "G" ) ) != 2 ) { + if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( "G" ) != 2 ) { return false; } - if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( new DomainId( "X" ) ) != 3 ) { + if ( ssdsd6.getNumberOfProteinsExhibitingCombinationWith( "X" ) != 3 ) { return false; } - if ( !sa5_d.getDomainId().getId().equals( "A" ) ) { + if ( !sa5_d.getDomainId().equals( "A" ) ) { return false; } final Species ciona6 = new BasicSpecies( "ciona" ); if ( sa6_d.getCombinableDomainIds( ciona6 ).size() != 5 ) { return false; } - if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( new DomainId( "A" ) ) ) { + if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( "A" ) ) { return false; } - if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( new DomainId( "B" ) ) ) { + if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( "B" ) ) { return false; } - if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( new DomainId( "F" ) ) ) { + if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( "F" ) ) { return false; } - if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( new DomainId( "G" ) ) ) { + if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( "G" ) ) { return false; } - if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( new DomainId( "X" ) ) ) { + if ( !sa6_d.getCombinableDomainIds( ciona6 ).contains( "X" ) ) { return false; } if ( !TestSurfacing @@ -930,25 +929,25 @@ public class TestSurfacing { true ); final Iterator sims_it6_p = sims6_p.iterator(); final DomainSimilarity sa6_p = sims_it6_p.next(); - if ( !sa6_p.getDomainId().getId().equals( "A" ) ) { + if ( !sa6_p.getDomainId().equals( "A" ) ) { return false; } if ( sa6_p.getCombinableDomainIds( ciona ).size() != 5 ) { return false; } - if ( !sa6_p.getCombinableDomainIds( ciona ).contains( new DomainId( "A" ) ) ) { + if ( !sa6_p.getCombinableDomainIds( ciona ).contains( "A" ) ) { return false; } - if ( !sa6_p.getCombinableDomainIds( ciona ).contains( new DomainId( "B" ) ) ) { + if ( !sa6_p.getCombinableDomainIds( ciona ).contains( "B" ) ) { return false; } - if ( !sa6_p.getCombinableDomainIds( ciona ).contains( new DomainId( "F" ) ) ) { + if ( !sa6_p.getCombinableDomainIds( ciona ).contains( "F" ) ) { return false; } - if ( !sa6_p.getCombinableDomainIds( ciona ).contains( new DomainId( "G" ) ) ) { + if ( !sa6_p.getCombinableDomainIds( ciona ).contains( "G" ) ) { return false; } - if ( !sa6_p.getCombinableDomainIds( ciona ).contains( new DomainId( "X" ) ) ) { + if ( !sa6_p.getCombinableDomainIds( ciona ).contains( "X" ) ) { return false; } if ( !TestSurfacing @@ -1047,7 +1046,7 @@ public class TestSurfacing { false ); final Iterator sims_it = sims.iterator(); final DomainSimilarity sa = sims_it.next(); - if ( !sa.getDomainId().getId().equals( "A" ) ) { + if ( !sa.getDomainId().equals( "A" ) ) { return false; } if ( sa.getSpeciesData().size() != 1 ) { @@ -1078,7 +1077,7 @@ public class TestSurfacing { return false; } final DomainSimilarity sb = sims_it.next(); - if ( !sb.getDomainId().getId().equals( "B" ) ) { + if ( !sb.getDomainId().equals( "B" ) ) { return false; } if ( sb.getSpeciesData().size() != 1 ) { @@ -1094,7 +1093,7 @@ public class TestSurfacing { true ); final Iterator sims_it2 = sims2.iterator(); final DomainSimilarity sa2 = sims_it2.next(); - if ( !sa2.getDomainId().getId().equals( "D" ) ) { + if ( !sa2.getDomainId().equals( "D" ) ) { return false; } if ( sa2.getSpeciesData().size() != 2 ) { @@ -1158,7 +1157,7 @@ public class TestSurfacing { } final Iterator sims_it = sims.iterator(); final DomainSimilarity sa = sims_it.next(); - if ( !sa.getDomainId().getId().equals( "A" ) ) { + if ( !sa.getDomainId().equals( "A" ) ) { return false; } if ( sa.getSpeciesData().size() != 4 ) { @@ -1277,17 +1276,18 @@ public class TestSurfacing { final SortedSet sorted = new TreeSet(); sorted.add( s0 ); sorted.add( s1 ); - sorted.add( s2 ); + sorted.add( s2 );// sorted.add( s3 ); - sorted.add( s3 ); - sorted.add( s3 ); - sorted.add( s4 ); + sorted.add( s3 );// + sorted.add( s3 );// + sorted.add( s4 );// sorted.add( s5 ); sorted.add( s6 ); sorted.add( s7 ); - sorted.add( s7 ); + sorted.add( s7 );// sorted.add( s8 ); - if ( sorted.size() != 6 ) { + if ( sorted.size() != 7 ) { + System.out.println( sorted.size() ); return false; } final DirectedBinaryDomainCombination aa = new DirectedBinaryDomainCombination( "a", "a" ); @@ -2751,7 +2751,7 @@ public class TestSurfacing { if ( !calc_i.getSharedDomains().contains( f.getDomainId() ) ) { return false; } - final Set all = calc_ni.getAllDomains(); + final Set all = calc_ni.getAllDomains(); if ( !all.contains( a.getDomainId() ) ) { return false; } @@ -3226,8 +3226,8 @@ public class TestSurfacing { } calc_u.setAllowDomainsToBeIgnored( true ); calc_u.addDomainIdToIgnore( u.getDomainId() ); - calc_u.addDomainIdToIgnore( new DomainId( "other" ) ); - calc_u.addDomainIdToIgnore( new DomainId( "other_too" ) ); + calc_u.addDomainIdToIgnore( "other" ); + calc_u.addDomainIdToIgnore( "other_too" ); if ( calc_u.getAllDomains().size() != 5 ) { return false; } @@ -3331,10 +3331,10 @@ public class TestSurfacing { //------------ calc_u.setAllowDomainsToBeIgnored( true ); calc_u.deleteAllDomainIdsToIgnore(); - calc_u.addDomainIdToIgnore( new DomainId( "v" ) ); - calc_u.addDomainIdToIgnore( new DomainId( "w" ) ); - calc_u.addDomainIdToIgnore( new DomainId( "other" ) ); - calc_u.addDomainIdToIgnore( new DomainId( "other_too" ) ); + calc_u.addDomainIdToIgnore( "v" ); + calc_u.addDomainIdToIgnore( "w" ); + calc_u.addDomainIdToIgnore( "other" ); + calc_u.addDomainIdToIgnore( "other_too" ); if ( calc_u.getAllDomains().size() != 4 ) { return false; } @@ -3453,7 +3453,7 @@ public class TestSurfacing { final List domain_collections = parser.parse(); final BasicGenomeWideCombinableDomains cdcc = BasicGenomeWideCombinableDomains .createInstance( domain_collections, false, new BasicSpecies( "human" ) ); - CombinableDomains cd = cdcc.get( new DomainId( "A" ) ); + CombinableDomains cd = cdcc.get( "A" ); if ( cd.getKeyDomainCount() != 9 ) { return false; } @@ -3502,7 +3502,7 @@ public class TestSurfacing { if ( cd.getKeyDomainCount() != 9 ) { return false; } - cd = cdcc.get( new DomainId( "B" ) ); + cd = cdcc.get( "B" ); if ( cd.getKeyDomainCount() != 12 ) { return false; } @@ -3551,7 +3551,7 @@ public class TestSurfacing { if ( cd.getKeyDomainCount() != 12 ) { return false; } - cd = cdcc.get( new DomainId( "C" ) ); + cd = cdcc.get( "C" ); if ( cd.getKeyDomainCount() != 10 ) { return false; } @@ -3597,7 +3597,7 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "NN" ).getDomainId() ) != 0 ) { return false; } - cd = cdcc.get( new DomainId( "D" ) ); + cd = cdcc.get( "D" ); if ( cd.getKeyDomainCount() != 15 ) { return false; } @@ -3607,7 +3607,7 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 11 ) { return false; } - cd = cdcc.get( new DomainId( "E" ) ); + cd = cdcc.get( "E" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } @@ -3617,7 +3617,7 @@ public class TestSurfacing { if ( cd.getKeyDomainProteinsCount() != 1 ) { return false; } - cd = cdcc.get( new DomainId( "U" ) ); + cd = cdcc.get( "U" ); if ( cd.getNumberOfCombinableDomains() != 11 ) { return false; } @@ -3627,7 +3627,7 @@ public class TestSurfacing { if ( cd.getKeyDomainProteinsCount() != 3 ) { return false; } - cd = cdcc.get( new DomainId( "V" ) ); + cd = cdcc.get( "V" ); if ( cd.getNumberOfCombinableDomains() != 11 ) { return false; } @@ -3637,7 +3637,7 @@ public class TestSurfacing { if ( cd.getKeyDomainProteinsCount() != 2 ) { return false; } - cd = cdcc.get( new DomainId( "W" ) ); + cd = cdcc.get( "W" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } @@ -3647,22 +3647,22 @@ public class TestSurfacing { if ( cd.getKeyDomainProteinsCount() != 2 ) { return false; } - cd = cdcc.get( new DomainId( "X" ) ); + cd = cdcc.get( "X" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } if ( cd.getKeyDomainCount() != 2 ) { return false; } - cd = cdcc.get( new DomainId( "Y" ) ); + cd = cdcc.get( "Y" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc.get( new DomainId( "Z" ) ); + cd = cdcc.get( "Z" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc.get( new DomainId( "NN" ) ); + cd = cdcc.get( "NN" ); if ( cd.getKeyDomainCount() != 1 ) { return false; } @@ -3675,7 +3675,7 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "NN" ).getDomainId() ) != 0 ) { return false; } - cd = cdcc.get( new DomainId( "MM" ) ); + cd = cdcc.get( "MM" ); if ( cd.getNumberOfCombinableDomains() != 1 ) { return false; } @@ -3685,7 +3685,7 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "OO" ).getDomainId() ) != 1 ) { return false; } - cd = cdcc.get( new DomainId( "OO" ) ); + cd = cdcc.get( "OO" ); if ( cd.getNumberOfCombinableDomains() != 2 ) { return false; } @@ -3695,7 +3695,7 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "MM" ).getDomainId() ) != 1 ) { return false; } - cd = cdcc.get( new DomainId( "QQ" ) ); + cd = cdcc.get( "QQ" ); if ( cd.getNumberOfCombinableDomains() != 1 ) { return false; } @@ -3708,7 +3708,7 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "QQ" ).getDomainId() ) != 3 ) { return false; } - cd = cdcc.get( new DomainId( "PP" ) ); + cd = cdcc.get( "PP" ); if ( cd.getNumberOfCombinableDomains() != 0 ) { return false; } @@ -3718,7 +3718,7 @@ public class TestSurfacing { if ( cd.getKeyDomainProteinsCount() != 2 ) { return false; } - cd = cdcc.get( new DomainId( "singlet" ) ); + cd = cdcc.get( "singlet" ); if ( cd.getKeyDomainCount() != 1 ) { return false; } @@ -3731,7 +3731,7 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "singlet" ).getDomainId() ) != 0 ) { return false; } - cd = cdcc.get( new DomainId( "three" ) ); + cd = cdcc.get( "three" ); if ( cd.getKeyDomainCount() != 3 ) { return false; } @@ -3741,10 +3741,10 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "three" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "three" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "so_far_so_bad" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "so_far_so_bad" ) != 0 ) { return false; } // Ignore combinations with same: @@ -3756,7 +3756,7 @@ public class TestSurfacing { DomainCombinationType.BASIC, null, null ); - cd = cdcc2.get( new DomainId( "A" ) ); + cd = cdcc2.get( "A" ); if ( cd.getKeyDomainCount() != 9 ) { return false; } @@ -3781,28 +3781,28 @@ public class TestSurfacing { if ( cd.getNumberOfProteinsExhibitingCombination( new SimpleDomain( "E" ).getDomainId() ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "U" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "U" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "V" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "V" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "W" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "W" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "X" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "X" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "Y" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "Y" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "Z" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "Z" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "NN" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "NN" ) != 0 ) { return false; } - cd = cdcc2.get( new DomainId( "B" ) ); + cd = cdcc2.get( "B" ); if ( cd.getKeyDomainCount() != 12 ) { return false; } @@ -3812,43 +3812,43 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "A" ) ) != 6 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "A" ) != 6 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "B" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "B" ) != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "C" ) ) != 4 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "C" ) != 4 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "D" ) ) != 3 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "D" ) != 3 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "E" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "E" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "U" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "U" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "V" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "V" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "W" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "W" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "X" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "X" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "Y" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "Y" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "Z" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "Z" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "NN" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "NN" ) != 0 ) { return false; } - cd = cdcc2.get( new DomainId( "C" ) ); + cd = cdcc2.get( "C" ); if ( cd.getKeyDomainCount() != 10 ) { return false; } @@ -3858,112 +3858,112 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "A" ) ) != 4 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "A" ) != 4 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "B" ) ) != 4 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "B" ) != 4 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "C" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "C" ) != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "D" ) ) != 3 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "D" ) != 3 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "E" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "E" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "U" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "U" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "V" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "V" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "W" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "W" ) != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "X" ) ) != 2 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "X" ) != 2 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "Y" ) ) != 2 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "Y" ) != 2 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "Z" ) ) != 2 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "Z" ) != 2 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "NN" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "NN" ) != 0 ) { return false; } - cd = cdcc2.get( new DomainId( "D" ) ); + cd = cdcc2.get( "D" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "E" ) ); + cd = cdcc2.get( "E" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } if ( cd.getKeyDomainCount() != 1 ) { return false; } - cd = cdcc2.get( new DomainId( "U" ) ); + cd = cdcc2.get( "U" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "V" ) ); + cd = cdcc2.get( "V" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "W" ) ); + cd = cdcc2.get( "W" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "X" ) ); + cd = cdcc2.get( "X" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "Y" ) ); + cd = cdcc2.get( "Y" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "Z" ) ); + cd = cdcc2.get( "Z" ); if ( cd.getNumberOfCombinableDomains() != 10 ) { return false; } - cd = cdcc2.get( new DomainId( "NN" ) ); + cd = cdcc2.get( "NN" ); if ( cd.getNumberOfCombinableDomains() != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "NN" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "NN" ) != 0 ) { return false; } - cd = cdcc2.get( new DomainId( "MM" ) ); + cd = cdcc2.get( "MM" ); if ( cd.getNumberOfCombinableDomains() != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "MM" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "MM" ) != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "OO" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "OO" ) != 1 ) { return false; } - cd = cdcc2.get( new DomainId( "OO" ) ); + cd = cdcc2.get( "OO" ); if ( cd.getNumberOfCombinableDomains() != 1 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "OO" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "OO" ) != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "MM" ) ) != 1 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "MM" ) != 1 ) { return false; } - cd = cdcc2.get( new DomainId( "QQ" ) ); + cd = cdcc2.get( "QQ" ); if ( cd.getNumberOfCombinableDomains() != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "QQ" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "QQ" ) != 0 ) { return false; } - cd = cdcc2.get( new DomainId( "singlet" ) ); + cd = cdcc2.get( "singlet" ); if ( cd.getKeyDomainCount() != 1 ) { return false; } @@ -3973,10 +3973,10 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "singlet" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "singlet" ) != 0 ) { return false; } - cd = cdcc2.get( new DomainId( "three" ) ); + cd = cdcc2.get( "three" ); if ( cd.getKeyDomainCount() != 3 ) { return false; } @@ -3986,10 +3986,10 @@ public class TestSurfacing { if ( cd.getNumberOfCombinableDomains() != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "three" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "three" ) != 0 ) { return false; } - if ( cd.getNumberOfProteinsExhibitingCombination( new DomainId( "so_far_so_bad" ) ) != 0 ) { + if ( cd.getNumberOfProteinsExhibitingCombination( "so_far_so_bad" ) != 0 ) { return false; } } @@ -4045,73 +4045,73 @@ public class TestSurfacing { if ( sorted.size() != 17 ) { return false; } - if ( !sorted.get( 0 ).getDomainId().getId().equals( "A" ) ) { + if ( !sorted.get( 0 ).getDomainId().equals( "A" ) ) { return false; } if ( sorted.get( 0 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 1 ).getDomainId().getId().equals( "B" ) ) { + if ( !sorted.get( 1 ).getDomainId().equals( "B" ) ) { return false; } if ( sorted.get( 1 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 2 ).getDomainId().getId().equals( "C" ) ) { + if ( !sorted.get( 2 ).getDomainId().equals( "C" ) ) { return false; } if ( sorted.get( 2 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 3 ).getDomainId().getId().equals( "D" ) ) { + if ( !sorted.get( 3 ).getDomainId().equals( "D" ) ) { return false; } if ( sorted.get( 3 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 4 ).getDomainId().getId().equals( "E" ) ) { + if ( !sorted.get( 4 ).getDomainId().equals( "E" ) ) { return false; } if ( sorted.get( 4 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 5 ).getDomainId().getId().equals( "F" ) ) { + if ( !sorted.get( 5 ).getDomainId().equals( "F" ) ) { return false; } if ( sorted.get( 5 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 6 ).getDomainId().getId().equals( "G" ) ) { + if ( !sorted.get( 6 ).getDomainId().equals( "G" ) ) { return false; } if ( sorted.get( 6 ).getNumber() != 1 ) { return false; } - if ( !sorted.get( 7 ).getDomainId().getId().equals( "H" ) ) { + if ( !sorted.get( 7 ).getDomainId().equals( "H" ) ) { return false; } if ( sorted.get( 7 ).getNumber() != 5 ) { return false; } - if ( !sorted.get( 8 ).getDomainId().getId().equals( "H" ) ) { + if ( !sorted.get( 8 ).getDomainId().equals( "H" ) ) { return false; } if ( sorted.get( 8 ).getNumber() != 2 ) { return false; } - if ( !sorted.get( 9 ).getDomainId().getId().equals( "H" ) ) { + if ( !sorted.get( 9 ).getDomainId().equals( "H" ) ) { return false; } if ( sorted.get( 9 ).getNumber() != 6 ) { return false; } - if ( !sorted.get( 10 ).getDomainId().getId().equals( "H" ) ) { + if ( !sorted.get( 10 ).getDomainId().equals( "H" ) ) { return false; } if ( sorted.get( 10 ).getNumber() != 4 ) { return false; } - if ( !sorted.get( 11 ).getDomainId().getId().equals( "H" ) ) { + if ( !sorted.get( 11 ).getDomainId().equals( "H" ) ) { return false; } if ( sorted.get( 11 ).getNumber() != 1 ) { @@ -4120,25 +4120,25 @@ public class TestSurfacing { if ( sorted.get( 11 ).getTotalCount() != 5 ) { return false; } - if ( !sorted.get( 12 ).getDomainId().getId().equals( "H" ) ) { + if ( !sorted.get( 12 ).getDomainId().equals( "H" ) ) { return false; } if ( sorted.get( 12 ).getNumber() != 3 ) { return false; } - if ( !sorted.get( 13 ).getDomainId().getId().equals( "H7" ) ) { + if ( !sorted.get( 13 ).getDomainId().equals( "H7" ) ) { return false; } if ( sorted.get( 13 ).getNumber() != 5 ) { return false; } - if ( !sorted.get( 14 ).getDomainId().getId().equals( "H7" ) ) { + if ( !sorted.get( 14 ).getDomainId().equals( "H7" ) ) { return false; } if ( sorted.get( 14 ).getNumber() != 5 ) { return false; } - if ( !sorted.get( 15 ).getDomainId().getId().equals( "H7" ) ) { + if ( !sorted.get( 15 ).getDomainId().equals( "H7" ) ) { return false; } if ( sorted.get( 15 ).getNumber() != 5 ) { @@ -4146,7 +4146,7 @@ public class TestSurfacing { } // To check if sorting is stable [as claimed by Sun for // Collections.sort( List )] - if ( !sorted.get( 16 ).getDomainId().getId().equals( "H7" ) ) { + if ( !sorted.get( 16 ).getDomainId().equals( "H7" ) ) { return false; } if ( sorted.get( 16 ).getNumber() != 5 ) { @@ -4221,10 +4221,10 @@ public class TestSurfacing { if ( abc_r2.getNumberOfProteinDomains() != 2 ) { return false; } - if ( !abc_r2.getProteinDomain( 0 ).getDomainId().getId().equals( "a" ) ) { + if ( !abc_r2.getProteinDomain( 0 ).getDomainId().equals( "a" ) ) { return false; } - if ( !abc_r2.getProteinDomain( 1 ).getDomainId().getId().equals( "b" ) ) { + if ( !abc_r2.getProteinDomain( 1 ).getDomainId().equals( "b" ) ) { return false; } final Domain d = new BasicDomain( "d", 0, 10, ( short ) 1, ( short ) 1, 0.1, 1 ); @@ -4245,13 +4245,13 @@ public class TestSurfacing { if ( def_r2.getNumberOfProteinDomains() != 3 ) { return false; } - if ( !def_r2.getProteinDomain( 0 ).getDomainId().getId().equals( "d" ) ) { + if ( !def_r2.getProteinDomain( 0 ).getDomainId().equals( "d" ) ) { return false; } - if ( !def_r2.getProteinDomain( 1 ).getDomainId().getId().equals( "f" ) ) { + if ( !def_r2.getProteinDomain( 1 ).getDomainId().equals( "f" ) ) { return false; } - if ( !def_r2.getProteinDomain( 2 ).getDomainId().getId().equals( "e" ) ) { + if ( !def_r2.getProteinDomain( 2 ).getDomainId().equals( "e" ) ) { return false; } } @@ -4311,58 +4311,58 @@ public class TestSurfacing { .createInstance( protein_list_eel, false, new BasicSpecies( "eel" ) ); final BasicGenomeWideCombinableDomains eel_ignore = BasicGenomeWideCombinableDomains .createInstance( protein_list_eel, true, new BasicSpecies( "eel" ) ); - if ( !eel_not_ignore.contains( new DomainId( "a" ) ) ) { + if ( !eel_not_ignore.contains( "a" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "b" ) ) ) { + if ( !eel_not_ignore.contains( "b" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "c" ) ) ) { + if ( !eel_not_ignore.contains( "c" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "d" ) ) ) { + if ( !eel_not_ignore.contains( "d" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "e" ) ) ) { + if ( !eel_not_ignore.contains( "e" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "f" ) ) ) { + if ( !eel_not_ignore.contains( "f" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "g" ) ) ) { + if ( !eel_not_ignore.contains( "g" ) ) { return false; } - if ( !eel_not_ignore.contains( new DomainId( "h" ) ) ) { + if ( !eel_not_ignore.contains( "h" ) ) { return false; } - if ( eel_not_ignore.contains( new DomainId( "x" ) ) ) { + if ( eel_not_ignore.contains( "x" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "a" ) ) ) { + if ( !eel_ignore.contains( "a" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "b" ) ) ) { + if ( !eel_ignore.contains( "b" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "c" ) ) ) { + if ( !eel_ignore.contains( "c" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "d" ) ) ) { + if ( !eel_ignore.contains( "d" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "e" ) ) ) { + if ( !eel_ignore.contains( "e" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "f" ) ) ) { + if ( !eel_ignore.contains( "f" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "g" ) ) ) { + if ( !eel_ignore.contains( "g" ) ) { return false; } - if ( !eel_ignore.contains( new DomainId( "h" ) ) ) { + if ( !eel_ignore.contains( "h" ) ) { return false; } - if ( eel_ignore.contains( new DomainId( "x" ) ) ) { + if ( eel_ignore.contains( "x" ) ) { return false; } if ( eel_not_ignore.getSize() != 8 ) { @@ -4371,52 +4371,52 @@ public class TestSurfacing { if ( eel_ignore.getSize() != 8 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "a" ) ).getCombinableDomainsIds().size() != 5 ) { + if ( eel_not_ignore.get( "a" ).getCombinableDomainsIds().size() != 5 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "b" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_not_ignore.get( "b" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "c" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_not_ignore.get( "c" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "d" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_not_ignore.get( "d" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "e" ) ).getCombinableDomainsIds().size() != 6 ) { + if ( eel_not_ignore.get( "e" ).getCombinableDomainsIds().size() != 6 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "f" ) ).getCombinableDomainsIds().size() != 2 ) { + if ( eel_not_ignore.get( "f" ).getCombinableDomainsIds().size() != 2 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "g" ) ).getCombinableDomainsIds().size() != 1 ) { + if ( eel_not_ignore.get( "g" ).getCombinableDomainsIds().size() != 1 ) { return false; } - if ( eel_not_ignore.get( new DomainId( "h" ) ).getCombinableDomainsIds().size() != 1 ) { + if ( eel_not_ignore.get( "h" ).getCombinableDomainsIds().size() != 1 ) { return false; } - if ( eel_ignore.get( new DomainId( "a" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_ignore.get( "a" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_ignore.get( new DomainId( "b" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_ignore.get( "b" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_ignore.get( new DomainId( "c" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_ignore.get( "c" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_ignore.get( new DomainId( "d" ) ).getCombinableDomainsIds().size() != 4 ) { + if ( eel_ignore.get( "d" ).getCombinableDomainsIds().size() != 4 ) { return false; } - if ( eel_ignore.get( new DomainId( "e" ) ).getCombinableDomainsIds().size() != 5 ) { + if ( eel_ignore.get( "e" ).getCombinableDomainsIds().size() != 5 ) { return false; } - if ( eel_ignore.get( new DomainId( "f" ) ).getCombinableDomainsIds().size() != 1 ) { + if ( eel_ignore.get( "f" ).getCombinableDomainsIds().size() != 1 ) { return false; } - if ( eel_ignore.get( new DomainId( "g" ) ).getCombinableDomainsIds().size() != 1 ) { + if ( eel_ignore.get( "g" ).getCombinableDomainsIds().size() != 1 ) { return false; } - if ( eel_ignore.get( new DomainId( "h" ) ).getCombinableDomainsIds().size() != 1 ) { + if ( eel_ignore.get( "h" ).getCombinableDomainsIds().size() != 1 ) { return false; } if ( eel_not_ignore.getAllDomainIds().size() != 8 ) { @@ -4660,9 +4660,9 @@ public class TestSurfacing { .equals( "pep:known chromosome:NCBI36:21:16024215:16174248:1 gene:ENSG00000155313 transcript:ENST00000285681" ) ) { return false; } - final List uba = pdc.getProteinDomains( new DomainId( "UBA" ) ); - final List uim = pdc.getProteinDomains( new DomainId( "UIM" ) ); - final List uch = pdc.getProteinDomains( new DomainId( "UCH" ) ); + final List uba = pdc.getProteinDomains( "UBA" ); + final List uim = pdc.getProteinDomains( "UIM" ); + final List uch = pdc.getProteinDomains( "UCH" ); if ( uba.size() != 1 ) { return false; } @@ -4673,14 +4673,14 @@ public class TestSurfacing { return false; } final BasicDomain uim_domain = ( BasicDomain ) uim.get( 1 ); - if ( !uim_domain.getDomainId().equals( new DomainId( "UIM" ) ) ) { + if ( !uim_domain.getDomainId().equals( "UIM" ) ) { return false; } if ( uim_domain.getTotalCount() != 2 ) { return false; } final BasicDomain uba_domain = ( BasicDomain ) uba.get( 0 ); - if ( !uba_domain.getDomainId().equals( new DomainId( "UBA" ) ) ) { + if ( !uba_domain.getDomainId().equals( "UBA" ) ) { return false; } if ( uba_domain.getNumber() != 1 ) { @@ -4747,9 +4747,9 @@ public class TestSurfacing { if ( pdc2.getNumberOfProteinDomains() != 3 ) { return false; } - final List uba2 = pdc2.getProteinDomains( new DomainId( "UBA" ) ); - final List uim2 = pdc2.getProteinDomains( new DomainId( "UIM" ) ); - final List uch2 = pdc2.getProteinDomains( new DomainId( "UCH" ) ); + final List uba2 = pdc2.getProteinDomains( "UBA" ); + final List uim2 = pdc2.getProteinDomains( "UIM" ); + final List uch2 = pdc2.getProteinDomains( "UCH" ); if ( uba2.size() != 1 ) { return false; } @@ -4760,14 +4760,14 @@ public class TestSurfacing { return false; } final BasicDomain uim_domain2 = ( BasicDomain ) uim2.get( 1 ); - if ( !uim_domain2.getDomainId().getId().equals( "UIM" ) ) { + if ( !uim_domain2.getDomainId().equals( "UIM" ) ) { return false; } if ( uim_domain2.getTotalCount() != 2 ) { return false; } final BasicDomain uba_domain2 = ( BasicDomain ) uba2.get( 0 ); - if ( !uba_domain2.getDomainId().getId().equals( "UBA" ) ) { + if ( !uba_domain2.getDomainId().equals( "UBA" ) ) { return false; } if ( uba_domain2.getNumber() != 1 ) { @@ -4809,9 +4809,9 @@ public class TestSurfacing { return false; } // - Set filter = new TreeSet(); - filter.add( new DomainId( "beauty" ) ); - filter.add( new DomainId( "strange" ) ); + Set filter = new TreeSet(); + filter.add( "beauty" ); + filter.add( "strange" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -4829,9 +4829,9 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "beauty" ) ); - filter.add( new DomainId( "strange" ) ); + filter = new TreeSet(); + filter.add( "beauty" ); + filter.add( "strange" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -4849,10 +4849,10 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "UIM" ) ); - filter.add( new DomainId( "A" ) ); - filter.add( new DomainId( "C" ) ); + filter = new TreeSet(); + filter.add( "UIM" ); + filter.add( "A" ); + filter.add( "C" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -4870,11 +4870,11 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "UIM" ) ); - filter.add( new DomainId( "A" ) ); - filter.add( new DomainId( "C" ) ); - filter.add( new DomainId( "X" ) ); + filter = new TreeSet(); + filter.add( "UIM" ); + filter.add( "A" ); + filter.add( "C" ); + filter.add( "X" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -4892,10 +4892,10 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "UIM" ) ); - filter.add( new DomainId( "A" ) ); - filter.add( new DomainId( "C" ) ); + filter = new TreeSet(); + filter.add( "UIM" ); + filter.add( "A" ); + filter.add( "C" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -4913,8 +4913,8 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "UIM" ) ); + filter = new TreeSet(); + filter.add( "UIM" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -4935,8 +4935,8 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "UIM" ) ); + filter = new TreeSet(); + filter.add( "UIM" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -4957,9 +4957,9 @@ public class TestSurfacing { return false; } // - filter = new TreeSet(); - filter.add( new DomainId( "A" ) ); - filter.add( new DomainId( "C" ) ); + filter = new TreeSet(); + filter.add( "A" ); + filter.add( "C" ); parser = new HmmPfamOutputParser( new File( test_dir + ForesterUtil.getFileSeparator() + "hmmpfam_output3" ), "human", "ls", @@ -5037,7 +5037,7 @@ public class TestSurfacing { if ( ab_s0.getNumberOfProteinDomains() != 1 ) { return false; } - if ( !ab_s0.getProteinDomain( 0 ).getDomainId().getId().equals( "a" ) ) { + if ( !ab_s0.getProteinDomain( 0 ).getDomainId().equals( "a" ) ) { return false; } final Protein ab_s1 = SurfacingUtil.removeOverlappingDomains( 4, false, ab ); @@ -5087,7 +5087,7 @@ public class TestSurfacing { if ( fghi_s0.getNumberOfProteinDomains() != 1 ) { return false; } - if ( !fghi_s0.getProteinDomain( 0 ).getDomainId().getId().equals( "h" ) ) { + if ( !fghi_s0.getProteinDomain( 0 ).getDomainId().equals( "h" ) ) { return false; } final Protein fghi_s1 = SurfacingUtil.removeOverlappingDomains( 11, false, fghi ); @@ -5119,7 +5119,7 @@ public class TestSurfacing { if ( jklm_s0.getNumberOfProteinDomains() != 1 ) { return false; } - if ( !jklm_s0.getProteinDomain( 0 ).getDomainId().getId().equals( "l" ) ) { + if ( !jklm_s0.getProteinDomain( 0 ).getDomainId().equals( "l" ) ) { return false; } final Protein jklm_s1 = SurfacingUtil.removeOverlappingDomains( 11, false, jklm ); @@ -5554,7 +5554,7 @@ public class TestSurfacing { gwcd_list.add( two ); gwcd_list.add( three ); gwcd_list.add( four ); - final Map> map_same = new HashMap>(); + final Map> map_same = new HashMap>(); final HashSet a_s = new HashSet(); a_s.add( "AAA" ); final HashSet b_s = new HashSet(); diff --git a/forester/java/src/org/forester/test/Test.java b/forester/java/src/org/forester/test/Test.java index 8f9341d..9a6afc0 100644 --- a/forester/java/src/org/forester/test/Test.java +++ b/forester/java/src/org/forester/test/Test.java @@ -91,7 +91,6 @@ import org.forester.phylogeny.iterators.PhylogenyNodeIterator; import org.forester.protein.BasicDomain; import org.forester.protein.BasicProtein; import org.forester.protein.Domain; -import org.forester.protein.DomainId; import org.forester.protein.Protein; import org.forester.protein.ProteinId; import org.forester.rio.TestRIO; @@ -172,15 +171,6 @@ public final class Test { System.exit( -1 ); } final long start_time = new Date().getTime(); - System.out.print( "Domain id: " ); - if ( !testDomainId() ) { - System.out.println( "failed." ); - failed++; - } - else { - succeeded++; - } - System.out.println( "OK." ); System.out.print( "Protein id: " ); if ( !testProteinId() ) { System.out.println( "failed." ); @@ -953,7 +943,7 @@ public final class Test { private static boolean testBasicDomain() { try { final Domain pd = new BasicDomain( "id", 23, 25, ( short ) 1, ( short ) 4, 0.1, -12 ); - if ( !pd.getDomainId().getId().equals( "id" ) ) { + if ( !pd.getDomainId().equals( "id" ) ) { return false; } if ( pd.getNumber() != 1 ) { @@ -997,7 +987,7 @@ public final class Test { if ( a1.compareTo( a2 ) != 0 ) { return false; } - if ( a1.compareTo( a3 ) != 0 ) { + if ( a1.compareTo( a3 ) == 0 ) { return false; } } @@ -1856,238 +1846,78 @@ public final class Test { p.addProteinDomain( A20 ); p.addProteinDomain( B25 ); p.addProteinDomain( D80 ); - List domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); + List domains_ids = new ArrayList(); + domains_ids.add( "A" ); + domains_ids.add( "B" ); + domains_ids.add( "C" ); if ( !p.contains( domains_ids, false ) ) { return false; } if ( !p.contains( domains_ids, true ) ) { return false; } - domains_ids.add( new DomainId( "X" ) ); + domains_ids.add( "X" ); if ( p.contains( domains_ids, false ) ) { return false; } if ( p.contains( domains_ids, true ) ) { return false; } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); + domains_ids = new ArrayList(); + domains_ids.add( "A" ); + domains_ids.add( "C" ); + domains_ids.add( "D" ); if ( !p.contains( domains_ids, false ) ) { return false; } if ( !p.contains( domains_ids, true ) ) { return false; } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "D" ) ); - domains_ids.add( new DomainId( "C" ) ); + domains_ids = new ArrayList(); + domains_ids.add( "A" ); + domains_ids.add( "D" ); + domains_ids.add( "C" ); if ( !p.contains( domains_ids, false ) ) { return false; } if ( p.contains( domains_ids, true ) ) { return false; } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( !p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( !p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); + domains_ids = new ArrayList(); + domains_ids.add( "A" ); + domains_ids.add( "A" ); + domains_ids.add( "B" ); if ( !p.contains( domains_ids, false ) ) { return false; } if ( !p.contains( domains_ids, true ) ) { return false; } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); + domains_ids = new ArrayList(); + domains_ids.add( "A" ); + domains_ids.add( "A" ); + domains_ids.add( "A" ); + domains_ids.add( "B" ); + domains_ids.add( "B" ); if ( !p.contains( domains_ids, false ) ) { return false; } if ( !p.contains( domains_ids, true ) ) { return false; } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( !p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( !p.contains( domains_ids, false ) ) { - return false; - } - if ( !p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - domains_ids.add( new DomainId( "X" ) ); - if ( p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "X" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); - if ( p.contains( domains_ids, false ) ) { - return false; - } - if ( p.contains( domains_ids, true ) ) { - return false; - } - domains_ids = new ArrayList(); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "B" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "A" ) ); - domains_ids.add( new DomainId( "C" ) ); - domains_ids.add( new DomainId( "D" ) ); + domains_ids = new ArrayList(); + domains_ids.add( "A" ); + domains_ids.add( "A" ); + domains_ids.add( "B" ); + domains_ids.add( "A" ); + domains_ids.add( "B" ); + domains_ids.add( "B" ); + domains_ids.add( "A" ); + domains_ids.add( "B" ); + domains_ids.add( "C" ); + domains_ids.add( "A" ); + domains_ids.add( "C" ); + domains_ids.add( "D" ); if ( !p.contains( domains_ids, false ) ) { return false; } @@ -3461,69 +3291,6 @@ public final class Test { return true; } - private static boolean testDomainId() { - try { - final DomainId id1 = new DomainId( "a" ); - final DomainId id2 = new DomainId( "a" ); - final DomainId id3 = new DomainId( "A" ); - final DomainId id4 = new DomainId( "b" ); - if ( !id1.equals( id1 ) ) { - return false; - } - if ( id1.getId().equals( "x" ) ) { - return false; - } - if ( id1.getId().equals( null ) ) { - return false; - } - if ( !id1.equals( id2 ) ) { - return false; - } - if ( id1.equals( id3 ) ) { - return false; - } - if ( id1.hashCode() != id1.hashCode() ) { - return false; - } - if ( id1.hashCode() != id2.hashCode() ) { - return false; - } - if ( id1.hashCode() == id3.hashCode() ) { - return false; - } - if ( id1.compareTo( id1 ) != 0 ) { - return false; - } - if ( id1.compareTo( id2 ) != 0 ) { - return false; - } - if ( id1.compareTo( id3 ) != 0 ) { - return false; - } - if ( id1.compareTo( id4 ) >= 0 ) { - return false; - } - if ( id4.compareTo( id1 ) <= 0 ) { - return false; - } - if ( !id4.getId().equals( "b" ) ) { - return false; - } - final DomainId id5 = new DomainId( " C " ); - if ( !id5.getId().equals( "C" ) ) { - return false; - } - if ( id5.equals( id1 ) ) { - return false; - } - } - catch ( final Exception e ) { - e.printStackTrace( System.out ); - return false; - } - return true; - } - private static boolean testEmblEntryRetrieval() { //The format for GenBank Accession numbers are: //Nucleotide: 1 letter + 5 numerals OR 2 letters + 6 numerals