Due Friday, November 8th 11:59 PM for 100 points A key plepent in many bioinform
ID: 3757752 • Letter: D
Question
Due Friday, November 8th 11:59 PM for 100 points A key plepent in many bioinformatics problems is the biological sequence. A biological a list of characters chosen from some alphabet. Two of the common nces are DNA (composed of the four characters A, C, G, and T) and ANA (composed of the four characters A, C, G, and U). In this project, you will implement some basic functionality for manipulating DNA and RNA sequences. Implementation You will implement sequences using linked lists, storing one sequence per linked list node. You may implement your data structure either using Java containers, or you may implement your linked list from scratch. It is mandatory that your linked-list remain application independent. (Use Generic) Input and Output The program will be invoked from the command-line as java bio1 The name of the program is bio1, and is the name of the input file that holds a list of DNA and RNA sequences. Each line in the file will have two strings separated by.There will be no white space between the two strings (type and sequence). However, your input file might have empty lines in the file type:sequence Your program should read each line in the input file and store the type and sequence information together in the list data structure The program should first print out all the contents in the list and then terminate when reading the EOF mark.Explanation / Answer
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class BioTranslation extends javax.swing.JFrame implements ActionListener
{
public static final int Width = 1400;
public static final int Height= 400;
TextArea DNABioTextArea, RNABioTextArea, proteinBioTextArea;
JButton Biotranscribe, Biotranslate, BioreverseTranscribe;
String DNA;
String RNA;
/** Creates new form TranslationGUI */
public BioTranslation()
{
super("Transcription tool and Translation Tool");
setSize(Width, Height);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new FlowLayout());
JPanel DNABioPanel = new JPanel();
DNABioPanel.setPreferredSize(new Dimension(420,390));
DNABioPanel.add(new JLabel("DNA Sequence"));
TextArea DNABioTextArea = new TextArea();
DNABioPanel.add(DNATextArea);
DNABioTextArea.setEditable(true);
DNAPanel.add(new JLabel("DNA (deoxyribonucleic acid)"));
JButton transcribe = new JButton();
DNABioPanel.add(new JButton("Transcribe"));
transcribe.addActionListener(this);
add(DNABioPanel, BorderLayout.WEST);
DNABioPanel.setBackground(Color.WHITE);
JPanel RNABioPanel = new JPanel();
RNABioPanel.setPreferredSize(new Dimension(420,390));
RNABioPanel.add(new JLabel("RNA Sequence"));
TextArea RNABioTextArea = new TextArea();
RNABioTextArea.setEditable(true);
RNABioPanel.add(RNATextArea);
RNABioPanel.add(new JLabel("RNA (ribonucleic acid)"));
JButton translate = new JButton();
RNABioPanel.add(new JButton("Translate"));
translate.addActionListener(this);
JButton reverseTranscribe = new JButton();
RNABioPanel.add(new JButton("Reverse Transcribe"));
reverseTranscribe.addActionListener(this);
add(RNABioPanel, BorderLayout.CENTER);
RNABioPanel.setBackground(Color.LIGHT_GRAY);
JPanel proteinBioPanel = new JPanel();
proteinBioPanel.setPreferredSize(new Dimension(420,390));
proteinBioPanel.add(new JLabel("Protein Sequence"));
TextArea proteinBioTextArea = new TextArea();
proteinBioPanel.add(proteinTextArea);
proteinBioPanel.add(new JLabel("Protein"));
add(proteinBioPanel, BorderLayout.EAST);
proteinBioPanel.setBackground(Color.WHITE);
pack();
}
public void actionPerformed(ActionEvent event)
{
if(event.getSource()== Biotranscribe)
{
BioDNA();
}
else if(event.getSource()== BioreverseTranscribe)
{
BioRNA();
}
else if(event.getSource()== Biotranslate)
{
Bio();
}
}
public void BioDNA()
{
String DNA = DNABioTextArea.getText();
char[] reverse = new char[DNA.length()];
for (int i = 0; i < reverse.length; i++)
{
switch(DNA.charAt(i))
{
case 'A': reverse[i] = 'T';break;
case 'C': reverse[i] = 'G';break;
case 'T': reverse[i] = 'A';break;
case 'G': reverse[i] = 'C';break;
default:
System.out.println("Not a DNA code");
}
}
DNA = new String(reverse);
RNATextArea.append(DNA);
}
public void BioRNA()
{
String RNA = RNABioTextArea.getText();
char[] reverse = new char[RNA.length()];
for (int i = 0; i < reverse.length; i++)
{
switch(RNA.charAt(i))
{
case 'T': reverse[i] = 'A';break;
case 'G': reverse[i] = 'C';break;
case 'A': reverse[i] = 'T';break;
case 'C': reverse[i] = 'G';break;
default:
System.out.println("Not a RNA code");
}
}
RNA = new String(reverse);
DNATextArea.append(RNA);
}
public void bio()
{
//do something
}
private static final String[][] CODON_AMINO =
{"att", "i"}, {"atc", "i"}, {"ata", "i"}, {"ctt", "l"},
{"ctc", "l"}, {"cta", "l"}, {"ctg", "l"}, {"tta", "l"},
{"ttg", "l"}, {"gtt", "v"}, {"gtc", "v"}, {"gta", "v"},
{"tgt", "c"}, {"tgc", "c"}, {"gct", "a"}, {"gcc", "a"},
{"gca", "a"}, {"gcg", "a"}, {"ggt", "g"}, {"ggc", "g"},
{"gga", "g"}, {"ggg", "g"}, {"cct", "p"}, {"ccc", "p"},
{"gtg", "v"}, {"ttt", "f"}, {"ttc", "f"}, {"atg", "m"},
{"cca", "p"}, {"ccg", "p"}, {"act", "t"}, {"acc", "t"},
{"aca", "t"}, {"acg", "t"}, {"tct", "s"}, {"tcc", "s"},
{"tat", "y"}, {"tac", "y"}, {"tgg", "w"}, {"caa", "q"},
{"tca", "s"}, {"tcg", "s"}, {"agt", "s"}, {"agc", "s"},
{"cag", "q"}, {"aat", "n"}, {"aac", "n"}, {"cat", "h"},
{"cac", "h"}, {"gaa", "e"}, {"gag", "e"}, {"gat", "d"},
{"gac", "d"}, {"aaa", "k"}, {"aag", "k"}, {"cgt", "r"},
{"cgc", "r"}, {"cga", "r"}, {"cgg", "r"}, {"aga", "r"},
{"agg", "r"}
};
private void initDNARNAComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 390, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 290, Short.MAX_VALUE)
);
java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setBounds((screenSize.width-415)/2, (screenSize.height-337)/2, 415, 337);
}
public static void main(String args[]) {
TranslationGUI frame = new TranslationGUI();
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(TranslationGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(TranslationGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TranslationGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(TranslationGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TranslationGUI().setVisible(true);
}
});
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.