Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Add new DE tidy table #72

@Zethson

Description

@Zethson

Something like this.

def tidy_table(
    de_test,
    adata,
    cells,
    ids: list,
    qval_thresh=0.9,
    group_bys: list = ["treatment"],
    cols=["gene", "pval", "qval", "log2fc"],
):
    res = de_test.summary().sort_values(by=["qval"], ascending=True)
    res = res[res.qval < qval_thresh].loc[:, cols].copy()
    
    for pair in list(zip(ids, group_bys)):
        res = sct.calc.add_percentages(adata[cells], res, ids=pair[0], group_by=pair[1])

    return res

Since we are now using lists for ids and group_bys this should be properly documented with an example call like:

res = tidy_table(
de_test,
adata,
cells=adata_raw.obs_names,
ids=[["uninfected", "infected"], ["AT2"], adata.obs.identifier.cat.categories.tolist()],
group_bys=["grouping", "cell_type", "identifier"],
qval_thresh=0.05,
)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions