コード例 #1
0
    def test_reconstruction(self):
        preds_by_cds = build_dummy_cds_predictions()

        starters = [Prediction('acetyl', 0., 0.)]
        elongations = [Prediction('7', 743.5, 1.2e-226)]
        classes = {"benzoisochromanequinone"}
        weights = {"acetyl_7": 451.23}
        cluster_pred = ProtoclusterPrediction(preds_by_cds,
                                              starter_units=starters,
                                              malonyl_elongations=elongations,
                                              product_classes=classes,
                                              molecular_weights=weights,
                                              start=100,
                                              end=2000)
        assert cluster_pred.cds_predictions == preds_by_cds
        assert cluster_pred.starter_units == starters
        assert cluster_pred.malonyl_elongations == elongations
        assert cluster_pred.product_classes == classes
        assert cluster_pred.molecular_weights == weights
        assert cluster_pred.start == 100
        assert cluster_pred.end == 2000
        reconstructed = ProtoclusterPrediction.from_json(
            json.loads(json.dumps(cluster_pred.to_json())))
        assert cluster_pred.cds_predictions == preds_by_cds
        assert reconstructed.starter_units == starters
        assert reconstructed.malonyl_elongations == elongations
        assert reconstructed.product_classes == classes
        assert reconstructed.molecular_weights == weights
        assert reconstructed.start == 100
        assert reconstructed.end == 2000
コード例 #2
0
 def test_invalid(self):
     with self.assertRaisesRegex(ValueError,
                                 "could not convert string to float"):
         Prediction("name", "not a float", 1e-89)
     with self.assertRaisesRegex(ValueError,
                                 "could not convert string to float"):
         Prediction("name", 1e-89, "not a float")
コード例 #3
0
ファイル: test_results.py プロジェクト: zachcp/antismash
def build_dummy_cluster_prediction():
    return ClusterPrediction(build_dummy_cds_predictions(),
                             [Prediction('acetyl', 0., 0.)],
                             [Prediction('7', 743.5, 1.2e-226)],
                             {"benzoisochromanequinone"}, {"acetyl_7": 451.23},
                             start=0,
                             end=1500)
コード例 #4
0
 def test_coelicolor_c11(self, _mocked_blastp):
     with patch.object(t2pks_analysis, "run_t2pks_hmmscan", return_value=self.hmm_results()):
         results = t2pks_analysis.analyse_cluster(self.cluster, self.record)
     assert isinstance(results, ProtoclusterPrediction)
     assert results.product_classes == {"benzoisochromanequinone"}
     assert results.starter_units == [Prediction("acetyl-CoA", 0., 0.)]
     assert results.malonyl_elongations == [Prediction("7", 743.5, 1.2e-226)]
     assert list(results.molecular_weights) == ["acetyl-CoA_7"]
     self.assertAlmostEqual(results.molecular_weights["acetyl-CoA_7"], 342.3845)
コード例 #5
0
ファイル: test_analysis.py プロジェクト: prihoda/antismash
 def test_coelicolor_c11(self):
     results = t2pks_analysis.analyse_cluster(self.cluster, self.record)
     assert isinstance(results, ClusterPrediction)
     assert results.product_classes == {"benzoisochromanequinone"}
     assert results.starter_units == [Prediction("acetyl-CoA", 0., 0.)]
     assert results.malonyl_elongations == [
         Prediction("7", 743.5, 1.2e-226)
     ]
     assert list(results.molecular_weights) == ["acetyl-CoA_7"]
     self.assertAlmostEqual(results.molecular_weights["acetyl-CoA_7"],
                            342.3845)
コード例 #6
0
    def test_equality(self):
        first = Prediction("somename", 15., 1e-89)
        second = Prediction("somename", 15., 1e-89)
        assert first == second

        second = Prediction("tomename", 15., 1e-89)
        assert first != second

        second = Prediction("somename", 1., 1e-89)
        assert first != second

        second = Prediction("tomename", 15., 1e-88)
        assert first != second

        assert first != "not a Prediction"
コード例 #7
0
 def test_reconstruction(self):
     pred = Prediction("somename", 15., 1e-89)
     reconstructed = Prediction.from_json(
         json.loads(json.dumps(pred.to_json())))
     assert pred is not reconstructed
     assert pred == reconstructed
コード例 #8
0
 def test_stringification(self):
     pred = Prediction("somename", 15., 1e-89)
     assert str(pred) == "somename (Score: 15.0; E-value: 1e-89)"