With manually processed files

Why manual processing?

  • In certain scenarios, the outputs of SAW count are observed as not perfect enough. Therefore, researchers may want the images (with a matrix) manually adjusted or the segmentation results from third-party tools made accessible, to ensure satisfactory analysis.

  • When the QC result of the image is unsuccessful, researchers have to manually fulfill the alignment between the microscope image and a spatial feature expression matrix.

In some instances, meticulous manual adjustments generate more accurate matrices for initiating downstream analysis.

Overview of SAW realign

Manually processed datasets of FF and FFPE tissues can both be analyzed with SAW realign.

The pipeline usually begins with:

  • the last related SAW count output folder,

  • a realigned image .tar.gz from StereoMap (recording manual processing).

circle-info

A realigned image .tar.gz file, from StereoMap, saves the original microscope images, QC information, and manual processing records.

Interaction between SAW and StereoMap

Output results mainly include:

  • expression-related data from the last SAW count,

  • processed images,

  • feature expression matrices at different dimensions,

  • clustering and differential expression analysis,

  • an integrated visualization.tar.gz for StereoMap.

Parameter
Description

-id <ID>

(Optional, default to None) A unique task id ([a-zA-Z0-9_-]+) which will be displayed as the output folder name and the title of HTML report. If the parameter is absent, --sn will play the same role.

--sn <SN>

(Required, default to None) SN (serial number) of the Stereo-seq chip.

--count-data <PATH>

(Required, default to None) Output folder of the corresponding SAW count result, which mainly contains the expression matrices and other related datasets.

--realigned-image-tar <TAR>

(Required, default to None) Compressed image file from StereoMap, which has been manually processed, including stitching, tissue segmentation, cell segmentation, calibration and registration.

--lasso-geojson <GEOJSON>

(Optional, default to None) Lasso GeoJSON from StereoMap is used for tissue segmentation when the analysis is without images. It is incompatible with --realigned-image-tar.

--adjusted-distance <INT>

(Optional, default to 10) Outspread distance based on the cellular contour of the cell segmentation image, in pixels. Default to 10. If --adjusted-distance=0, the pipeline will not expand the cell border.

When your analysis is without images, a lasso GeoJSON from StereoMap can be used as tissue re-segmentation, to extract a new .tissue.gef matrix.

triangle-exclamation

The first run of SAW count

The inputs of SAW count runs are divided into three categories:

  • with a QC-passed image,

  • with a QC-failed image,

  • without an image.

No matter what, the following common outputs will be generated in the output directory after running SAW count.

circle-info

visualization.tar.gz is not only used for analysis presentations but also for manual adjustments in StereoMap. Modifications processed will be recorded in the image .tar.gz file.

When it comes to the analysis with a QC-failed image or without an image, tissue segmentation is performed based on the expression matrix. So the output results of these two have nothing to do with image algorithms during the automatic workflow.

Manual adjustments

Manual adjustments, including registration, tissue segmentation and cell segmentation, can be implemented in StereoMap. All of these require certain tools in StereoMap, to obtain the modified results that are visible in real time.

Registration

The operation of registration always requires a matrix and a base image to be performed together. According to the tissue morphology, the analyst can align two layers with each other until there is a suitable overlap. Image alignment is necessary for later steps.

A matrix heatmap and an H&E-stained image for registration

Tissue segmentation

Tissue segmentation refers to encircling the contour area by identifying the tissue morphology of the sample. A microscope image allows analysts to properly identify the relative position of tissue on the Stereo-seq chip.

Tissue segmentation on an H&E-stained image

Cell segmentation

Cell segmentation refers to encircling the individual cellular areas by identifying the cell morphology. According to cellular contour, information at the cell dimension can be extracted from the whole sample.

circle-info

Tissue and cell segmentations are key procedures in bioinformatics analysis, and appropriate segmentation results have an important impact on subsequent data analysis and interpretation.

Back to SAW realign

With a QC-passed image

The third part of this tutorial is essential because the corresponding outputs of the last SAW count will help SAW realign to finish the remaining work, till generating the HTML report.

In SAW realign, as the same as SAW count, cell border expansion is performed automatically based on the cell segmentation mask image, which defaults to 10 pixels. You can set --adjusted-distance to adjust the expansion of cells according to various tissue samples and cell types.

circle-info

DNB is the capture unit on the Stereo-seq chip.

DNBs correspond to the vertices of the square pixel block of the image after registration. If the expansion distance of the cell contour is X pixels, the physical distance would be estimated as X * 500 nm.

If you are completely pleased with the cell segmentation (the manually processed one or the one from a third-party tool), set --adjusted-distance=0 to close the expansion.

When it comes to the situation where you only need images or expression matrices from the realigned image .tar.gz, --no-matrix or --no-report parameters will meet your needs.

Run the pipeline just as:

With a QC-failed image

A basic manual registration for the QC-failed image has to be done before subsequent analysis.

circle-exclamation

Without an image

A lasso GeoJSON from StereoMap can be accepted by SAW realign for tissue re-segmentation.

circle-exclamation

Run the pipeline just as:

Output results of SAW realign

After pipeline analysis is completed, a new folder named Adjusted_Demo_Mouse_Brain (which is provided by --id, or by --sn in the absence of --id) will appear in your working directory.

All the metadata and outputs generated from SAW realign are listed below:

If you want to dig deeper into the results,

Last updated