[BioRuby-cvs] bioruby/lib/bio sequence.rb,0.58,0.58.2.1

Naohisa Goto ngoto at dev.open-bio.org
Wed Feb 13 10:28:20 UTC 2008


Update of /home/repository/bioruby/bioruby/lib/bio
In directory dev.open-bio.org:/tmp/cvs-serv17175/lib/bio

Modified Files:
      Tag: BRANCH-biohackathon2008
	sequence.rb 
Log Message:
Added a new class method Bio::Sequence.read(str).


Index: sequence.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v
retrieving revision 0.58
retrieving revision 0.58.2.1
diff -C2 -d -r0.58 -r0.58.2.1
*** sequence.rb	5 Apr 2007 23:35:39 -0000	0.58
--- sequence.rb	13 Feb 2008 10:28:16 -0000	0.58.2.1
***************
*** 334,337 ****
--- 334,356 ----
      @moltype = AA
    end
+ 
+   # Create a new Bio::Sequence object from a formatted string
+   # (GenBank, EMBL, fasta format, etc.)
+   #
+   #   s = Bio::Sequence.read(str)
+   # ---
+   # *Arguments*:
+   # * (required) _str_: string
+   # * (optional) _format_: format specification (class or nil)
+   # *Returns*:: Bio::Sequence object
+   def self.read(str, format = nil)
+     if format then
+       klass = format
+     else
+       klass = Bio::FlatFile::AutoDetect.default.guess(str)
+     end
+     obj = klass.new(str)
+     obj.to_biosequence
+   end
    
  end # Sequence




More information about the bioruby-cvs mailing list