Example #1
0
    def produce_additional_models(self):
        model = self.create_random_model()
        if not self.check_consistency(model):
            out = self.revise(model)
            if out == False:
                self.archive.record(AdditModProdFail())
            else:
                self.archive.record(AdditionalModels(out[0]))
        else:
            self.archive.record(AdditionalModels([model]))

        if out[1] == True:
            raise ValueError(
                'produce_additional_models: revised set of ignored results instead of model itself'
            )
Example #2
0
    def setUp(self):
        self.archive = Archive()
        exd = ExperimentDescription(DetectionEntity(None))
        res1 = Result('res_0', exd, None)
        res2 = Result('res_1', exd, None)
        res3 = Result('res_2', exd, None)
        res4 = Result('res_3', exd, None)
        exp1 = Experiment('exp_0', [res1])
        exp2 = Experiment('exp_1', [res2])
        exp3 = Experiment('exp_2', [res3])
        exp4 = Experiment('exp_3', [res4])
        r1 = NewResults(exp1)
        r2 = NewResults(exp2)
        r3 = NewResults(exp3)
        r4 = NewResults(exp4)

        self.mod1 = Model('m_0', [1], [], [])
        self.mod1.ignored_results = frozenset([res3])
        self.mod1.results_covered = frozenset([res1, res4])

        self.mod2 = Model('m_1', [2], [], [])
        self.mod2.ignored_results = frozenset([res3])
        self.mod2.results_covered = frozenset([res1, res2, res4])

        m = AdditionalModels([self.mod1, self.mod2])

        self.archive.record(r1)
        self.archive.record(m)
        self.archive.record(r2)
        self.archive.record(r3)
        self.archive.record(r4)
Example #3
0
 def test_was_new_model_produced_since_last_check_positive(self):
     self.overseer_qual.archive.development_history.append(
         CheckPointSuccess())
     self.overseer_qual.archive.development_history.append(
         AdditionalModels([]))
     out = self.overseer_qual.was_new_model_produced_since_last_check()
     self.assertEqual(out, True)
Example #4
0
    def produce_additional_models(self):
        model = self.get_current_best_model()
        out = self.revise(model, True)
        if out == False:
            self.archive.record(AdditModProdFail())
        else:
            self.archive.record(AdditionalModels(out[0]))

        if out[1] == True:
            raise ValueError(
                'produce_additional_models: revised set of ignored results instead of model itself'
            )
Example #5
0
    def test_check_consistency_negative(self):
        met1 = mnm_repr.Metabolite('met1')
        met2 = mnm_repr.Metabolite('met2')
        comp1 = mnm_repr.Medium()
        cond_subst_1 = mnm_repr.PresentEntity(met1, comp1)
        cond_subst_2 = mnm_repr.PresentEntity(met2, comp1)
        base_model = mnm_repr.Model('m1', [cond_subst_1, cond_subst_2], [], [])
        exd = exp_repr.ExperimentDescription(exp_repr.DetectionEntity('met1'),
                                             [])
        res = exp_repr.Result('r1', exd, 'false')
        exp = exp_repr.Experiment('exp1', [res])

        arch = Archive()
        arch.mnm_entities = [met1, met2]
        arch.mnm_compartments = [comp1]
        ev1 = AdditionalModels([base_model])
        ev2 = AcceptedResults(exp)
        arch.record(ev1)
        arch.record(ev2)

        rev = RevisionModule(arch)
        out = rev.check_consistency(base_model)
        self.assertEqual(False, out)