JAL-629 STDOUT documentation. Opt.STDOUT narrower option. Fix for subvals and STDOU...
[jalview.git] / help / help / html / features / clarguments-basic.html
1 <html>
2 <!--
3  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
4  * Copyright (C) $$Year-Rel$$ The Jalview Authors
5  * 
6  * This file is part of Jalview.
7  * 
8  * Jalview is free software: you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License 
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *  
13  * Jalview is distributed in the hope that it will be useful, but 
14  * WITHOUT ANY WARRANTY; without even the implied warranty 
15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
16  * PURPOSE.  See the GNU General Public License for more details.
17  * 
18  * You should have received a copy of the GNU General Public License
19  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
20  * The Jalview Authors are detailed in the 'AUTHORS' file.
21  -->
22 <title>Command Line: basic usage</title>
23 <body>
24
25   <h1>Command Line: basic usage</h1>
26
27   <p>
28   <a href="clarguments.html">Command Line: introduction</a>
29   <br/>
30   Command Line: basic usage
31   <br/>
32   <a href="clarguments-advanced.html">Command Line: advanced usage</a>
33   <br/>
34   <a href="clarguments-argfiles.html">Command Line: argument files</a>
35   <br/>
36   <a href="clarguments-reference.html">Command Line: reference</a>
37   </p>
38
39   <hr/>
40
41   <ul>
42   <li><a href="#openingalignments">Opening alignments</a></li>
43   <li><a href="#alignmentoptions">Alignment options</a></li>
44   <li><a href="#adding3dstructures">Adding 3D structures</a></li>
45   <li><a href="#outputtingalignmentfiles">Outputting/converting alignment files and images</a></li>
46   <li><a href="#filenamesubstitutionsandbatchprocessing">Filename substitutions and batch processing</a></li>
47   <li><a href="#alloutputwildcard">The all output wildcard</a></li>
48   </ul>
49
50   <h2><a name="openingalignments"></a>Opening alignments (<code>--open</code>, <code>--append</code>, <code>--new</code>)</h2>
51
52   <p>
53   To simply open one or more alignment files in different windows just put the filenames as the first arguments:
54   <pre>
55   jalview filename1 filename2 ...
56   </pre>
57   </p>
58
59   <p>
60   You can use shell-expanded wildcards:
61   <pre>
62   jalview this/filename* that/filename* other/filename*
63   </pre>
64   and URLs:
65   <pre>
66   jalview https://rest.uniprot.org/uniprotkb/P00221.fasta
67   </pre>
68   </p>
69
70   <p>
71   (Using initial filenames is the same as using the <code>--open</code> argument, and further arguments can be used
72   after the initial filenames.)
73   </p>
74
75   <h3><a name="open"></a><code>--open</code></h3>
76
77   <p>
78   Use the <code>--open</code> argument to open alignment files each in their own window.
79   </p>
80
81   <p>
82   The following are equivalent:
83   <pre>
84   jalview --open filename1 filename2 ...
85
86   jalview --open filename*
87
88   jalview --open filename1 --open filename2 --open ...
89
90   jalview filename1 filename2 ...
91   </pre>
92   </p>
93
94   <p>
95   Similarly you can open URLs:
96   <pre>
97   jalview --open https://rest.uniprot.org/uniprotkb/P00221.fasta
98   </pre>
99   </p>
100
101   <h3><a name="append"></a><code>--append</code></h3>
102
103   <p>
104   To append several alignment files together use:
105   <pre>
106   jalview --open filename1.fa --append filename2.fa filename3.fa
107   </pre>
108   or, if you haven't previously used <code>--open</code> then you can use --append to open one new window and keep appending each set of alignments:
109   <pre>
110   jalview --append these/filename*.fa --append more/filename*.fa
111
112   jalview --append https://rest.uniprot.org/uniprotkb/P00221.fasta https://www.uniprot.org/uniprotkb/A0A0K9QVB3/entry
113   </pre>
114   </p>
115
116   <p>
117   <strong>Note</strong> that whilst you can include a Jalview Project File (<code>.jvp</code>) as an <code>--append</code> value, the items in the file will always open in their original windows and not append to another.
118   </p>
119
120   <h3><a name="new"></a><code>--new</code></h3>
121
122   <p>
123   To append different sets of alignment files in different windows, use <code>--new</code> to move on to a new alignment window:
124   <pre>
125   jalview --append these/filename*.fa --new --append other/filename*.fa
126   </pre>
127   </p>
128
129   <p>
130   <code>--open</code> is like using <code>--new --append</code> applied to every filename/URL given to <code>--open</code>
131   </p>
132
133
134   <h2><a name="alignmentoptions"></a>Alignment options (<code>--colour</code>, <code>--wrap</code>, <code>--showannotations</code>, <code>--title</code>)</h2>
135
136   <h3><a name="colour"></a><code>--colour</code></h3>
137
138   <p>
139   You can specify a residue/base colouring for the alignment using the <code>--colour</code> option (note spelling -- Jalview is made in Scotland!):
140   <pre>
141   jalview --open examples/uniref50.fa --colour gecos-flower
142   </pre>
143   There are several colour schemes that you can use.  See the <a href="../colourSchemes/index.html">page on Colour Schemes</a> for details.
144   The names to use on the command line for colour schemes are:
145   </p>
146   <p>
147   <code>clustal</code>,
148   <br/>
149   <code>blosum62</code>,
150   <br/>
151   <code>pc-identity</code>,
152   <br/>
153   <code>zappo</code>,
154   <br/>
155   <code>taylor</code>,
156   <br/>
157   <code>gecos-flower</code>,
158   <br/>
159   <code>gecos-blossom</code>,
160   <br/>
161   <code>gecos-sunset</code>,
162   <br/>
163   <code>gecos-ocean</code>,
164   <br/>
165   <code>hydrophobic</code>,
166   <br/>
167   <code>helix-propensity</code>,
168   <br/>
169   <code>strand-propensity</code>,
170   <br/>
171   <code>turn-propensity</code>,
172   <br/>
173   <code>buried-index</code>,
174   <br/>
175   <code>nucleotide</code>,
176   <br/>
177   <code>nucleotide-ambiguity</code>,
178   <br/>
179   <code>purine-pyrimidine</code>,
180   <br/>
181   <code>rna-helices</code>,
182   <br/>
183   <code>t-coffee-scores</code>,
184   <br/>
185   <code>sequence-id</code>
186   </p>
187
188   <h3><a name="wrap"></a><code>--wrap</code></h3>
189   <p>
190   An alignment should open with your usual preferences stored in the <code>.jalview_properties</code> file.  To open an alignment with the sequences (definitely) wrapped, following your <code>--open</code> (or first <code>--append</code>) argument use the argument <code>--wrap</code>:
191   <pre>
192   jalview --open examples/uniref50.fa --wrap
193   </pre>
194   To ensure an alignment is not wrapped use <code>--nowrap</code>:
195   <pre>
196   jalview --open examples/uniref50.fa --nowrap
197   </pre>
198   </p>
199
200   <h3><a name="showannotations"></a><code>--showannotations</code> / <code>--noshowannotations</code></h3>
201
202   <p>
203   You can specify whether the currently opened alignment window should show alignment annotations (e.g. Conservation, Quality, Consensus...) or not with either <code>--showannotations</code> or <code>--noshowannotations</code>.  If you don't specify then your saved preference will be used.
204   <pre>
205   jalview --open examples/uniref50.fa --noshowannotations
206   </pre>
207   </p>
208
209   <h3><a name="title"></a><code>--title</code></h3>
210
211   <p>
212   If you would like to give the alignment window a specific title you can do so with the <code>--title</code> option:
213   <pre>
214   jalview --open examples/uniref50.fa --title "My example alignment"
215   </pre>
216   </p>
217
218
219
220
221   <h2><a name="adding3dstructures"></a>Adding 3D structures (<code>--structure</code>, <code>--seqid</code>, <code>--structureviewer</code>, <code>--paematrix</code>, <code>--tempfac</code>, <code>--showssannotations</code>)</h2>
222
223   <p>
224   </p>
225
226   <h3><a name="structure"></a><code>--structure</code></h3>
227
228   <p>
229   You can add a 3D structure file to a sequence in the current alignment window with the <code>--structure</code> option:
230   <pre>
231   jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb
232   </pre>
233   By default this attaches to the first sequence in the alignment but most likely you will want to attach it to a specific sequence.
234   </p>
235
236   <h3><a name="seqid"></a><code>--seqid</code></h3>
237
238   <p>
239   The easiest way to specify a sequence ID for your structure is to follow the <code>--structure</code> argument with a <code>--seqid</code> argument with a value of a sequence ID in the alignment.  This does of course require some knowledge of the sequences in the alignment files
240   that have been opened.
241   <br/>
242   Alternatively you can specify a <em>sub-value</em> with the <code>--structure</code> argument value.  You do this by preceding the value with square brackets and <code>seqid=SequenceId</code>,
243   like this:
244   <pre>
245   jalview --open examples/uniref50.fa --structure [seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
246   </pre>
247   which is equivalent to
248   <pre>
249   jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb --seqid FER1_SPIOL
250   </pre>
251   </p>
252
253   <p>
254   The sub-value <code>seqid=FER1_SPIOL</code> takes precedence over the following argument <code>--seqid FER1_SPIOL</code> if you accidentally specify both (in which case the argument will probably be completely unused).
255   </p>
256
257   <p>
258   If you don't know the sequence IDs but do know the position of the sequence in the alignment, you can also specify an <em>INDEX</em>
259   in the sub-values to indicate which sequence in the alignment to attach the sequence to (although this is less precise).  This is a zero-indexed value, so to specify the eighth sequence in the alignment use:
260   <pre>
261   jalview --open examples/uniref50.fa --structure [7]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
262   </pre>
263
264   <p>
265   Remember that you might need to escape any spaces in the sequence ID or enclose the ID in quotation marks.
266   </p>
267
268   <h3><a name="structureviewer"></a><code>--structureviewer</code></h3>
269
270   <p>
271   You can specify which structure viewer (or none) to use to open the structure using either the <code>--structureviewer</code> argument or the <code>structureviewer</code> sub-value.  Multiple sub-values can be specified together, separated by a comma ','.  Possible values for the <code>structureviewer</code> are:
272   <br/>
273   <code>none</code>,
274   <br/>
275   <code>jmol</code>,
276   <br/>
277   <code>chimera</code>,
278   <br/>
279   <code>chimerax</code>,
280   <br/>
281   <code>pymol</code>.
282   </p>
283   <p>
284   <code>none</code> and <code>jmol</code> will always be available, but to use the others you must have the appropriate software already set up on your computer and in Jalview.  See the page <a href="../features/viewingpdbs.html">Discovering and Viewing PDB and 3D-Beacons structures</a> for more details.
285   <pre>
286   jalview --open examples/uniref50.fa --structure [seqid=FER1_SPIOL,structureviewer=none]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
287   </pre>
288   or, if you prefer
289   <pre>
290   jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb --seqid FER1_SPIOL --structureviewer none
291   </pre>
292   </p>
293
294   <h3><a name="paematrix"></a><code>--paematrix</code></h3>
295
296   <p>
297   If you are opening a structure file that has a PAE matrix (provided as a JSON file), such as from an AlphaFold model or an nf-core pipeline, you can add the PAE matrix as an annotation by following the <code>--structure</code> argument with a <code>--paematrix</code> argument with the filename.  You can also specify a <code>paematrix=filename</code> sub-value.
298   <pre>
299   jalview --open examples/uniref50.fa --structure [seqid=FER1+SPIOL,structureviewer=pymol]examples/AlphaFold/AF-P00221-F1-model_v4.pdb --paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json
300   </pre>
301   </p>
302
303   <h3><a name="tempfac"></a><code>--tempfac</code></h3>
304
305   <p>
306   Structure files may have a temperature factor associated with the structure component positions.  If the temperature factor is a pLDDT confidence score, such as with an AlphaFold model, you can specify this by using a following argument of <code>--tempfac</code> with a value of <code>plddt</code>.  This will enable standard pLDDT colouring of the temperature factor annotation.  Valid values are:
307   <code>default</code>,
308   <code>plddt</code>.
309   More types of temperature factor may be added in future releases of Jalview.
310   <br/>
311   The value can also be specified as a sub-value:
312   <pre>
313   jalview --open examples/uniref50.fa --structure [seqid=FER1+SPIOL,structureviewer=jmol,tempfac=plddt]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
314   </pre>
315   which is equivalent to
316   <pre>
317   jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb --tempfac plddt --seqid FER1+SPIOL
318    --structureviewer jmol
319   </pre>
320
321   </p>
322
323   <!-- notempfac not yet working. undocumented until then -->
324
325   <h3><a name="showssannotations"></a><code>--showssannotations</code> / <code>--noshowssannotations</code></h3>
326
327   <p>
328   You can specify whether the currently opened alignment window should show secondary structure annotations or not with either <code>--showssannotations</code> or <code>--noshowssannotations</code>.  If you don't specify then your saved preference will be used.
329   <pre>
330   jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb --noshowssannotations
331   </pre>
332   or you can use a sub-value modifier:
333   <pre>
334   jalview --open examples/uniref50.fa --structure [noshowssannotations]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
335   </pre>
336   </p>
337
338   <h2><a name="outputtingalignmentfiles"></a>Outputting/converting alignment files and images (<code>--output</code>, <code>--format</code>, <code>--image</code>, <code>--type</code>, <code>--textrenderer</code>, <code>--scale</code>, <code>--backups</code>, <code>--overwrite</code>)</h2>
339
340   <p>
341   You can save an alignment as an alignment file, or exported as an image, in different formats.  Jalview's alignment output formats are:
342   fasta,
343   pfam,
344   stockholm,
345   pir,
346   blc,
347   amsa,
348   json,
349   pileup,
350   msf,
351   clustal,
352   phylip,
353   jalview.
354   </p>
355   <p>
356   Alignments can be exported as an image in formats EPS, SVG, HTML, BioJSON (vector formats) or PNG (bitmap format).
357   </p>
358   <p>
359   In vector formats you can specify whether text should be rendered as text (which may have font changes, but will produce a smaller and more usable file) or as lineart (which will retain exact appearance of text, but will be less easy to edit or use to copy text).
360   </p>
361   <p>
362   In bitmap formats (currently only PNG, but what else would you want?!) you can specify a scaling factor to improve the resolution of the output image.
363   </p>
364
365   <h3><a name="output"></a><code>--output</code></h3>
366
367   <p>
368   To save the open alignment in a new alignment file use <code>--output filename</code>.  The format for the file can be found from the extension of <code>filename</code>, or if you are using a non-standard extension you can use a following <code>--format</code> argument, or specify it as a sub-value modifier.
369   </p>
370   <p>
371   Recognised formats and their recognised extensions are:
372   <br/>
373   <code>fasta</code> (<code>fa, fasta, mfa, fastq</code>),
374   <br/>
375   <code>pfam</code> (<code>pfam</code>),
376   <br/>
377   <code>stockholm</code> (<code>sto, stk</code>),
378   <br/>
379   <code>pir</code> (<code>pir</code>),
380   <br/>
381   <code>blc</code> (<code>blc</code>),
382   <br/>
383   <code>amsa</code> (<code>amsa</code>),
384   <br/>
385   <code>json</code> (<code>json</code>),
386   <br/>
387   <code>pileup</code> (<code>pileup</code>),
388   <br/>
389   <code>msf</code> (<code>msf</code>),
390   <br/>
391   <code>clustal</code> (<code>aln</code>),
392   <br/>
393   <code>phylip</code> (<code>phy</code>),
394   <br/>
395   <code>jalview</code> (<code>jvp, jar</code>).
396   </p>
397   <p>
398   For example, to open a FASTA file, append another FASTA file and then save the concatenation as a Stockholm file, do
399   <pre>
400   jalview --open alignment1.fa --append alignment2.fa --output bothalignments.stk
401   </pre>
402   or
403   <pre>
404   jalview --append alignment*.fa --output bigballofstring.txt --format stockholm
405   </pre>
406   or
407   <pre>
408   jalview --append alignment*.fa --output [format=stockholm]bigballofstring.txt
409   </pre>
410   </p>
411
412   <p>
413   <em>Important!</em> If you use <code>--output</code> 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 <code>--headless</code>).  To use Jalview with <code>--output</code> and not assume headless mode, use the <code>--gui</code> or <code>--noheadless</code> argument (the order doesn't matter).
414   </p>
415
416   <p>
417   If you would like to output an alignment file directly to standard output (often referred to as STDOUT), then use the filename <code>-</code> (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.
418   </p>
419   <p>
420   For example, to open a Stockholm file and pipe it to another command as a Block file, do
421   <pre>
422   jalview --open alignment1.stk --output - --format blc | another_command
423   </pre>
424   or equivalently
425   <pre>
426   jalview alignment1.stk --output=[format=blc]- | another_command
427   </pre>
428   </p>
429
430   <h3><a name="format"></a><code>--format</code></h3>
431
432   <p>
433   To specify the format of the output file (if using an unrecognised file extension) use the <code>--format</code> argument to specify a value (see above).  A sub-value modifier on the <code>--output</code> value can also be used.
434   </p>
435
436   <h3><a name="image"></a><code>--image</code></h3>
437   To export the open alignment window as an image, use the <code>--image</code> argument, which will give an image of the alignment and annotations as it appears (or would appear if not in <code>--headless</code> mode) in the alignment window if it was large enough for the whole alignment, including colour choice and features.
438   <p>
439   <pre>
440   jalview --open examples/plantfdx.fa --colour gecos-blossom --features examples/plantfdx.features --annotations examples/plantfdx.annotations --image plantfdx.png --headless
441   </pre>
442   </p>
443
444   <p>
445   This by default produces a PNG image of screen or webpage resolution, which you may want to improve upon.  There are two ways of doing this with Jalview: increasing the scale of the PNG image, or using a vector based image format (EPS, SVG, HTML).
446   <p>
447
448   <h3><a name="bitmap"></a>Bitmap image types (<code>png</code>)</h3>
449
450   <p>
451   Bitmap images are composed of an array of pixels.  Bitmap images with a low resolution that are blown up to a larger size appear "blocky", so it is important to get the resolution for your purpose correct.  Older screens only require a modest resolution, whilst newer HiDPI screens look better with a higher resolution.  For print you will want an even higher resolution although in this case you would probably want to use a vector image format.  In general creating a bitmap image that has a large resolution means you can scale the image down if needed, although if you are running a batch process this will take more time and resources.
452   </p>
453   <p>
454   Jalview only produces a PNG bitmap image type.  This is a high-colour lossless format which can also use lossless compression so is suitable for alignment figures.
455   </p>
456   <p>
457   Let's increase the resolution of the PNG image:
458   </p>
459
460   <h3><a name="scale"></a><code>--scale</code></h3>
461
462   <p>
463   We can increase the size of the PNG image by a factor of <em>S</em> by following the <code>--image</code> argument with a <code>--scale <em>S</em></code> argument and value.  The value doesn't have to be an integer and should be given as an integer or floating point formatted number, e.g.
464   <pre>
465   jalview --open examples/uniref50.fa --colour gecos-ocean --image mypic.png --scale 5.5 --headless
466   </pre>
467   which will produce a PNG image 5.5 times larger (and more detailed) than without the <code>--scale</code> argument.
468   </p>
469   <p>
470   However, since you won't necessarily already know the size of an alignment's exported image you can specify either an exact width or height (in pixels) with either one of the
471   <code>--width</code> and <code>--height</code> arguments:
472
473   <h3><a name="width"></a><code>--width</code></h3>
474
475   <p>
476   Specify an exact width of an exported PNG image with <code>--width</code>:
477   <pre>
478   jalview --headless --open https://www.ebi.ac.uk/interpro/api/entry/pfam/PF03760/?annotation=alignment%3Aseed --noshowannotations --colour gecos-sunset --image wallpaper.png --width 3840
479   </pre>
480   </p>
481
482   <h3><a name="height"></a><code>--height</code></h3>
483
484   <p>
485   Alternatively specify an exact height with the <code>--height</code> argument:
486   <pre>
487   jalview --headless --open https://www.ebi.ac.uk/interpro/api/entry/pfam/PF03760/?annotation=alignment%3Aseed --noshowannotations --colour gecos-ocean --image wallpaper.png --height 2160
488   </pre>
489   </p>
490
491   <p>
492   You can specify two or all of <code>--scale</code>, <code>--width</code> and <code>--height</code> as limits to the size of the image (think of one or two bounding boxes) and the one which produces the smallest scale of image is used.  You can also specify each of these as sub-value modifiers to the <code>--image</code> value:
493   <pre>
494   jalview --headless --open https://www.ebi.ac.uk/interpro/api/entry/pfam/PF03760/?annotation=alignment%3Aseed --noshowannotations --colour gecos-flower --image [scale=0.25,width=320,height=240]thumbnail.png
495   </pre>
496   </p>
497
498   <p>
499   Next we look at vector image formats, which maintain detail at all resolutions.
500   </p>
501
502   <h3><a name="vector"></a>Vector image export</h3>
503
504   <p>
505   Jalview can export an alignment in Encapsulated PostScript (<code>eps</code>), Scalable Vector Graphics (<code>svg</code>), HTML (<code>html</code>) or BioJSON -- another HTML format (<code>biojs</code>), by using, e.g.
506   <pre>
507   jalview --open examples/uniref50.fa --colour gecos-flower --image printable.eps
508   </pre>
509   The image format can be specified with the <code>--type</code> argument or as a sub-value modifier on the <code>--image</code> value.  If neither is used the <code>type</code> will be guessed from the image file extension.  The following three examples should produce the same contents:
510   <pre>
511   jalview --open examples/uniref50.fa --colour gecos-flower --image printable.eps
512   jalview --open examples/uniref50.fa --colour gecos-flower --image printable.postscript --type eps
513   jalview --open examples/uniref50.fa --colour gecos-flower --image [type=eps]printable.postscript
514   </pre>
515   </p>
516
517   <h3><a name="textrenderer"></a><code>--textrenderer</code></h3>
518
519   <p>
520   In a vector format any text that appears on the page (including residue/base labels) can be saved in the image file either as <code>text</code> or as <code>lineart</code> using the <code>--textrenderer</code> argument.  This is only available for <code>eps</code>, <code>svg</code> and <code>html</code> formats.
521   </p>
522
523   <p>
524   The difference is potentially in the appearance of the file, and definitely in the filesize!  Saving with <code>text</code> requires the font used to display the text characters in the alignment to be present on the viewing platform to look exactly the same.  If it isn't then another suitable font will probably be used.  The filesize using <code>text</code> is relatively small.
525   </p>
526   <p>
527   When using <code>lineart</code> each individual character that appears in the alignment (including names/titles and resisdues/bases) is stored in the image with its own vector lines.  This means that the appearance of the text is retained exactly independent of installed fonts, but the filesize is increased.  You will also be unable to copy what appears to be text as text.
528   </p>
529
530   <p>
531   The type of <code>--textrenderer</code> can be specified with an argument following <code>--image</code> or as a sub-value modifier:
532   <pre>
533   jalview --open examples/uniref50.fa --colour gecos-flower --image printable.html --type biojs
534   jalview --open examples/uniref50.fa --colour gecos-flower --image [type=eps,textrenderer=lineart]printable.ps
535   </pre>
536   </p>
537
538
539   <h2><a name="filenamesubstitutionsandbatchprocessing"></a>Filename substitutions and batch processing (<code>--substitutions</code>, <code>--close</code>, <code>--all</code>)</h2>
540
541   <p>
542   One of the more powerful aspects of Jalview's command line operations is that stores all of the different opened alignment arguments (before opening them) and can apply some arguments to <em>all</em> of the alignments as they are opened.  This includes display and output arguments.
543   </p>
544
545   <p>
546   When outputting a file you will obviously want to use a different filename for each of the alignments that are opened.  There are several ways you can specify how that filename differs, but the easiest way is to refer to the input filename and change the extension.  In the case of an alignment where multiple files are appended, the filename of the first file to be appended or opened is used.
547   </p>
548
549   <p>
550   To refer to different parts of the opening filename, you can use the strings
551   <ul>
552   <li><code>{dirname}</code> -- is replaced by the directory path to the opened file.</li>
553   <li><code>{basename}</code> -- is replaced by the base of the filename of the opened file. This is without the path or file extension (if there is one).</li>
554   <li><code>{extension}</code> -- is replaced by the extension of the filename of the opened file.</li>
555   </ul>
556   The braces (curly brackets '{', '}') are important!
557   </p>
558
559   <p>
560   These filename substitutions are on by default, but if for whatever reason you wish to disable the substitutions, they can be turned off (or back on again) through the list of arguments with:
561   </p>
562
563   <h3><a name="substitutions"></a><code>--substitutions / --nosubstitutions</code></h3>
564
565   <p>
566   Enable (or disable) filename substitutions in the following argument values and sub-value modifier values.
567   <pre>
568   jalview --open exampes/uniref50.fa --nosubstitutions --output I_Want_A_Weird_Output_Filname_With_{basename}_Curly_Brackets_In_And_A_Sensible_One_Next.stk --substitutions --output tmp/{basename}.stk --headless
569   </pre>
570   </p>
571
572   <p>
573   For opening single files this is less useful, since you could obviously just type the output filename, but for multiple opened alignments you can also use these substituted values and they will be replaced by the relevant part of the filename given for each opened alignment window.  Normally an <code>--output</code> or <code>--image</code> argument will only be applied to the latest opened alignment window, but you can tell Jalview to apply some arguments to all alignments that have been opened (so far) by using the <code>--all</code> argument.
574   </p>
575
576   <h3><a name="all"></a><code>--all / -noall</code></h3>
577
578   <p>
579   When using the <code>--all</code> argument, following arguments will apply to all of the previously opened alignment windows.  You can turn this behaviour off again for following arguments using the <code>--noall</code> argument.  The arguments that can apply to all previously opened alignments are:
580   <br/>
581   <code>--colour</code>
582   <br/>
583   <code>--sortbytree</code>
584   <br/>
585   <code>--showannotations</code>
586   <br/>
587   <code>--wrap</code>
588   <br/>
589   <code>--nostructure</code>
590   <br/>
591   <code>--notempfac</code>
592   <br/>
593   <code>--showssannotations</code>
594   <br/>
595   <code>--image</code>
596   <br/>
597   <code>--type</code>
598   <br/>
599   <code>--textrenderer</code>
600   <br/>
601   <code>--scale</code>
602   <br/>
603   <code>--width</code>
604   <br/>
605   <code>--height</code>
606   <br/>
607   <code>--output</code>
608   <br/>
609   <code>--format</code>
610   <br/>
611   <code>--groovy</code>
612   <br/>
613   <code>--backups</code>
614   <br/>
615   <code>--overwrite</code>
616   <br/>
617   <code>--close</code>
618   </p>
619   <p>
620   In particular, for our example above, we can use <code>-all</code> and <code>--output</code> like this (<code>--close</code> will be explained in a moment):
621   <pre>
622   jalview --open all_my_fasta_files/*.fa --all --output all_my_converted_stockholm_files/{basename}.stk --close --headless
623   </pre>
624   </p>
625
626   <p>
627   Another example would be to create a print quality coloured postscript image for every Fasta file in several directories and place the image next to the alignment:
628   <pre>
629   jalview --open */*.fa --all --colour gecos-flower --image {dirname}/{basename}.eps --textrenderer text --close --headless
630   </pre>
631   or thumbnails for every Fasta file with
632   <pre>
633   jalview --open */*.fa --all --colour gecos-flower --image {dirname}/{basename}.png --width 256 --height 256 --close --headless
634   </pre>
635   </p>
636
637   <h3><a name="close"></a><code>--close</code></h3>
638
639   <p>
640   The <code>--close</code> tag is used to close an alignment window after all output files or image exports are performed.  This reduces memory use, especially if an <code>--open</code> value is set to open many files.  These will be opened, formatted and output sequentially so since they are closed before the next one is opened memory use will not build up over a large number of alignments.
641   <pre>
642   </pre>
643   </p>
644
645
646   <h2><a name="alloutputwildcard"></a>The all output wildcard: <code>--output "*.ext"</code>,  <code>--image "*.ext"</code></h2>
647
648   <p>
649   Purely as an intuitive syntactic sweetener, you can use the <code>--output</code> wildcard <code>*</code> <em>at the beginning of the output filename</em> as shorthand for <code>--all --output {dirname}/{basename}</code> followed by whatever you put after the '<code>*</code>'.  For example, to achieve the same as the thumbnails example above, you could use
650   <pre>
651   jalview --open */*.fa --image "*.png" --colour gecos-flower --width 256 --height 256 --close --headless
652   </pre>
653   Here we move the <code>--colour</code> argument after the <code>--output</code> argument (it will still be applied before the image export or file output) so that it is included after the implied <code>--all</code> argument.  The thumbnails will be placed in the same directory as the alignment file with the same filename except for a different extension of <code>.png</code>.
654   </p>
655
656   <p>
657   For a simple conversion of many fasta files into Stockholm format, simply use
658   <pre>
659   jalview --open all_my_fasta_files/*.fa --output "*.stk" --close --headless
660   </pre>
661   </p>
662
663   <p>
664   <strong>Important!</strong>  Please note that using a bareword <code>*.ext</code> (i.e. without an escape or quotation marks) in a shell command line will potentially be expanded by the shell to a list of all the files in the current directory ending with <code>.ext</code> <em>before</em> this value is passed to Jalview.  This will result in the first of these files being overwritten (multiple times)!  If you shell-escape the <code>*</code> (usually with a backslash '\') or enclose the value in quotation marks (<code>"*.ext"</code> - that's including the quotation marks) then the shell will not expand the wildcard.
665   </p>
666
667   <p>
668   An alternative is to use an equals sign ('=') with no spaces between the argument and the value, <code>--output=*.ext</code>, which Jalview will interpret the same, but the shell will not automatically expand before it is sent to Jalview, e.g.
669   <pre>
670   jalview --open all_my_fasta_files/*.fa --output=*.stk --close --headless
671   </pre>
672   </p>
673
674   <hr/>
675   Continue to <a href="clarguments-advanced.html">Command Line: advanced usage</a>.
676   <br/>
677   <a href="clarguments-reference.html">Command Line: reference</a>
678
679 </body>
680 </html>