The 20 commonly occurring amino acids are abbreviated by using 20 letters from t
ID: 3556758 • Letter: T
Question
The 20 commonly occurring amino acids are abbreviated by using 20 letters from the English alphabet (all letters except for B, J, O, U, X, and Z). Protein strings are constructed from these 20 symbols. Henceforth, the term genetic string will incorporate protein strings along with DNA strings and RNA strings.
The RNA codon table dictates the details regarding the encoding of specific codons into the amino acid alphabet.
Here is the RNA condon table for your reference:
A table indicating the translation of individual RNA codons into amino acids for the purpose of protein creation.
UUU F CUU L AUU I GUU V
UUC F CUC L AUC I GUC V
UUA L CUA L AUA I GUA V
UUG L CUG L AUG M GUG V
UCU S CCU P ACU T GCU A
UCC S CCC P ACC T GCC A
UCA S CCA P ACA T GCA A
UCG S CCG P ACG T GCG A
UAU Y CAU H AAU N GAU D
UAC Y CAC H AAC N GAC D
UAA Stop CAA Q AAA K GAA E
UAG Stop CAG Q AAG K GAG E
UGU C CGU R AGU S GGU G
UGC C CGC R AGC S GGC G
UGA Stop CGA R AGA R GGA G
UGG W CGG R AGG R GGG G
Given: An RNA string s corresponding to a strand of mRNA (of length at most 10 kbp).
Return: The protein string encoded by s.
For example: RNA String: AUGGCCAUGGCGCCCAGAACUGAGAUCAAUAGUACCCGUAUUAACGGGUGA, should be translated into Protein String: MAMAPRTEINSTRING
Here is the beginning fragment of the output protein string: MTCSAIISAESFHLPALLPHHKLFSKPTESVTPSIFCSYREQIPRVLRNFIRILIPNENNVSSQFRTVSLNDRC
This is the data file :https://sbctc-files.instructure.com/courses/980825/files/37935528/course%20files/RNAString.txt?download=1&inline=1&sf_verifier=49a231f94fc303cf48ac353a658a2a2e&ts=1399670279&user_id=3653461
This is the code I have so far :
public class RNA2PProctein {
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
//skeleton for RNA2Protein
public class RNA2Protein {
public static void main(String[] args) {
Map condonTable = new HashMap();
createCondonTable(condonTable);
Scanner inFile = new Scanner (new File("RNA2PProctein.text"));
String RNAString = inFile.nextLine();
String proteinString = encode (condonTable, RNAString);
S.O.P(proteinString);
//System.out.print();
}
private static String encode(Map condonTable,
String rNAString) {
return null;
}
private static void createCondonTable(Map condonTable) {
condonTable.put("UUU", "F");
condonTable.put("UUC", "F");
condonTable.put("UUA", "L");
condonTable.put("UUG", "L");
condonTable.put("UCU", "S");
condonTable.put("UCC", "S");
condonTable.put("UCA", "S");
condonTable.put("UCG", "S");
condonTable.put("UAU", "Y");
condonTable.put("UAC", "Y");
condonTable.put("UAA", "STOP");
condonTable.put("UAG", "STOP");
condonTable.put("UGU", "C");
condonTable.put("UGC", "C");
condonTable.put("UGA", "STOP");
condonTable.put("UGG", "W");
condonTable.put("UUU", "L");
condonTable.put("UUC", "L");
condonTable.put("UUA", "L");
condonTable.put("UUG", "L");
condonTable.put("UCU", "P");
condonTable.put("UCC", "P");
condonTable.put("UCA", "P");
condonTable.put("UCG", "P");
condonTable.put("UAU", "H");
condonTable.put("UCA", "P");
condonTable.put("UAC", "H");
condonTable.put("UAA", "Q");
condonTable.put("UAG", "Q");
condonTable.put("UGU", "R");
condonTable.put("CGC", "R");
condonTable.put("CGA", "R");
condonTable.put("CGG", "R");
condonTable.put("AUU", "I");
condonTable.put("AUC", "I");
condonTable.put("AUA", "I");
condonTable.put("AUG", "M");
condonTable.put("ACU", "T");
condonTable.put("ACC", "T");
condonTable.put("ACA", "T");
condonTable.put("ACG", "T");
condonTable.put("AAU", "N");
condonTable.put("AAC", "N");
condonTable.put("AAU", "N");
condonTable.put("AAA", "K");
condonTable.put("AAG", "K");
condonTable.put("AGU", "S");
condonTable.put("AGC", "S");
condonTable.put("AGA", "R");
condonTable.put("AGG", "R");
condonTable.put("GUU", "V");
condonTable.put("GUC", "V");
condonTable.put("GUA", "V");
condonTable.put("GUG", "V");
condonTable.put("GCU", "A");
condonTable.put("GCC", "A");
condonTable.put("GCA", "A");
condonTable.put("GCG", "A");
condonTable.put("GAU", "D");
condonTable.put("GAC", "D");
condonTable.put("GAA", "E");
condonTable.put("GAG", "E");
condonTable.put("GGU", "G");
condonTable.put("GGC", "G");
condonTable.put("GGA", "G");
condonTable.put("GGG", "G");
}
}
Explanation / Answer
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
//skeleton for RNA2Protein
public class RNA2Protein {
public static void main(String[] args) {
Map condonTable = new HashMap();
createCondonTable(condonTable);
Scanner inFile = new Scanner (new File("RNA2PProctein.text"));
String RNAString = inFile.nextLine();
String proteinString = encode (condonTable, RNAString);
System.out.println(proteinString);
//System.out.print();
}
private static String encode(Map<String, String> condonTable,
String rNAString) {
int i=0,j=2;
String x,value="";
while(j<rNAString.length()) {
x=rNAString.substring(i,j);
for(Map.Entry entry: condonTable.entrySet()){
if(x.equals(entry.getKey())){
System.out.print(entry.getValue());
break; //breaking because its one to one map
}
}
i +=3;
j+=3;
}
return value;
}
private static void createCondonTable(Map condonTable) {
condonTable.put("UUU", "F");
condonTable.put("UUC", "F");
condonTable.put("UUA", "L");
condonTable.put("UUG", "L");
condonTable.put("UCU", "S");
condonTable.put("UCC", "S");
condonTable.put("UCA", "S");
condonTable.put("UCG", "S");
condonTable.put("UAU", "Y");
condonTable.put("UAC", "Y");
condonTable.put("UAA", "STOP");
condonTable.put("UAG", "STOP");
condonTable.put("UGU", "C");
condonTable.put("UGC", "C");
condonTable.put("UGA", "STOP");
condonTable.put("UGG", "W");
condonTable.put("UUU", "L");
condonTable.put("UUC", "L");
condonTable.put("UUA", "L");
condonTable.put("UUG", "L");
condonTable.put("UCU", "P");
condonTable.put("UCC", "P");
condonTable.put("UCA", "P");
condonTable.put("UCG", "P");
condonTable.put("UAU", "H");
condonTable.put("UCA", "P");
condonTable.put("UAC", "H");
condonTable.put("UAA", "Q");
condonTable.put("UAG", "Q");
condonTable.put("UGU", "R");
condonTable.put("CGC", "R");
condonTable.put("CGA", "R");
condonTable.put("CGG", "R");
condonTable.put("AUU", "I");
condonTable.put("AUC", "I");
condonTable.put("AUA", "I");
condonTable.put("AUG", "M");
condonTable.put("ACU", "T");
condonTable.put("ACC", "T");
condonTable.put("ACA", "T");
condonTable.put("ACG", "T");
condonTable.put("AAU", "N");
condonTable.put("AAC", "N");
condonTable.put("AAU", "N");
condonTable.put("AAA", "K");
condonTable.put("AAG", "K");
condonTable.put("AGU", "S");
condonTable.put("AGC", "S");
condonTable.put("AGA", "R");
condonTable.put("AGG", "R");
condonTable.put("GUU", "V");
condonTable.put("GUC", "V");
condonTable.put("GUA", "V");
condonTable.put("GUG", "V");
condonTable.put("GCU", "A");
condonTable.put("GCC", "A");
condonTable.put("GCA", "A");
condonTable.put("GCG", "A");
condonTable.put("GAU", "D");
condonTable.put("GAC", "D");
condonTable.put("GAA", "E");
condonTable.put("GAG", "E");
condonTable.put("GGU", "G");
condonTable.put("GGC", "G");
condonTable.put("GGA", "G");
condonTable.put("GGG", "G");
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.