Bering.objects.Bering_Graph

class Bering.objects.Bering_Graph(df_spots_seg, df_spots_unseg, image=None, channels=None, use_features=None, required_features=['x', 'y', 'features', 'segmented', 'labels'], dimension_3d=False)[source]

Build Bering Object for training and prediction purposes. The input data contains segmented spots and unsegmented spots. In addition, image and the channel description are required for image-dependent training .

Parameters:
  • df_spots_seg (DataFrame) – Dataframe for segmented spots, which contains 2D/3D coordinates (“x”, “y”, “z”); Transcript /Protein IDs (“features”); Coarsely Segmented Cell IDs (“segmented”); and labels of cells (“labels”)

  • df_spots_unseg (DataFrame) – Dataframe for unsegmented spots, which contains 2D/3D coordinates (“x”, “y”, “z”); Transcript /Protein IDs (“features”).

  • image (Optional[ndarray]) – Concatenated microscopy image contains ndims layers (e.g. dapi + cytoplasm + membrane). The shape is (n_channels, height, width).

  • channels (Optional[Sequence[str]]) – Channel names of the image

  • use_features (Optional[Sequence[str]]) – Features to use

  • required_features (Optional[Sequence[str]]) – Required features in the input dataframe

  • dimension_3d (bool) – Whether the spots are 3D or not

Returns:

Bering_Graph

Methods

add_image_features([normalize])

Add image features to spots.

use_settings(bg2)

Borrow settings from another Bering_Graph object to ensure same training settings.