def test_compound_reverse(self): self.feature.location = CompoundLocation([FeatureLocation(21, 27, -1), FeatureLocation(12, 15, -1), FeatureLocation(0, 6, -1)]) assert self.get_sub(2, 3) == FeatureLocation(12, 15, -1)
def test_simple_reverse(self): self.feature.location = FeatureLocation(10, 40, -1) assert self.get_sub(0, 1) == FeatureLocation(37, 40, -1) assert self.get_sub(2, 4) == FeatureLocation(28, 34, -1) assert self.get_sub(9, 10) == FeatureLocation(10, 13, -1)
def test_simple_forward(self): assert self.get_sub(0, 1) == FeatureLocation(10, 13, 1) assert self.get_sub(2, 4) == FeatureLocation(16, 22, 1) assert self.get_sub(9, 10) == FeatureLocation(37, 40, 1)
def setUp(self): self.feature = Feature(FeatureLocation(10, 40, 1), feature_type="test") self.get_sub = self.feature.get_sub_location_from_protein_coordinates
def test_negative_locations(self): loc = FeatureLocation(-2, 500, strand=1) with self.assertRaisesRegex(ValueError, "negative coordinate"): Feature(loc, feature_type="")
def test_bridging_fails(self): parts = [FeatureLocation(9, 12, strand=1), FeatureLocation(0, 3, strand=1)] with self.assertRaisesRegex(ValueError, "bridge the record origin"): Feature(CompoundLocation(parts, operator="join"), feature_type="test") Feature(CompoundLocation(parts[::-1], operator="join"), feature_type="test")