コード例 #1
0
    def test_plot(self):
        phy = PhyBo(self.inputfile, output_dir=self.tmp.as_posix())
        phy.get_GLS()
        glm = list(phy.stats.keys())[0]
        phy.plot_GLS(glm)
        phy.plot_ACS(glm)

        for method in ['bc', 'td', 'mr']:
            phy.get_MLN(glm, method=method)

        phy.plot_MLN(glm)
        phy.plot_MLN_3d(glm)
        phy.analyze(runs=[('weighted', (2, 1))], output_gml=True,
                    output_plot=True)
        phy.get_IVSD()
        phy.get_ACS(phy.best_model)
        phy.get_MSN(phy.best_model)
        phy.get_MSN(phy.best_model, deep_nodes=True)
        phy.plot_MSN(phy.best_model, conf=phy.conf)
        phy.plot_two_concepts('I', '15:2', '16:2')
        edge1, edge2 = list(phy.graph[phy.best_model].edges())[0]
        phy.get_edge(phy.best_model, edge1, edge2)
        phy.get_edge(phy.best_model, 'Beijing', 'Shanghai')
        phy.get_edge(phy.best_model, edge1, edge2, msn=True)
        phy.get_PDC('w-2-1', aligned_output=True)
        phy.plot_concept_evolution(phy.best_model, concept="I")
コード例 #2
0
ファイル: test_phylogeny.py プロジェクト: kadster/lingpy
def test_plot(inputfile, mocker, Bmp, Sp, Plt, tmppath):
    mocker.patch('lingpy.compare.phylogeny.mpl', new=mocker.MagicMock())
    mocker.patch('lingpy.compare.phylogeny.gls2gml', new=mocker.MagicMock())
    mocker.patch('lingpy.compare.phylogeny.plot_tree', new=mocker.MagicMock())
    mocker.patch('lingpy.compare.phylogeny.bmp', new=Bmp)
    mocker.patch('lingpy.compare.phylogeny.plt', new=Plt)
    mocker.patch('lingpy.compare.phylogeny.sp', new=Sp)

    phy = PhyBo(inputfile, output_dir=str(tmppath))
    phy.get_GLS()
    glm = list(phy.stats.keys())[0]
    phy.plot_GLS(glm)
    phy.plot_ACS(glm)

    for method in ['bc', 'td', 'mr']:
        phy.get_MLN(glm, method=method)

    phy.plot_MLN(glm)
    phy.plot_MLN_3d(glm)
    phy.analyze(runs=[('weighted', (2, 1))], output_gml=True, output_plot=True)
    phy.get_IVSD()
    phy.get_ACS(phy.best_model)
    phy.get_MSN(phy.best_model)
    phy.get_MSN(phy.best_model, deep_nodes=True)
    phy.plot_MSN(phy.best_model, conf=phy.conf)
    phy.plot_two_concepts('I', '15:2', '16:2')
    edge1, edge2 = list(phy.graph[phy.best_model].edges())[0]
    phy.get_edge(phy.best_model, edge1, edge2)
    phy.get_edge(phy.best_model, 'Beijing', 'Shanghai')
    phy.get_edge(phy.best_model, edge1, edge2, msn=True)
    phy.get_PDC('w-2-1', aligned_output=True)
    phy.plot_concept_evolution(phy.best_model, concept="I")
コード例 #3
0
    def test_get_GLS(self):
        phy = PhyBo(self.inputfile, output_dir=self.tmp.as_posix())
        _ = PhyBo(test_data('phybo2.qlc'), output_dir=self.tmp.as_posix(),
                  tree=test_data('phylogeny.tre'))
        _ = PhyBo(test_data('phybo2.qlc'), output_dir=self.tmp.as_posix())

        # test default scenario
        phy.get_GLS()

        # check for weight in one of the scenarios
        assert phy.gls['w-1-1']['2:1'][1] == 9
        assert phy.gls['w-1-1']['8:1'][1] == 2

        # test restriction scenario
        phy.get_GLS(mode='restriction', force=True)
        assert phy.gls['r-3']['12:1'][1] == 3
        assert phy.gls['r-3']['8:1'][1] == 2

        # test topdown, somehow, the algorithmic ordering leads to unstable
        # outputs, this should be fixed, but for testing, it is not unexpected
        # right now, which is why I change to the less than construct for the
        # moment
        phy.get_GLS(mode='topdown', force=True)
        assert phy.gls['t-3']['29:3'][1] < 3
        assert phy.gls['t-3']['8:1'][1] == 2
        phy.get_GLS(mode='weighted', force=True)

        glm = list(phy.stats.keys())[0]
        phy.get_stats(glm)
コード例 #4
0
 def test_plot(self):
     phy = PhyBo(self.inputfile, output_dir=self.tmp)
     phy.get_GLS()
     glm = list(phy.stats.keys())[0]
     phy.plot_concept_evolution(glm)
     phy.plot_GLS(glm)
     phy.plot_ACS(glm)
     phy.get_MLN(glm)
     phy.graph = defaultdict(lambda: Graph())
     phy.plot_MLN(glm)
     phy.analyze()
     phy.get_IVSD()
     phy.get_MSN()
     glm = list(phy.geograph.keys())[0]
     phy.geograph[glm] = MagicMock(
         edges=lambda **kw: [(MagicMock(), MagicMock(), defaultdict(lambda: 2))])
     phy._meta['conf'] = dict(linescale=2, groups_colors=defaultdict(lambda: 'a'))
     phy.plot_MSN(glm)
コード例 #5
0
 def test_plot(self):
     phy = PhyBo(self.inputfile, output_dir=self.tmp)
     phy.get_GLS()
     glm = list(phy.stats.keys())[0]
     phy.plot_concept_evolution(glm)
     phy.plot_GLS(glm)
     phy.plot_ACS(glm)
     phy.get_MLN(glm)
     phy.graph = defaultdict(lambda: Graph())
     phy.plot_MLN(glm)
     phy.analyze()
     phy.get_IVSD()
     phy.get_MSN()
     glm = list(phy.geograph.keys())[0]
     phy.geograph[glm] = MagicMock(edges=lambda **kw: [(MagicMock(
     ), MagicMock(), defaultdict(lambda: 2))])
     phy._meta['conf'] = dict(linescale=2,
                              groups_colors=defaultdict(lambda: 'a'))
     phy.plot_MSN(glm)