Thanks Robin - I was using the latest (1.21) binary. Updating to the current code was a marked improvement. The input and output genbank files nearly match. There is a slight issue with an accumulation of '/JoinType="join"' feature table qualifiers on CDS and mRNA records (i.e., if you read in and print out the same genbank record n times, you'll get n '/JoinType="join"' qualifiers for each feature that has a join. This probably won't break anyone's parser though and is more cosmetic than vital.
neill --- "Emig, Robin" <[EMAIL PROTECTED]> wrote: > Are you using the latest source from the CVS? We should have recently cleaned up a >lot of the > genbank and msf parsing code. > -Robin > > -----Original Message----- > From: Neill White [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 29, 2002 6:30 PM > To: [EMAIL PROTECTED] > Subject: [Biojava-l] Genbank SeqIO question > > > Hello- > > I'm a new user of biojava and have a small problem that > I'm hoping someone can help me with - that is, I'm trying > to read in and write out genbank files such > that what I write out is somewhat close to what I read in > (it's acceptable if some info is lost - not all parsers > are perfect). The problem is that some information > (the annotation) is lost after the first iteration. Not > a huge problem, but if I now modify the program to read in > this freshly created genbank file ('file.dat'), and write > it out again - it's now missing the feature table. Any > advice would be greatly appreciated. > > Thanks- > neill > > my program: > > import java.io.FileOutputStream; > import java.io.PrintStream; > import java.io.BufferedReader; > import java.io.FileReader; > > import org.biojava.bio.*; > import org.biojava.bio.seq.*; > import org.biojava.bio.seq.impl.*; > import org.biojava.bio.seq.io.*; > import org.biojava.bio.symbol.*; > > public class SimpleBioJava{ > public static void main(String args[]) throws Exception{ > > // First, make, or read in a simple DNA sequence > //Sequence sequence = nwSequence( "gattaca", "DNA" ); > // This line reads in the first sequence from a fasta file > //Sequence sequence = nwReadFastaSequence( "test.fa" ); > // This line reads in the first sequence from a genbank file > Sequence sequence = nwReadGenbankSequence( "gi20537285.gbk" ); > > // Phew, now that that's done, let's write it to a file > SequenceFormat seqFormat = new GenbankFormat(); > PrintStream stream = new PrintStream( new FileOutputStream( "test.dat" ) ); > seqFormat.writeSequence( sequence, stream ); > } > > public static Sequence nwReadGenbankSequence( String fileName ) throws Exception{ > > Sequence sequence = null; > > BufferedReader br = new BufferedReader( new FileReader( fileName ) ); > SequenceIterator stream = SeqIOTools.readGenbank( br ); > > if ( stream.hasNext() ){ > sequence = stream.nextSequence(); > } > > return sequence; > } > } > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Health - Feel better, live better > http://health.yahoo.com > _______________________________________________ > Biojava-l mailing list - [EMAIL PROTECTED] > http://biojava.org/mailman/listinfo/biojava-l __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com _______________________________________________ Biojava-l mailing list - [EMAIL PROTECTED] http://biojava.org/mailman/listinfo/biojava-l
