-
Notifications
You must be signed in to change notification settings - Fork 580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rank_genes_groups refactoring #723
Labels
Area – Differential Expression
Differential expression
Comments
I think there was some discussion of this (among other topics) here: #562 |
Some notes from a brief discussion with Sergei.
|
Can rank_genes_groups be linked to use diffxpy on top of the available methods? I am using the following code to convert the output of rank_genes_groups to a data frame, in case is useful: def rank_genes_groups_df(adata, key='rank_genes_groups'):
# create a data frame with columns from .uns['rank_genes_groups'] (eg. names,
# logfoldchanges, pvals).
# Ideally, the list of columns should be consistent between methods
# but 'logreg' does not return logfoldchanges for example
dd = []
groupby = adata.uns['rank_genes_groups']['params']['groupby']
for group in adata.obs[groupby].cat.categories:
cols = []
# inner loop to make data frame by concatenating the columns per group
for col in adata.uns[key].keys():
if col != 'params':
cols.append(pd.DataFrame(adata.uns[key][col][group], columns=[col]))
df = pd.concat(cols,axis=1)
df['group'] = group
dd.append(df)
# concatenate the individual group data frames into one long data frame
rgg = pd.concat(dd)
rgg['group'] = rgg['group'].astype('category')
return rgg.set_index('group') This results on a table like this: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, @falexwolf
Do you have any specific things in mind for
rank_genes_groups
refactoring? What should be done?The text was updated successfully, but these errors were encountered: