private static final String NODE_NAME_FIELD = "n";
final static private String PICKY_OPTION = "p";
final static private String FIELD_OPTION = "f";
+ final static private String TRIM_AFTER_TILDE_OPTION = "t";
final static private String MOVE_DOMAIN_NUMBER_OPTION = "mdn"; // Hidden expert option.
final static private String TREE_NAME_OPTION = "pn";
final static private String TREE_ID_OPTION = "pi";
System.out.println( " -" + decorator.PROCESS_SIMILAR_TO_OPTION
+ " : process name \"intelligently\" and process information after \"similar to\" (only for -f=n)" );
System.out.println( " -c : cut name after first space (only for -f=n)" );
+ System.out.println( " -" + decorator.TRIM_AFTER_TILDE_OPTION + " : trim after tilde" );
System.out.println();
System.exit( -1 );
}
allowed_options.add( decorator.TREE_ID_OPTION );
allowed_options.add( decorator.TREE_DESC_OPTION );
allowed_options.add( decorator.MOVE_DOMAIN_NUMBER_OPTION );
+ allowed_options.add( decorator.TRIM_AFTER_TILDE_OPTION );
final String dissallowed_options = cla.validateAllowedOptionsAsString( allowed_options );
if ( dissallowed_options.length() > 0 ) {
ForesterUtil.fatalError( decorator.PRG_NAME, "unknown option(s): " + dissallowed_options );
boolean process_similar_to = false;
boolean extract_bracketed_scientific_name = false;
boolean move_domain_numbers_at_end_to_middle = false;
+ boolean trim_after_tilde = false;
String tree_name = "";
String tree_id = "";
String tree_desc = "";
}
process_similar_to = true;
}
+ if ( cla.isOptionSet( decorator.TRIM_AFTER_TILDE_OPTION ) ) {
+ if ( advanced_table ) {
+ argumentsError();
+ }
+ trim_after_tilde = true;
+ }
if ( cla.isOptionSet( decorator.ALLOW_REMOVAL_OF_CHARS_OPTION ) ) {
numbers_of_chars_allowed_to_remove_if_not_found_in_map = cla
.getOptionValueAsInt( decorator.ALLOW_REMOVAL_OF_CHARS_OPTION );
process_name_intelligently,
process_similar_to,
numbers_of_chars_allowed_to_remove_if_not_found_in_map,
- move_domain_numbers_at_end_to_middle );
+ move_domain_numbers_at_end_to_middle,
+ trim_after_tilde );
}
}
catch ( final NullPointerException e ) {
public final static boolean ALLOW_DDBJ_BLAST = false;
public final static String PRG_NAME = "Archaeopteryx";
final static String VERSION = "0.973";
- final static String PRG_DATE = "120904";
+ final static String PRG_DATE = "120907";
final static String DEFAULT_CONFIGURATION_FILE_NAME = "_aptx_configuration_file";
final static String[] DEFAULT_FONT_CHOICES = { "Verdana", "Tahoma",
"Arial", "Helvetica", "Dialog", "Lucida Sans", "SansSerif", "Sans-serif", "Sans" };
}
displayedPhylogenyMightHaveChanged( false );
}
+ else if ( e.getSource() == _show_domain_architectures ) {
+ search();
+ displayedPhylogenyMightHaveChanged( false );
+ }
else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) {
if ( e.getSource() == getDisplayAsPhylogramCb() ) {
setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() );
}
query = query.trim();
if ( query.indexOf( '+' ) >= 0 ) {
- nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ), tree, getOptions()
- .isSearchCaseSensitive(), !getOptions().isMatchWholeTermsOnly() ) );
+ nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
+ tree,
+ getOptions().isSearchCaseSensitive(),
+ !getOptions().isMatchWholeTermsOnly(),
+ isShowDomainArchitectures() ) );
}
else {
nodes.addAll( PhylogenyMethods.searchData( query,
tree,
getOptions().isSearchCaseSensitive(),
- !getOptions().isMatchWholeTermsOnly() ) );
+ !getOptions().isMatchWholeTermsOnly(),
+ isShowDomainArchitectures() ) );
}
}
if ( getOptions().isInverseSearchResult() ) {
public static List<PhylogenyNode> searchData( final String query,
final Phylogeny phy,
final boolean case_sensitive,
- final boolean partial ) {
+ final boolean partial,
+ final boolean search_domains ) {
final List<PhylogenyNode> nodes = new ArrayList<PhylogenyNode>();
if ( phy.isEmpty() || ( query == null ) ) {
return nodes;
partial ) ) {
match = true;
}
- if ( !match && node.getNodeData().isHasSequence()
+ if ( search_domains && !match && node.getNodeData().isHasSequence()
&& ( node.getNodeData().getSequence().getDomainArchitecture() != null ) ) {
final DomainArchitecture da = node.getNodeData().getSequence().getDomainArchitecture();
I: for( int i = 0; i < da.getNumberOfDomains(); ++i ) {
public static List<PhylogenyNode> searchDataLogicalAnd( final String[] queries,
final Phylogeny phy,
final boolean case_sensitive,
- final boolean partial ) {
+ final boolean partial,
+ final boolean search_domains ) {
final List<PhylogenyNode> nodes = new ArrayList<PhylogenyNode>();
if ( phy.isEmpty() || ( queries == null ) || ( queries.length < 1 ) ) {
return nodes;
partial ) ) {
match = true;
}
- if ( !match && node.getNodeData().isHasSequence()
+ if ( search_domains && !match && node.getNodeData().isHasSequence()
&& ( node.getNodeData().getSequence().getDomainArchitecture() != null ) ) {
final DomainArchitecture da = node.getNodeData().getSequence().getDomainArchitecture();
I: for( int i = 0; i < da.getNumberOfDomains(); ++i ) {
break I;
}
}
- // final String[] bcp_ary = node.getNodeData().getBinaryCharacters()
- // .getPresentCharactersAsStringArray();
- // I: for( final String bc : bcp_ary ) {
- // if ( match( bc, query, case_sensitive, partial ) ) {
- // match = true;
- // break I;
- // }
- // }
- // final String[] bcg_ary = node.getNodeData().getBinaryCharacters()
- // .getGainedCharactersAsStringArray();
- // I: for( final String bc : bcg_ary ) {
- // if ( match( bc, query, case_sensitive, partial ) ) {
- // match = true;
- // break I;
- // }
- // }
}
if ( !match ) {
all_matched = false;
final boolean process_name_intelligently,
final boolean process_similar_to,
final int numbers_of_chars_allowed_to_remove_if_not_found_in_map,
- final boolean move_domain_numbers_at_end_to_middle ) throws IllegalArgumentException,
- NHXFormatException, PhyloXmlDataFormatException {
+ final boolean move_domain_numbers_at_end_to_middle,
+ final boolean trim_after_tilde ) throws IllegalArgumentException, NHXFormatException,
+ PhyloXmlDataFormatException {
PhylogenyDecorator.decorate( phylogeny,
map,
field,
process_name_intelligently,
process_similar_to,
numbers_of_chars_allowed_to_remove_if_not_found_in_map,
- move_domain_numbers_at_end_to_middle );
+ move_domain_numbers_at_end_to_middle,
+ trim_after_tilde );
}
/**
final boolean process_name_intelligently,
final boolean process_similar_to,
final int numbers_of_chars_allowed_to_remove_if_not_found_in_map,
- final boolean move_domain_numbers_at_end_to_middle ) throws IllegalArgumentException,
+ final boolean move_domain_numbers_at_end_to_middle,
+ final boolean trim_after_tilde ) throws IllegalArgumentException,
PhyloXmlDataFormatException {
if ( extract_bracketed_scientific_name && ( field == FIELD.TAXONOMY_SCIENTIFIC_NAME ) ) {
throw new IllegalArgumentException( "Attempt to extract bracketed scientific name together with data field pointing to scientific name" );
for( final PhylogenyNodeIterator iter = phylogeny.iteratorPostorder(); iter.hasNext(); ) {
final PhylogenyNode node = iter.next();
String name = node.getName();
+ if ( trim_after_tilde && ( name.indexOf( '~' ) > 0 ) ) {
+ name = name.substring( 0, name.indexOf( '~' ) );
+ }
if ( !ForesterUtil.isEmpty( name ) ) {
if ( intermediate_map != null ) {
name = PhylogenyDecorator.extractIntermediate( intermediate_map, name );
final boolean process_name_intelligently,
final boolean process_similar_to,
final int numbers_of_chars_allowed_to_remove_if_not_found_in_map,
- final boolean move_domain_numbers_at_end_to_middle ) throws IllegalArgumentException,
- NHXFormatException, PhyloXmlDataFormatException {
+ final boolean move_domain_numbers_at_end_to_middle,
+ final boolean trim_after_tilde ) throws IllegalArgumentException, NHXFormatException,
+ PhyloXmlDataFormatException {
for( int i = 0; i < phylogenies.length; ++i ) {
PhylogenyDecorator.decorate( phylogenies[ i ],
map,
process_name_intelligently,
process_similar_to,
numbers_of_chars_allowed_to_remove_if_not_found_in_map,
- move_domain_numbers_at_end_to_middle );
+ move_domain_numbers_at_end_to_middle,
+ trim_after_tilde );
}
}
final boolean process_name_intelligently,
final boolean process_similar_to,
final int numbers_of_chars_allowed_to_remove_if_not_found_in_map,
- final boolean move_domain_numbers_at_end_to_middle ) throws IllegalArgumentException,
- NHXFormatException, PhyloXmlDataFormatException {
+ final boolean move_domain_numbers_at_end_to_middle,
+ final boolean trim_after_tilde ) throws IllegalArgumentException, NHXFormatException,
+ PhyloXmlDataFormatException {
for( int i = 0; i < phylogenies.length; ++i ) {
PhylogenyDecorator.decorate( phylogenies[ i ],
map,
process_name_intelligently,
process_similar_to,
numbers_of_chars_allowed_to_remove_if_not_found_in_map,
- move_domain_numbers_at_end_to_middle );
+ move_domain_numbers_at_end_to_middle,
+ trim_after_tilde );
}
}