GeneSetActivityScoresReport (gesso.GeneSetActivityScoresReport)

GeneSetActivityScoresReport is a class that encapsulates the results of gene set activity score (GAS) computations in GESSO.

class gesso.GeneSetActivityScoresReport(gas_df: DataFrame, locations_df: DataFrame, geneset_to_gene_contributions_df_dict: dict)[source]

Report object for storing GESSO geneset activity score results.

gas_df() DataFrame[source]

Returns the geneset activity scores as a DataFrame. The index is the spot ID. The columns are the geneset names.

Return type:

pd.DataFrame

gene_contributions_df(geneset: str, sort_by: Literal['gene_contribution', 'gene_name'] = 'gene_contribution') DataFrame[source]

Returns a gene contribution DataFrame with a single column (geneset name). The index is the gene name.

Parameters:
  • geneset (str) – geneset name.

  • sort_by (Literal["gene_contribution", "gene_name"]) – Default: “gene_contribution”. How to sort the DataFrame. If “gene_contribution”, sorts by the gene contribution weight (descending). If “gene_name”, sorts by the gene name (ascending).

Return type:

pd.DataFrame

locations_df() DataFrame[source]

Returns the locations DataFrame. The index is the spot ID. The columns are “x” and “y”.

Return type:

pd.DataFrame

plot_gas_spatial_map(geneset: str, size: int = 20, cmap: Colormap | str = 'viridis', show_coords: bool = False, figsize: tuple[float, float] = (5.0, 5.0), ax: Axes | None = None) Figure[source]

Plots the geneset activity scores of a given geneset of interest across all locations.

Parameters:
  • geneset (str) – The name of the geneset to plot.

  • size (int) – Default: 20. The size of the scatter points.

  • cmap (Colormap | None) – Default: “viridis”. The colormap to use for the scatter plot.

  • show_coords (bool) – Default: False. If True, shows the coordinates of the points.

  • figsize (tuple[float, float]) – Default: (5.0, 5.0) The size of the figure.

  • ax (plt.Axes | None) – Default: None. If None, creates a new figure.