Class MultipleAlignmentScorer

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

public class MultipleAlignmentScorer extends Object
Utility class for calculating common scores of MultipleAlignments.
Since:
4.1.0
Author:
Spencer Bliven, Aleix Lafita
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Calculates and puts the RMSD and the average TM-Score of the MultipleAlignment.
    static double
    getAvgTMScore(List<Atom[]> transformed, List<Integer> lengths)
    Calculates the average TMScore all the possible pairwise structure comparisons of the given a set of superimposed Atoms and the original structure lengths.
    static double
    Calculates the average TMScore of all the possible pairwise structure comparisons of the given alignment.
    static double
    getMCScore(MultipleAlignment alignment, double gapOpen, double gapExtension, double dCutoff)
    Calculates the MC score, specific for the MultipleAlignment algorithm.
    static double
    getRefRMSD(List<Atom[]> transformed, int reference)
    Calculates the average RMSD from all structures to a reference s tructure, given a set of superimposed atoms.
    static double
    getRefRMSD(MultipleAlignment alignment, int ref)
    /** Calculates the average RMSD from all structures to a reference s tructure, given a set of superimposed atoms.
    static double
    getRefTMScore(List<Atom[]> transformed, List<Integer> lengths, int reference)
    Calculates the average TMScore from all structures to a reference structure, given a set of superimposed atoms.
    static double
    getRefTMScore(MultipleAlignment alignment, int ref)
    Calculates the average TMScore from all structures to a reference structure, given a set of superimposed atoms.
    static double
    getRMSD(List<Atom[]> transformed)
    Calculates the RMSD of all-to-all structure comparisons (distances), given a set of superimposed atoms.
    static double
    Calculates the RMSD of all-to-all structure comparisons (distances) of the given MultipleAlignment.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • MultipleAlignmentScorer

      public MultipleAlignmentScorer()
  • Method Details

    • calculateScores

      public static void calculateScores(MultipleAlignment alignment) throws StructureException
      Calculates and puts the RMSD and the average TM-Score of the MultipleAlignment.
      Parameters:
      alignment -
      Throws:
      StructureException
      See Also:
    • getRMSD

      public static double getRMSD(MultipleAlignment alignment)
      Calculates the RMSD of all-to-all structure comparisons (distances) of the given MultipleAlignment.

      Complexity: T(n,l) = O(l*n^2), if n=number of structures and l=alignment length.

      The formula used is just the sqroot of the average distance of all possible pairs of atoms. Thus, for R structures aligned over C columns without gaps, we have

       RMSD = \sqrt{1/(C*(R*(R-1)/2)) * \sum_{r1=1}^{R-1}
       \sum_{r2=r1+1}^{R-1} \sum_{j=0}^{C-1} (atom[r1][c]-atom[r2][c])^2}
       
      Parameters:
      alignment -
      Returns:
      double RMSD
    • getRMSD

      public static double getRMSD(List<Atom[]> transformed)
      Calculates the RMSD of all-to-all structure comparisons (distances), given a set of superimposed atoms.
      Parameters:
      transformed -
      Returns:
      double RMSD
      See Also:
    • getRefRMSD

      public static double getRefRMSD(MultipleAlignment alignment, int ref)
      /** Calculates the average RMSD from all structures to a reference s tructure, given a set of superimposed atoms.

      Complexity: T(n,l) = O(l*n), if n=number of structures and l=alignment length.

      For ungapped alignments, this is just the sqroot of the average distance from an atom to the aligned atom from the reference. Thus, for R structures aligned over C columns (with structure 0 as the reference), we have:

       RefRMSD = \sqrt{ 1/(C*(R-1)) * \sum_{r=1}^{R-1} \sum_{j=0}^{C-1}
       (atom[1][c]-atom[r][c])^2 }
       

      For gapped alignments, null atoms are omitted from consideration, so that the RMSD is the average over all columns with non-null reference of the average RMSD within the non-null elements of the column.

      Parameters:
      alignment - MultipleAlignment
      ref - reference structure index
      Returns:
    • getRefRMSD

      public static double getRefRMSD(List<Atom[]> transformed, int reference)
      Calculates the average RMSD from all structures to a reference s tructure, given a set of superimposed atoms.

      Complexity: T(n,l) = O(l*n), if n=number of structures and l=alignment length.

      For ungapped alignments, this is just the sqroot of the average distance from an atom to the aligned atom from the reference. Thus, for R structures aligned over C columns (with structure 0 as the reference), we have:

       RefRMSD = \sqrt{ 1/(C*(R-1)) * \sum_{r=1}^{R-1} \sum_{j=0}^{C-1}
       (atom[1][c]-atom[r][c])^2 }
       

      For gapped alignments, null atoms are omitted from consideration, so that the RMSD is the average over all columns with non-null reference of the average RMSD within the non-null elements of the column.

      Parameters:
      transformed -
      reference -
      Returns:
    • getAvgTMScore

      public static double getAvgTMScore(MultipleAlignment alignment) throws StructureException
      Calculates the average TMScore of all the possible pairwise structure comparisons of the given alignment.

      Complexity: T(n,l) = O(l*n^2), if n=number of structures and l=alignment length.

      Parameters:
      alignment -
      Returns:
      double Average TMscore
      Throws:
      StructureException
    • getAvgTMScore

      public static double getAvgTMScore(List<Atom[]> transformed, List<Integer> lengths) throws StructureException
      Calculates the average TMScore all the possible pairwise structure comparisons of the given a set of superimposed Atoms and the original structure lengths.

      Complexity: T(n,l) = O(l*n^2), if n=number of structures and l=alignment length.

      Parameters:
      transformed - aligned Atoms transformed
      lengths - lengths of the structures in residue number
      Returns:
      double Average TMscore
      Throws:
      StructureException
    • getRefTMScore

      public static double getRefTMScore(MultipleAlignment alignment, int ref) throws StructureException
      Calculates the average TMScore from all structures to a reference structure, given a set of superimposed atoms.

      Complexity: T(n,l) = O(l*n), if n=number of structures and l=alignment length.

      Parameters:
      alignment -
      reference - Index of the reference structure
      Returns:
      Throws:
      StructureException
    • getRefTMScore

      public static double getRefTMScore(List<Atom[]> transformed, List<Integer> lengths, int reference) throws StructureException
      Calculates the average TMScore from all structures to a reference structure, given a set of superimposed atoms.

      Complexity: T(n,l) = O(l*n^2), if n=number of structures and l=alignment length.

      Parameters:
      transformed - Arrays of aligned atoms, after superposition
      lengths - lengths of the full input structures
      reference - Index of the reference structure
      Returns:
      Throws:
      StructureException
    • getMCScore

      public static double getMCScore(MultipleAlignment alignment, double gapOpen, double gapExtension, double dCutoff) throws StructureException
      Calculates the MC score, specific for the MultipleAlignment algorithm. The score function is modified from the original CEMC paper, making it continuous and differentiable.

      The maximum score of a match is 20, and the penalties for gaps are part of the input. The half-score distance, d0, is chosen as in the TM-score.

      Complexity: T(n,l) = O(l*n^2), if n=number of structures and l=alignment length.

      Parameters:
      alignment -
      gapOpen - penalty for gap opening (reasonable values are in the range (1.0-20.0)
      gapExtension - penalty for extending a gap (reasonable values are in the range (0.5-10.0)
      dCutoff - the distance cutoff
      Returns:
      the value of the score
      Throws:
      StructureException