final static private String SEQ_EXTRACT_OPTION = "prot_extract";
final static private char SEPARATOR_FOR_INPUT_VALUES = '#';
final static private String PRG_VERSION = "2.230";
- final static private String PRG_DATE = "2012.04.21";
+ final static private String PRG_DATE = "2012.04.22";
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;
final Runtime rt = java.lang.Runtime.getRuntime();
final long free_memory = rt.freeMemory() / 1000000;
final long total_memory = rt.totalMemory() / 1000000;
- System.out.println();
- System.out.println( "Time for analysis : " + ( new Date().getTime() - analysis_start_time ) + "ms" );
- System.out.println( "Total running time: " + ( new Date().getTime() - start_time ) + "ms " );
- System.out.println( "Free memory : " + free_memory + "MB, total memory: " + total_memory + "MB" );
- System.out.println();
- System.out.println( "If this application is useful to you, please cite:" );
- System.out.println( surfacing.WWW );
- System.out.println();
+
+ ForesterUtil.programMessage( PRG_NAME, "Time for analysis : " + ( new Date().getTime() - analysis_start_time ) + "ms" );
+ ForesterUtil.programMessage( PRG_NAME, "Total running time: " + ( new Date().getTime() - start_time ) + "ms " );
+ ForesterUtil.programMessage( PRG_NAME, "Free memory : " + free_memory + "MB, total memory: " + total_memory + "MB" );
+
+ ForesterUtil.programMessage( PRG_NAME, "If this application is useful to you, please cite:" );
+ ForesterUtil.programMessage( PRG_NAME, surfacing.WWW );
+
ForesterUtil.programMessage( PRG_NAME, "OK" );
System.out.println();
}
import java.util.SortedSet;
import java.util.TreeSet;
+import org.forester.application.surfacing;
import org.forester.evoinference.matrix.character.BasicCharacterStateMatrix;
import org.forester.evoinference.matrix.character.CharacterStateMatrix;
import org.forester.evoinference.matrix.character.CharacterStateMatrix.BinaryStates;
final SortedSet<BinaryDomainCombination> all_binary_combinations_mapped = new TreeSet<BinaryDomainCombination>();
final Set<BinaryDomainCombination>[] binary_combinations_per_genome_mapped = new HashSet[ number_of_identifiers ];
int identifier_index = 0;
+
+ final SortedSet<String> no_mappings = new TreeSet<String>();
for( final GenomeWideCombinableDomains gwcd : gwcd_list ) {
binary_combinations_per_genome_mapped[ identifier_index ] = new HashSet<BinaryDomainCombination>();
for( final BinaryDomainCombination bc : gwcd.toBinaryDomainCombinations() ) {
- if ( !domain_id_to_second_features_map.containsKey( bc.getId0() ) ) {
- throw new IllegalArgumentException( "no mapping found for " + bc.getId0() );
- }
- if ( !domain_id_to_second_features_map.containsKey( bc.getId1() ) ) {
- throw new IllegalArgumentException( "no mapping found for " + bc.getId1() );
- }
-
-
- final BinaryDomainCombination mapped_bc = new BasicBinaryDomainCombination( domain_id_to_second_features_map.get( bc.getId0()) ,
- domain_id_to_second_features_map.get( bc.getId1()) );
+ final BinaryDomainCombination mapped_bc = mapBinaryDomainCombination( domain_id_to_second_features_map,
+ bc,
+ no_mappings );
all_binary_combinations_mapped.add( mapped_bc );
binary_combinations_per_genome_mapped[ identifier_index ].add( mapped_bc );
}
++identifier_index;
}
+ if ( !no_mappings.isEmpty() ) {
+ ForesterUtil.programMessage( surfacing.PRG_NAME, "No mappings for the following (" + no_mappings.size() + "):" );
+ for( final String id : no_mappings ) {
+ ForesterUtil.programMessage( surfacing.PRG_NAME, id);
+ }
+ }
+
final int number_of_characters = all_binary_combinations_mapped.size();
final CharacterStateMatrix<CharacterStateMatrix.BinaryStates> matrix = new BasicCharacterStateMatrix<CharacterStateMatrix.BinaryStates>( number_of_identifiers,
number_of_characters );
}
return matrix;
}
+
+ private static BinaryDomainCombination mapBinaryDomainCombination( final Map<DomainId, String> domain_id_to_second_features_map,
+ final BinaryDomainCombination bc,
+ final SortedSet<String> 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();
+ }
+ 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();
+ }
+ else {
+ id1 = domain_id_to_second_features_map.get( bc.getId1());
+ }
+
+ return new BasicBinaryDomainCombination( id0, id1 );
+ }