public SubstitutionMatrixScorer(SequencePair<S, C> pair, SubstitutionMatrix<C> matrix) {
   super();
   this.query = pair.getQuery().getOriginalSequence();
   this.target = pair.getTarget().getOriginalSequence();
   this.matrix = matrix;
   for (int i = 1; i <= pair.getLength(); i++) {
     C query = pair.getCompoundAt(1, i);
     C target = pair.getCompoundAt(2, i);
     score += matrix.getValue(query, target);
   }
 }
 /**
  * @return The minimum score the query could be assigned when aligned against any target sequence.
  */
 @Override
 public double getMinScore() {
   // assume nothing about the matrix
   double score = 0;
   for (C queryC : query.getAsList()) {
     short min = Short.MAX_VALUE;
     for (Short value : matrix.getRow(queryC).values()) {
       if (value < min) min = value;
     }
     score += min;
   }
   return score;
 }
 /**
  * @return The maximum score the query could be assigned when aligned against any target sequence.
  */
 @Override
 public double getMaxScore() {
   // assume nothing about the matrix
   double score = 0;
   for (C queryC : query.getAsList()) {
     short max = Short.MIN_VALUE;
     for (Short value : matrix.getRow(queryC).values()) {
       if (value > max) max = value;
     }
     score += max;
   }
   return score;
 }