Function RNAtoAminoAcids

  • Parse RNA into a list of amino acids. Translation stops when a stop codon is encountered.

    Parameters

    • rna: RNA

      The RNA comprised of codons

    Returns AminoAcid[]

    A list of amino acids (translation stops at first stop codon)

    Throws

    InvalidSequenceError Thrown if the sequence is undefined, or not evenly divisible by CODON_LENGTH (codons always have a length of CODON_LENGTH)

    Throws

    InvalidCodonError Thrown if an invalid codon is encountered (one that does not code for an amino acid and is not a stop codon)

    Example

     //passing RNA with coding codons and stop codon
    RNAtoAminoAcids(new RNA('AUGAAACCCUAG')); //returns 3 amino acids, stops at UAG