Read the output of 10x Genomics Atera,
a next-generation in situ sequencing platform. All Atera outputs (aside
from images) are stored in AnnData zarr (storage format v2) files, zipped
with Stored (uncompressed) zip entries; reading them requires the
blosc and jsonlite packages. Zarr chunks are read directly
out of the zip archive by byte-range seeks with no disk extraction.
Usage
ReadAtera(
data.dir,
outs = c("matrix", "centroids"),
mols.qv.threshold = 20,
genes = NULL,
feature.types = NULL,
bpcells.dir = NULL,
morphology.channel = "dapi",
morphology.resolution = NULL,
morphology.region = NULL
)
LoadAtera(
data.dir,
fov = "fov",
assay = "Atera",
mols.qv.threshold = 20,
cell.centroids = TRUE,
molecule.coordinates = FALSE,
segmentations = NULL,
cell.annotations = TRUE,
genes = NULL,
feature.types = NULL,
bpcells.dir = NULL,
morphology.image = FALSE,
morphology.channel = "dapi",
morphology.resolution = NULL,
morphology.region = NULL
)Arguments
- data.dir
Path to folder containing Atera outputs
- outs
Types of outputs to read; choose one or more of:
“matrix”: the counts matrix
“centroids”: cell centroids in micron coordinate space
“segmentations”: cell segmentation boundary polygons in micron coordinate space
“nucleus_segmentations”: nucleus segmentation boundary polygons in micron coordinate space. Cells may have zero, one, or more than one nucleus polygon
“annotations”: per-cell Azimuth cell type annotations (the
azimuth_*columns ofcell_feature_matrix.zarr.zip), if available“microns”: transcript molecule coordinates. This is optional as transcripts files can be very large.
“morphology”: a single channel plane of a “morphology_2d” image (eg the DAPI stain), by default at the lowest-resolution pyramid level, for use as a background/overview image. Requires the
RBioFormatspackage, since these images are pyramidal, JPEG2000-compressed OME-TIFFs that the basetiffpackage cannot reliably decode.
- mols.qv.threshold
Remove transcript molecules with a calibrated Q-score less than this threshold
- genes
Optional character vector of gene names to restrict the initial
molecule.coordinatesload to. Whenmolecule.coordinates = TRUE, a lazy, on-disk handle onto the transcript table is always kept on the returned object (regardless of whethergenesis set), so additional genes can be fetched later withLoadAteraMoleculeswithout re-reading genes already fetched. SeeReadAtera- feature.types
Optional character vector of feature types to restrict the counts matrix to (eg “Gene Expression”);
NULL(the default) loads all feature types, matching current behavior. “Gene Expression” is always included, since it backs the object's primary assay. SeeReadAtera- bpcells.dir
Path to a directory used to cache the counts matrix on disk via
BPCells.NULL(the default) auto-selects a session-scoped cache directory so the returned object is BPCells-backed and lazy by default (even for small bundles) wheneverBPCellsis installed; passFALSEto always get plain in-memory matrices instead. SeeReadAtera- morphology.channel
Channel to load when
morphology.image = TRUE: either a channel name (matched case-insensitively as a substring, eg “dapi”) or a 0-based integer channel index. SeeReadAtera- morphology.resolution
Pyramid resolution level to load when
morphology.image = TRUE, where1is full resolution. Defaults toNULL, which loads the lowest-resolution (smallest, fastest) level available. SeeReadAtera- morphology.region
Optional list with
x/yelements (each a length-2 micron range) to crop the loaded morphology image to a rectangular window instead of reading the whole plane; recommended when usingmorphology.resolution = 1(full resolution) on real-world datasets, since these whole-slide images can be tens of thousands of pixels per side. Defaults toNULL, which reads the whole plane. SeeReadAtera- fov
FOV name
- assay
Assay name
- cell.centroids
Whether or not to load cell centroids
- molecule.coordinates
Whether or not to load transcript molecule coordinates
- segmentations
Which segmentation boundary polygons to load, one of “cell” or “nucleus”, or
NULLto load none- cell.annotations
Whether or not to add Azimuth cell type annotations (
azimuth_*) to the object's metadata; silently skipped when the annotations are not available indata.dir- morphology.image
Whether to load a single channel plane of a “morphology_2d” image (eg the DAPI stain), by default at the lowest-resolution pyramid level, for use as a background/overview image in plots. Requires the
RBioFormatspackage. Defaults toFALSEsince it is an optional dependency and not needed for downstream analysis. SeeReadAtera
Value
ReadAtera: A list with some combination of the following
values:
“
matrix”: a named list of sparse matrices with expression data, one per feature type (eg “Gene Expression”); cells are columns and features are rows“
centroids”: a data frame with cell centroid coordinates in three columns: “x”, “y”, and “cell”“
segmentations”/“nucleus_segmentations”: a data frame with one row per polygon vertex, in three columns: “cell”, “x”, and “y”“
annotations”: a data frame of Azimuth annotations with cell ids as row names, orNULLif none are available“
microns”: a data frame with transcript coordinates in three columns: “x”, “y”, and “gene”“
morphology”: a list with elementsimage(a numeric matrix, indexed[x, y], in the same top-left-origin pixel convention as “centroids”/“microns”' micron coordinates – no axis flip is needed),channel,resolution,n.resolutions,pixel.size(microns per pixel ofimage), andorigin(the micron coordinates,c(x=, y=), ofimage's[1, 1]pixel –c(x=0, y=0)unlessmorphology.regioncrops out the top-left corner of the full plane); seemorphology.channel/morphology.resolution/morphology.region
LoadAtera: A Seurat object
Details
Parallel processing uses the active future::plan().
Molecule and codeword reads parallelize across tiles; numeric array reads
parallelize chunk decoding. Array reads inside tile workers stay sequential
to avoid nested parallelism. Configure the strategy and worker count with
future::plan(future::multisession, workers = 4), or use
future::plan(future::sequential) for sequential processing.
This setting is independent of setThreads().
Newly loaded Atera FOVs display x horizontally and y increasing downward in ImageDimPlot and ImageFeaturePlot, keeping stored coordinates unchanged.