def test_basic():
    params = {'-g': join(INPATH, 'map_red.tsv'),
              '-t': join(INPATH, 'go-basic.obo.1'),
              '-o': join(OUTPATH, 'output.tsv')}
    response = runner.invoke(_propagate_GO, f"{dict2str(params)}")
    assert response.exit_code == 0
    genes_out = load_df(join(OUTPATH, "output.tsv"))
    genes_exp = load_df(join(EXPPATH, "new_tree_propagated_GO.tsv"))
    pdt.assert_frame_equal(genes_out, genes_exp)
def test_basic():
    params = {
        '-i': join(INPATH, 'deepfri_reduced.tsv'),
        '-g': join(INPATH, 'GO_informative.txt'),
        '-o': join(OUTPATH, 'output.tsv')
    }
    response = runner.invoke(_process_deepfri, f"{dict2str(params)}")
    assert response.exit_code == 0
    genes_out = load_df(join(OUTPATH, "output.tsv"))
    genes_exp = load_df(join(EXPPATH, "deepfri_out.tsv"))
    pdt.assert_frame_equal(genes_out, genes_exp)
def test_missing_checkm_and_gtdb():
    params = {
        '-r': join(INPATH, 'cluster_genes/nr.reduced.clstr'),
        '-g': join(INPATH, 'cluster_genes/sample_genes.fa'),
        '-c': join(INPATH, 'assemble/merged.min500.contigs.fa'),
        '-b': join(INPATH, 'metabat2/'),
        '-t': join(INPATH, 'empty/'),  # difference wrt basic
        '-m': join(INPATH, 'empty/'),  # difference wrt basic
        '-e': join(INPATH, 'eggnog-mapper/eggNOG_reduced.tsv'),
        '-p': join(OUTPATH),
        '-o': 'example_split'
    }
    response = runner.invoke(_perform_mapping, f"{dict2str(params)}")
    assert response.exit_code == 0
    out = load_df(join(OUTPATH, f"example_split.tsv"))
    exp = load_df(join(EXPPATH, f"table_missing_checkm_gtdb.tsv"))
    pdt.assert_frame_equal(out, exp)
def test_missing_checkm_and_gtdb():
    params = {
        '-r': join(INPATH, 'cluster_genes/nr.reduced.clstr'),
        '-g': join(INPATH, 'cluster_genes/sample_genes.fa'),
        '-c': join(INPATH, 'assemble/merged.min500.contigs.fa'),
        '-b': join(INPATH, 'metabat2/'),
        '-t': join(INPATH, 'empty/'),  # difference wrt basic
        '-m': join(INPATH, 'empty/'),  # difference wrt basic
        '-e': join(INPATH, 'eggnog-mapper/eggNOG_reduced.tsv'),
        '-o': join(OUTPATH)
    }
    response = runner.invoke(_perform_mapping, f"{dict2str(params)}")
    assert response.exit_code == 0
    for name in ['Mapped_genes_cluster', 'Individual_mapped_genes', 'MAGS']:
        out = load_df(os.path.join(OUTPATH, f"{name}.tsv"))
        exp = load_df(os.path.join(EXPPATH, f"{name}_missing_checkm_gtdb.tsv"))
        pdt.assert_frame_equal(out, exp)
def test_basic_split():
    params = {
        '-r': join(INPATH, 'cluster_genes/nr.reduced.clstr'),
        '-g': join(INPATH, 'cluster_genes/sample_genes.fa'),
        '-c': join(INPATH, 'assemble/merged.min500.contigs.fa'),
        '-b': join(INPATH, 'metabat2/'),
        '-t': join(INPATH, 'gtdbtk/'),
        '-m': join(INPATH, 'checkm/'),
        '-e': join(INPATH, 'eggnog-mapper/eggNOG_reduced.tsv'),
        '-s': '',
        '-p': join(OUTPATH),
        '-o': 'example_split'
    }
    response = runner.invoke(_perform_mapping, f"{dict2str(params)}")
    assert response.exit_code == 0
    for name in ['mapped_genes_cluster', 'individual_mapped_genes', 'MAGS']:
        out = load_df(join(OUTPATH, f"example_split_{name}.tsv"))
        exp = load_df(join(EXPPATH, f"{name}.tsv"))
        pdt.assert_frame_equal(out, exp)