def test_result_vec_to_features(self): "Test lanthipeptides.result_vec_to_features()" orig_feature = DummyCDS(0, 165) orig_feature.locus_tag = 'FAKE0001' seq = "TAILTAILTAILTAILTAILTAILTAILTAILTAILCC" vec = Lanthipeptide(CleavageSiteHit(23, 42, 'Class-I'), 23, "HEADHEADHEAD", seq) motif = result_vec_to_feature(orig_feature, vec) assert motif.location.start == 0 assert motif.location.end == 165 assert motif.location.strand == 1 assert motif.locus_tag == orig_feature.locus_tag assert motif.score == 42 assert motif.detailed_information.rodeo_score == 23 assert motif.peptide_class == "lanthipeptide" assert motif.peptide_subclass == "Class I" assert motif.detailed_information.lan_bridges == 2 self.assertAlmostEqual(motif.molecular_weight, 3648.6, places=1) self.assertAlmostEqual(motif.monoisotopic_mass, 3646.3, places=1) for calc, expected in zip( motif.alternative_weights, [3666.6, 3684.6, 3702.7, 3720.7, 3738.7, 3756.7, 3774.7]): self.assertAlmostEqual(calc, expected, places=1) assert motif.core == seq assert motif.leader == vec.leader
def test_prediction_with_core_class2(self, _patched_rodeo): # the cleavage result adjusted to leave at least one amino in core cleavage_result = CleavageSiteHit(end=40, score=-6.8, lantype="Class-II") with patch.object(lanthi, "predict_cleavage_site", return_value=cleavage_result): results = run_lanthipred(DummyRecord(features=[self.cds]), self.cds, "Class-II", self.domains) assert results is not None assert str(results).startswith("Lanthipeptide(..40, -6.8, 'Class-II', 'LSQGLGGC', 1, 715")
def test_prediction_with_no_core(self): # the real cleavage site result (+1 at end for the C) cleavage_result = CleavageSiteHit(end=48, score=-6.8, lantype="Class-II") mock("lanthi.predict_cleavage_site", returns=cleavage_result) for part in ["I", "II"]: assert run_lanthipred(None, self.cds, "Class-%s" % part, self.domains) is None
def test_prediction_with_core_class1(self): # the cleavage result adjusted to leave at least one amino in core cleavage_result = CleavageSiteHit(end=40, score=-6.8, lantype="Class-I") mock("lanthi.predict_cleavage_site", returns=cleavage_result) results = run_lanthipred(DummyRecord(features=[self.cds]), self.cds, "Class-I", self.domains) assert results assert str(results).startswith( "Lanthipeptide(..40, -6.8, 'Class-I', 'LSQGLGGC', 1, 715")
def test_prediction_with_no_core(self, _patched_rodeo): # the real cleavage site result (+1 at end for the C) cleavage_result = CleavageSiteHit(end=48, score=-6.8, lantype="Class-II") with patch.object(lanthi, "predict_cleavage_site", return_value=cleavage_result): for part in ["I", "II"]: assert run_lanthipred(None, self.cds, "Class-%s" % part, self.domains) is None
def test_prediction_with_core(self): # the cleavage result adjusted to leave at least one amino in core cleavage_result = CleavageSiteHit(start=38, end=40, score=-6.8, lantype="Class-II") mock("lanthi.predict_cleavage_site", returns=cleavage_result) for part in ["I", "II"]: results = run_lanthipred(DummyRecord(features=[self.cds]), self.cds, "Class-%s" % part, self.domains) assert results is not None
def setUp(self): self.lant = Lanthipeptide(CleavageSiteHit(42, 17, 'Class-I'), 23, "HEAD", "MAGICHAT")