Esempio n. 1
0
def test_tqdm_style_loops():
    for i in main_tqdm(range(1, 11), desc="using TQDM style logging"):
        time.sleep(0.1)
    for i in LoggerManager.progress_logger(
            range(1,
                  11), progress_name="using LoggerManager's progress_logger"):
        time.sleep(0.1)
Esempio n. 2
0
def test_logger_simple_progress_logger(test_logger):
    total = 10
    test_logger.log_time()
    for _ in LoggerManager.progress_logger(
            range(total),
            test_logger,
            progress_name=
            "progress logger test looooooooooooooooooooooooooooooong"):
        time.sleep(0.1)
Esempio n. 3
0
def test_logger():
    return LoggerManager.get_main_logger()
Esempio n. 4
0
    dyn.pp.top_pca_genes(adata)
    top_pca_genes = adata.var.index[adata.var.top_pca_genes]
    dyn.vf.jacobian(adata, regulators=top_pca_genes, effectors=top_pca_genes)
    dyn.pd.state_graph(adata, group="Cell_type", basis="pca", method="vf")


def test_cell_cycle_score_logger_pancreatic_endocrinogenesis():
    adata = dyn.sample_data.pancreatic_endocrinogenesis()
    adata = adata[:1000]
    dyn.pp.recipe_monocle(
        adata,
        n_top_genes=1000,
        fg_kwargs={"shared_count": 20},
        # genes_to_append=['Xkr4', 'Gm28672', 'Gm20837'],
        genes_to_exclude=["Sbspon", "Adgrb3", "Eif2s3y"],
    )
    dyn.pp.cell_cycle_scores(adata)


if __name__ == "__main__":
    test_tqdm_style_loops()

    test_logger_simple_output_1(LoggerManager.get_main_logger())
    test_logger_simple_progress_naive(LoggerManager.get_main_logger())
    test_logger_simple_progress_logger(LoggerManager.get_main_logger())
    test_logger_simple_progress_logger(LoggerManager.get_temp_timer_logger())

    test_vectorField_logger()
    test_zebrafish_topography_tutorial_logger()
    test_cell_cycle_score_logger_pancreatic_endocrinogenesis()
Esempio n. 5
0
from dynamo import LoggerManager
import dynamo.tools
import dynamo as dyn
import pytest
import time
import numpy as np
import os
from test_utils import *

logger = LoggerManager.get_main_logger()


@pytest.fixture
def adata():
    return gen_or_read_zebrafish_data()


def test_simple_cluster_community_adata(adata):
    dyn.tl.louvain(adata)
    dyn.tl.leiden(adata)
    dyn.tl.infomap(adata)

    try:
        dyn.tl.louvain(adata, directed=True)
    except ValueError as e:
        print("################################################")
        print("PASSED: Value error captured as EXPECTED, Exception info:")
        print(e)
        print("################################################")

    dyn.tl.leiden(adata, directed=True)
Esempio n. 6
0
    dyn.vf.acceleration(adata, basis="pca")
    dyn.vf.rank_acceleration_genes(adata, groups="Cell_type")
    dyn.pp.top_pca_genes(adata)
    top_pca_genes = adata.var.index[adata.var.top_pca_genes]
    dyn.vf.jacobian(adata, regulators=top_pca_genes, effectors=top_pca_genes)


def test_zebrafish_topography_tutorial_logger():
    adata = dyn.sample_data.zebrafish()
    dyn.pp.recipe_monocle(adata, num_dim=20, exprs_frac_max=0.005)
    dyn.tl.dynamics(adata, model="stochastic", cores=8)
    dyn.tl.reduceDimension(adata, n_pca_components=5, enforce=True)
    dyn.tl.cell_velocities(adata, basis="pca")
    dyn.vf.VectorField(adata, basis="pca", M=100)
    dyn.vf.curvature(adata, basis="pca")
    dyn.vf.acceleration(adata, basis="pca")
    dyn.vf.rank_acceleration_genes(adata, groups="Cell_type")
    dyn.pp.top_pca_genes(adata)
    top_pca_genes = adata.var.index[adata.var.top_pca_genes]
    dyn.vf.jacobian(adata, regulators=top_pca_genes, effectors=top_pca_genes)
    dyn.pd.state_graph(adata, group="Cell_type", basis="pca", method="vf")


if __name__ == "__main__":
    # test_logger_simple_output_1(LoggerManager.get_main_logger())
    # test_logger_simple_progress_naive(LoggerManager.get_main_logger())
    # test_logger_simple_progress_logger(LoggerManager.get_main_logger())
    test_logger_simple_progress_logger(LoggerManager.get_temp_timer_logger())
    # test_vectorField_logger()
    # test_zebrafish_topography_tutorial_logger()