Main Content

multialignwrite

Write multiple alignment to file

Syntax

multialignwrite(File, Alignment)
multialignwrite(..., 'Format', FormatValue, ...)
multialignwrite(..., 'Header', HeaderValue, ...)
multialignwrite(..., 'WriteCount', WriteCountValue, ...)

Description

multialignwrite(File, Alignment) writes the contents of an alignment to a ClustalW ALN-formatted (default) or MSF-formatted file.

multialignwrite(..., 'PropertyName', PropertyValue, ...) calls multialignwrite with optional properties that use property name/property value pairs. You can specify one or more properties in any order. Enclose each PropertyName in single quotation marks. Each PropertyName is case insensitive. These property name/property value pairs are as follows:

multialignwrite(..., 'Format', FormatValue, ...) specifies the format of the file. FormatValue can be 'ALN' (default) or 'MSF'.

multialignwrite(..., 'Header', HeaderValue, ...) specifies the first line of the file. The default for HeaderValue is 'MATLAB multiple sequence alignment'.

multialignwrite(..., 'WriteCount', WriteCountValue, ...) specifies whether to add the residue counts to the end of each line. WriteCountValue can be true (default) or false.

Input Arguments

Alignment

An alignment, such as returned by the multialign function, represented by a vector of structures, each containing the fields Header and Sequence.

File

Character vector or string specifying either a file name or a path and file name for saving the data. If you specify only a file name, the file is saved to the MATLAB® Current Folder browser.

Tip

If you use an .msf extension when supplying a file name for File, the data is written to an MSF-formatted file. Otherwise, the data is written to a ClustalW ALN-formatted file.

Below the columns of the ClustalW ALN-formatted file, symbols can appear that denote:

  • * — Residues or nucleotides in the column are identical in all sequences in the alignment.

  • : — Conserved substitutions exist in the column for all sequences in the alignment.

  • . — Semiconserved substitutions exist in the column for all sequences in the alignment.

For more information on these symbols and the groups of residues considered conserved and semiconserved, see section 12 in “Changes since version 1.6” at https://web.mit.edu/seven/src/clustalw-1.82/README.

FormatValue

Character vector or string that specifies the format of File. Choices are 'ALN' (default) or 'MSF'.

Tip

You can also write to an MSF-formatted file by using an .msf extension when supplying a file name for File.

HeaderValue

Character vector or string that specifies the first line of the file.

Tip

Use the 'Header' property if your file header must be a specific format for a third-party software application.

Default: 'MATLAB multiple sequence alignment'

WriteCountValue

Specifies whether to add the residue counts to the end of each line. Choices are true (default) or false.

Examples

  1. Use the fastaread function to read p53samples.txt, a FASTA-formatted file included with the Bioinformatics Toolbox™ software, which contains seven cellular tumor antigen p53 sequences.

    p53 = fastaread('p53samples.txt')
    
    p53 = 
    
    7x1 struct array with fields:
        Header
        Sequence
  2. Use the multialign function to align the seven cellular tumor antigen p53 sequences.

    ma = multialign(p53,'verbose',true);
  3. Write the alignment to a file named p53.aln.

    multialignwrite('p53.aln',ma)

Version History

Introduced in R2008b