def create_cluster(n_start, start, end, n_end, product='a'): cluster = Protocluster(FeatureLocation(start, end), FeatureLocation(n_start, n_end), tool="testing", product=product, cutoff=1, neighbourhood_range=0, detection_rule="some rule text") cds = create_cds(start, end, [product]) cluster.add_cds(cds) return cluster
def create_cluster(self, rule_name, start, end): rule = self.rules_by_name[rule_name] core = FeatureLocation(start, end) surrounds = FeatureLocation(max(0, start - rule.neighbourhood), end + rule.neighbourhood) return Protocluster(core, surrounds, tool="testing", cutoff=rule.cutoff, neighbourhood_range=rule.neighbourhood, product=rule_name, detection_rule="rule text")
def create_cluster(): cluster = Protocluster(FeatureLocation(8, 71, strand=1), FeatureLocation(3, 76, strand=1), tool="test", cutoff=17, neighbourhood_range=5, product='a', detection_rule="some rule text") return cluster
def test_product(self): loc = FeatureLocation(1, 6, strand=1) for bad in [ "-", "-like", "NRPS-", "NRPS PKS", "NRPS/PKS", "NRPS,PKS", "NRPS.PKS" ]: with self.assertRaisesRegex(ValueError, "invalid protocluster product"): Protocluster(loc, loc, tool="test", cutoff=17, neighbourhood_range=5, product=bad, detection_rule="some rule text")
def test_biopython_conversion(self): bio = self.cluster.to_biopython() assert len(bio) == 2 assert bio[0].type == "protocluster" and bio[1].type == "proto_core" new = Protocluster.from_biopython(bio[0]) assert new is not self.cluster assert new.cutoff == self.cluster.cutoff == 17 assert new.neighbourhood_range == self.cluster.neighbourhood_range == 5 assert new.product == self.cluster.product == 'a' assert new.location.start == self.cluster.location.start == 3 assert new.core_location.start == self.cluster.core_location.start == 8 assert new.detection_rule == self.cluster.detection_rule == "some rule text" assert new.tool == self.cluster.tool == "test" assert new.location.start == self.cluster.location.start == 3 assert new.location.end == self.cluster.location.end == 76 assert new.core_location.start == self.cluster.core_location.start == 8 assert new.core_location.end == self.cluster.core_location.end == 71