Exemple #1
0
 def test_json(self):
     component = Component(DummyHMMResult(PKS_START), subtype=TRANS_AT_SUBTYPE)
     intermediate = component.to_json()
     new = Component.from_json(json.loads(json.dumps(intermediate)))
     assert new.to_json() == intermediate
     assert new.domain == component.domain
     assert new.subtype == TRANS_AT_SUBTYPE
     assert new.classification == component.classification
Exemple #2
0
    def test_construction(self):
        domain = DummyHMMResult("ACP")
        component = Component(domain)
        assert component.domain == domain
        assert component.label == domain.hit_id
        assert component.subtype == ""
        assert component.classification == "CP"

        domain._hit_id = PKS_START
        component = Component(domain, "some-subtype")
        assert component.subtype == "some-subtype"
        assert component.classification == "KS"
Exemple #3
0
 def test_loader(self):
     for cond in [PKS_LOAD, "AMP-binding", "A-OX"]:
         assert Component(DummyHMMResult(cond)).is_loader()
     assert not Component(DummyHMMResult(NRPS_START)).is_loader()
Exemple #4
0
 def test_condensation(self):
     for cond in CLASSIFICATIONS["C"]:
         assert Component(DummyHMMResult(cond)).is_condensation()
     assert not Component(DummyHMMResult(NRPS_LOAD)).is_condensation()
Exemple #5
0
 def test_unknown_component_type(self):
     component = Component(DummyHMMResult(NRPS_LOAD))
     component._domain._hit_id = "unclassifiable"
     component.classification = "unclassifiable"
     with self.assertRaisesRegex(ValueError, "unhandled"):
         Module().add_component(component)
Exemple #6
0
def add_component(module, name, sub="", start=1, end=10):
    module.add_component(Component(DummyHMMResult(name, start, end), sub))