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
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
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); } } Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
