Exemplo n.º 1
0
    def test_scale_taxa_data_matrix(self):
        coord = np.array([[1, 4, 7, 0], [2, 5, 8, 1], [3, 6, 9, 2]], float)
        taxdata = {}
        taxdata['prevalence'] = np.array([0, .5, 1])
        taxdata['coord'] = coord
        taxdata['lineages'] = np.array(['Root;A', 'Root;B', 'Root;C'])
        pct_var = np.array([100, 10, 1], dtype="float")

        # with scaling
        res = bp.make_mage_taxa(taxdata,
                                3,
                                pct_var,
                                scaled=True,
                                scalars=None,
                                radius=1,
                                min_taxon_radius=10,
                                max_taxon_radius=20,
                                taxon_alpha=.7)
        self.assertEqual(res, taxa_mage_scale)

        # without scaling
        res = bp.make_mage_taxa(taxdata,
                                3,
                                pct_var,
                                scaled=False,
                                scalars=None,
                                radius=1,
                                min_taxon_radius=10,
                                max_taxon_radius=20,
                                taxon_alpha=.7)
        self.assertEqual(res, taxa_mage_no_scale)
Exemplo n.º 2
0
    def test_scale_taxa_data_matrix(self):
        coord = np.array([  [1,4,7,0],
                            [2,5,8,1],
                            [3,6,9,2]],float)
        taxdata = {}
        taxdata['prevalence'] = np.array([0,.5,1])
        taxdata['coord'] = coord
        taxdata['lineages'] = np.array(['Root;A','Root;B','Root;C'])
        pct_var = np.array([100,10,1],dtype="float")

        # with scaling
        res = bp.make_mage_taxa(taxdata,3,pct_var,scaled=True,scalars=None,\
                                    radius=1,
                                    min_taxon_radius=10, max_taxon_radius=20,
                                    taxon_alpha=.7)
        self.assertEqual(res, taxa_mage_scale)

        # without scaling
        res = bp.make_mage_taxa(taxdata,3,pct_var,scaled=False,scalars=None,\
                                    radius=1,
                                    min_taxon_radius=10, max_taxon_radius=20,
                                    taxon_alpha=.7)
        self.assertEqual(res, taxa_mage_no_scale)