sc_toolbox.tools.de_res_to_anndata#

sc_toolbox.tools.de_res_to_anndata(adata, de_res, *, groupby, gene_id_col='gene_symbol', score_col='score', pval_col='pvalue', pval_adj_col=None, lfc_col='lfc', key_added='rank_genes_groups')[source]#

Add a tabular differential expression result to AnnData as if it was produced by scanpy.tl.rank_genes_groups.

Parameters:
  • adata (AnnData) – Annotated data matrix

  • de_res (DataFrame) – Tablular DE result as Pandas DataFrame

  • groupby (str) – Column in de_res that indicates the group. This column must also exist in adata.obs.

  • gene_id_col (str) – Column in de_res that holds the gene identifiers

  • score_col (str) – Column in de_res that holds the score (results will be ordered by score).

  • pval_col (str) – Column in de_res that holds the unadjusted pvalue

  • pval_adj_col (Optional[str]) – Column in de_res that holds the adjusted pvalue. If not specified, the unadjusted p values will be FDR-adjusted.

  • lfc_col (str) – Column in de_res that holds the log fold change

  • key_added (str) – Key under which the results will be stored in adata.uns

Return type:

None