[Biojava-l] extracting genome sequence from Genbank file

David Waring dwaring@u.washington.edu
Fri, 12 Apr 2002 10:46:31 -0700


Ikro
Once you have that Sequence object you should note that Sequence implements
SymbolList. So you can call any of the SymbolList methods on s.

Find the base a position 234
  Symbol sym = s.symbolAt(234)
Or get the String version of the DNA sequence so you can print it.
  String myString = s.seqString()

Sequence has all the SymbolList function plus much more.


> -----Original Message-----
> From: biojava-l-admin@biojava.org [mailto:biojava-l-admin@biojava.org]On
> Behalf Of Schreiber, Mark
> Sent: Thursday, April 11, 2002 2:55 PM
> To: Ikro Yoon; biojava-l@biojava.org
> Subject: RE: [Biojava-l] extracting genome sequence from Genbank file
>
>
> Hi -
>
> The following should do it:
>
>      File gbFile = new File("myGBFile.gbk");
>      SequenceIterator si = SeqIOTools.readGenbank( new BufferedReader(
> new FileReader(gbFile),1024));
>      Sequence s = si.next();
>
> This returns a sequence iterator that iterates through all the sequences
> in the GenBank file. In most GB files there is only one sequence so you
> can get away with one call to si.next(); If there is more than one then
> you could do this.
>
>    ArrayList seqs = new ArrayList();
>    while(si.hasNext()){
>       seqs.add(si.next());
>    }
>
> Or if you want you could use a biojava SeqDB object rather than an array
> list. The SeqDB allows you to retreive a specific sequence by ID.
>
> Mark
>
>
> > -----Original Message-----
> > From: Ikro Yoon [mailto:ikro@cs.stanford.edu]
> > Sent: Friday, 12 April 2002 9:11 a.m.
> > To: biojava-l@biojava.org
> > Subject: [Biojava-l] extracting genome sequence from Genbank file
> >
> >
> > Hello,
> >
> > I have just started using biojava and find it extremely useful.
> > Particularly, I am using it for parsing Genbank files. I took
> > a look at the documentation as well as TestGenbank.java under
> > demos/seq directory to get an idea of how to extract various
> > information from Genbank files.
> >
> > One thing that I am still having trouble is extracting the
> > genome sequence at the end of Genbank file. How could I do that?
> >
> > Thank you for your help.
> >
> > Ikro
> > _______________________________________________
> > Biojava-l mailing list  -  Biojava-l@biojava.org
> > http://biojava.org/mailman/listinfo/biojava-l
> >
> =======================================================================
> Attention: The information contained in this message and/or attachments
> from AgResearch Limited is intended only for the persons or entities
> to which it is addressed and may contain confidential and/or privileged
> material. Any review, retransmission, dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipients is prohibited by AgResearch
> Limited. If you have received this message in error, please notify the
> sender immediately.
> =======================================================================
> _______________________________________________
> Biojava-l mailing list  -  Biojava-l@biojava.org
> http://biojava.org/mailman/listinfo/biojava-l