Esempio n. 1
0
 def test_bbsr(self):
     self.workflow = create_puppet_workflow(base_class="tfa",
                                            regression_class="bbsr")
     self.workflow = self.workflow(self.data, self.prior,
                                   self.gold_standard)
     self.workflow.tf_names = self.tf_names
     self.workflow.run()
     self.assertEqual(self.workflow.results.score, 1)
Esempio n. 2
0
 def test_base(self):
     self.workflow = create_puppet_workflow(
         base_class=tfa_workflow.TFAWorkFlow)
     self.workflow = self.workflow(self.data, self.prior,
                                   self.gold_standard)
     self.workflow.tf_names = self.tf_names
     with self.assertRaises(NotImplementedError):
         self.workflow.run()
 def setUp(self):
     self.expr = TestDataSingleCellLike.expression_matrix.transpose()
     self.meta = TestDataSingleCellLike.meta_data
     self.prior = TestDataSingleCellLike.priors_data
     self.gold_standard = self.prior.copy()
     self.gene_list = TestDataSingleCellLike.gene_metadata
     self.tf_names = TestDataSingleCellLike.tf_names
     self.workflow = create_puppet_workflow(base_class=SingleCellWorkflow)(
         self.expr.transpose(), self.meta, self.prior, self.gold_standard)
    def test_stars(self):
        self.workflow = create_puppet_workflow(base_class="tfa",
                                               regression_class="stars")
        self.workflow = self.workflow(self.data, self.prior,
                                      self.gold_standard)
        self.workflow.set_regression_parameters(num_subsamples=5)
        self.workflow.tf_names = self.tf_names

        self.workflow.run()
        self.assertAlmostEqual(self.workflow.results.score, 0.32222, places=4)
 def test_bbsr(self):
     self.workflow = create_puppet_workflow(base_class="tfa",
                                            regression_class="bbsr")
     self.workflow = self.workflow(self.expr, self.meta, self.prior,
                                   self.gold_standard)
     self.workflow.gene_list = self.gene_list
     self.workflow.tf_names = self.tf_names
     self.workflow.meta_data_file = None
     self.workflow.read_metadata()
     self.workflow.run()
     self.assertEqual(self.workflow.results.score, 1)
 def test_base(self):
     self.workflow = create_puppet_workflow(
         base_class=tfa_workflow.TFAWorkFlow)
     self.workflow = self.workflow(self.expr, self.meta, self.prior,
                                   self.gold_standard)
     self.workflow.gene_list = self.gene_list
     self.workflow.tf_names = self.tf_names
     self.workflow.meta_data_file = None
     self.workflow.read_metadata()
     with self.assertRaises(NotImplementedError):
         self.workflow.run()
Esempio n. 7
0
    def test_elasticnet(self):
        self.workflow = create_puppet_workflow(base_class="tfa",
                                               regression_class="elasticnet")
        self.workflow = self.workflow(self.data, self.prior,
                                      self.gold_standard)
        self.workflow.tf_names = self.tf_names

        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            self.workflow.run()

        self.assertEqual(self.workflow.results.score, 1)
    def test_sklearn(self):
        self.workflow = create_puppet_workflow(base_class="tfa",
                                               regression_class="sklearn")
        self.workflow = self.workflow(self.data, self.prior,
                                      self.gold_standard)
        self.workflow.tf_names = self.tf_names

        with self.assertRaises(ValueError):
            self.workflow.set_regression_parameters(model=42)

        with self.assertRaises(ValueError):
            self.workflow.set_regression_parameters(model=LinearRegression())

        self.workflow.set_regression_parameters(model=LinearRegression)

        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            self.workflow.run()

        self.assertEqual(self.workflow.results.score, 1)