Colocalization
Match colocalized spots over two different channels:
Visualize the impact of distance threshold to discriminate between the colocalized spots and the distant ones:
- bigfish.multistack.detect_spots_colocalization(spots_1, spots_2, voxel_size, threshold=None, return_indices=False, return_threshold=False)
Detect colocalized spots between two arrays of spot coordinates ‘spots_1’ and ‘spots_2’. Pairs of spots below a specific threshold are defined as colocalized.
- Parameters:
- spots_1np.ndarray
Coordinates of the spots 1 with shape (nb_spots_1, 3) or (nb_spots_1, 2).
- spots_2np.ndarray
Coordinates of the spots 2 with shape (nb_spots_2, 3) or (nb_spots_2, 2).
- voxel_sizeint, float, Tuple(int, float), or List(int, float)
Size of a voxel, in nanometer. One value per spatial dimension (zyx or yx dimensions). If it’s a scalar, the same value is applied to every dimensions.
- thresholdint, float or None
A threshold to discriminate colocalized spots from distant ones. If None, an optimal threshold is selected automatically.
- return_indicesbool
Return the indices of the colocalized spots within ‘spots_1’ and ‘spots_2’.
- return_thresholdbool
Return the threshold used to detect colocalized spots.
- Returns:
- spots_1_colocalizednp.ndarray
Coordinates of the colocalized spots from ‘spots_1’ with shape (nb_colocalized_spots,).
- spots_2_colocalizednp.ndarray
Coordinates of the colocalized spots from ‘spots_2’with shape (nb_colocalized_spots,).
- distancesnp.ndarray, np.float64
Distance matrix between spots with shape (nb_colocalized_spots,).
- indices_1np.ndarray, np.int64
Indices of the colocalized spots in ‘spots_1’ with shape (nb_colocalized_spots,). Optional.
- indices_2np.ndarray, np.int64
Indices of the colocalized spots in ‘spots_2’ with shape (nb_colocalized_spots,). Optional.
- thresholdint or float
Threshold used to discriminate colocalized spots from distant ones. Optional.
- bigfish.multistack.get_elbow_value_colocalized(spots_1, spots_2, voxel_size)
Get values to plot the elbow curve used to automatically set the threshold to detect colocalized spots.
- Parameters:
- spots_1np.ndarray
Coordinates of the spots with shape (nb_spots, 3) or (nb_spots, 2).
- spots_2np.ndarray
Coordinates of the spots with shape (nb_spots, 3) or (nb_spots, 2).
- voxel_sizeint, float, Tuple(int, float), or List(int, float)
Size of a voxel, in nanometer. One value per spatial dimension (zyx or yx dimensions). If it’s a scalar, the same value is applied to every dimensions.
- Returns:
- thresholdsnp.ndarray, np.float64
Candidate threshold values.
- nb_colocalizednp.ndarray, np.float64
Colocalized spots count.
- optimal_thresholdfloat or None
Threshold automatically set.