atlas_protocol_scripts.tl.long_form_df_to_decoupler#

atlas_protocol_scripts.tl.long_form_df_to_decoupler(df, *, gene_col='gene_id', p_col='pvalue', log_fc_col='log2FoldChange', group_col='cell_type')#

Convert a long-form data frame of DE results into a pair of logFC/pvalue matrices as used by decoupler.

Parameters
  • df (DataFrame) – long-form pandas data frame

  • gene_col (str (default: 'gene_id')) – column that contains the gene identifier (will be columns of the matrices)

  • p_col (str (default: 'pvalue')) – column that contains the p-value or adjusted p-value

  • log_fc_col (str (default: 'log2FoldChange')) – column that contains the log fold change

  • group_col (str (default: 'cell_type')) – column that contains some grouping information (will be rows of the matrices)

Return type

tuple[DataFrame, DataFrame]