To browse all the classes in the package here

This preview shows page 2 - 4 out of 5 pages.

To browse all the classes in the packagehere:(ml?org/biojava/bio/seq/io/agave/package-summary.html1. In question #1of homework04, you are asked to read a Fasta format DNA sequence file with 6 records (seq.fasta). BioJava has made this type of operationmuch simpler (see the java program: readFastaDNA.java, in the In-Class exercises main topic under week10-11 forum). With little modification to that program, please develop a Java program to read a GenBank format DNA sequence file (GenBank_seq.gb), and extract the GenBank accession number, the length of the sequence, and the description of the sequence (all printedon the first line)and sequence itself to be printed as a separate line.( 3 points)importorg.biojava.bio.*; importorg.biojava.bio.seq.io.*;importorg.biojava.bio.seq.*;importorg.biojavax.Namespace;importorg.biojavax.RichObjectFactory;importorg.biojavax.bio.BioEntry;importorg.biojavax.bio.seq.RichSequence;importorg.biojavax.bio.seq.RichSequence.IOTools;importorg.biojavax.bio.seq.RichSequenceIterator;importjava.io.*; importjava.util.*; importjavax.swing.JFileChooser;publicclasshwk5_1 {privatestaticJFileChooser ourChooser= newJFileChooser("."); publicstaticBufferedReader openFile(){ intretval = ourChooser.showOpenDialog(null); BufferedReader br = null; if(retval == JFileChooser.APPROVE_OPTION){ File file = ourChooser.getSelectedFile(); try{ br = newBufferedReader(newFileReader(file)); } catch(FileNotFoundException e) { System.out.println("trouble reading "+file.getName());e.printStackTrace(); } } returnbr; }
publicstaticvoidmain(String[] args) throwsBioException, IOException {BufferedReader br = openFile();RichSequenceIterator it = RichSequence.IOTools.readGenbankDNA(br, null);intcount = 0;while(it.hasNext()) {count++;RichSequence s = it.nextRichSequence();System.out.println("Accession number: " + s.getAccession());System.out.println("Length of the sequence: " + s.length());System.out.println("Description of the sequence: " + s.getDescription());System.out.println("Sequence: " + s.seqString());System.out.println("\n");} System.out.println("# sequences read: "+count); }}2. In homework03, you are asked to write two methods for a DNA class,

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture