Bering.graphs.BuildWindowGraphs

Bering.graphs.BuildWindowGraphs(bg, n_cells_perClass=10, window_width=10.0, window_height=10.0, n_neighbors=10, min_points=20, use_unsegmented_ratio=0.8, max_unsegmented_thresh=0.4, cell_percentile_from_border=10, window_shift_ratio=0.25, n_windows_per_cell=5, min_spots_outside=5, **kwargs)[source]

Build Graphs for originally segemented cells. We randomly select a subset of cells and get their neighboring regions (windows) to construct graphs.

Parameters:
  • bg (Bering_Graph) – Bering_Graph object

  • n_cells_perClass (int) – Number of cells per cell class for training

  • window_width (float) – Width of each selected region for graph construction

  • window_height (float) – Height of each selected region for graph construction

  • n_neighbors (int) – Number of neighbors in KNN

  • min_points (int) – Minimum number of points in a window

  • use_unsegmented_ratio (float) – Proportion of unsegmented spots used in a window

  • max_unsegmented_thresh (float) – Maximum proportion of unsegmented spots in a window

  • cell_percentile_from_border (float) – Remove cells in the border that are too close (within the defined percentile) to the image border

  • window_shift_ratio (float) – To balance the transcripts within cells and out of cells, we shift the window to the centroid of the cell by a ratio of the cell diameter

  • n_windows_per_cell (int) – Number of windows per cell. Available options are 1, 3, 5

  • min_spots_outside (int) – Minimum number of spots outside the cell

  • **kwargs – Other arguments for BuildGraph

Returns:

: Bering_Graph.Graphs_golden: BrGraph() object with a list of graphs (torch_geometric.data.Data) for training