Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java help develop a Java program usigng Biojava to translate a DNA sequence into

ID: 3866020 • Letter: J

Question

Java help

develop a Java program usigng Biojava to translate a DNA sequence into its corresponding protein sequence. The program should us readFastaDNA.java (below) in order to read in one or more DNA sequences from a Fasta formatted DNA sequence file with the name seq.fasta The program should be able to translate three forwarding open reading frames. You can first use the transcribe() method of the GeneticCodes class to transcribe the DNA sequence into a RNA sequence, and then use the translate() method to translate it into a protein sequence.

readFastaDNA.java

Explanation / Answer

import org.biojava.bio.BioException;
import org.biojavax.bio.seq.RichSequence;
import org.biojavax.bio.seq.RichSequenceIterator;
import org.biojavax.bio.seq.RichSequence.IOTools;

import java.io.*;
import java.util.Scanner;
import javax.swing.JFileChooser;

public class readFastaDNA {

private static JFileChooser ourChooser = new JFileChooser(".");

/**
* Open a file through a FileChooser
*/
public static BufferedReader openFile(){
int retval = ourChooser.showOpenDialog(null);
BufferedReader br = null;

if (retval == JFileChooser.APPROVE_OPTION){
File file = ourChooser.getSelectedFile();
try {
br = new BufferedReader(new FileReader(file));
} catch (FileNotFoundException e) {
System.out.println("trouble reading "+file.getName());
e.printStackTrace();
}
}   
return br;
}


public static void main(String[] args) throws BioException{
BufferedReader br = openFile();

RichSequenceIterator it = IOTools.readFastaDNA(br, null);

int count = 0;

while (it.hasNext()){
count++;
RichSequence s = it.nextRichSequence();
System.out.println(s.getAccession());
System.out.println( s.seqString());
}
System.out.println("# sequences read: "+count);   
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote