Extract a subsequence from this sequence using coordinates that are
    relative to the start of the sequence (relative position 1) and the number
    of nuceltodies in the sequence, including gaps. For example:

      46  --> A--CTGC-TAGC-GATCGACT <--  62      subsequence(2,7) == --CTG

def gapped_relative_subsequence(self, start, end):
    """
    Extract a subsequence from this sequence using coordinates that are
    relative to the start of the sequence (relative position 1) and the number
    of nuceltodies in the sequence, including gaps. For example:

      46  --> A--CTGC-TAGC-GATCGACT <--  62      subsequence(2,7) == --CTG
    """
    if start < 1:
      msg = "invalid start coordinate for subsequence: " + str(start)
      raise InvalidSequenceCoordinatesError(msg)
    if end > len(self.sequenceData) + 1:
      msg = "invalid end coordinate for subsequence: " + str(end) +\
            " greater than length of sequence (" + str(len(self)) + ")"
      raise InvalidSequenceCoordinatesError(msg)

    non_gaps_before = start - 1 - self.sequenceData[:start - 1].count(GAP_CHAR)
    seq = self.sequenceData[start - 1:end - 1]
    non_gaps_in = len(seq) - seq.count(GAP_CHAR)
    non_gaps_after = self.ungapped_len - non_gaps_before - non_gaps_in
    new_start = self.start + non_gaps_before
    new_end = new_start + non_gaps_in
    new_remaining = self.remaining + non_gaps_after

    return Sequence(self.name, seq, new_start, new_end, self.strand,
                    new_remaining, self.meta_data, self.mutableString)