Пример #1
0
class GeneRna_Test(unittest.TestCase):
    def setUp(self):
        self.e1 = Ival(100, 200)
        self.e2 = Ival(210, 220)
        self.e3 = Ival(300, 420)
        self.grna1 = GeneRna("chr1", "+", (self.e1, self.e2, self.e3))
        self.grna2 = GeneRna("chr2", "-", (self.e1, self.e2, self.e3))

    def test__create_blocklist(self):
        assert self.grna1._create_blocklist() == [Ival(0, 100), Ival(100, 110), Ival(110, 230)]
        assert self.grna2._create_blocklist() == [Ival(0, 120), Ival(120, 130), Ival(130, 230)]

    def test_backmap(self):
        assert self.grna1.backmap_ival(190, 210) == [Ival(380, 400)]
        assert self.grna2.backmap_ival(190, 210) == [Ival(120, 140)]
        assert self.grna1.backmap_ival(90, 120) == [Ival(190, 200), Ival(210, 220), Ival(300, 310)]
        assert self.grna2.backmap_ival(90, 120) == [Ival(300, 330)]

    def test_as_bed12(self):
        assert self.grna1.as_bed12("uc1") == (
            "chr1",
            100,
            420,
            "uc1",
            0,
            "+",
            100,
            100,
            "0,0,0",
            3,
            "100,10,120",
            "0,110,200",
        )
        assert self.grna2.as_bed12("uc2") == (
            "chr2",
            100,
            420,
            "uc2",
            0,
            "-",
            100,
            100,
            "0,0,0",
            3,
            "100,10,120",
            "0,110,200",
        )
Пример #2
0
 def setUp(self):
     self.e1 = Ival(100, 200)
     self.e2 = Ival(210, 220)
     self.e3 = Ival(300, 420)
     self.grna1 = GeneRna("chr1", "+", (self.e1, self.e2, self.e3))
     self.grna2 = GeneRna("chr2", "-", (self.e1, self.e2, self.e3))