Class MultipleAlignmentScorer
- java.lang.Object
-
- org.biojava.nbio.structure.align.multiple.util.MultipleAlignmentScorer
-
public class MultipleAlignmentScorer extends Object
Utility class for calculating common scores ofMultipleAlignment
s.- Since:
- 4.1.0
- Author:
- Spencer Bliven, Aleix Lafita
-
-
Field Summary
Fields Modifier and Type Field Description static String
AVGTM_SCORE
static String
CE_SCORE
static String
MC_SCORE
static String
PROBABILITY
static String
REF_RMSD
static String
REFTM_SCORE
static String
RMSD
-
Constructor Summary
Constructors Constructor Description MultipleAlignmentScorer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
calculateScores(MultipleAlignment alignment)
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
getAvgTMScore(MultipleAlignment alignment)
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
getRMSD(MultipleAlignment alignment)
Calculates the RMSD of all-to-all structure comparisons (distances) of the given MultipleAlignment.
-
-
-
Field Detail
-
PROBABILITY
public static final String PROBABILITY
- See Also:
- Constant Field Values
-
CE_SCORE
public static final String CE_SCORE
- See Also:
- Constant Field Values
-
RMSD
public static final String RMSD
- See Also:
- Constant Field Values
-
AVGTM_SCORE
public static final String AVGTM_SCORE
- See Also:
- Constant Field Values
-
MC_SCORE
public static final String MC_SCORE
- See Also:
- Constant Field Values
-
REF_RMSD
public static final String REF_RMSD
- See Also:
- Constant Field Values
-
REFTM_SCORE
public static final String REFTM_SCORE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MultipleAlignmentScorer
public MultipleAlignmentScorer()
-
-
Method Detail
-
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:
getAvgTMScore(MultipleAlignment)
,getRMSD(MultipleAlignment)
-
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:
getRMSD(MultipleAlignment)
-
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
- MultipleAlignmentref
- 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 transformedlengths
- 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 superpositionlengths
- lengths of the full input structuresreference
- 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
-
-