Ejemplo n.º 1
0
 def test_mixed(self):
     domains = [
         DummyHMMResult("PKS_KS", start=1, end=40),
         DummyHMMResult("PKS_AT", start=50, end=90),
         DummyHMMResult("PKS_KS", start=100, end=140),
     ]
     sub_hits = [DummyHMMResult("trans-AT", start=99, end=139)]
     assert self.func(domains, sub_hits) == ["", "trans-AT"]
Ejemplo n.º 2
0
 def test_module_for_orphans(self):
     for name in [
             NRPS_START, NRPS_LOAD, PKS_START, PKS_LOAD, "cMT", "ACP",
             "Trans-AT_docking"
     ]:
         modules = build_modules_for_cds([DummyHMMResult(name)],
                                         [DummyHMMResult("")])
         assert len(modules) == 1
         assert not modules[0].is_complete()
Ejemplo n.º 3
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"
Ejemplo n.º 4
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
Ejemplo n.º 5
0
 def test_starters(self):
     for domain_type in [NRPS_LOAD, PKS_LOAD]:
         domains = [DummyHMMResult(i) for i in [domain_type, "ACP", domain_type, "ACP"]]
         modules = build_modules_for_cds(domains, [])
         print(modules)
         assert len(modules) == 2
         assert modules[0]._first_in_cds
         assert modules[0].is_complete()
         assert not modules[1]._first_in_cds
         print(modules[1], modules[1].is_complete())
         print(modules[1]._starter, modules[1]._loader, modules[1]._carrier_protein, modules[1]._starter is modules[1]._loader)
         assert not modules[1].is_complete()
Ejemplo n.º 6
0
 def test_module_for_each_starter(self):
     modules = build_modules_for_cds([
         DummyHMMResult("Condensation_DCL"),
         DummyHMMResult("Condensation_LCL")
     ], [])
     assert len(modules) == 2
Ejemplo n.º 7
0
 def test_unclassifiable(self):
     with self.assertRaisesRegex(ValueError, "could not classify domain"):
         build_modules_for_cds([DummyHMMResult("UNCLASSIFIABLE")], [])
Ejemplo n.º 8
0
 def test_no_empties(self):
     assert build_modules_for_cds([], []) == []
     assert build_modules_for_cds([DummyHMMResult("ACPS")], []) == []
Ejemplo n.º 9
0
 def test_mismatching_ks_subtypes(self):
     with self.assertRaises(StopIteration):
         build_modules_for_cds([DummyHMMResult(PKS_START)], [])
Ejemplo n.º 10
0
def dummy_hmm(hit_id="dummy", start=1):
    return DummyHMMResult(hit_id, start, start + 40, 1e-5, 10)
Ejemplo n.º 11
0
 def test_condensation(self):
     for cond in CLASSIFICATIONS["C"]:
         assert Component(DummyHMMResult(cond)).is_condensation()
     assert not Component(DummyHMMResult(NRPS_LOAD)).is_condensation()
Ejemplo n.º 12
0
def add_component(module, name, sub="", start=1, end=10, cds_name="test_name"):
    assert cds_name
    module.add_component(
        Component(DummyHMMResult(name, start, end), cds_name, sub))
Ejemplo n.º 13
0
 def test_PKS_with_no_hit(self):
     assert self.func(
         [DummyHMMResult("PKS_KS", start=1, end=40)],
         [DummyHMMResult("trans-AT", start=41, end=48)]) == [""]
Ejemplo n.º 14
0
 def test_non_PKS(self):
     assert self.func([DummyHMMResult()], []) == []
Ejemplo n.º 15
0
 def test_bad_add_makes_new_module(self):
     modules = build_modules_for_cds([DummyHMMResult(NRPS_LOAD)] * 2, [])
     assert len(modules) == 2
     assert not modules[0].is_complete()
Ejemplo n.º 16
0
def add_component(module, name, sub="", start=1, end=10):
    module.add_component(Component(DummyHMMResult(name, start, end), sub))
Ejemplo n.º 17
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)
Ejemplo n.º 18
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()
Ejemplo n.º 19
0
 def test_pks_with_hit(self):
     assert self.func(
         [DummyHMMResult("PKS_KS", start=1, end=40)],
         [DummyHMMResult("trans-AT", start=1, end=38)]) == ["trans-AT"]