attr_accessor :seq_name, :seq, :type, :qual
- # Method that generates all possible oligos of a specifed length and type.
+ # Class method to instantiate a new Sequence object given
+ # a Biopiece record.
+ def self.new_bp(record)
+ seq_name = record[:SEQ_NAME]
+ seq = record[:SEQ]
+ type = record[:SEQ_TYPE]
+ qual = record[:SCORES]
+
+ self.new(seq_name, seq, type, qual)
+ end
+
+ # Class method that generates all possible oligos of a specifed length and type.
def self.generate_oligos(length, type)
raise SeqError, "Cannot generate negative oligo length: #{length}" if length <= 0
# dna.seq = "A\tT\r\tC\nG "
# assert_equal(dna.seq, "ATCG")
# end
+
+ def test_Seq_new_bp_returns_correctly
+ record = {:SEQ_NAME => "test", :SEQ => "ATCG", :SEQ_TYPE => "dna", :SCORES => "hhhh"}
+ seq = Seq.new_bp(record)
+ assert_equal("test", seq.seq_name)
+ assert_equal("ATCG", seq.seq)
+ assert_equal("dna", seq.type)
+ assert_equal("hhhh", seq.qual)
+ end
def test_Seq_is_dna_with_no_sequence_type_returns_false
assert(@entry.is_dna? == false)