[BioRuby-cvs] bioruby/lib/bio sequence.rb,0.58.2.7,0.58.2.8

Naohisa Goto ngoto at dev.open-bio.org
Tue Mar 4 11:10:30 UTC 2008


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

Modified Files:
      Tag: BRANCH-biohackathon2008
	sequence.rb 
Log Message:
* lib/bio/sequence.rb
  Bio::Sequence#output is moved to lib/bio/sequence/format.rb.
* lib/bio/sequence/format.rb
 * Bio::Sequence#output is changed not to directly read erb file.
 * Bio::Sequence::Format::FormatterBase class, a base class of formatter, 
   is newly added. 
 * Bio::Sequence::Format::Formatter, NucFormatter, AminoFormatter are
   newly added to store formatter classes.
 * Bio::Sequence#list_output_formats is added.
 * (The names of above classes/modules/methods might be changed if more
   appropriate names are given.)


Index: sequence.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence.rb,v
retrieving revision 0.58.2.7
retrieving revision 0.58.2.8
diff -C2 -d -r0.58.2.7 -r0.58.2.8
*** sequence.rb	20 Feb 2008 09:56:22 -0000	0.58.2.7
--- sequence.rb	4 Mar 2008 11:10:28 -0000	0.58.2.8
***************
*** 13,17 ****
  #
  
- require 'erb'
  require 'bio/sequence/compat'
  
--- 13,16 ----
***************
*** 156,178 ****
    attr_accessor :seq
    
-   # Using Bio::Sequence::Format, return a String with the Bio::Sequence
-   # object formatted in the given style.
-   #
-   # Formats currently implemented are: 'fasta', 'genbank', and 'embl'
-   #
-   #   s = Bio::Sequence.new('atgc')
-   #   puts s.output(:fasta)                   #=> "> \natgc\n"
-   #
-   # The style argument is given as a Ruby 
-   # Symbol(http://www.ruby-doc.org/core/classes/Symbol.html)
-   # ---
-   # *Arguments*: 
-   # * (required) _format_: :fasta, :genbank, *or* :embl
-   # *Returns*:: String object
-   def output(format = :fasta)
-     record_template = ERB.new(File.read(File.dirname(__FILE__) + "/db/#{format.to_s}/format.erb"))
-     record_template.result(binding)
-   end
- 
    # Guess the type of sequence, Amino Acid or Nucleic Acid, and create a 
    # new sequence object (Bio::Sequence::AA or Bio::Sequence::NA) on the basis
--- 155,158 ----




More information about the bioruby-cvs mailing list