scvi-tools icon indicating copy to clipboard operation
scvi-tools copied to clipboard

TotalVI unexpected behaviour in differential expression function

Open canergen opened this issue 1 year ago • 0 comments

If defining protein_names_uns_key the DE function fails. This is unexpected behaviour.

def test_totalvi_de_error(save_path):
    adata = synthetic_iid()
    TOTALVI.setup_anndata(
        adata,
        batch_key="batch",
        protein_expression_obsm_key="protein_expression",
    )
    model = TOTALVI(adata)
    model.train(1, train_size=0.5)
    model.differential_expression(groupby="labels", group1="label_1")

    adata = synthetic_iid()
    TOTALVI.setup_anndata(
        adata,
        batch_key="batch",
        protein_expression_obsm_key="protein_expression",
        protein_names_uns_key="protein_names",
    )
    model = TOTALVI(adata)
    model.train(1, train_size=0.5)
    model.differential_expression(groupby="labels", group1="label_1")

ValueError("cannot reindex on an axis with duplicate labels")

canergen avatar Mar 23 '24 22:03 canergen