attr_accessor :seq, :seq_type
# Method to initialize a new sequence.
- def initialize( seq = nil, seq_type = nil )
+ def initialize( seq = "", seq_type = nil )
@seq = seq
@seq_type = seq_type
end
raise "ERROR: Wrap width must be an integer." unless width.is_a? Fixnum
raise "ERROR: Cannot wrap sequence to negative width: #{ width }." if width <= 0
@seq.tr!( " \t\n\r", '' )
- @seq.gsub( /.{#{ width }}/, "\\0#{ delimit }" )
+ @seq.gsub( /.{#{ width }}/, "\\0#{ delimit }" ).sub( /#{ delimit }$/, "" )
end
# Method to wrap and replace a sequence to a given width using a given delimiter.
# Class containing methods specific for amino acid (AA) sequences.
class AA < Seq
# Method to initialize a new amino acid sequence.
- def initialize( seq = nil )
+ def initialize( seq = "" )
@seq = seq
@seq_type = "AA"
end
# Testing Seq::AA#initialize
- def test_Seq#AA_initialize_with_0_args
+ def test_Seq_AA_initialize_with_0_args
s = Seq::AA.new
assert_equal( "", s.seq )
assert_equal( "AA", s.seq_type )
end
- def test_Seq#AA_initialize_with_1_args
+ def test_Seq_AA_initialize_with_1_args
s = Seq::AA.new( "SEQ" )
assert_equal( "SEQ", s.seq )
assert_equal( "AA", s.seq_type )