For this report I used a Seurat-based resource-usage benchmark comparing Atera and Xenium spatial transcriptomics datasets processed through the same workflow: zero-count-cell filtering, SCTransform normalization, PCA, nearest-neighbor graph construction, clustering, and UMAP.
Six datasets were used in this benchmarking exercise.
Five datasets came from the public 10x Genomics dataset collection: Atera FFPE human breast, Atera FFPE human cervix, Xenium human breast, Xenium human cervix, and Xenium fresh-frozen mouse brain.
The sixth mouse-brain regional dataset came from Margo’s paper about the
Isocortex Layer-6 ‘a’ and ‘b’ and was the dataset used in the Xenium
demo workflow, represented as z_Region_2_left_margo-obj.rds.
For each of the five datasets obtained from 10x Genomics, two Seurat
.rds objects were generated using the custom LoadAtera function
derived from Seurat (Sajita lab)‘s LoadXenium function, as each of
them contained the modern’.zarr’ file format that LoadXenium does not
support. The only significant change is, as follows
molecule_coordinates = TRUE: Molecule-level spatial coordinates were retained. Default forLoadXeniumfunction.molecule_coordinates = FALSE: Molecule-level coordinates were omitted. Default forLoadAterafunction.
Files containing false_coords are the the ones with
molecule_coordinates set to FALSE, while files without false_coords
have the setting set to TRUE.
| File Name | Configuration |
|---|---|
Atera_Breast_false_coords-obj.rds |
molecule_coordinates = FALSE |
Atera_Breast-obj.rds |
molecule_coordinates = TRUE |
To use the function, first run the setup, and then load the function by running it’s script.
source("python_reticulate_setup.R")
source("LoadAtera.R")
Then you can call the function as shown:
xenium_obj <- LoadAtera(
data.dir = "path/to/xenium/outs",
fov = "fov",
cell.centroids = TRUE,
molecule.coordinates = FALSE
)
The scripts get_RDS.R and get_RDS_xenium.R were used with rotating
raw data directory namess to obtain the requisite Seurat objects, stored
as .RDS files. All of the processed files are also archived
here
All benchmark objects were processed through the same Seurat analysis
workflow implemented in the demo. This was done by first loading the
requisite functions from mem_test_with_checkpoints.R, then running the
Mem_test_loop.R.
- Load Object: Load the
.rdsobject and update it to the current Seurat object structure. - Filter Cells: Remove zero-count cells from the Xenium assay count layer.
- Normalize Data: Run
SCTransformnormalization on the Xenium assay. - Reduce Dimensions: Run PCA on the SCT assay.
- Cluster Cells: Build a nearest-neighbor graph, cluster the cells, and run UMAP.
- Log Metrics: Record runtime, CPU time, object size, and memory-usage summaries in the output workbook.
Note: For the Atera human cervical dataset, the full object exceeded RAM capacity of the workstation during
SCTransform. To make benchmarking feasible, a left-half spatial crop of the Atera cervical tissue was created and benchmarked instead.
The Excel workbook records several metrics for each object:
| Metric Group | Field Name | Description |
|---|---|---|
| Metadata | Datasets | Descriptive dataset label used in the benchmark output. |
| Species | Organism represented by the dataset. | |
| Sample type | Tissue or sample label. | |
| Cells or nuclei | Indicates whether the object represents cells or nuclei. | |
| Preservation | Sample preservation method. | |
| Area (mm²) | Tissue area used in the benchmark. | |
| Molecule Coordinates | Whether molecule-level spatial coordinates were retained. | |
| Memory | Avg. Memory Usage | Average process memory sampled across checkpoints. |
| Min. Memory Usage | Minimum process memory observed across checkpoint samples. | |
| Max. memory Usage | Peak memory observed during the run. | |
| Disk Usage | Input .rds file size on disk. |
|
| PeakRAM_total_allocated_GiB | Total RAM allocated by the benchmarked expression. | |
| Dataset Dimensions | RDS_file | Filename of the processed Seurat object. |
| Input_cells | Number of cells in the Seurat object. | |
| Input_features | Number of input features or genes in the Seurat object. | |
| Clusters | Number of clusters identified after clustering. | |
| Performance | Start_time | Timestamp marking the start of the benchmark run. |
| End_time | Timestamp marking the end of the benchmark run. | |
| Wall_time_min | Total elapsed runtime in minutes. | |
| CPU_user_sec | CPU time spent executing user-space code. | |
| CPU_system_sec | CPU time spent in system-level operations. | |
| Normalized Metrics | Peak(GB)/mm^2 | Peak memory normalized by tissue area. |
| Peak(KB)/Total_features | Peak memory normalized by total feature count (cells × features). |
- Atera: Aggregate Atera values for area-normalized peak-memory comparisons.
- Xenium: Aggregate Xenium values for the same normalized comparisons.
- Ratio: Atera-to-Xenium ratio for each summary metric.
Note: The Results of a run are stored in
Resource_usage.xlsx, even though the script creates a.csv. This was done to make the post-processing of Normalized Metrics and Summary Rows easier to Manage. As these are not included in the script or the loop