[BioRuby-cvs] bioruby/lib/bio/shell/plugin flatfile.rb,1.2,1.3

Katayama Toshiaki k at pub.open-bio.org
Wed Oct 5 04:56:16 EDT 2005


Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin
In directory pub.open-bio.org:/tmp/cvs-serv910/shell/plugin

Modified Files:
	flatfile.rb 
Log Message:
* added flatauto method to open and retrieve one entry from a flatfile, or
  iterates on all entries of a flatfile.


Index: flatfile.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/flatfile.rb,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** flatfile.rb	25 Sep 2005 05:25:14 -0000	1.2
--- flatfile.rb	5 Oct 2005 08:56:14 -0000	1.3
***************
*** 25,28 ****
--- 25,43 ----
  module Bio::Shell
  
+   def flatauto(filename)
+     if block_given?
+       Bio::FlatFile.auto(filename) do |flat|
+         flat.each do |entry|
+           yield entry
+         end
+       end
+     else
+       flat = Bio::FlatFile.auto(filename)
+       entry = flat.next_entry
+       flat.close
+       return entry
+     end
+   end
+ 
    def convert_to_fasta(fastafile, *flatfiles)
      puts "Saving fasta file (#{fastafile}) ... "



More information about the bioruby-cvs mailing list