[BioRuby-cvs] bioruby/lib/bio/db rebase.rb,1.5,1.6
Trevor Wennblom
trevor at dev.open-bio.org
Sun Dec 31 23:22:05 UTC 2006
Update of /home/repository/bioruby/bioruby/lib/bio/db
In directory dev.open-bio.org:/tmp/cvs-serv32678
Modified Files:
rebase.rb
Log Message:
Updated REBASE to conform to README.DEV
Index: rebase.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/db/rebase.rb,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rebase.rb 31 Dec 2006 20:44:21 -0000 1.5
--- rebase.rb 31 Dec 2006 23:22:03 -0000 1.6
***************
*** 142,148 ****
end
! # Iterate over each entry
def each
! @data.each { |v| yield v }
end
--- 142,153 ----
end
! # Calls _block_ once for each element in <tt>@data</tt> hash, passing that element as a parameter.
! #
! # ---
! # *Arguments*
! # * Accepts a block
! # *Returns*:: results of _block_ operations
def each
! @data.each { |item| yield item }
end
***************
*** 158,165 ****
end
! # [+enzyme_lines+] contents of EMBOSS formatted enzymes file (_required_)
! # [+reference_lines+] contents of EMBOSS formatted references file (_optional_)
! # [+supplier_lines+] contents of EMBOSS formatted suppliers files (_optional_)
! # [+yaml+] enzyme_lines, reference_lines, and supplier_lines are read as YAML if set to true (_default_ +false+)
def initialize( enzyme_lines, reference_lines = nil, supplier_lines = nil, yaml = false )
# All your REBASE are belong to us.
--- 163,175 ----
end
! # Constructor
! #
! # ---
! # *Arguments*
! # * +enzyme_lines+: (_required_) contents of EMBOSS formatted enzymes file
! # * +reference_lines+: (_optional_) contents of EMBOSS formatted references file
! # * +supplier_lines+: (_optional_) contents of EMBOSS formatted suppliers files
! # * +yaml+: (_optional_, _default_ +false+) enzyme_lines, reference_lines, and supplier_lines are read as YAML if set to true
! # *Returns*:: Bio::REBASE
def initialize( enzyme_lines, reference_lines = nil, supplier_lines = nil, yaml = false )
# All your REBASE are belong to us.
***************
*** 180,183 ****
--- 190,198 ----
# List the enzymes available
+ #
+ # ---
+ # *Arguments*
+ # * _none_
+ # *Returns*:: +Array+ sorted enzyme names
def enzymes
@data.keys.sort
***************
*** 188,195 ****
--- 203,218 ----
# rebase.save_yaml( 'enz.yaml', 'ref.yaml' )
# rebase.save_yaml( 'enz.yaml', 'ref.yaml', 'sup.yaml' )
+ #
+ # ---
+ # *Arguments*
+ # * +f_enzyme+: (_required_) Filename to save YAML formatted output of enzyme data
+ # * +f_reference+: (_optional_) Filename to save YAML formatted output of reference data
+ # * +f_supplier+: (_optional_) Filename to save YAML formatted output of supplier data
+ # *Returns*:: nothing
def save_yaml( f_enzyme, f_reference=nil, f_supplier=nil )
File.open(f_enzyme, 'w') { |f| f.puts YAML.dump(@enzyme_data) }
File.open(f_reference, 'w') { |f| f.puts YAML.dump(@reference_data) } if f_reference
File.open(f_supplier, 'w') { |f| f.puts YAML.dump(@supplier_data) } if f_supplier
+ return
end
***************
*** 198,201 ****
--- 221,231 ----
# rebase = Bio::REBASE.read( 'emboss_e', 'emboss_r' )
# rebase = Bio::REBASE.read( 'emboss_e', 'emboss_r', 'emboss_s' )
+ #
+ # ---
+ # *Arguments*
+ # * +f_enzyme+: (_required_) Filename to read enzyme data
+ # * +f_reference+: (_optional_) Filename to read reference data
+ # * +f_supplier+: (_optional_) Filename to read supplier data
+ # *Returns*:: Bio::REBASE object
def self.read( f_enzyme, f_reference=nil, f_supplier=nil )
e = IO.readlines(f_enzyme)
***************
*** 209,212 ****
--- 239,249 ----
# rebase = Bio::REBASE.load_yaml( 'enz.yaml', 'ref.yaml' )
# rebase = Bio::REBASE.load_yaml( 'enz.yaml', 'ref.yaml', 'sup.yaml' )
+ #
+ # ---
+ # *Arguments*
+ # * +f_enzyme+: (_required_) Filename to read YAML-formatted enzyme data
+ # * +f_reference+: (_optional_) Filename to read YAML-formatted reference data
+ # * +f_supplier+: (_optional_) Filename to read YAML-formatted supplier data
+ # *Returns*:: Bio::REBASE object
def self.load_yaml( f_enzyme, f_reference=nil, f_supplier=nil )
e = YAML.load_file(f_enzyme)
More information about the bioruby-cvs
mailing list