コード例 #1
0
ファイル: test_location.py プロジェクト: abulovic/binner
    def testSingleLocation(self):
        location = Location.from_location_str('join(311,400..854)')

        self.assertTrue(location.intersects(Location.from_location((311, ))),
                        "Location doesn't contain target point")

        location = Location.from_location_str('join(14424..14857,1)')
        self.assertTrue(location.intersects(Location.from_location((1, ))),
                        "Location doesn't contain target point")
コード例 #2
0
ファイル: test_location.py プロジェクト: abulovic/binner
    def testSingleLocationWithTolerance(self):
        location = Location.from_location_str(
            'join(<10,61..86,162..203,264..318,388..>495)', tolerance=10)

        self.assertTrue(location.intersects(Location.from_location((5, ))),
                        "Location doesn't contain target point")

        location = Location.from_location_str('join(<1..129,>657)',
                                              tolerance=10)

        self.assertTrue(location.intersects(Location.from_location((660, ))),
                        "Location doesn't contain target point")
コード例 #3
0
ファイル: test_location.py プロジェクト: abulovic/binner
    def testParsesMultisegmentLocation(self):
        location = Location.from_location_str(
            'join(AF178221.1:<1..60,AF178222.1:1..63,AF178223.1:1..42, 1..>90)'
        )

        self.assertTrue(location.intersects(Location.from_location((80, ))),
                        "Location doesn't contain target point")
        self.assertIn('AF178221.1', location.references(),
                      'Reference AF178221.1 not parsed')
        self.assertIn('AF178222.1', location.references(),
                      'Reference AF178222.1 not parsed')
        self.assertIn('AF178223.1', location.references(),
                      'Reference AF178223.1 not parsed')
        self.assertTrue(
            len(location.references()) == 3, 'Wrong number of references')
コード例 #4
0
ファイル: test_location.py プロジェクト: abulovic/binner
    def testIntersections(self):
        location = Location.from_location_str(
            "complement(join(<197..1301,2070..>2451))")

        self.assertFalse(location.intersects(Location.from_location((100, ))))

        self.assertFalse(
            location.intersects(
                Location.from_location((100, ), complement=True)))

        self.assertFalse(location.intersects(Location.from_location((300, ))))

        self.assertTrue(
            location.intersects(
                Location.from_location((300, ), complement=True)))

        self.assertFalse(location.intersects(Location.from_location(
            (50, 100))))

        self.assertFalse(
            location.intersects(
                Location.from_location((50, 100), complement=True)))

        self.assertFalse(
            location.intersects(Location.from_location((300, 400))))

        self.assertTrue(
            location.intersects(
                Location.from_location((300, 400), complement=True)))

        self.assertFalse(
            location.intersects(Location.from_location((1200, 1400))))

        self.assertTrue(
            location.intersects(
                Location.from_location((1200, 1400), complement=True)))
コード例 #5
0
 def matches(self, location, complement, tolerance):
     l1 = Location.from_location_str(self.location, tolerance)
     return l1.intersects(Location.from_location(location, complement))
コード例 #6
0
ファイル: test_location.py プロジェクト: abulovic/binner
 def testIntersectionDifferentStrands(self):
     loc1 = Location.from_location(location_tuple=(1, 2), complement=True)
     loc2 = Location.from_location(location_tuple=(1, 2), complement=False)
     self.assertEqual(None, loc1.find_intersection(loc2))
コード例 #7
0
ファイル: test_location.py プロジェクト: abulovic/binner
 def testParseReferenceLocation(self):
     location = Location.from_location_str('REFERENCE:1..10')
     self.assertTrue(location.intersects(Location.from_location((5, 15))))
コード例 #8
0
ファイル: test_location.py プロジェクト: abulovic/binner
 def testParseOrderLocation(self):
     location = Location.from_location_str('order(1..3,4..6)')
     self.assertTrue(location.intersects(Location.from_location((3, 4))),
                     "Location doesn't contain target point")
コード例 #9
0
ファイル: test_location.py プロジェクト: abulovic/binner
    def testParsesLocationWithSpaces(self):
        location = Location.from_location_str(
            'join(620..987, 1010..1170,1194..1443)')

        self.assertTrue(location.intersects(Location.from_location((1010, ))),
                        "Location doesn't contain target point")
コード例 #10
0
ファイル: mock_db_access.py プロジェクト: abulovic/binner
 def matches(self, location, complement, tolerance):
     l1 = Location.from_location_str(self.location, tolerance)
     return l1.intersects(Location.from_location(location, complement))