code: public static <S extends Sequence<S>> int calculateScore(S seq1, Range seq1Range, Mutations<S> mutations,
                                                               LinearGapAlignmentScoring<S> scoring) {
          if (!mutations.isEmpty() && mutations.getPositionByIndex(0) < seq1Range.getFrom() - 1)
              throw new IllegalArgumentException();
  
          final AlignmentIteratorForward<S> iterator = new AlignmentIteratorForward<>(mutations, seq1Range);
  
          int score = 0;
  
          while (iterator.advance()) {
              final int mut = iterator.getCurrentMutation();
              switch (Mutation.getRawTypeCode(mut)) {
                  case RAW_MUTATION_TYPE_SUBSTITUTION:
                      score += scoring.getScore(Mutation.getFrom(mut), Mutation.getTo(mut));
                      break;
  
                  case RAW_MUTATION_TYPE_DELETION:
                  case RAW_MUTATION_TYPE_INSERTION:
                      score += scoring.getGapPenalty();
                      break;
  
                  default:
                      byte c = seq1.codeAt(iterator.getSeq1Position());
                      score += scoring.getScore(c, c);
                      break;
              }
          }
  
          return score;
      }
docs: Calculates score of alignment
  
  @param seq1      target sequence
  @param seq1Range aligned range
  @param mutations mutations (alignment)
  @param scoring   scoring
  @param <S>       sequence type
  @return score