def test_construction(): tax = test_taxonomy() nr, mr = tax.reactions, tax.metabolites com = Community(tax) assert len(com.taxa) == 4 assert len(com.taxonomy) == 4 assert len(com.reactions) > tax.reactions.sum() assert len(com.metabolites) > tax.metabolites.sum()
def test_db(tmp_path): manifest = load_qiime_manifest(db) tax = md.test_taxonomy() manifest.file = tax.file[0] built = build_database(manifest, str(tmp_path), rank="species") assert built.shape[0] == 3 for fi in built.file: assert (tmp_path / fi).exists() built = build_database(manifest, str(tmp_path / "db.zip")) assert (tmp_path / "db.zip").exists()
def test_abundance_cutoff(): tax = test_taxonomy(n=3) tax["abundance"] = [1.0, 2.0, 1e-6] com = Community(tax) assert len(com.taxa) == 2 assert len(com.taxonomy) == 2
def test_benchmark_construction(benchmark): tax = test_taxonomy(3) benchmark(Community, tax)