With manually processed files
Last updated
Last updated
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.
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).
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.
-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.
--lasso-geojson
is incompatible with --realigned-image-tar
.
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
.
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, 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.
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.
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.
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.
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.
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:
A basic manual registration for the QC-failed image has to be done before subsequent analysis.
SAW pipelines consider that QC-failed images which have been manually realigned by analysts, can be analyzed by applying automatic image algorithms in the following steps.
A lasso GeoJSON from StereoMap can be accepted by SAW realign
for tissue re-segmentation.
Make sure there is only one label in your lasso GeoJSON, because a SAW realign
run accepts a tissue re-segmentation outline once.
This works only in the scenario without image input. --lasso-json
can not take effect with image-related parameters.
Run the pipeline just as:
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,
Jump to the report.html
inside <SN>.report.tar.gz
.
Explore the visualization.tar.gz
in StereoMap.
Learn more about the individual files on the Outputs page.