Command Line: basic usage

Command Line: introduction
Command Line: basic usage
Command Line: advanced usage
Command Line: argument files
Command Line: reference


Opening alignments (‑‑open, ‑‑append, ‑‑new)

To simply open one or more alignment files in different alignment windows just put the filenames as the first arguments:

  jalview filename1 filename2 ...
  

You can use shell-expanded wildcards:

  jalview this/filename* that/filename* other/filename*
  
and URLs:
  jalview https://rest.uniprot.org/uniprotkb/P00221.fasta
  

(Using initial filenames is the same as using the ‑‑open argument, and further arguments can be used after the initial filenames.)

‑‑open

Use the ‑‑open argument to open alignment files each in their own window.

The following are equivalent:

  jalview --open filename1 filename2 ...

  jalview --open filename*

  jalview --open filename1 --open filename2 --open ...

  jalview filename1 filename2 ...
  

Similarly you can open URLs:

  jalview --open https://rest.uniprot.org/uniprotkb/P00221.fasta
  

‑‑append

To append several alignment files together use:

  jalview --open filename1.fa --append filename2.fa filename3.fa
  
or, if you haven't previously used ‑‑open then you can use --append to open one new window and keep appending each set of alignments:
  jalview --append these/filename*.fa --append more/filename*.fa

  jalview --append https://rest.uniprot.org/uniprotkb/P00221.fasta https://www.uniprot.org/uniprotkb/A0A0K9QVB3/entry
  

Note that whilst you can include a Jalview Project File (.jvp) as an ‑‑append value, the items in the file will always open in their original windows and not append to another.

‑‑new

To append different sets of alignment files in different windows, use ‑‑new to move on to a new alignment window:

  jalview --append these/filename*.fa --new --append other/filename*.fa
  

‑‑open is like using ‑‑new --append applied to every filename/URL given to ‑‑open

Alignment options (‑‑colour, ‑‑wrap, ‑‑showannotations, ‑‑title)

An opened alignment window (or set of opened alignment windows) can be modified in its appearance using the following arguments before the next ‑‑open argument. These modifying arguments apply to the one or more files that were opened with the preceding ‑‑open argument. E.g. ‑‑open file.fa --colour gecos-flower will colour the one alignment window with file.fa. However, ‑‑open *.fa --colour gecos-flower will colour every alignment window matching file*.fa, and --open file1.fa file2.fa --colour gecos-flower will colour both opened alignment windows.

‑‑colour

You can specify a residue/base colouring for the alignment using the ‑‑colour option (note spelling -- Jalview is made in Scotland!):

  jalview --open examples/uniref50.fa --colour gecos-flower
  
There are several colour schemes that you can use. See the page on Colour Schemes for details. The names to use on the command line for colour schemes are:

clustal,
blosum62,
pc-identity,
zappo,
taylor,
gecos-flower,
gecos-blossom,
gecos-sunset,
gecos-ocean,
hydrophobic,
helix-propensity,
strand-propensity,
turn-propensity,
buried-index,
nucleotide,
nucleotide-ambiguity,
purine-pyrimidine,
rna-helices,
t-coffee-scores,
sequence-id

‑‑wrap

An alignment should open with your usual preferences stored in the .jalview_properties file. To open an alignment with the sequences (definitely) wrapped, following your ‑‑open (or first ‑‑append) argument use the argument ‑‑wrap:

  jalview --open examples/uniref50.fa --wrap
  
To ensure an alignment is not wrapped use ‑‑nowrap:
  jalview --open examples/uniref50.fa --nowrap
  

‑‑showannotations / ‑‑noshowannotations

You can specify whether the currently opened alignment window should show alignment annotations (e.g. Conservation, Quality, Consensus...) or not with either ‑‑showannotations or ‑‑noshowannotations. If you don't specify then your saved preference will be used.

  jalview --open examples/uniref50.fa --noshowannotations
  

‑‑title

If you would like to give the alignment window a specific title you can do so with the ‑‑title option:

  jalview --open examples/uniref50.fa --title "My example alignment"
  

Adding 3D structures (‑‑structure, ‑‑seqid, ‑‑structureviewer, ‑‑paematrix, ‑‑tempfac, ‑‑showssannotations)

‑‑structure

You can add a 3D structure file to a sequence in the current alignment window with the ‑‑structure option:

  jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb
  
By default this attaches to the first sequence in the alignment but most likely you will want to attach it to a specific sequence.

‑‑seqid

The easiest way to specify a sequence ID for your structure is to follow the ‑‑structure argument with a ‑‑seqid 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 that have been opened.
Alternatively you can specify a sub-value with the ‑‑structure argument value. You do this by preceding the value with square brackets and seqid=SequenceId, like this:

  jalview --open examples/uniref50.fa --structure [seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
  
which is equivalent to
  jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb --seqid FER1_SPIOL
  

The sub-value seqid=FER1_SPIOL takes precedence over the following argument ‑‑seqid FER1_SPIOL if you accidentally specify both (in which case the argument will probably be completely unused).

If you don't know the sequence IDs but do know the position of the sequence in the alignment, you can also specify an INDEX 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:

  jalview --open examples/uniref50.fa --structure [7]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
  

Remember that you might need to escape any spaces in the sequence ID or enclose the ID in quotation marks.

‑‑structureviewer

You can specify which structure viewer (or none) to use to open the structure using either the ‑‑structureviewer argument or the structureviewer sub-value. Multiple sub-values can be specified together, separated by a comma ','. Possible values for the structureviewer are:
none,
jmol,
chimera,
chimerax,
pymol.

none and jmol 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 Discovering and Viewing PDB and 3D-Beacons structures for more details.

  jalview --open examples/uniref50.fa --structure [seqid=FER1_SPIOL,structureviewer=none]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
  
or, if you prefer
  jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb --seqid FER1_SPIOL --structureviewer none
  

‑‑paematrix

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 ‑‑structure argument with a ‑‑paematrix argument with the filename. You can also specify a paematrix=filename sub-value.

  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
  

‑‑tempfac

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 ‑‑tempfac with a value of plddt. This will enable standard pLDDT colouring of the temperature factor annotation. Valid values are: default, plddt. More types of temperature factor may be added in future releases of Jalview.
The value can also be specified as a sub-value:

  jalview --open examples/uniref50.fa --structure [seqid=FER1_SPIOL,structureviewer=jmol,tempfac=plddt]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
  
which is equivalent to
  jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb --tempfac plddt --seqid FER1_SPIOL
   --structureviewer jmol
  

‑‑showssannotations / ‑‑noshowssannotations

You can specify whether the currently opened alignment window should show secondary structure annotations or not with either ‑‑showssannotations or ‑‑noshowssannotations. If you don't specify then your saved preference will be used.

  jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb --noshowssannotations
  
or you can use a sub-value modifier:
  jalview --open examples/uniref50.fa --structure [noshowssannotations]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
  

Outputting/converting alignment files and images (‑‑output, ‑‑format, ‑‑image, ‑‑structureimage, ‑‑type, ‑‑scale, ‑‑width, ‑‑height, ‑‑imagecolour, ‑‑bgcolour, ‑‑textrenderer, ‑‑overwrite, ‑‑backups, ‑‑mkdirs)

You can save an alignment as an alignment file, or exported as an image, in different formats. Jalview's alignment output formats are: fasta, pfam, stockholm, pir, blc, amsa, json, pileup, msf, clustal, phylip, jalview.

Alignments can be exported as an image in formats EPS, SVG, HTML, BioJSON (vector formats) or PNG (bitmap format).

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).

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.

‑‑output

To save the open alignment in a new alignment file use ‑‑output filename. The format for the file can be found from the extension of filename, or if you are using a non-standard extension you can use a following ‑‑format argument, or specify it as a sub-value modifier.

Recognised formats and their recognised extensions are:
fasta (fa, fasta, mfa, fastq),
pfam (pfam),
stockholm (sto, stk),
pir (pir),
blc (blc),
amsa (amsa),
json (json),
pileup (pileup),
msf (msf),
clustal (aln),
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

  jalview --open alignment1.fa --append alignment2.fa --output bothalignments.stk
  
or
  jalview --append alignment*.fa --output bigballofstring.txt --format stockholm
  
or
  jalview --append alignment*.fa --output [format=stockholm]bigballofstring.txt
  

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 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

To specify the format of the output file (if using an unrecognised file extension) use the ‑‑format argument to specify a value (see above). A sub-value modifier on the ‑‑output value can also be used.

‑‑image

To export the open alignment window as an image, use the ‑‑image argument, which will give an image of the alignment and annotations as it appears (or would appear if not in ‑‑headless mode) in the alignment window if it was large enough for the whole alignment, including colour scheme and features.

  jalview --open examples/plantfdx.fa --colour gecos-blossom --features examples/plantfdx.features --annotations examples/plantfdx.annotations --image plantfdx.png --headless
  

‑‑structureimage

To export an open structure as an image, use the ‑‑structureimage argument, which will give an image of the structure as it appears (or would appear if not in ‑‑headless mode) in a Jmol window including colour scheme. ‑‑structureimage can currently only be used with structures opened with the jmol structureviewer (the default viewer).

  jalview --open examples/plantfdx.fa --colour gecos-blossom --features examples/plantfdx.features --annotations examples/plantfdx.annotations --image plantfdx.png --headless
  

These by default produce a PNG image of screen or webpage resolution, which you will probably 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).

‑‑type

To specify the type of image file to write (if using an unrecognised file extension) use the ‑‑type argument to specify a value (see above). A sub-value modifier on the ‑‑image and ‑‑structureimage value can also be used. Valid values are:
png - A Portable Network Graphics image (bitmap, default),
svg - A Scalable Vector Graphics image (vector),
eps - An Encapsulated PostScript file (vector),
html - An HTML rendition of the alignment with embedded source data (vector/web browser),
biojs - An HTML rendition of the alignment with interactive MSA viewer BioJS-MSA (vector).

Bitmap image types (png)

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.

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.

Let's increase the resolution of the PNG image:

‑‑scale

We can increase the size of the PNG image by a factor of S by following the ‑‑image or ‑‑structureimage argument with a ‑‑scale S 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.

  jalview --open examples/uniref50.fa --colour gecos-ocean --image mypic.png --scale 5.5 --headless
  
which will produce a PNG image 5.5 times larger (and more detailed) than without the ‑‑scale argument.

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 ‑‑width and ‑‑height arguments:

‑‑width

Specify an exact width of an exported PNG image with ‑‑width:

  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
  

‑‑height

Alternatively specify an exact height with the ‑‑height argument:

  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
  

You can specify two or all of ‑‑scale, ‑‑width and ‑‑height 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 ‑‑image or ‑‑structureimage value:

  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
  

‑‑imagecolour

Specify a colour scheme to use just for this image using the ‑‑imagecolour argument:

  jalview --open examples/uniref50.fa --colour gecos-flower --image uniref50-residues.png --height 2160 --image uniref50-helix.png --imagecolour helix-propensity --width 800 --image uniref50-turn.png --imagecolour turn-propensity --width 800
  

‑‑bgcolour

Only applies to ‑‑structureimage. Specify a background colour for a structure image. The colour can be specified as a named colour recognised by Java (e.g. "white", "cyan") or as a RRGGBB 6 digit hex string (e.g. ffffff, 00ffff).

E.g.

  jalview --open examples/uniref50.fa --colour gecos-sunset --structure examples/AF-P00221-F1-model_v4.pdb --seqid FER1_SPIOL --structureimage temp.png  --bgcolour magenta
  

Next we look at vector image formats, which maintain detail at all resolutions.

Vector image export (svg, eps, html, biojs)

Jalview can export an alignment in Encapsulated PostScript (eps), Scalable Vector Graphics (svg), HTML (html) or BioJSON -- another HTML format with an interactive MSA viewer (biojs), by using, e.g.

  jalview --open examples/uniref50.fa --colour gecos-flower --image printable.eps
  
The image format can be specified with the ‑‑type argument or as a sub-value modifier on the ‑‑image value. If neither is used the type will be guessed from the image file extension. The following three examples should produce the same contents:
  jalview --open examples/uniref50.fa --colour gecos-flower --image printable.eps
  jalview --open examples/uniref50.fa --colour gecos-flower --image printable.postscript --type eps
  jalview --open examples/uniref50.fa --colour gecos-flower --image [type=eps]printable.postscript
  jalview --open examples/uniref50.fa --colour gecos-flower --image [type=biojs]printable.html
  

‑‑textrenderer

In a vector format any text that appears on the page (including residue/base labels) can be saved in the image file either as text or as lineart using the ‑‑textrenderer argument. This is only available for eps, svg and html formats.

The difference is potentially in the appearance of the file, and definitely in the filesize! Saving with text 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 text is relatively small.

When using lineart 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.

The type of ‑‑textrenderer can be specified with an argument following ‑‑image or as a sub-value modifier:

  jalview --open examples/uniref50.fa --colour gecos-flower --image printable.html --type biojs
  jalview --open examples/uniref50.fa --colour gecos-flower --image [type=eps,textrenderer=lineart]printable.ps
  

Output behaviour

‑‑overwrite

By default, Jalview will refuse to overwrite an output file (alignment or image) unless backups are in operation (alignment files only). To force overwriting files, use the ‑‑overwrite argument.

‑‑backups / --nobackups

Jalview should honour your preferences for backup files of output alignment files. Using ‑‑backups or ‑‑nobackups forces the behaviour. With no backups set, you will need to use ‑‑overwrite to overwrite an existing file. Note that Jalview does not make backup files of exported images.

‑‑mkdirs

If you want to output a file into a folder that doesn't yet exist (this might happen particularly when using {dirname} substitutions -- see below), then Jalview will fail to write the file since the parent directory doesn't exist. You can use ‑‑mkdirs to tell Jalview to make the new directory (or directories, it will create several nested directories if necessary) before writing the file. ‑‑mkdirs is cautious and will generally refuse to make a new directory using a relative path with .. in.

Filename substitutions and batch processing (‑‑substitutions, ‑‑close, ‑‑all)

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 all of the alignments as they are opened. This includes display and output arguments.

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.

To refer to different parts of the opening filename, you can use the strings

The braces (curly brackets '{', '}') are important!

Specifically for ‑‑structureimage output, you can also use substitutions using parts of the structure filename:

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:

‑‑substitutions / --nosubstitutions

Enable (or disable) filename substitutions in the following argument values and sub-value modifier values.

  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
  

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 ‑‑output or ‑‑image 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 ‑‑all argument.

‑‑all / -noall

When using the ‑‑all 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 ‑‑noall argument. The arguments that can apply to all previously opened alignments are:
‑‑colour
‑‑sortbytree
‑‑showannotations
‑‑wrap
‑‑nostructure
‑‑notempfac
‑‑showssannotations
‑‑image
‑‑type
‑‑textrenderer
‑‑scale
‑‑width
‑‑height
‑‑output
‑‑format
‑‑groovy
‑‑backups
‑‑overwrite
‑‑close

In particular, for our example above, we can use -all and ‑‑output like this (‑‑close will be explained in a moment):

  jalview --open all_my_fasta_files/*.fa --all --output all_my_converted_stockholm_files/{basename}.stk --close --headless
  

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:

  jalview --open */*.fa --all --colour gecos-flower --image {dirname}/{basename}.eps --textrenderer text --close --headless
  
or thumbnails for every Fasta file with
  jalview --open */*.fa --all --colour gecos-flower --image {dirname}/{basename}.png --width 256 --height 256 --close --headless
  

‑‑close

The ‑‑close tag is used to close an alignment window after all output files or image exports are performed. This reduces memory use, especially if an ‑‑open 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.

  

The all output wildcard: ‑‑output "*/*.ext", ‑‑image "*/*.ext"

Purely as an intuitive syntactic sweetener, you can use the ‑‑output wildcard * in two places as part of an output path and filename.

Using an asterisk (*) as a filename before an extension, e.g. ‑‑image "tmp/*.png" will result in that asterisk being treated as a {basename} substitution.

Using an asterisk (*) before a file separator (usually /), e.g. ‑‑image "tmp/*/file1.png" will result in that asterisk being treated as a {dirname} substitution.

You can combine these, using an asterisk (*) before and after the last file separator, e.g. ‑‑image "tmp/*/*.png" will result in being substituted like tmp/{dirname}/{basename}.png.

For example, to achieve the same as the thumbnails example above, you could use

  jalview --open */*.fa --image "*/*.png" --colour gecos-flower --width 256 --height 256 --close --headless
  
Here we move the ‑‑colour argument after the ‑‑output argument (it will still be applied before the image export or file output) so that it is included after the implied ‑‑all argument. The thumbnails will be placed in the same directory as the alignment file with the same filename except for a different extension of .png.

For a simple conversion of many fasta files into Stockholm format, simply use

  jalview --open all_my_fasta_files/*.fa --output "*.stk" --close --headless
  

Important! Please note that using a bareword *.ext (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 .ext before this value is passed to Jalview. This will result in the first of these files being overwritten (multiple times)! If you shell-escape the * (usually with a backslash '\') or enclose the value in quotation marks ("*.ext" - that's including the quotation marks) then the shell will not expand the wildcard.

An alternative is to use an equals sign ('=') with no spaces between the argument and the value, ‑‑output=*.ext, which Jalview will interpret the same, but the shell will not automatically expand before it is sent to Jalview, e.g.

  jalview --open all_my_fasta_files/*.fa --output=*.stk --close --headless
  


Continue to Command Line: advanced usage.
Command Line: reference