API

Utils

ipa.utils.interactive_analysis_utils.compute_lab(im_roi: array) array

This function takes in an image array and returns a labelled image array. The labelled image is obtained by thresholding the image using Otsu’s method. The labelled image is then eroded and filled to remove noise and avoid computing the intensity of neighboring cells.

Parameters:

im_roi (np.array) – Image array

Returns:

Labelled image array

Return type:

np.array

ipa.utils.interactive_analysis_utils.overlap(im_lab: array, center: tuple) list

This function takes in a labelled image array and the coordinate of the center of the cell to consider and returns a list of images containing only one label correspong to the tracked-cell. The list of labels is obtained by computing the overlap between the labelled image and its subsequent frames. The label with the highest overlap (IoU) is chosen as the label for the subsequent frame.

Parameters:
  • im_lab (np.array) – Labelled image array

  • center (tuple) – Center of the tracked-cell

Returns:

List of labels

Return type:

list

ipa.utils.interactive_analysis_utils.zoomed_image(logger: Logger, im: array, center: tuple, size: int) array

This function takes in an image array and returns a zoomed image array. The zoomed image is a square of size ‘size’ centered at ‘center’. If the zoomed image is out of bounds, the function returns the original image.

Parameters:
  • im (np.array) – Image array

  • center (tuple) – Center of the zoomed image

  • size (int) – Size of the zoomed image

Returns:

Zoomed image array

Return type:

np.array

ipa.utils.interpolation_utils.concat_runs(pattern: list, condition: str, path: str = '../runs/', nuclei_to_exclude: DataFrame = '../scratchpad/data/nuclei_wrong.csv') DataFrame

Concatenate all the runs from the path and return the dataframe

Args:

pattern: list

List of strings to match the files

condition: str

Experimental condition to match the nuclei to exclude

path: str

Path to the runs

nuclei_to_exclude: pd.DataFrame

DataFrame containing the nuclei to exclude from the analysis

ipa.utils.interpolation_utils.format_background(file_path: str) ndarray

This function takes a file path as input and opens the last background file specified by the file path. It then calculates the average background intensity over all the circles for each frame.

Parameters:

file_path (str) – The file path of the background file.

Returns:

A 1D array containing the mean intensity for each frame.

Return type:

background_int (np.ndarray)

ipa.utils.interpolation_utils.format_coord_df(file_path: str) tuple

Function to format the ROI dataframe and interpolate the coordinates of the unbleached and bleached spots

Args: file_path: str: path to the ROI dataframe

Returns: df_roi: pd.DataFrame: dataframe containing the ROI information x_un: np.ndarray: x coordinate of the unbleached spot (interpolate), np.array shape: (n_frames, n_nuclei) y_un: np.ndarray: y coordinate of the unbleached spot (interpolated), np.array shape: (n_frames, n_nuclei) x_bleached: np.ndarray: x coordinate of the bleached spot (interpolated), np.array shape: (n_frames, n_nuclei) y_bleached: np.ndarray: y coordinate of the bleached spot (interpolated), np.array shape: (n_frames, n_nuclei)

ipa.utils.interpolation_utils.format_log(file_path: str) tuple

Function to extract the relevant information from the log file

Args: file_path (str): path to the log file

Returns: tuple: a tuple containing the following information: - cell_coord: the coordinates of the cells analyzed (list of tuple) - bbox: the size of the zoomed image (int) - radius_unbleached: the radius of the unbleached circular ROI (int) - radius_bleached: the radius of the bleached circular ROI (int) - im_path: the path to the image (str)

ipa.utils.interpolation_utils.parse_files(file_path: str) tuple

Parse files in the given directory and return the paths of the latest log file, ROI file, raw file, background intensity file, and phluorophore bleaching intensity file.

Parameters:

file_path (str) – The directory path where the files are located.

Returns:

A tuple containing the paths of the latest log file, ROI file, raw file, background intensity file, and phluorophore bleaching intensity file.

Return type:

tuple

ipa.utils.interpolation_utils.perform_analysis(file_path: str) DataFrame

Perform analysis on the data from the given file path.

This function reads various data files, performs interpolation and mean_list_interp_bleached_flat calculations for each nucleus, and returns the results in a DataFrame.

Args: file_path (str): The path to the directory containing the data files.

Returns:

pd.DataFrame: A DataFrame containing the mean_list_interp_bleached_flat values, interpolated values for bleached and unbleached regions, background intensity, unfrap cell values, nucleus number, and frame number for each nucleus and frame.

Build config file

build_preprocessing_config.py

Ask for user input via command line interface (CLI) to build the preprocessing_config.yaml. The preprocessing_config.yaml is consumed by the run_preprocessing.py script.

ipa.build_interactive_config.main() None

Create preprocessing_config.yaml from user inputs.

Run analysis