git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added -rs option
[jalview.git]
/
forester
/
java
/
src
/
org
/
forester
/
application
/
cladinator.java
diff --git
a/forester/java/src/org/forester/application/cladinator.java
b/forester/java/src/org/forester/application/cladinator.java
index
ae8d970
..
e00dd20
100644
(file)
--- a/
forester/java/src/org/forester/application/cladinator.java
+++ b/
forester/java/src/org/forester/application/cladinator.java
@@
-52,8
+52,8
@@
import org.forester.util.UserException;
public final class cladinator {
final static private String PRG_NAME = "cladinator";
public final class cladinator {
final static private String PRG_NAME = "cladinator";
- final static private String PRG_VERSION = "1.05";
- final static private String PRG_DATE = "170919";
+ final static private String PRG_VERSION = "1.06";
+ final static private String PRG_DATE = "171115";
final static private String PRG_DESC = "clades within clades of annotated labels -- analysis of pplacer-type outputs";
final static private String E_MAIL = "phyloxml@gmail.com";
final static private String WWW = "https://sites.google.com/site/cmzmasek/home/software/forester";
final static private String PRG_DESC = "clades within clades of annotated labels -- analysis of pplacer-type outputs";
final static private String E_MAIL = "phyloxml@gmail.com";
final static private String WWW = "https://sites.google.com/site/cmzmasek/home/software/forester";
@@
-69,6
+69,7
@@
public final class cladinator {
final static private String QUIET_OPTION = "Q";
final static private String SPECIAL_PROCESSING_OPTION = "S";
final static private String VERBOSE_OPTION = "v";
final static private String QUIET_OPTION = "Q";
final static private String SPECIAL_PROCESSING_OPTION = "S";
final static private String VERBOSE_OPTION = "v";
+ final static private String REMOVE_ANNOT_SEP_OPTION = "rs";
final static private double SPECIFICS_CUTOFF_DEFAULT = 0.8;
final static private String SEP_DEFAULT = ".";
final static private Pattern QUERY_PATTERN_DEFAULT = AnalysisMulti.DEFAULT_QUERY_PATTERN_FOR_PPLACER_TYPE;
final static private double SPECIFICS_CUTOFF_DEFAULT = 0.8;
final static private String SEP_DEFAULT = ".";
final static private Pattern QUERY_PATTERN_DEFAULT = AnalysisMulti.DEFAULT_QUERY_PATTERN_FOR_PPLACER_TYPE;
@@
-101,7
+102,7
@@
public final class cladinator {
print_help();
System.exit( -1 );
}
print_help();
System.exit( -1 );
}
- final List<String> allowed_options = new ArrayList<>();
+ final List<String> allowed_options = new ArrayList<String>();
allowed_options.add( SEP_OPTION );
allowed_options.add( QUERY_PATTERN_OPTION );
allowed_options.add( SPECIFICS_CUTOFF_OPTION );
allowed_options.add( SEP_OPTION );
allowed_options.add( QUERY_PATTERN_OPTION );
allowed_options.add( SPECIFICS_CUTOFF_OPTION );
@@
-112,6
+113,7
@@
public final class cladinator {
allowed_options.add( SPECIAL_PROCESSING_OPTION );
allowed_options.add( VERBOSE_OPTION );
allowed_options.add( QUIET_OPTION );
allowed_options.add( SPECIAL_PROCESSING_OPTION );
allowed_options.add( VERBOSE_OPTION );
allowed_options.add( QUIET_OPTION );
+ allowed_options.add( REMOVE_ANNOT_SEP_OPTION );
final String dissallowed_options = cla.validateAllowedOptionsAsString( allowed_options );
if ( dissallowed_options.length() > 0 ) {
ForesterUtil.fatalError( PRG_NAME, "unknown option(s): " + dissallowed_options );
final String dissallowed_options = cla.validateAllowedOptionsAsString( allowed_options );
if ( dissallowed_options.length() > 0 ) {
ForesterUtil.fatalError( PRG_NAME, "unknown option(s): " + dissallowed_options );
@@
-233,7
+235,6
@@
public final class cladinator {
}
extra_processing1_keep = true;
}
}
extra_processing1_keep = true;
}
-
Pattern special_pattern = null;
boolean special_processing = false;
if ( cla.isOptionSet( SPECIAL_PROCESSING_OPTION ) ) {
Pattern special_pattern = null;
boolean special_processing = false;
if ( cla.isOptionSet( SPECIAL_PROCESSING_OPTION ) ) {
@@
-258,6
+259,13
@@
public final class cladinator {
ForesterUtil.fatalError( PRG_NAME, "no value for special processing pattern" );
}
}
ForesterUtil.fatalError( PRG_NAME, "no value for special processing pattern" );
}
}
+ final boolean remove_annotation_sep;
+ if ( cla.isOptionSet( REMOVE_ANNOT_SEP_OPTION ) ) {
+ remove_annotation_sep = true;
+ }
+ else {
+ remove_annotation_sep = false;
+ }
final boolean verbose;
if ( cla.isOptionSet( VERBOSE_OPTION ) ) {
verbose = true;
final boolean verbose;
if ( cla.isOptionSet( VERBOSE_OPTION ) ) {
verbose = true;
@@
-279,6
+287,9
@@
public final class cladinator {
+ " rows)" );
}
System.out.println( "Annotation-separator : " + separator );
+ " rows)" );
}
System.out.println( "Annotation-separator : " + separator );
+ if ( remove_annotation_sep ) {
+ System.out.println( "Remove anno.-sep. in output: " + remove_annotation_sep );
+ }
System.out.println( "Query pattern : " + pattern );
if ( extra_processing1 ) {
System.out.println( "Extra processing : " + extra_processing1 );
System.out.println( "Query pattern : " + pattern );
if ( extra_processing1 ) {
System.out.println( "Extra processing : " + extra_processing1 );
@@
-340,14
+351,14
@@
public final class cladinator {
final ResultMulti res = AnalysisMulti.execute( phy, pattern, separator, cutoff_specifics );
if ( !quit ) {
if ( phys.length == 1 ) {
final ResultMulti res = AnalysisMulti.execute( phy, pattern, separator, cutoff_specifics );
if ( !quit ) {
if ( phys.length == 1 ) {
- printResult( res, -1 );
+ printResult( res, -1, remove_annotation_sep );
}
else {
}
else {
- printResult( res, counter );
+ printResult( res, counter, remove_annotation_sep );
}
}
if ( outtable_writer != null ) {
}
}
if ( outtable_writer != null ) {
- writeResultToTable( res, outtable_writer );
+ writeResultToTable( res, outtable_writer, remove_annotation_sep );
outtable_writer.flush();
}
++counter;
outtable_writer.flush();
}
++counter;
@@
-369,7
+380,9
@@
public final class cladinator {
}
}
}
}
- private final static void printResult( final ResultMulti res, final int counter ) {
+ private final static void printResult( final ResultMulti res,
+ final int counter,
+ final boolean remove_annotation_sep ) {
System.out.println();
if ( counter == -1 ) {
System.out.println( "Result for " + res.getQueryNamePrefix() );
System.out.println();
if ( counter == -1 ) {
System.out.println( "Result for " + res.getQueryNamePrefix() );
@@
-383,21
+396,41
@@
public final class cladinator {
else {
System.out.println( " Matching Clade(s):" );
for( final Prefix prefix : res.getCollapsedMultiHitPrefixes() ) {
else {
System.out.println( " Matching Clade(s):" );
for( final Prefix prefix : res.getCollapsedMultiHitPrefixes() ) {
- System.out.println( " " + prefix );
+ if ( remove_annotation_sep ) {
+ System.out.println( " " + prefix.toStringRemovSeparator() );
+ }
+ else {
+ System.out.println( " " + prefix );
+ }
}
if ( res.isHasSpecificMultiHitsPrefixes() ) {
System.out.println();
System.out.println( " Specific-hit(s):" );
for( final Prefix prefix : res.getSpecificMultiHitPrefixes() ) {
}
if ( res.isHasSpecificMultiHitsPrefixes() ) {
System.out.println();
System.out.println( " Specific-hit(s):" );
for( final Prefix prefix : res.getSpecificMultiHitPrefixes() ) {
- System.out.println( " " + prefix );
+ if ( remove_annotation_sep ) {
+ System.out.println( " " + prefix.toStringRemovSeparator() );
+ }
+ else {
+ System.out.println( " " + prefix );
+ }
}
System.out.println();
System.out.println( " Matching Clade(s) with Specific-hit(s):" );
for( final Prefix prefix : res.getCollapsedMultiHitPrefixes() ) {
}
System.out.println();
System.out.println( " Matching Clade(s) with Specific-hit(s):" );
for( final Prefix prefix : res.getCollapsedMultiHitPrefixes() ) {
- System.out.println( " " + prefix );
+ if ( remove_annotation_sep ) {
+ System.out.println( " " + prefix.toStringRemovSeparator() );
+ }
+ else {
+ System.out.println( " " + prefix );
+ }
for( final Prefix spec : res.getSpecificMultiHitPrefixes() ) {
if ( spec.getPrefix().startsWith( prefix.getPrefix() ) ) {
for( final Prefix spec : res.getSpecificMultiHitPrefixes() ) {
if ( spec.getPrefix().startsWith( prefix.getPrefix() ) ) {
- System.out.println( " " + spec );
+ if ( remove_annotation_sep ) {
+ System.out.println( " " + spec.toStringRemovSeparator() );
+ }
+ else {
+ System.out.println( " " + spec );
+ }
}
}
}
}
}
}
@@
-406,14
+439,24
@@
public final class cladinator {
System.out.println();
System.out.println( " Matching Down-tree Bracketing Clade(s):" );
for( final Prefix prefix : res.getCollapsedMultiHitPrefixesDown() ) {
System.out.println();
System.out.println( " Matching Down-tree Bracketing Clade(s):" );
for( final Prefix prefix : res.getCollapsedMultiHitPrefixesDown() ) {
- System.out.println( " " + prefix );
+ if ( remove_annotation_sep ) {
+ System.out.println( " " + prefix.toStringRemovSeparator() );
+ }
+ else {
+ System.out.println( " " + prefix );
+ }
}
}
if ( !ForesterUtil.isEmpty( res.getAllMultiHitPrefixesUp() ) ) {
System.out.println();
System.out.println( " Matching Up-tree Bracketing Clade(s):" );
for( final Prefix prefix : res.getCollapsedMultiHitPrefixesUp() ) {
}
}
if ( !ForesterUtil.isEmpty( res.getAllMultiHitPrefixesUp() ) ) {
System.out.println();
System.out.println( " Matching Up-tree Bracketing Clade(s):" );
for( final Prefix prefix : res.getCollapsedMultiHitPrefixesUp() ) {
- System.out.println( " " + prefix );
+ if ( remove_annotation_sep ) {
+ System.out.println( " " + prefix.toStringRemovSeparator() );
+ }
+ else {
+ System.out.println( " " + prefix );
+ }
}
}
System.out.println();
}
}
System.out.println();
@@
-423,7
+466,10
@@
public final class cladinator {
System.out.println();
}
System.out.println();
}
- private final static void writeResultToTable( final ResultMulti res, final EasyWriter w ) throws IOException {
+ private final static void writeResultToTable( final ResultMulti res,
+ final EasyWriter w,
+ final boolean remove_annotation_sep )
+ throws IOException {
if ( ( res.getAllMultiHitPrefixes() == null ) | ( res.getAllMultiHitPrefixes().size() < 1 ) ) {
w.print( res.getQueryNamePrefix() );
w.print( "\t" );
if ( ( res.getAllMultiHitPrefixes() == null ) | ( res.getAllMultiHitPrefixes().size() < 1 ) ) {
w.print( res.getQueryNamePrefix() );
w.print( "\t" );
@@
-435,7
+481,12
@@
public final class cladinator {
w.print( "\t" );
w.print( "Matching Clades" );
w.print( "\t" );
w.print( "\t" );
w.print( "Matching Clades" );
w.print( "\t" );
- w.print( prefix.getPrefix() );
+ if ( remove_annotation_sep ) {
+ w.print( prefix.getPrefixRemovSeparator() );
+ }
+ else {
+ w.print( prefix.getPrefix() );
+ }
w.print( "\t" );
w.print( df.format( prefix.getConfidence() ) );
w.print( "\t" );
w.print( "\t" );
w.print( df.format( prefix.getConfidence() ) );
w.print( "\t" );
@@
-450,7
+501,12
@@
public final class cladinator {
w.print( "\t" );
w.print( "Specific-hits" );
w.print( "\t" );
w.print( "\t" );
w.print( "Specific-hits" );
w.print( "\t" );
- w.print( prefix.getPrefix() );
+ if ( remove_annotation_sep ) {
+ w.print( prefix.getPrefixRemovSeparator() );
+ }
+ else {
+ w.print( prefix.getPrefix() );
+ }
w.print( "\t" );
w.print( df.format( prefix.getConfidence() ) );
w.print( "\t" );
w.print( "\t" );
w.print( df.format( prefix.getConfidence() ) );
w.print( "\t" );
@@
-466,7
+522,12
@@
public final class cladinator {
w.print( "\t" );
w.print( "Matching Down-tree Bracketing Clades" );
w.print( "\t" );
w.print( "\t" );
w.print( "Matching Down-tree Bracketing Clades" );
w.print( "\t" );
- w.print( prefix.getPrefix() );
+ if ( remove_annotation_sep ) {
+ w.print( prefix.getPrefixRemovSeparator() );
+ }
+ else {
+ w.print( prefix.getPrefix() );
+ }
w.print( "\t" );
w.print( df.format( prefix.getConfidence() ) );
w.print( "\t" );
w.print( "\t" );
w.print( df.format( prefix.getConfidence() ) );
w.print( "\t" );
@@
-482,7
+543,12
@@
public final class cladinator {
w.print( "\t" );
w.print( "Matching Up-tree Bracketing Clades" );
w.print( "\t" );
w.print( "\t" );
w.print( "Matching Up-tree Bracketing Clades" );
w.print( "\t" );
- w.print( prefix.getPrefix() );
+ if ( remove_annotation_sep ) {
+ w.print( prefix.getPrefixRemovSeparator() );
+ }
+ else {
+ w.print( prefix.getPrefix() );
+ }
w.print( "\t" );
w.print( df.format( prefix.getConfidence() ) );
w.print( "\t" );
w.print( "\t" );
w.print( df.format( prefix.getConfidence() ) );
w.print( "\t" );
@@
-516,11
+582,13
@@
public final class cladinator {
System.out.println( " -" + EXTRA_PROCESSING1_KEEP_EXTRA_OPTION
+ " : to keep extra annotations (e.g. \"Q16611|A.1.1\" becomes \"A.1.1.Q16611\")" );
System.out.println( " -" + SPECIAL_PROCESSING_OPTION
System.out.println( " -" + EXTRA_PROCESSING1_KEEP_EXTRA_OPTION
+ " : to keep extra annotations (e.g. \"Q16611|A.1.1\" becomes \"A.1.1.Q16611\")" );
System.out.println( " -" + SPECIAL_PROCESSING_OPTION
- + "=<pattern> : special processing with pattern (e.g. \"(\\d+)([a-z]+)_(.+)\" for \"6q_EF42\" to \"6.q.EF42\")" );
+ + "=<pattern> : special processing with pattern (e.g. \"(\\d+)([a-z]+)_.+\" for changing \"6q_EF42\" to \"6.q\")" );
+ System.out.println( " -" + REMOVE_ANNOT_SEP_OPTION
+ + " : to remove the annotation-separator in the output" );
System.out.println( " -" + VERBOSE_OPTION + " : verbose" );
System.out.println( " -" + VERBOSE_OPTION + " : verbose" );
- System.out.println( " -" + QUIET_OPTION + " : quiet" );
+ System.out.println( " -" + QUIET_OPTION + " : quiet (for when used in a pipeline)" );
System.out.println( " --" + QUERY_PATTERN_OPTION
System.out.println( " --" + QUERY_PATTERN_OPTION
- + "=<query pattern>: the regular expression for the query (default: \"" + QUERY_PATTERN_DEFAULT
+ + "=<pattern> : the regular expression pattern for the query (default: \"" + QUERY_PATTERN_DEFAULT
+ "\" for pplacer output)" );
System.out.println();
System.out.println( "Examples:" );
+ "\" for pplacer output)" );
System.out.println();
System.out.println( "Examples:" );
@@
-531,6
+599,7
@@
public final class cladinator {
System.out.println( " " + PRG_NAME + " -x -xs=& -xk pp_out_trees.sing.tre result.tsv" );
System.out.println( " " + PRG_NAME + " -x -xs=\"|\" pp_out_trees.sing.tre result.tsv" );
System.out.println( " " + PRG_NAME + " -x -xk -m=map.tsv pp_out_trees.sing.tre result.tsv" );
System.out.println( " " + PRG_NAME + " -x -xs=& -xk pp_out_trees.sing.tre result.tsv" );
System.out.println( " " + PRG_NAME + " -x -xs=\"|\" pp_out_trees.sing.tre result.tsv" );
System.out.println( " " + PRG_NAME + " -x -xk -m=map.tsv pp_out_trees.sing.tre result.tsv" );
+ System.out.println( " " + PRG_NAME + " -m=map.tsv -S='(\\d+)([a-z?]*)_.+' pp_out_trees.sing.tre result.tsv" );
System.out.println();
}
}
System.out.println();
}
}