spared.graph_operations.get_graphs

spared.graph_operations.get_graphs(adata: AnnData, n_hops: int, layer: str, hex_geometry: bool = True) dict[source]

Get graphs for all the slides in a dataset. This function wraps the get_graphs_one_slide function to get the graphs for all the slides in the dataset. After computing the graph dicts for each slide it concatenates them into a single dictionary which is then used to compute the positional embeddings for each graph.

For details see get_graphs_one_slide and get_sin_cos_positional_embeddings functions.

Parameters:
  • adata (ad.AnnData) – The AnnData object used to build the graphs.

  • n_hops (int) – The number of hops to compute each graph.

  • layer (str) – The layer of the graph to predict. Will be added as y to the graph.

  • hex_geometry (bool) – Whether the graph is hexagonal or not. Only true for visium datasets. Defaults to True.

Returns:

A dictionary where the spots’ names are the keys and pytorch geometric graphs are values.

Return type:

dict