translate
Translate a nucleotide sequence NucSeq into amino acids ProteinSeq.
Parameters
CodonTable to be used (defaults to Standard)
defaults to False meaning do a full translation continuing on past any stop codons (translated as the specified stop_symbol). If True, translation is terminated at the first in frame stop codon (and the stop_symbol is not appended to the returned protein sequence).
If True, this checks the sequence starts with a valid alternative start codon (which will be translated as methionine, M), that the sequence length is a multiple of three, and that there is a single in frame stop codon at the end (this will be excluded from the protein sequence, regardless of the to_stop option). If these tests fail, an IllegalStateException is raised.
val codingDNA = NucSeq("GTGGCCATTGTAATGGGCCGCTGAAAGGGTGCCCGATAG")
println(codingDNA.translate()) //VAIVMGR*KGAR*
println(codingDNA.translate(to_stop = true)) //VAIVMGR
val mitoTable = CodonTable(2)
println(codingDNA.translate(table = mitoTable)) //VAIVMGRWKGAR*
println(codingDNA.translate(mitoTable, to_stop = true)) //VAIVMGRWKGAR
//With CDS true, it then checks for alternative start and GTG is converted to M
println(codingDNA.translate(mitoTable, to_stop = true, cds = true)) //MAIVMGRWKGARAmbiguous nucleotides are not supported and will throw errors