This function converts a codon to an amino acid. If the codon is not 
    valid an error message is given, or else, the amino acid is returned.
971994
def aa(codon):
    
    codon = codon.upper()
    aa = {"ATT": "I", "ATC": "I", "ATA": "I",
            "CTT": "L", "CTC": "L", "CTA": "L", "CTG": "L", "TTA": "L", "TTG": "L",
            "GTT": "V", "GTC": "V", "GTA": "V", "GTG": "V",
            "TTT": "F", "TTC": "F",
            "ATG": "M",
            "TGT": "C", "TGC": "C",
            "GCT": "A", "GCC": "A", "GCA": "A", "GCG": "A",
            "GGT": "G", "GGC": "G", "GGA": "G", "GGG": "G",
            "CCT": "P", "CCC": "P", "CCA": "P", "CCG": "P",
            "ACT": "T", "ACC": "T", "ACA": "T", "ACG": "T",
            "TCT": "S", "TCC": "S", "TCA": "S", "TCG": "S", "AGT": "S", "AGC": "S",
            "TAT": "Y", "TAC": "Y",
            "TGG": "W",
            "CAA": "Q", "CAG": "Q",
            "AAT": "N", "AAC": "N",
            "CAT": "H", "CAC": "H",
            "GAA": "E", "GAG": "E",
            "GAT": "D", "GAC": "D",
            "AAA": "K", "AAG": "K",
            "CGT": "R", "CGC": "R", "CGA": "R", "CGG": "R", "AGA": "R", "AGG": "R",
            "TAA": "*", "TAG": "*", "TGA": "*"} 

    # Translate valid codon 
    try:
        amino_a = aa[codon]
    except KeyError:
        amino_a = "?"
    return amino_a
496476
def convert(data, _first)
      data
        .reject { |o| o['refseq_protein_ids'].empty? }
        .map do |o|
          "#{o['peptide']}\tref|#{o['refseq_protein_ids']}|\t100\t10\t0\t0\t0\t10\t0\t10\t1e-100\t100\n"
        end
        .join
    end
1064105
def coding_sequence(self):
        
        if self.sequence is None:
            return None

        start = self.first_start_codon_spliced_offset
        end = self.last_stop_codon_spliced_offset

        # If start codon is the at nucleotide offsets [3,4,5] and
        # stop codon is at nucleotide offsets  [20,21,22]
        # then start = 3 and end = 22.
        #
        # Adding 1 to end since Python uses non-inclusive ends in slices/ranges.

        # pylint: disable=invalid-slice-index
        # TODO(tavi) Figure out pylint is not happy with this slice
        return self.sequence[start:end + 1]
1179498
public static void main(final String[] args) {
        Switch about = new Switch("a", "about", "display about message");
        Switch help = new Switch("h", "help", "display help message");
        FileArgument aminoAcidHmm2File = new FileArgument("m", "amino-acid-hmm2-file", "amino acid HMM file in HMMER2 format", true);
        FileArgument inputFastaFile = new FileArgument("i", "input-fasta-file", "input FASTA file, default stdin", false);
        FileArgument outputFastaFile = new FileArgument("o", "output-fasta-file", "output FASTA file, default stdout", false);

        ArgumentList arguments = new ArgumentList(about, help, aminoAcidHmm2File, inputFastaFile, outputFastaFile);
        CommandLine commandLine = new CommandLine(args);

        FilterInterpretableExons filterInterpretableExons = null;
        try {
            CommandLineParser.parse(commandLine, arguments);
            if (about.wasFound()) {
                About.about(System.out);
                System.exit(0);
            }
            if (help.wasFound()) {
                Usage.usage(USAGE, null, commandLine, arguments, System.out);
                System.exit(0);
            }
            filterInterpretableExons = new FilterInterpretableExons(aminoAcidHmm2File.getValue(), inputFastaFile.getValue(), outputFastaFile.getValue());
        }
        catch (CommandLineParseException e) {
            if (about.wasFound()) {
                About.about(System.out);
                System.exit(0);
            }
            if (help.wasFound()) {
                Usage.usage(USAGE, null, commandLine, arguments, System.out);
                System.exit(0);
            }
            Usage.usage(USAGE, e, commandLine, arguments, System.err);
            System.exit(-1);
        }
        catch (NullPointerException e) {
            Usage.usage(USAGE, e, commandLine, arguments, System.err);
            System.exit(-1);
        }
        try {
            System.exit(filterInterpretableExons.call());
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
967716
public Sequence<AminoAcidCompound> translate(
			Sequence<NucleotideCompound> dna) {
		Map<Frame, Sequence<AminoAcidCompound>> trans = multipleFrameTranslation(
				dna, Frame.ONE);
		return trans.get(Frame.ONE);
	}
852616
public String getConceptualTranslation() {
        if (codons == null) {
            return "";
        }        
        StringBuilder translation = new StringBuilder();
        for (int i = 0 ; i < conceptualTranslationCodons ; ++i) {
            Codon codon = codons.get(i);
            translation.append(codon.getAminoAcid());
        }
        return translation.toString();
    }
313937
def _is_protein(pe):
    """"""
    val = isinstance(pe, _bp('Protein')) or \
            isinstance(pe, _bpimpl('Protein')) or \
            isinstance(pe, _bp('ProteinReference')) or \
            isinstance(pe, _bpimpl('ProteinReference'))
    return val
904990
function ttf2eotTransform() {
  // Return a callback function handling the buffered content
  return function ttf2eotTransformCb(err, buf, cb) {

    // Handle any error
    if(err) {
      return cb(new PluginError(PLUGIN_NAME, err, { showStack: true }));
    }

    // Use the buffered content
    try {
      buf = new Buffer(ttf2eot(new Uint8Array(buf)).buffer);
      return cb(null, buf);
    } catch(err2) {
      return cb(new PluginError(PLUGIN_NAME, err2, { showStack: true }));
    }

  };
}
502716
def convert_pmod(pmod):
    """"""

    if pmod.args[0].value in spec["bel1_migration"]["protein_modifications"]:
        pmod.args[0].value = spec["bel1_migration"]["protein_modifications"][
            pmod.args[0].value
        ]

    return pmod
943194
def mb_code(s, coding=None, errors='replace'):
    """"""
    if isinstance(s, unicode):
        return s if coding is None else s.encode(coding, errors=errors)
    for c in ('utf-8', 'gb2312', 'gbk', 'gb18030', 'big5'):
        try:
            s = s.decode(c)
            return s if coding is None else s.encode(coding, errors=errors)
        except:
            pass
    return unicode(s, errors=errors)
790840
public static int[] decode(String mutations, Alphabet alphabet) {
        Matcher matcher = getMutationPatternForAlphabet(alphabet).matcher(mutations);
        IntArrayList list = new IntArrayList();
        while (matcher.find()) {
            switch (matcher.group(0).charAt(0)) {
                //TODO codeFromSymbolWithError ?
                case 'S':
                    list.add(createSubstitution(Integer.parseInt(matcher.group(2)),
                            alphabet.symbolToCode(matcher.group(1).charAt(0)),
                            alphabet.symbolToCode(matcher.group(3).charAt(0))));
                    break;
                case 'D':
                    list.add(createDeletion(Integer.parseInt(matcher.group(5)),
                            alphabet.symbolToCode(matcher.group(4).charAt(0))));
                    break;
                case 'I':
                    list.add(createInsertion(Integer.parseInt(matcher.group(6)),
                            alphabet.symbolToCode(matcher.group(7).charAt(0))));
                    break;
            }
        }
        return list.toArray();
    }
1174689
def as_protein(structure, filter_residues=True):
    

    from ssbio.biopython.Bio.Struct.Protein import Protein
    return Protein.from_structure(structure, filter_residues)
1003105
def convert(self, text):
        """"""
        # Main function. The order in which other subs are called here is
        # essential. Link and image substitutions need to happen before
        # _EscapeSpecialChars(), so that any *'s or _'s in the <a>
        # and <img> tags get encoded.

        # Clear the global hashes. If we don't clear these, you get conflicts
        # from other articles when generating a page which contains more than
        # one article (e.g. an index page that shows the N most recent
        # articles):
        self.reset()

        if not isinstance(text, unicode):
            #TODO: perhaps shouldn't presume UTF-8 for string input?
            text = unicode(text, 'utf-8')

        if self.use_file_vars:
            # Look for emacs-style file variable hints.
            emacs_vars = self._get_emacs_vars(text)
            if "markdown-extras" in emacs_vars:
                splitter = re.compile("[ ,]+")
                for e in splitter.split(emacs_vars["markdown-extras"]):
                    if '=' in e:
                        ename, earg = e.split('=', 1)
                        try:
                            earg = int(earg)
                        except ValueError:
                            pass
                    else:
                        ename, earg = e, None
                    self.extras[ename] = earg

        # Standardize line endings:
        text = re.sub("\r\n|\r", "\n", text)

        # Make sure $text ends with a couple of newlines:
        text += "\n\n"

        # Convert all tabs to spaces.
        text = self._detab(text)

        # Strip any lines consisting only of spaces and tabs.
        # This makes subsequent regexen easier to write, because we can
        # match consecutive blank lines with /\n+/ instead of something
        # contorted like /[ \t]*\n+/ .
        text = self._ws_only_line_re.sub("", text)

        # strip metadata from head and extract
        if "metadata" in self.extras:
            text = self._extract_metadata(text)

        text = self.preprocess(text)

        if self.safe_mode:
            text = self._hash_html_spans(text)

        # Turn block-level HTML blocks into hash entries
        text = self._hash_html_blocks(text, raw=True)

        # Strip link definitions, store in hashes.
        if "footnotes" in self.extras:
            # Must do footnotes first because an unlucky footnote defn
            # looks like a link defn:
            #   [^4]: this "looks like a link defn"
            text = self._strip_footnote_definitions(text)
        text = self._strip_link_definitions(text)

        text = self._run_block_gamut(text)

        if "footnotes" in self.extras:
            text = self._add_footnotes(text)

        text = self.postprocess(text)

        text = self._unescape_special_chars(text)

        if self.safe_mode:
            text = self._unhash_html_spans(text)

        if "nofollow" in self.extras:
            text = self._a_nofollow.sub(r'<\1 rel="nofollow"\2', text)

        text += "\n"

        rv = UnicodeWithAttrs(text)
        if "toc" in self.extras:
            rv._toc = self._toc
        if "metadata" in self.extras:
            rv.metadata = self.metadata
        return rv
80250
def make_charsets(self):
        
        count_start = 1
        out = ''
        for gene_code, lengths in self.data.gene_codes_and_lengths.items():
            count_end = lengths[0] + count_start - 1
            formatted_line = self.format_charset_line(gene_code, count_start, count_end)
            converted_line = formatted_line.replace('    charset', 'DNA,').replace(';', '')
            out += converted_line
            count_start = count_end + 1
        return out
368070
def codons(self, frame):
        
        start = frame
        while start + 3 <= self.size:
            yield self.sequence[start : start + 3], start
            start += 3
1208370
def is_purine(nucleotide, allow_extended_nucleotides=False):
    """"""
    if not allow_extended_nucleotides and nucleotide not in STANDARD_NUCLEOTIDES:
        raise ValueError(
            "{} is a non-standard nucleotide, neither purine or pyrimidine".format(nucleotide))
    return nucleotide in PURINE_NUCLEOTIDES
303355
def convert_sub(sub):
    """"""

    args = sub.args
    (ref_aa, pos, new_aa) = args

    parent_fn_name = sub.parent_function.name_short
    prefix_list = {"p": "p.", "r": "r.", "g": "c."}
    prefix = prefix_list[parent_fn_name]

    new_var_arg = f'"{prefix}{spec["namespaces"]["AminoAcid"]["to_short"][ref_aa.value]}{pos.value}{spec["namespaces"]["AminoAcid"]["to_short"][new_aa.value]}"'

    new_var = bel.lang.ast.Function("var", bo.spec)

    new_var.add_argument(StrArg(new_var_arg, new_var))

    return new_var