[BioRuby] Multi Fasta Sequence file to Genbank conversion..

Naohisa GOTO ngoto at gen-info.osaka-u.ac.jp
Fri Sep 5 01:34:26 UTC 2008


Hi,

On Thu, 4 Sep 2008 19:13:25 -0400
"Adam Kraut" <adamnkraut at gmail.com> wrote:

> I've never used the genbank format, but in Bioruby you could try:
> 
> include Bio
> 
> fasta = Alignment::MultiFastaFormat.new(File.open('my.fasta').read)
> fasta.entries.each do |seq|
>   puts seq.to_seq.output(:genbank)
> end

No need to use Bio::Alignment::MultiFastaFormat in this case.
Bio::FlatFile alone can do.

For example, to read from stdin and output to stdout,

  require 'bio'
  Bio::FlatFile.open($<) do |ff|
    ff.each do |e|
      print e.to_biosequence.output(:genbank)
    end
  end

Note that the output(:genbank) are new feature only in
the latest development version in the git repository. 
http://github.com/bioruby/bioruby
(i.e. in BioRuby 1.2.1, above examples cannot be run.)

Naohisa Goto
ngoto at gen-info.osaka-u.ac.jp / ng at bioruby.org

> The only tricky part is perhaps is the to_seq call for a Bio::Sequence
> object which has different output format methods.
> -Adam
> 
> On Thu, Sep 4, 2008 at 10:53 AM, Sharvari Gujja <sgujja at broad.mit.edu>wrote:
> 
> > Hi,
> >
> > I am trying to convert a multi fasta sequence file (nucleotide/protein) to
> > genbank format.Is there a way to do this using Bioruby?
> >
> > Appreciate any input/suggestions.
> >
> > Thanks
> > S
> > _______________________________________________
> > BioRuby mailing list
> > BioRuby at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/bioruby<https://lists.open-bio.org/mailman/listinfo/bioruby>
> >
> _______________________________________________
> BioRuby mailing list
> BioRuby at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioruby






More information about the BioRuby mailing list