Ejemplo n.º 1
0
    def test_validate(self):
        dna = BioSeq.create_bio_seq("ACTG")
        rna = BioSeq.create_bio_seq("ACUG", "rna")
        self.assertTrue(dna.validate())
        self.assertTrue(rna.validate())

        # seq.csv contains a DNA sequence
        rna.read_sequence('tests/files/seq.csv')
        self.assertFalse(rna.validate())
Ejemplo n.º 2
0
 def test_save_load(self):
     seq = BioSeq.create_bio_seq("ACTGTCATAT")
     seq.save('tests/files/test_save_load.csv')
     loaded_seq = BioSeq.load('tests/files/test_save_load.csv')
     self.assertEqual(seq.get_seq(), loaded_seq.get_seq())
     self.assertEqual(seq.get_genetic_code(), loaded_seq.get_genetic_code())
     self.assertEqual(seq.__class__.__name__, loaded_seq.__class__.__name__)
Ejemplo n.º 3
0
    def test_read_write(self):
        seq = BioSeq.create_bio_seq("ACTGTCATAT")
        len_bwr = len(seq)

        seq.write_sequence('tests/files/test_write.csv')
        seq.read_sequence('tests/files/seq.csv')
        self.assertGreater(len(seq), len_bwr)
        self.assertEqual(2591, len(seq))

        seq.read_sequence('tests/files/test_write.csv')
        self.assertEqual(len_bwr, len(seq))
Ejemplo n.º 4
0
 def test_freq(self):
     seq = BioSeq.create_bio_seq("ACTGTCATAT")
     self.assertEqual(seq.freq_symbols(), {"T": 4, "A": 3, "C": 2, "G": 1})
Ejemplo n.º 5
0
 def test_basics(self):
     seq = BioSeq.create_bio_seq("ACTGTCATGAT")
     self.assertEqual(seq.get_seq(), "ACTGTCATGAT")
     self.assertEqual(len(seq), len("ACTGTCATGAT"))
Ejemplo n.º 6
0
 def test_rev_complement(self):
     self.assertEqual(
         BioSeq.create_bio_seq("ACGGTA").reverse_complement(), "TACCGT")
     self.assertEqual(
         BioSeq.create_bio_seq("ACGUUA", "rna").reverse_complement(),
         "UAACGU")
Ejemplo n.º 7
0
 def test_gc_percent(self):
     dna = BioSeq.create_bio_seq("ACGG")
     self.assertEqual(dna.gc_percent(), 0.75)
     self.assertEqual(dna.gc_percent_sub_seq(2), [0.5, 1])