def gapped_relative_subsequence(self, start, end):
if start < <NUM_LIT:1>:<EOL><INDENT>msg = "<STR_LIT>" + str(start)<EOL>raise InvalidSequenceCoordinatesError(msg)<EOL><DEDENT>if end > len(self.sequenceData) + <NUM_LIT:1>:<EOL><INDENT>msg = "<STR_LIT>" + str(end) +"<STR_LIT>" + str(len(self)) + "<STR_LIT:)>"<EOL>raise InvalidSequenceCoordinatesError(msg)<EOL><DEDENT>non_gaps_before = start - <NUM_LIT:1> - self.sequenceData[:start - <NUM_LIT:1>].count(GAP_CHAR)<EOL>seq = self.sequenceData[start - <NUM_LIT:1>:end - <NUM_LIT:1>]<EOL>non_gaps_in = len(seq) - seq.count(GAP_CHAR)<EOL>non_gaps_after = self.ungapped_len - non_gaps_before - non_gaps_in<EOL>new_start = self.start + non_gaps_before<EOL>new_end = new_start + non_gaps_in<EOL>new_remaining = self.remaining + non_gaps_after<EOL>return Sequence(self.name, seq, new_start, new_end, self.strand,<EOL>new_remaining, self.meta_data, self.mutableString)<EOL>
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