def _guess_sequence_type_from_string(self, seq):
<EOL>aa_chars = ['<STR_LIT:P>','<STR_LIT>','<STR_LIT:L>','<STR_LIT:I>','<STR_LIT:M>','<STR_LIT:F>','<STR_LIT:Y>','<STR_LIT>','<STR_LIT:H>','<STR_LIT>','<STR_LIT:R>','<STR_LIT>','<STR_LIT:N>','<STR_LIT:E>','<STR_LIT:D>','<STR_LIT:S>','<STR_LIT:X>','<STR_LIT:*>']<EOL>aas = set(itertools.chain(aa_chars, [lower(a) for a in aa_chars]))<EOL>na_chars = ['<STR_LIT:A>', '<STR_LIT:T>', '<STR_LIT>', '<STR_LIT:C>', '<STR_LIT:N>', '<STR_LIT>']<EOL>nas = set(itertools.chain(na_chars, [lower(a) for a in na_chars]))<EOL>num_nucleotide = <NUM_LIT:0><EOL>num_protein = <NUM_LIT:0><EOL>count = <NUM_LIT:0><EOL>for residue in seq:<EOL><INDENT>if residue in nas:<EOL><INDENT>num_nucleotide += <NUM_LIT:1><EOL><DEDENT>elif residue in aas:<EOL><INDENT>num_protein += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>' % (residue))<EOL><DEDENT>count += <NUM_LIT:1><EOL>if count ><NUM_LIT>: break<EOL><DEDENT>if float(num_protein) / (num_protein+num_nucleotide) > <NUM_LIT:0.1>:<EOL><INDENT>return self.PROTEIN_SEQUENCE_TYPE<EOL><DEDENT>else:<EOL><INDENT>return self.NUCLEOTIDE_SEQUENCE_TYPE<EOL><DEDENT>
Return 'protein' if there is >10% amino acid residues in the
        (string) seq parameter, else 'nucleotide'. Raise Exception if a
        non-standard character is encountered