Class MultipleAlignmentWriter

java.lang.Object
org.biojava.nbio.structure.align.multiple.util.MultipleAlignmentWriter

public class MultipleAlignmentWriter extends Object
This class contains functions for the conversion of MultipleAlignment to various String outputs.

Supported formats: FASTA, FatCat, Aligned Residues, Transformation Matrices, XML, 3D format.

Since:
4.1.0
Author:
Aleix Lafita
  • Constructor Details

    • MultipleAlignmentWriter

      public MultipleAlignmentWriter()
  • Method Details

    • toFASTA

      public static String toFASTA(MultipleAlignment alignment)
      Converts the MultipleAlignment into a multiple sequence alignment String in FASTA format.
      Parameters:
      alignment - MultipleAlignment
      Returns:
      String multiple sequence alignment in FASTA format
      See Also:
    • toFatCat

      public static String toFatCat(MultipleAlignment alignment)
      Converts the MultipleAlignment into a FatCat String format. Includes summary information about the alignment in the top and a multiple sequence alignment at the bottom.
      Parameters:
      alignment - MultipleAlignment
      Returns:
      String multiple sequence alignment in FASTA format
      See Also:
    • toAlignedResidues

      public static String toAlignedResidues(MultipleAlignment multAln)
      Converts the alignment to its simplest form: a list of groups of aligned residues. Format is one line per residue group, tab delimited:
      • PDB number (includes insertion code)
      • Chain
      • Amino Acid (three letter code)
      Example: 52 A ALA 102 A VAL 154 A THR

      Note that this format loses information about blocks.

      Parameters:
      multAln - MultipleAlignment object
      Returns:
      a String representation of the aligned residues.
    • toTransformMatrices

      public static String toTransformMatrices(MultipleAlignment alignment)
      Converts the transformation Matrices of the alignment into a String output.
      Parameters:
      afpChain -
      Returns:
      String transformation Matrices
    • toXML

      public static String toXML(MultipleAlignmentEnsemble ensemble) throws IOException
      Converts all the information of a multiple alignment ensemble into an XML String format. Cached variables, like transformation matrices and scores, are also converted.
      Parameters:
      ensemble - the MultipleAlignmentEnsemble to convert.
      Returns:
      String XML representation of the ensemble
      Throws:
      IOException
      See Also:
    • to3DFormat

      public static String to3DFormat(MultipleAlignment alignment, int queryIndex, int templateIndex) throws StructureException
      Outputs a pairwise alignment in I-TASSER's 3D Format for target-template alignment. http://zhanglab.ccmb.med.umich.edu/I-TASSER/option4.html

      The format is closely related to a standard PDB file, but contains only CA atoms and adds two columns for specifying the alignment:

       ATOM   2001  CA  MET     1      41.116 -30.727   6.866  129 THR
       ATOM   2002  CA  ALA     2      39.261 -27.408   6.496  130 ARG
       ATOM   2003  CA  ALA     3      35.665 -27.370   7.726  131 THR
       ATOM   2004  CA  ARG     4      32.662 -25.111   7.172  132 ARG
       ATOM   2005  CA  GLY     5      29.121 -25.194   8.602  133 ARG
      
       Column 1 -30: Atom & Residue records of query sequence.
       Column 31-54: Coordinates of atoms in query copied from corresponding atoms in template.
       Column 55-59: Corresponding residue number in template based on alignment
       Column 60-64: Corresponding residue name in template
       

      Note that the output is a pairwise alignment. Only the first and second rows in the MultipleAlignment will be used, others ignored.

      This method supports topology-independent alignments. The output will have sequence order matching the query, but include atoms from the template.

      Parameters:
      alignment - A full multiple alignment between proteins
      queryIndex - index of the query within the multiple alignment
      templateIndex - index of the template within the multiple alignment
      Returns:
      The file contents as a string
      Throws:
      StructureException - If an error occurs parsing the alignment's structure names