From 585dbfeb3c901e3ca234a74c51a01c9e84132ef9 Mon Sep 17 00:00:00 2001
From: Ben Soares phylip
(phy
),
jalview
(jvp, jar
).
+
For example, to open a FASTA file, append another FASTA file and then save the concatenation as a Stockholm file, do
@@ -412,6 +413,20 @@ Important! If you use--output
or any other argument that outputs a file, then it will be assumed you want to run Jalview in headless mode (as if you had specified--headless
). To use Jalview with--output
and not assume headless mode, use the--gui
or--noheadless
argument (the order doesn't matter). ++ If you would like to output an alignment file directly to standard output (often referred to as STDOUT), then use the filename
+-
(a single hyphen). In this case any messages that would normally appear on STDOUT will be diverted to STDERR to avoid invalidating the output file. ++ For example, to open a Stockholm file and pipe it to another command as a Block file, do +
+ jalview --open alignment1.stk --output - --format blc | another_command ++ or equivalently ++ jalview alignment1.stk --output=[format=blc]- | another_command ++ +
--format
diff --git a/help/help/html/features/clarguments-reference.html b/help/help/html/features/clarguments-reference.html index dd0bd52..48e3a79 100644 --- a/help/help/html/features/clarguments-reference.html +++ b/help/help/html/features/clarguments-reference.html @@ -521,6 +521,8 @@
phylip
(phy
),
jalview
(jvp, jar
). +
+ To output directly to STDOUT (console output) use the filename-
(a single hyphen). In this case all STDOUT messages will instead go to STDERR. If noformat
is supplied then Fasta will be assumed.format=name
✓ diff --git a/src/jalview/bin/argparser/Arg.java b/src/jalview/bin/argparser/Arg.java index 2f25978..0088c60 100644 --- a/src/jalview/bin/argparser/Arg.java +++ b/src/jalview/bin/argparser/Arg.java @@ -93,11 +93,10 @@ public enum Arg + "turn-propensity,\n" + "buried-index,\n" + "nucleotide,\n" + "nucleotide-ambiguity,\n" + "purine-pyrimidine,\n" + "rna-helices,\n" - + "t-coffee-scores,\n" + "sequence-id.\n" - +"\n" + + "t-coffee-scores,\n" + "sequence-id.\n" + "\n" + "Names of user defined colourschemes will also work,\n" - +"and jalview colourscheme specifications like\n" - +"--colour=\"D,E=red; K,R,H=0022FF; C,c=yellow\"", + + "and jalview colourscheme specifications like\n" + + "--colour=\"D,E=red; K,R,H=0022FF; C,c=yellow\"", Opt.STRING, Opt.LINKED, Opt.ALLOWALL), FEATURES(Type.OPENING, "Add a feature file or URL to the open alignment.", Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS), @@ -200,7 +199,7 @@ public enum Arg + "clustal (aln),\n" + "phylip (phy),\n" + "jalview (jvp, jar).", Opt.STRING, Opt.LINKED, Opt.ALLOWSUBSTITUTIONS, Opt.ALLOWALL, - Opt.REQUIREINPUT, Opt.OUTPUTFILE, Opt.PRIMARY), + Opt.REQUIREINPUT, Opt.OUTPUTFILE, Opt.STDOUT, Opt.PRIMARY), FORMAT(Type.OUTPUT, "Sets the format for the preceding --output file. Valid formats are:\n" + "fasta,\n" + "pfam,\n" + "stockholm,\n" + "pir,\n" @@ -384,6 +383,11 @@ public enum Arg */ OUTPUTFILE("output file --headless will be assumed unless --gui used"), /* + * A STDOUT Arg can take an output filename that can be '-' to mean print to STDOUT. + */ + STDOUT("allows the output filename '" + ArgParser.STDOUTFILENAME + + "' to mean output to STDOUT"), + /* * A STORED Arg resets and creates a new set of "opened" linkedIds */ STORED(null), diff --git a/src/jalview/bin/argparser/BootstrapArgs.java b/src/jalview/bin/argparser/BootstrapArgs.java index 32eb91a..a989206 100644 --- a/src/jalview/bin/argparser/BootstrapArgs.java +++ b/src/jalview/bin/argparser/BootstrapArgs.java @@ -152,11 +152,19 @@ public class BootstrapArgs // not a bootstrap arg // make a check for an output going to stdout - if (a != null && a.hasOption(Opt.OUTPUTFILE)) + if (a != null && a.hasOption(Opt.OUTPUTFILE) + && a.hasOption(Opt.STDOUT)) { - if ((val == null && i + 1 < args.size() - && ArgParser.STDOUTFILENAME.equals(args.get(i + 1))) - || ArgParser.STDOUTFILENAME.equals(val)) + if (val == null && i + 1 < args.size()) + { + val = args.get(i + 1); + } + if (val.startsWith("[") && val.indexOf(']') > 0) + { + val = val.substring(val.indexOf(']') + 1); + } + + if (ArgParser.STDOUTFILENAME.equals(val)) { this.outputToStdout = true; } -- 1.7.10.2