Function rosalind::prot::translate_rna_into_protein [] [src]

pub fn translate_rna_into_protein(rna: &str) -> RosalindResult<String>

This function translates provided RNA string into protein string

Examples

use rosalind::RosalindError::{CodonParseError, UnknownCodon};
use rosalind::prot::*;

let rna = "AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA";
assert_eq!(translate_rna_into_protein(rna).unwrap(), "MAMAPRTEINSTRING");
assert_eq!(translate_rna_into_protein("AUGUGA\n").unwrap(), "M");
assert_eq!(translate_rna_into_protein("Z").unwrap_err(), CodonParseError);
assert_eq!(translate_rna_into_protein("ZZZ").unwrap_err(), UnknownCodon("ZZZ".to_string()));