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

Add new DE tidy table #72

Open
Zethson opened this issue Jun 10, 2021 · 0 comments
Open

Add new DE tidy table #72

Zethson opened this issue Jun 10, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Zethson
Copy link
Member

Zethson commented Jun 10, 2021

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,
)

@Zethson Zethson added the enhancement New feature or request label Jun 10, 2021
@Zethson Zethson self-assigned this Jun 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant