def sequence(self, line_data, child_type=None, reference=None):
<EOL>reference = reference or self.fasta_external or self.fasta_embedded<EOL>if not reference:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>try:<EOL><INDENT>line_index = line_data['<STR_LIT>']<EOL><DEDENT>except TypeError:<EOL><INDENT>line_index = self.lines[line_data]['<STR_LIT>']<EOL><DEDENT>ld = self.lines[line_index]<EOL>if ld['<STR_LIT:type>'] != '<STR_LIT>':<EOL><INDENT>return None<EOL><DEDENT>seq = reference[ld['<STR_LIT>']][ld['<STR_LIT:start>']-<NUM_LIT:1>:ld['<STR_LIT:end>']]<EOL>if ld['<STR_LIT>'] == '<STR_LIT:->':<EOL><INDENT>seq = complement(seq[::-<NUM_LIT:1>])<EOL><DEDENT>return seq<EOL>
Get the sequence of line_data, according to the columns 'seqid', 'start', 'end', 'strand'.
Requires fasta reference.
When used on 'mRNA' type line_data, child_type can be used to specify which kind of sequence to return:
* child_type=None:  pre-mRNA, returns the sequence of line_data from start to end, reverse complement according to strand. (default)
* child_type='exon':  mature mRNA, concatenates the sequences of children type 'exon'.
* child_type='CDS':  coding sequence, concatenates the sequences of children type 'CDS'. Use the helper
                     function translate(seq) on the returned value to obtain the protein sequence.

:param line_data: line_data(dict) with line_data['line_index'] or line_index(int)
:param child_type: None or feature type(string)
:param reference: If None, will use self.fasta_external or self.fasta_embedded(dict)
:return: sequence(string)