def test_beta_rarefaction_too_many_samples_dropped(self):
     # mantel needs 3x3 or larger distance matrix
     table = Table(np.array([[0, 1, 3], [1, 1, 2]]),
                   ['O1', 'O2'], ['S1', 'S2', 'S3'])
     with self.assertRaisesRegex(ValueError, '3x3 in size'):
         beta_rarefaction(self.output_dir, table, 'braycurtis', 'upgma',
                          self.md, 2)
    def test_beta_rarefaction_pearson_correlation(self):
        beta_rarefaction(self.output_dir, self.table, 'jaccard', 'upgma',
                         self.md, 2, iterations=7, correlation_method='pearson'
                         )

        self.assertBetaRarefactionValidity(
            self.output_dir, 7, 'pearson', 'upgma')
    def test_beta_rarefaction_with_phylogeny(self):
        beta_rarefaction(self.output_dir, self.table,
                         'weighted_unifrac',
                         'upgma', self.md, 2, phylogeny=self.tree)

        self.assertBetaRarefactionValidity(
            self.output_dir, 10, 'spearman', 'upgma')
    def test_beta_rarefaction_pearson_correlation(self):
        beta_rarefaction(self.output_dir, self.table, 'jaccard', 'upgma',
                         self.md, 2, iterations=7, correlation_method='pearson'
                         )

        self.assertBetaRarefactionValidity(
            self.output_dir, 7, 'pearson', 'upgma')
 def test_beta_rarefaction_too_many_samples_dropped(self):
     # mantel needs 3x3 or larger distance matrix
     table = Table(np.array([[0, 1, 3], [1, 1, 2]]),
                   ['O1', 'O2'], ['S1', 'S2', 'S3'])
     with self.assertRaisesRegex(ValueError, '3x3 in size'):
         beta_rarefaction(self.output_dir, table, 'braycurtis', 'upgma',
                          self.md, 2)
    def test_beta_rarefaction_minimum_iterations(self):
        beta_rarefaction(self.output_dir,
                         self.table,
                         'braycurtis',
                         'upgma',
                         self.md,
                         2,
                         iterations=2)

        self.assertBetaRarefactionValidity(self.output_dir, 2, 'spearman',
                                           'upgma')
    def test_beta_rarefaction_neighbor_joining(self):
        beta_rarefaction(self.output_dir,
                         self.table,
                         'euclidean',
                         'nj',
                         self.md,
                         3,
                         iterations=5,
                         color_scheme='PiYG')

        self.assertBetaRarefactionValidity(self.output_dir, 5, 'spearman',
                                           'nj')
    def test_beta_rarefaction_non_default_color_scheme(self):
        beta_rarefaction(self.output_dir,
                         self.table,
                         'euclidean',
                         'upgma',
                         self.md,
                         3,
                         iterations=5,
                         color_scheme='PiYG')

        self.assertBetaRarefactionValidity(self.output_dir, 5, 'spearman',
                                           'upgma')
    def test_beta_rarefaction_minimum_iterations(self):
        beta_rarefaction(self.output_dir, self.table, 'braycurtis', 'upgma',
                         self.md, 2, iterations=2)

        self.assertBetaRarefactionValidity(
            self.output_dir, 2, 'spearman', 'upgma')
    def test_beta_rarefaction_without_phylogeny(self):
        beta_rarefaction(self.output_dir, self.table, 'braycurtis', 'upgma',
                         self.md, 2)

        self.assertBetaRarefactionValidity(
            self.output_dir, 10, 'spearman', 'upgma')
    def test_beta_rarefaction_with_phylogeny(self):
        beta_rarefaction(self.output_dir, self.table, 'weighted_unifrac',
                         'upgma', self.md, 2, phylogeny=self.tree)

        self.assertBetaRarefactionValidity(
            self.output_dir, 10, 'spearman', 'upgma')
 def test_beta_rarefaction_empty_table(self):
     table = Table(np.array([[]]), [], [])
     with self.assertRaisesRegex(ValueError,
                                 'shallow enough sampling depth'):
         beta_rarefaction(self.output_dir, table, 'braycurtis', 'upgma',
                          self.md, 1)
 def test_beta_rarefaction_empty_table(self):
     table = Table(np.array([[]]), [], [])
     with self.assertRaisesRegex(ValueError, 'feature table is empty'):
         beta_rarefaction(self.output_dir, table, 'braycurtis', 'upgma',
                          self.md, 1)
    def test_beta_rarefaction_without_phylogeny(self):
        beta_rarefaction(self.output_dir, self.table, 'braycurtis', 'upgma',
                         self.md, 2)

        self.assertBetaRarefactionValidity(
            self.output_dir, 10, 'spearman', 'upgma')
    def test_beta_rarefaction_non_default_color_scheme(self):
        beta_rarefaction(self.output_dir, self.table, 'euclidean', 'upgma',
                         self.md, 3, iterations=5, color_scheme='PiYG')

        self.assertBetaRarefactionValidity(
            self.output_dir, 5, 'spearman', 'upgma')
    def test_beta_rarefaction_neighbor_joining(self):
        beta_rarefaction(self.output_dir, self.table, 'euclidean', 'nj',
                         self.md, 3, iterations=5, color_scheme='PiYG')

        self.assertBetaRarefactionValidity(
            self.output_dir, 5, 'spearman', 'nj')
 def test_beta_rarefaction_all_samples_dropped(self):
     with self.assertRaisesRegex(ValueError,
                                 'shallow enough sampling depth'):
         beta_rarefaction(self.output_dir, self.table, 'braycurtis',
                          'upgma', self.md, 100)
 def test_beta_rarefaction_all_samples_dropped(self):
     with self.assertRaisesRegex(ValueError,
                                 'shallow enough sampling depth'):
         beta_rarefaction(self.output_dir, self.table, 'braycurtis',
                          'upgma', self.md, 100)
 def test_beta_rarefaction_missing_phylogeny(self):
     with self.assertRaisesRegex(ValueError, 'Phylogeny must be provided'):
         beta_rarefaction(self.output_dir, self.table,
                          'weighted_unifrac',
                          'upgma', self.md, 2)
 def test_beta_rarefaction_missing_phylogeny(self):
     with self.assertRaisesRegex(ValueError, 'Phylogeny must be provided'):
         beta_rarefaction(self.output_dir, self.table, 'weighted_unifrac',
                          'upgma', self.md, 2)
예제 #21
0
 def test_beta_rarefaction_empty_table(self):
     table = Table(np.array([[]]), [], [])
     with self.assertRaisesRegex(ValueError, 'feature table is empty'):
         beta_rarefaction(self.output_dir, table, 'braycurtis', 'upgma',
                          self.md, 1)