Exemple #1
0
    def test_export(self):
        """export a table with reference priors"""
                        
        config = MGITestConfig()            
        config.table = "reference_priors"        
        
        # export the table
        out = StringIO()            
        pipeline = Phenoscoring(config)
        pipeline.export(out)

        # check some basic properties                
        outvalue = out.getvalue().strip().split("\n")
        self.assertGreater(len(outvalue), 4)        
        self.assertEqual(outvalue[0], "id\tvalue")
    if config.action == "clearmodels":
        # remove all models and model scores from the database
        pipeline.clearmodels()

    if config.action == "update":
        # add new or update existing model defintions/phenotypes
        pipeline.update()

    if config.action == "remove":
        # remove a subset of models from the database
        pipeline.remove()

    if config.action == "recompute":
        # remove all scores and re-generate them from scratch
        pipeline.recompute()

    if config.action == "export":
        # write a database table into a tsv file
        pipeline.export()

    if config.action == "representations":
        # compute complete representations for references and models
        pipeline.export_representations()

    if config.action == "explain":
        # provide step-by-step explanation of scoring
        result = pipeline.explain()
        if config.pretty:
            result = json.dumps(json.loads(result), indent=2)
        print(result)