Java code with biojava alter program to be able to translate three forwarding op
ID: 3866541 • Letter: J
Question
Java code with biojava
alter program to be able to translate three forwarding open reading frames.its possible to 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.
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);
}
}
Explanation / Answer
Check this... changes made bold and italic
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();
int count = 0;
RichSequenceIterator seqsData = RichSequence.IOTools.readGenbankDNA(br, null);
while (seqsData.hasNext()) {
count++;
RichSequence _seq = seqsData.nextRichSequence();
System.out.println(_seq.getAccession());
System.out.println(_seq.getDescription());
}
System.out.println("# sequences read: " + count);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.