Skip to content

HattoriLabUTSW/CRTCtoolkit

Repository files navigation

CRTC Toolkit

Toolkit for CRTC data visualization and analysis

The CRTC Toolkit provides a series of applications which allow for annotating and collecting individual cells from microscopy images, segmenting those cells into nuclear and cytoplasmic regions, and performing data analysis using the relative expression levels of CRTC in each region. The toolkit is provided as a set of compiled MATLAB apps, with source code available for modification and further scripting of the pipeline and workflows.

Installation

The toolkit can be installed on Windows and MacOS, although the Windows version is more stable and thoroughly tested. Access installers from the Releases section. On MacOS, the ResNet used for cytoplasmic/nuclear segmentation (crtcUbwonkoNet_resnet50.mat) must be downloaded separately and supplied as a path in the Segment Cells portion of the workflow.

The MATLAB Runtime is required to run the toolkit, and the correct version should be automatically downloaded by the installer if not already present on your computer. If your network is restricted (e.g., behind an institutional proxy), click the Connection Settings button in the first step of the installer and supply the appropriate information.

Usage

The process of analyzing raw CRTC data using the toolkit is divided into two steps in the GUI, the core workflow and the data analysis portion. The former involves extracting cells images from CZI files and segmenting them into nuclear vs. cytoplasmic regions. The latter step uses the segmented cell data to calculate nuclear localization indices of each cell, aggregate by experimental group, generate figures, and optionally conduct basic statistical analyses.

Core workflow

Begin with all CZI files in a single directory. Use the Get Cells app to capture cell bodies from each CZI file:

  • Navigate to the optimal z-slice (generally the middle) for each cell, and click Draw Rectangle to create a tightly bound region in which the cell is contained.
  • Click Done with rect when satisfied, and review the cell image in the top right box.
  • If the image contains a single identifiable cell, click Done with cell, and move to the next cell in the z-stack.
  • When all cells in an image have been marked, use the Save data button to export the cell locations to a .mat file.

Next, use the Segment Cells app to note the cytoplasmic and nuclear components of each cell image:

  • If the ResNet file is not pre-filled (e.g., on MacOS), browse to and select the location of the downloaded crtcUbwonkoNet_resnet50.mat file.
  • Browse to and select the data folder, which contains the data4*.mat files generated by the Get Cells app.
  • Click the Process button to use the ResNet to automatically generate cytoplasmic/nuclear segmentations and update the data files.

Finally, use the Check and Correct Cells app to verify and fix automatic segmentations:

  • Select the folder containing the data4*.mat files which have been updated with segmentation values. Use the Next and Prev buttons for images and cells to navigate through the automatic segmentations.
  • If an incorrect segmentation is seen, use the Draw Nuc ROI and Draw Cell ROI buttons to manually annotate the nucleus and cell, respectively.
  • Click the Save Data button to generate corr_data4*.mat files which incorporate the manually corrected data where appropriate, and use the automatic segmentation values where corrections were not made.
Data analysis

Reorganize corr_data4*.mat files and data4*.mat files into an experimental structure, ensuring that no images are represented twice (e.g., for each image, there must be only one .mat file. An experimental structure will look like:

  • Experiment directory
    • Condition 1
      • FLY01
      • FLY02
      • FLY...
    • Condition 2
      • FLY01
      • FLY02
      • FLY...
    • Condition ...

Then, you can use the Per Condition Analysis App to analyze only a single experimental condition:

  • Include the condition name in the appropriate box. Use the Save data checkbox if you'd like for output to be saved as an Excel file and a .fig file.
  • Select colors for the plots to be generated.
  • Browse to and select the appropriate condition folder, which should contain subfolders named in the format FLYnn, as shown above.
  • Click the Start analysis button to generate and save figures as specified.

Or, you can use the Cross-Group Analysis App to analyze and compare multiple experimental conditions, outputting statistical results as a part of the process:

  • Provide the experiment name in the topmost textbox. Use the Save data checkbox if you'd like for output to be saved as an Excel file and a .fig file.
  • Select colors for each experimental group to be plotted, up to eight.
  • Optionally, you can modify the y-axis bounds on the NLI plots which will be generated.
  • Browse to and select the experiment folder, which should follow the structure specified above.
  • Click the Start analysis button to generate and save figures/data as specified.
Convenience tools

A handful of tools are provided as a part of the toolkit.

The Manual Annotation App combines the Get Cells App and the Check and Correct Cells App in cases where the network-based automatic segmentation is not desired:

  • Select a CZI file.
  • Scroll through the z-stack to find a slice which contains a cell body.
  • Mark the cell body with a rectangle as described in the Get Cells App section.
  • Optionally, use the Auto ROI button to generate a segmentation for the cell using k-means clustering.
  • Use the Draw Cell ROI and Draw Nuc ROI buttons to manually segment the cell.
  • Click Done With Cell when satisfied with the segmentation.
  • Click the Save Data button when done with the CZI file.

The MIP from CZI App generates maximum intensity projections from a directory containing CZI files. This tool will create a subfolder per CZI file, saving .png images of MIP per channel as well as merged MIP:

  • Browse to and select a folder containing .CZI files.
  • Update the channel options if necessary to map each channel to the desired color.
  • Click Create MIP to generate the aforementioned output.

The Open .fig File App provides a simple convenience tool to reopen saved .fig files from previous sections of the toolkit:

  • Browse to and select a .fig file.
  • Click open to re-open the file in the MATLAB GUI.

Extending from source code

If you have access to a MATLAB license, the raw source code provides a powerful interface to modify the toolkit to optimally fit your workflow. The CRTC toolkit has been created and tested using MATLAB version R2021b. Necessary add-ons and packages are listed in the analyzeCRTC.m file, which also provides a well-documented guide to scripting the different components of the toolkit.

Many intermediate steps of the toolkit generate .mat files, which can be examined and interacted with using MATLAB.