end
test "Seq.new_bp returns correctly" do
- record = {:SEQ_NAME => "test", :SEQ => "ATCG", :SEQ_TYPE => "dna", :SCORES => "hhhh"}
+ 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(:dna, seq.type)
assert_equal("hhhh", seq.qual)
end
end
test "#is_dna? with dna sequence type returns true" do
- @entry.type = 'dna'
+ @entry.type = :dna
assert(@entry.is_dna? == true)
end
end
test "#is_rna? with rna sequence type returns true" do
- @entry.type = 'rna'
+ @entry.type = :rna
assert(@entry.is_rna? == true)
end
end
test "#is_protein? with protein sequence type returns true" do
- @entry.type = 'protein'
+ @entry.type = :protein
assert_equal(true, @entry.is_protein?)
end
test "#type_guess with protein returns protein" do
@entry.seq = 'atcatcrFgatcg'
- assert_equal('protein', @entry.type_guess)
+ assert_equal(:protein, @entry.type_guess)
end
test "#type_guess with rna returns rna" do
@entry.seq = 'atcatcrUgatcg'
- assert_equal('rna', @entry.type_guess)
+ assert_equal(:rna, @entry.type_guess)
end
test "#type_guess with dna returns dna" do
@entry.seq = 'atcatcgatcg'
- assert_equal('dna', @entry.type_guess)
+ assert_equal(:dna, @entry.type_guess)
end
test "#type_guess! without sequence raises" do
test "#type_guess! with protein returns protein" do
@entry.seq = 'atcatcrFgatcg'
@entry.type_guess!
- assert_equal('protein', @entry.type)
+ assert_equal(:protein, @entry.type)
end
test "#type_guess! with rna returns rna" do
@entry.seq = 'atcatcrUgatcg'
@entry.type_guess!
- assert_equal('rna', @entry.type)
+ assert_equal(:rna, @entry.type)
end
test "#type_guess! with dna returns dna" do
@entry.seq = 'atcatcgatcg'
@entry.type_guess!
- assert_equal('dna', @entry.type)
+ assert_equal(:dna, @entry.type)
end
test "#length returns corretly" do
end
test "#to_rna with no sequence raises" do
- @entry.type = 'dna'
+ @entry.type = :dna
assert_raise(SeqError) { @entry.to_rna }
end
test "#to_rna with bad type raises" do
@entry.seq = 'ATCG'
- @entry.type = 'rna'
+ @entry.type = :rna
assert_raise(SeqError) { @entry.to_rna }
end
test "#to_rna transcribes correctly" do
@entry.seq = 'ATCGatcg'
- @entry.type = 'dna'
+ @entry.type = :dna
assert_equal("AUCGaucg", @entry.to_rna)
end
test "#to_rna changes entry type to rna" do
@entry.seq = 'ATCGatcg'
- @entry.type = 'dna'
+ @entry.type = :dna
@entry.to_rna
- assert_equal("rna", @entry.type)
+ assert_equal(:rna, @entry.type)
end
test "#to_dna with no sequence raises" do
- @entry.type = 'rna'
+ @entry.type = :rna
assert_raise(SeqError) { @entry.to_dna }
end
test "#to_dna with bad type raises" do
@entry.seq = 'AUCG'
- @entry.type = 'dna'
+ @entry.type = :dna
assert_raise(SeqError) { @entry.to_dna }
end
test "#to_dna transcribes correctly" do
@entry.seq = 'AUCGaucg'
- @entry.type = 'rna'
+ @entry.type = :rna
assert_equal("ATCGatcg", @entry.to_dna)
end
test "#to_dna changes entry type to dna" do
@entry.seq = 'AUCGaucg'
- @entry.type = 'rna'
+ @entry.type = :rna
@entry.to_dna
- assert_equal("dna", @entry.type)
+ assert_equal(:dna, @entry.type)
end
test "#to_bp returns correct record" do
end
test "#complement with no sequence raises" do
- @entry.type = 'dna'
+ @entry.type = :dna
assert_raise(SeqError) { @entry.complement }
end
test "#complement with bad type raises" do
@entry.seq = 'ATCG'
- @entry.type = 'protein'
+ @entry.type = :protein
assert_raise(SeqError) { @entry.complement }
end
test "#complement for DNA is correct" do
@entry.seq = 'ATCGatcg'
- @entry.type = 'dna'
+ @entry.type = :dna
comp = @entry.complement
assert_equal("TAGCtagc", comp.seq)
assert_equal("ATCGatcg", @entry.seq)
test "#complement for RNA is correct" do
@entry.seq = 'AUCGaucg'
- @entry.type = 'rna'
+ @entry.type = :rna
comp = @entry.complement
assert_equal("UAGCuagc", comp.seq)
assert_equal("AUCGaucg", @entry.seq)
end
test "#complement! with no sequence raises" do
- @entry.type = 'dna'
+ @entry.type = :dna
assert_raise(SeqError) { @entry.complement! }
end
test "#complement! with bad type raises" do
@entry.seq = 'ATCG'
- @entry.type = 'protein'
+ @entry.type = :protein
assert_raise(SeqError) { @entry.complement! }
end
test "#complement! for DNA is correct" do
@entry.seq = 'ATCGatcg'
- @entry.type = 'dna'
+ @entry.type = :dna
assert_equal("TAGCtagc", @entry.complement!.seq)
end
test "#complement! for RNA is correct" do
@entry.seq = 'AUCGaucg'
- @entry.type = 'rna'
+ @entry.type = :rna
assert_equal("UAGCuagc", @entry.complement!.seq)
end
end
test "#generate with length < 1 raises" do
- assert_raise(SeqError) { @entry.generate(-10, "dna") }
- assert_raise(SeqError) { @entry.generate(0, "dna") }
+ assert_raise(SeqError) { @entry.generate(-10, :dna) }
+ assert_raise(SeqError) { @entry.generate(0, :dna) }
end
test "#generate with bad type raises" do
end
test "#generate with ok type dont raise" do
- %w[dna DNA rna RNA protein Protein].each do |type|
- assert_nothing_raised { @entry.generate(10, type) }
+ %w[dna rna protein].each do |type|
+ assert_nothing_raised { @entry.generate(10, type.to_sym) }
end
end
test "#<< with different types raises" do
@entry.seq = "atcg"
- assert_raise(SeqError) { @entry << Seq.new("test", "atcg", "dna") }
+ assert_raise(SeqError) { @entry << Seq.new("test", "atcg", :dna) }
end
test "#<< with missing qual in one entry raises" do
@entry.seq = "atcg"
- @entry.type = "dna"
- assert_raise(SeqError) { @entry << Seq.new("test", "atcg", "dna", "IIII") }
+ @entry.type = :dna
+ assert_raise(SeqError) { @entry << Seq.new("test", "atcg", :dna, "IIII") }
@entry.qual = "IIII"
- assert_raise(SeqError) { @entry << Seq.new("test", "atcg", "dna") }
+ assert_raise(SeqError) { @entry << Seq.new("test", "atcg", :dna) }
end
test "#<< with nil qual in both entries dont raise" do
test "#<< with qual in both entries dont raise" do
@entry.seq = "atcg"
- @entry.type = "dna"
+ @entry.type = :dna
@entry.qual = "IIII"
- assert_nothing_raised { @entry << Seq.new("test", "atcg", "dna", "IIII") }
+ assert_nothing_raised { @entry << Seq.new("test", "atcg", :dna, "IIII") }
end
test "#<< without qual returns correctly" do
test "#<< with qual returns correctly" do
@entry.seq = "atcg"
- @entry.type = "dna"
+ @entry.type = :dna
@entry.qual = "HHHH"
- @entry << Seq.new("test", "ATCG", "dna", "IIII")
+ @entry << Seq.new("test", "ATCG", :dna, "IIII")
assert_equal("atcgATCG", @entry.seq)
assert_equal("HHHHIIII", @entry.qual)
end