# # test/unit/bio/util/test_sirna.rb - Unit test for Bio::SiRNA. # # Copyright:: Copyright (C) 2005 Mitsuteru C. Nakao # License:: The Ruby License # # $Id:$ # # loading helper routine for testing bioruby require 'pathname' load Pathname.new(File.join(File.dirname(__FILE__), ['..'] * 3, 'bioruby_test_helper.rb')).cleanpath.to_s # libraries needed for the tests require 'test/unit' require 'bio/util/sirna' module Bio RANDOM_SEQ = "ctttcggtgcggacgtaaggagtattcctgtactaactaaatggagttaccaaggtaggaccacggtaaaatcgcgagcagcctcgatacaagcgttgtgctgaagcctatcgctgacctgaaggggggcgtaagcaaggcagcggttcaccttcatcagttctgctagaaatcacctagcaccccttatcatccgcgtcaggtccattacccttcccattatgtcggactcaattgaggtgcttgtgaacttatacttgaatccaaaacgtctactgtattggcgactaaaaagcacttgtggggagtcggcttgatcagcctccattagggccaggcactgaggatcatccagttaacgtcagattcaaggtctggctcttagcactcggagttgcac" class TestSiRNANew < Test::Unit::TestCase def test_new naseq = Bio::Sequence::NA.new(RANDOM_SEQ) assert(Bio::SiRNA.new(naseq)) assert(Bio::SiRNA.new(naseq, 21)) assert(Bio::SiRNA.new(naseq, 21, 60.0)) assert(Bio::SiRNA.new(naseq, 21, 60.0, 40.0)) assert_raise(ArgumentError) { Bio::SiRNA.new(naseq, 21, 60.0, 40.0, 10.0) } end end class TestSiRNA < Test::Unit::TestCase def setup naseq = Bio::Sequence::NA.new(RANDOM_SEQ) @obj = Bio::SiRNA.new(naseq) end def test_antisense_size assert_equal(21, @obj.antisense_size) end def test_max_gc_percent assert_equal(60.0, @obj.max_gc_percent) end def test_min_gc_percent assert_equal(40.0, @obj.min_gc_percent) end def test_uitei? target = "aaGaa" assert_equal(false, @obj.uitei?(target)) target = "aaAaa" assert_equal(false, @obj.uitei?(target)) target = "G" * 9 assert_equal(false, @obj.uitei?(target)) end def test_reynolds? target = "G" * 9 assert_equal(false, @obj.reynolds?(target)) target = "aaaaAaaaaaaUaaAaaaaaAaa" assert_equal(true, @obj.reynolds?(target)) end def test_uitei assert(@obj.uitei) end def test_reynolds assert(@obj.reynolds) end def test_design assert(@obj.design) end def test_design_uitei assert(@obj.design('uitei')) end def test_design_reynolds assert(@obj.design('reynolds')) end end class TestSiRNAPairNew < Test::Unit::TestCase def test_new target = "" sense = "" antisense = "" start = 0 stop = 1 rule = 'rule' gc_percent = 60.0 assert_raise(ArgumentError) { Bio::SiRNA::Pair.new(target, sense, antisense, start, stop, rule) } assert(Bio::SiRNA::Pair.new(target, sense, antisense, start, stop, rule, gc_percent)) assert_raise(ArgumentError) { Bio::SiRNA::Pair.new(target, sense, antisense, start, stop, rule, gc_percent, "") } end end class TestSiRNAPair < Test::Unit::TestCase def setup naseq = Bio::Sequence::NA.new(RANDOM_SEQ) @obj = Bio::SiRNA.new(naseq).design.first end def test_target assert_equal("gcggacguaaggaguauuccugu", @obj.target) end def test_sense assert_equal("ggacguaaggaguauuccugu", @obj.sense) end def test_antisense assert_equal("aggaauacuccuuacguccgc", @obj.antisense) end def test_start assert_equal(9, @obj.start) end def test_stop assert_equal(32, @obj.stop) end def test_rule assert_equal("uitei", @obj.rule) end def test_gc_percent assert_equal(52.0, @obj.gc_percent) end def test_report report =<