pegasus.write_results_to_excel

pegasus.write_results_to_excel(results, output_file, ndigits=3)[source]

Write DE analysis results into Excel workbook.

Parameters
  • results (Dict[str, Dict[str, pd.DataFrame]], or Dict[str, Dict[str, Dict[str, pd.DataFrame]]]) – DE marker dictionary generated by pg.markers.

  • output_file (str) – File name to which the marker dictionary is written.

  • ndigits (int, optional, default: 3) – Round non p-values and q-values to ndigits after decimal point in the excel.

Return type

None

Returns

  • None

  • Marker information is written to file with name output_file.

  • In the generated Excel workbook,

    • If condition is None in pg.de_analysis: Each tab stores DE result of up/down-regulated genes of cells within one cluster, and its name follows the pattern: “cluster_id|up” or “cluster_id|dn”.

    • If condition is not None in pg.de_analysis: Each tab stores DE result of up/down-regulated genes of cells within one cluster under one condition level. The tab’s name follows the pattern: “cluster_id|cond_level|up” or “cluster_id|cond_level|dn”.

    • Notice that the tab name in Excel only allows at most 31 characters. Therefore, some of the resulting tab names may be truncated if their names are longer than this threshold.

Examples

>>> pg.write_results_to_excel(marker_dict, "result.de.xlsx")