This vignette walks end-to-end
through the Strand AI Platform API
using the strand R package: upload a Whole Slide Image
(WSI), submit a Lattice H&E to multiplex protein inference job, wait
for completion, and pull results back as a
SpatialExperiment.
The chunks below set
eval = FALSEso the vignette renders cleanly on CRAN without network access. To run them yourself, mint an API key atapp.strandai.com/settings/api-keys, setSTRAND_API_KEY, and run interactively.
strand_upload_file() initiates a resumable session and
streams the file to GCS in 8 MiB chunks. The final PUT triggers
automatic ingest, and the function polls only until the upload status
leaves uploading. Dimensions can remain unavailable while
preprocessing continues; estimation reports when the sample is
ready.
strand_samples_list() lists owned samples, the public
cohort, or both. Every item has an ownership discriminator
and a canonical id accepted by
strand_samples_get(). Owned detail includes recent
inference jobs; public detail contains public geometry and marker
channels without job history.
A dry run performs the same validation and pricing as submission without reserving credits or creating a job.
Submission atomically reserves the estimated credits
in the same database transaction that creates the job. If your org has
insufficient credits, you’ll see a
strand_insufficient_credits_error.
job <- strand_predict(client, upload$id, markers)
status <- strand_job_wait(job, progress = TRUE)
stopifnot(status$status == "completed")Pass model = "v0.7" to select the current dispatchable
Lattice version explicitly. Omitting model lets the
platform pick the same current default. Older "v0.4" and
"v0.5" labels can appear on historical jobs but are sunset
for new submissions.
For long pipeline runs, pass wait = FALSE to
strand_run() to return the job handle as soon as upload +
submit complete. The job continues server-side — you can poll or
download later from the same or a fresh process.
strand_download_results() walks the OME-Zarr result
store via the API-key-authenticated proxy and assembles the channels
into a SpatialExperiment.
Rows are markers, columns are pixels; spatial coordinates are stored in
spatialCoords(spe).
For very large slides, supply path = "out/" to mirror
the zarr store to disk and read selectively with Rarr
instead.