Class Scores

  • All Implemented Interfaces:
    ScoreMatrix
    Direct Known Subclasses:
    AminoAcidScores, NucleotideScores, SubstScoreMatrix

    public abstract class Scores
    extends java.lang.Object
    implements ScoreMatrix
    Base class for all score matrices in the package.
    Version:
    $Id: Scores.java 916 2008-05-26 03:33:27Z matt_kearse $ Based on code originally by Peter Setsoft. See package.html.
    Author:
    Alexei Drummond
    • Field Detail

      • score

        public float[][] score
    • Constructor Detail

      • Scores

        public Scores()
    • Method Detail

      • getScore

        public final float getScore​(char x,
                                    char y)
        Specified by:
        getScore in interface ScoreMatrix
        Returns:
        the score for matching char x with char y
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • forMatrix

        public static Scores forMatrix​(ScoreMatrix scoreMatrix)
        Parameters:
        scoreMatrix - A ScoreMatrix with only low ascii characters (< chr(127)) in the alphabet
        Returns:
        A Scores instance corresponding to scoreMatrix.
      • duplicate

        public static Scores duplicate​(Scores scores)
      • includeGaps

        public static Scores includeGaps​(Scores scores,
                                         float gapVersusResidueCost,
                                         float gapVersusGapCost)
        Parameters:
        scores -
        gapVersusResidueCost - should be a negative value
        gapVersusGapCost - should be a positive value
      • includeAdditionalCharacters

        public static Scores includeAdditionalCharacters​(Scores scores,
                                                         java.lang.String characters)
        includes additional characters in the score matrix which will all have scored zero when compared to other characters. Current system does not handle special characters well, such as ? Or "R" for NucleotideSequences, which represents a "A" or "G". Currently, we just add all characters to the allowed set of characters, and they are scored as zero cost when comparing to other characters, including themselves. One-day, we should probably introduce better scoring system so that "R" is a positive score compared to "A" or "G", but a negative score compared to "C" or "T". example usage: scores = Scores.includeAdditionalCharacters(scores, "?ABCDEFGHIJKLMNOPQRSTUVWXYZ");
        Parameters:
        scores -
        characters -
        Returns:
        a new score matrix.
      • getMatrixString

        public java.lang.String getMatrixString()
        Returns:
        this score matrix as a string.