[BioRuby-cvs] bioruby/lib/bio/sequence common.rb,1.1,1.2
Katayama Toshiaki
k at pub.open-bio.org
Mon Feb 6 14:16:19 UTC 2006
Update of /home/repository/bioruby/bioruby/lib/bio/sequence
In directory pub.open-bio.org:/tmp/cvs-serv1993/sequence
Modified Files:
common.rb
Log Message:
* added RDoc header with Ruby's license
* changed to use autoload
* subseq method is changed to raise exception when the start or end position
is not a positive integer
* splicing method is renamed to splice
* splicing is made aliased to splice method
Index: common.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/sequence/common.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** common.rb 23 Jan 2006 04:13:36 -0000 1.1
--- common.rb 6 Feb 2006 14:16:17 -0000 1.2
***************
*** 1,6 ****
--- 1,20 ----
+ #
+ # = bio/sequence/common.rb - common methods for biological sequence
+ #
+ # Copyright:: Copyright (C) 2006
+ # Toshiaki Katayama <k at bioruby.org>
+ # License:: Ruby's
+ #
+ # $Id$
+ #
+
module Bio
+ autoload :Locations, 'bio/location'
+
class Sequence
+ # This module provides common methods for biological sequence classes
+ # which must inherit String.
module Common
***************
*** 34,38 ****
# Returns the subsequence of the self string.
def subseq(s = 1, e = self.length)
! return nil if s < 1 or e < 1
s -= 1
e -= 1
--- 48,52 ----
# Returns the subsequence of the self string.
def subseq(s = 1, e = self.length)
! raise "Error: start/end position must be a positive integer" unless s > 0 and e > 0
s -= 1
e -= 1
***************
*** 134,140 ****
# Receive a GenBank style position string and convert it to the Locations
# objects to splice the sequence itself. See also: bio/location.rb
! #
! # This method depends on Locations class, see bio/location.rb
! def splicing(position)
unless position.is_a?(Locations) then
position = Locations.new(position)
--- 148,152 ----
# Receive a GenBank style position string and convert it to the Locations
# objects to splice the sequence itself. See also: bio/location.rb
! def splice(position)
unless position.is_a?(Locations) then
position = Locations.new(position)
***************
*** 155,158 ****
--- 167,171 ----
return self.class.new(s)
end
+ alias splicing splice
end # Common
More information about the bioruby-cvs
mailing list