Что вам нужно сделать, это указать отображение кодона мРна в аминокислоты, одним из способов будет определение функции
// Pass mRna codon and get amino acid, this is not complete list
// please refer some authorotative reference to get all the mappings,
// once you have the mappings then use the below function to codify them
private fun mapToAmino(mRna: String): String{
return when(mRna){
// List all the codons that map to a specific amino acid
"UUU","UUC" -> "Phe"
"UUA","UUG" -> "Leu"
//These six map to "Ser" so list them as comma separated
"UCU","UCC","UCA","UCG","AGU","AGC" -> "Ser"
else -> "Not found"
}
}
Затем в вашем activity
вы можете выполнить следующее, чтобы получить list
аминокислот.
val result = okstr.replace(oldChar = 'G', newChar = '_').replace(oldChar = 'C', newChar = 'G').replace(oldChar = '_', newChar = 'C').replace(oldChar = 'A', newChar = 'U').replace(oldChar = 'T', newChar = 'A')
val ogamino = result.replace("\\s".toRegex(), "")
val newamino = ogamino.chunked(3).map { mapToAmino(it) }
// newAmino is a list of all amino acids, given that you defined the mappings correctly
Получите сопоставления из действительного и авторитетного источника, например этот хорошо выглядит, но, пожалуйста, сделайте свое исследование.