SpatialData had no x or y column: the
coordinates stayed in spatialdataR's point geometry, next to the Python index
column, so the layer could not be used by MASE's own operations. For
example, subsetByBoundingBox() over the whole extent of the blobs example
took its points layer from 200 rows to none. The geometry is now turned into
x and y (and z when there is one), placed first, and every other
column, including __null_dask_index__ and any feature column, is kept as
stored, so the element still goes back unchanged.c() of two MultiAssaySpatialExperiment objects lost the coordinate
transforms of the second one. Joining the two metadata lists left two
entries called transforms, and only the first is ever found. The
transforms of both objects are now kept in one entry. They are filed per
element and element names are unique across the two objects, so they do not
collide.pointNames<-, shapeNames<-, imageNames<- or
labelNames<- left the element's coordinate transforms filed under its old
name, where nothing found them (for points and shapes it already updated the
spatialMap). The transforms now follow the rename.A SpatialData points or shapes element now links to its table through the
table's instance_key, whatever that column is called. Before, only an
instance_id or id column worked, so a table keyed on, say, cell_id
produced a spatialMap that pointed at nothing.
Converting to SpatialData could give a shapes element with no rows, with
no error: a table annotating the shapes was read and written with its region
and instance ids in colData, where spatialdataR keeps them in int_colData
and matches them to the element through the element's instance_key. spatialdataR then
kept none of the shapes. Tables now carry their keys where spatialdataR looks,
elements declare their instance_key, and a table built by spatialdataR is
read the same way. A layer that loses rows in the SpatialData now warns.
The CRS of points and shapes was dropped, silently, going to SpatialData. It
is now carried over.
A failed conversion to SpatialData removed none of the DuckDB tables it had
written. It now does. (After a successful one the tables stay on the
connection, because the SpatialData reads from them.)
Unloading and loading SpatialFeatureExperiment or spatialdataR again left
the integration's methods missing without a word, because the record that
they were registered outlived the old namespace. Registration is now tied to
the namespace that is loaded.
The spatialGraphs(), spatialGraph() and spatialGraphNames() methods
ignored sample_id and returned one merged graph. They now read one sample at
a time and return the shape SpatialFeatureExperiment does.
The spatialdataR accessors agree with spatialdataR: looking up a name or
position that is not there is an error, NULL empties a layer, and
element(x, i) <- value takes a position. point(x, 10) <- v no longer
invents an element called point3. The names of images, labels, points and
shapes can be replaced, and the spatialMap follows.
Going to SpatialData now warns that the sample-level colData is dropped,
and a layer whose instance ids do not match the assay's column names warns
that its rows are taken in stored order.
dimGeometries() no longer declares a default for MARGIN that could never
apply.
The metadata of a SpatialFeatureExperiment was dropped by the coercion, and
so was the weight style of every sample's graph but the first. Both now
survive the round trip.
findDebrisCells() on a MultiAssaySpatialExperiment now returns a
MultiAssaySpatialExperiment with the is_debris flag in the experiment's
colData, as aggregate() and splitByCol() already did. It returned a
bare SpatialFeatureExperiment before.
localResults() agrees with localResultNames(): with nothing requested it
returns an empty list instead of an error. Asking for a named result still
fails, with a message that says local results are not carried over.
Reloading the package no longer stacks duplicate load hooks for
SpatialFeatureExperiment and spatialdataR, and unloading removes them
(new .onUnload). A registration that fails now warns, naming the
integration and the cause, instead of printing a bare hook error.
The SpatialData integration never activated against the real package. It
waited for a package called SpatialData, but the Bioconductor package is
spatialdataR, and it called constructors (PointFrame(), ShapeFrame())
that spatialdataR no longer has. It now targets spatialdataR:
as.data.frame(), because
spatialdataR holds them as lazy DuckDB queries, and are built with
SpatialDataPoint() and SpatialDataShape().labels() is registered as base::labels(object, ...), which is what it
is in spatialdataR.layer(x, i) returns the layer that holds element i, and element(x, i)
takes an element name or a position counted across the layers, as in
spatialdataR. The earlier layer(x, "images") and
element(x, "images", name) forms are gone. element<- is new.int_metadata() without importing it, and called
layer() and element() without qualifying them. It only worked in a
session that had attached SingleCellExperiment and spatialdataR. Elsewhere
a table that annotates a points or shapes element came out with no
spatialMap at all, without an error, because one call sat inside a
tryCatch() that returned NULL, and element() failed outright when
spatialdataR was loaded but not attached.x and y, such as the imageX
and imageY of a MASE made from an SFE, now convert; they use the first two
columns other than instance_id, as the rest of the package does.spatialMap that covers only some of an assay's columns no longer throws
away the instance ids of the rest: the mapped columns keep theirs and the
others get NA, with a warning. A table that annotates several regions is
read and written per column. A table keeps its own region and instance keys,
and column names such as __null_dask_index__ are no longer made
syntactic.images<-, labels<-, points<-, shapes<- and tables<- accept the
layer lists their getters return, not only a plain list.inst/scripts, where it was sourced at
run time and so never seen by R CMD check or BiocCheck, into
R/MultiAssaySpatialExperiment-SpatialData.R, laid out like the
SpatialFeatureExperiment one: its generics are imported into a private
environment and every method is registered there with an explicit where.
It no longer shadows setMethod(), setReplaceMethod() and setAs().spatialdataR is now in Suggests, and the integration's tests moved from
inst/scripts to tests/testthat, where R CMD check runs them. They
include two clean R sessions, one per load order, which is the only way to
see the failures above.Converting a SpatialFeatureExperiment to a MASE had several problems that
showed up on anything but a single sample with simple graphs:
colGraph() and colGeometry() were called with
their defaults, which return only the first sample, and the coercion
failed or was silently partial. Objects with several samples now convert
both ways: geometries are taken for all samples, and each sample's column
graph is merged into one graph over all columns and split again per sample."raw" weight style made the converted MASE unusable
("Style raw invalid"), because the graph was rebuilt with nb2listw(),
which does not accept it. It is now assembled directly, as SFE does.unit() rebuilt a whole SpatialFeatureExperiment on every call and
returned NULL if that failed. It now reads the unit from the object's
metadata, or from the assay when that is itself an SFE.localResults already did.The help pages for both integrations list their methods as aliases, so
?spatialGraphs and the like find them, and say where the results differ from
the upstream objects (dimGeometry() columns, bbox(), graphs, DuckDB tables).
The README no longer carries file counts and points to the right issue
tracker, and the use-cases vignette no longer loads ggplot2, which it did
not use.
New help page ?MultiAssaySpatialExperiment-SpatialFeatureExperiment, which
error messages already pointed to. It covers what the coercion keeps and
drops, what each method does, the cost of rebuilding a view per call, and how
unit() and localResults() differ from SFE's.
The docs say the spatialdataR and SpatialFeatureExperiment integrations
need the package loaded, not just installed, since they register when it
loads. The package description now mentions spatialdataR, and the README
no longer carries a hard-coded version.
Documented the spatialdataR integration: a new help page,
?"coerce-SpatialData", a "From SpatialData" section in the use-cases
vignette, two rows in the cheatsheet's coercion table, and a README section.
The README's coercion list also now includes as(mase, "SpatialFeatureExperiment"), which was missing.
Corrected the terminology sections that said MASE has no bare accessors, and that called a named entry in a list a "layer". As in spatialdataR, a layer is one of images, labels, points, shapes or tables, and an element is a named entry in a layer.
as(mase, "SpatialFeatureExperiment") failed with 'arg' should be one of "full_res_image_pixel", "micron" for any MASE built from an SFE that
stores its unit as "full_res_image_pixels", which is how older SFE
objects, including the SFEData example datasets, record it. The SFE
constructor only accepts the singular spelling, and the coercion passed the
stored value through unchanged. The legacy spelling is now normalized both
when the unit is stored in metadata(mase) and when it is read back, so
MASE objects written before this fix also convert.\dontrun{} with \donttest{} in the four platform-reader
examples that need real vendor output (readHDF5ForMASE(),
readVisiumMASE(), readVisiumHDMASE(), readXeniumMASE()), per
BiocCheck: \dontrun{} examples never run, even under
R CMD check --run-donttest or interactive example(), while
\donttest{} ones do, which is what lets Bioconductor's periodic checks
catch these examples rotting out from under a real file-format change.
Verified directly with BiocCheck: no ERROR or WARNING, and its
dontrun/donttest usage NOTE now reports only \donttest{} tags.# Where to go next, in a full-sentence bullet style that didn't match
the "Title: short phrase" convention -workflows.Rmd and
-usecases.Rmd already use consistently. Brought into line.sampleMap mismatch that is silently dropped with a message during
harmonization, and a broken spatialMap that fails validObject()
outright, since a dangling geometry reference cannot be silently
dropped the way a sampleMap row can.-usecases.Rmd and
-workflows.Rmd to prose (transcript use cases, two Xenium/Visium
background comparisons, a data-preparation listing, the aggregation
strategy rationale, and the rasterization/vectorization preview).
Structural lists (vendor output file listings, parameter tables, the
numbered platform-integration rationale, "See also") were left alone;
those are legitimate uses of a list, not the pattern being fixed.experiments(mase) box had no visible
connection to the ExperimentList class named in the surrounding prose;
relabeled to experiments(mase) (ExperimentList), matching the
Experiment (SummarizedExperiment) convention the same diagram already
uses for a different entity.build_diagrams.sh
itself would silently regenerate it at 784x527, the exact low resolution
from a previous round of review, since the script never recorded the
scale factor actually used to produce the checked-in 3168x2128 image, and
its default background (transparent) rendered incorrectly in at least
one viewer. Both fixed (-s 4, default background changed to white);
the diagram is now reproducible from the script as checked in.R CMD check "Rd cross-references" NOTE: 34 roxygen \linkS4class{}
references to classes defined in other packages (DataFrame and List/
SimpleList in S4Vectors; SpatialExperiment; SingleCellExperiment;
MultiAssayExperiment and ExperimentList in MultiAssayExperiment;
SummarizedExperiment) had no package anchor, across 7 source files and
the 12 man pages they generate. \linkS4class{X} only resolves without a
warning for classes in the current package; cross-package references now
use \link[pkg:X-class]{X}. Classes defined in this package itself
(MultiAssaySpatialExperiment, RasterLayerList, PointsLayerList,
ShapesLayerList, SpatialLayerList) were left as plain \linkS4class{},
since those never needed anchoring.http:// Bioconductor badge URL in README.md (R CMD check flagged it as a 301 redirect to https://).Matrix Suggests dependency, used directly in
tests/ but not declared, which R CMD check flagged as an unstated
test dependency."regions", which collides
with spatialMap's own region column (the points/shapes layer name each
row references). Renamed to cells in the introduction vignette and
anatomical_regions in use cases (where the layer is tissue-scale, not
per-cell); added a paragraph after annotateWithRegions() in the
introduction distinguishing the pre-existing region column from the new
annotation column the function adds. A colData column separately named
region in Working with MultiAssaySpatialExperiment's subsetting example
collided for an unrelated reason and is now zone. The cheatsheet's
annotateWithRegions() entry made the identical mistake in prose
("records the region on spatialMap") and now describes what the function
actually does: add a new column named for the shapes layer.ExperimentList, colData and sampleMap before their first
use in the introduction vignette instead of leaving them to appear
unexplained in code output, added the "each row reads ..." sentence for
sampleMap that Design of MultiAssaySpatialExperiment already used for
spatialMap, explained st_polygon()/st_sfc()/sfc_POLYGON where they
are first used, and noted that read*() functions exist for real platform
data before walking through manual construction.subsetByAssay() note in Working with
MultiAssaySpatialExperiment. Consistency: "Part 1: Data Import" and
"Part 2: Real-World Workflows" used Title Case where every other heading
in the same document uses sentence case after a colon; the Xenium reader
section had an "Options" table that the Visium, CosMx and MERSCOPE
sections did not (added, values taken from each function's own roxygen
@param docs); two sentences in use cases used first-person-plural
narrative voice ("We will create...") where the rest of the document
describes what the code does. Concision: the entity-relationship diagram's
intro sentence in Design of MultiAssaySpatialExperiment duplicated its
own figure caption almost verbatim (trimmed); the "Scientific question"
callout in use cases used more promotional language ("leverage...
improve our understanding of") than the plain register used elsewhere in
the document.aggregateByRegion(x, by, FUN = "count") named its result column region
regardless of by; the "sum"/"mean" branches already name result
columns after by, so "count" was the odd one out and, for any by
other than a layer literally named "region", produced a column name that
did not match the argument that produced it. It now names the column after
by, e.g. by = "cells" produces a cells column.for loops with lapply()/vapply()/
Reduce()/vectorized code, in the same spirit as 0.99.8's refactor:
spatialMatch()'s two loops (one needed no loop or apply at all, just
vectorized arithmetic); .subsetSpatialMapByColumn() and
.subsetMASEBySpatialFilter(); .aggregateMatrixByRegion() and
aggregateByRegion()'s per-assay loop; .mergeLayerList() and
.reduceLayerList() (the latter was a manual fold, now a Reduce());
four loops in .check_visiumhd_files()/.build_mase_from_visiumhd(), two
of which re-tested a loop-invariant is.null(boundaries) condition on
every iteration and are now hoisted out; the ShapesLayerList()
constructor's coercion loop; the annotGeometryNames loop in the
SpatialFeatureExperiment coercion; .spatialImages_from_imgData()'s
rename-and-filter loop; and a test helper's loop around file.remove(),
which already vectorizes. Verified against the full test suite plus
targeted re-runs of every touched test file, and (for spatialMatch()'s
vectorized branch) a direct comparison against the original loop's output.break on the first match, so an apply variant can't
short-circuit) into two shared helpers, .firstExistingPath() and
.firstMatchingFile(), in a new "File discovery" section of
MultiAssaySpatialExperiment-read-helpers.R. Those fifteen loops were the
same six-line block copy-pasted across the CosMx, MERSCOPE, Xenium and
Visium readers; all fifteen call sites now delegate to one of the two
helpers instead, including the one Xenium case that also checks
dir.exists() (passed in as a check override). Behavior is unchanged,
confirmed by directly unit-testing both helpers against no-match, match,
and the Xenium dual-check case, and by the full read-technology test file
(151 assertions) passing unchanged. for loops in R/ go from 43 to 15
overall between this entry and 0.99.8; the remainder are the validity-check
accumulators, side-effect-only loops, and upstream-fidelity ports (e.g.
.get_img_idx_mase()) that 0.99.8 already explains.subsetByBoundingBox() and subsetByPolygon() were structurally identical
apart from the functions used to index each layer, and each contained four
near-duplicate loops. Both now delegate to one .subsetMASEByGeometry()
engine, which also removes redundant work: each method previously indexed
every spatial layer twice, once to build the retained-instance map and
again, with identical arguments, to build the filtered layers, so
subsetByPolygon() ran its point-in-polygon join twice per layer on every
call. Equivalence was checked against the previous implementation across
partial-hit, everything-retained and empty-result cases for both methods,
comparing dimensions, layer contents, layer names and spatialMap.for loops could use the apply
family. Eight are removed by the refactor above. Of the remainder, fifteen
are file-pattern searches that break on the first hit, where an apply
variant cannot short-circuit and would test every candidate path; the rest
either fold state across iterations or exist for their side effects, where a
loop is the clearer form. The two examples named in the review are kept:
.get_img_idx_mase() is a near-verbatim port of
SpatialExperiment:::.get_img_idx(), deliberately structured like its
upstream counterpart, and .import_SFE_generics() is a two-line side-effect
loop registering generics.# The conversion: twice and # The combined MASE has:), matching the ones
already removed in 0.99.7. No cat() call or comment block now stands in for
prose in any vignette.SingleCellExperiment's intro.Rmd. The
slot-by-slot anatomy, the mapping tables and the entity-relationship
diagram move to a new Design of MultiAssaySpatialExperiment vignette,
which is both the split SingleCellExperiment makes between intro and
devel and the <Package>-design convention already used by the sibling
packages in this suite.MultiAssayExperiment's. Two vignettes previously
pointed readers at a cheatsheet that did not exist.Introduction.Rmd becomes MultiAssaySpatialExperiment.Rmd,
WorkingWithMASE.Rmd becomes MultiAssaySpatialExperiment-workflows.Rmd,
and UseCases.Rmd becomes MultiAssaySpatialExperiment-usecases.Rmd.spatialImages and spatialLabels are
included for the first time; their absence was part of why the diagram and
its description could not be reconciled. Crow's-foot notation is now
explained.sf is required only for the shapes slot.cat() calls that printed static workflow text from code
chunks, gave the subsetting, spatial-operation and coercion sections
runnable examples, and renamed headings that merely repeated the sentence
below them.P1, P2) from observation identifiers (S1...S4). With one assay whose
column names matched its specimen names, subsetting by specimen and by assay
column produced identical output and the distinction was invisible.Spatial to biocViews..check_visium_files() no longer builds a message with paste0() inside
the condition signal; the subdirectory name is computed once and reused..spatialLabels_from_rasters(),
.read_label_rasters(), set_block_size() and list_technologies().else continuations in .mergeMASE(), the cbind
method, and the SpatialFeatureExperiment coercion.no definition for class "MultiAssaySpatialExperiment"
warning (one per setAs()/setMethod() call registered in
.register_SFE_coercion()/.register_SFE_methods(), ~20 total) emitted
whenever SpatialFeatureExperiment was already loaded before
MultiAssaySpatialExperiment (e.g. library(SpatialFeatureExperiment); library(MultiAssaySpatialExperiment)). Registration in that case runs
synchronously inside .onLoad, which always completes before this
package is attached to search(); .sfe_ext_env (added in 0.99.5 to
work around namespace sealing) was parented to globalenv(), so at
registration time it couldn't yet see "package:MultiAssaySpatialExperiment"
to validate the class in the method signature. .sfe_ext_env is now
parented to this package's own namespace instead, where the class is
always immediately reachable regardless of attachment timing. Harmless
(registration and dispatch both still worked correctly), but noisy.as(spe/sfe, "MultiAssaySpatialExperiment") now store the assay as a plain
SingleCellExperiment and keep all spatial content (colGeometries,
annotGeometries, unit, col-margin spatialGraphs) in MASE's own
points/shapes/spatialMap/colPair() layers, instead of retaining the
full SpatialExperiment/SpatialFeatureExperiment object. Previously,
writeParquet() (BiocDuckDB) only ever read those MASE-native layers, so
anything living only in a nested SFE's colGeometries beyond the primary
centroids, annotGeometries, or spatialGraphs was silently dropped on
write even though it looked preserved in memory. as(mase, "SpatialExperiment"/"SpatialFeatureExperiment") and the SFE-delegating
methods (dimGeometry, annotGeometry, bbox, unit, splitByCol,
aggregate, findDebrisCells) now reconstruct a real SPE/SFE view from
those native layers on demand; spatialGraphs/spatialGraph/
spatialGraphNames read colPair() directly. localResults is not
carried over by this coercion (no MASE-native home for it yet); it now
errors with a message that says so instead of a misleading
"no SpatialFeatureExperiment assay" message.SpatialFeatureExperiment
integration (all coercions and the dimGeometry/unit/bbox/etc.
delegating methods) would silently fail to register whenever anything
loaded MultiAssaySpatialExperiment before the user loaded
SpatialFeatureExperiment in the same session (for example, loading
BiocDuckDB first, since it imports this package) -- as(sfe, "MultiAssaySpatialExperiment") would then silently fall back to the
generic SpatialExperiment coercion with no error. The deferred
registration hook ran after this namespace was already sealed, and
setAs()/setMethod() need to create a new top-level binding the first
time a generic is used from a namespace; that's forbidden once a
namespace is sealed, and the resulting error was masked by an
overly-broad grepl("locked", ...) catch in the load hook. Registration
now targets a small dedicated, never-sealed environment instead of this
namespace, which works regardless of load order; the test suite's own
pkgload::load_all() workaround for this (helper-sfe-register.R) is no
longer needed and has been removed.@aliases coerce,...-method entries for the
list/List -> RasterLayerList/PointsLayerList/ShapesLayerList
coercions in ?SpatialLayerList-class; these were implemented but
undocumented, which R CMD check flagged as missing documentation
entries.URL and BugReports fields to DESCRIPTION.?MultiAssaySpatialExperiment).\value sections (roxygen @return) to the MultiAssaySpatialExperiment
class, combine, subset, and SpatialExperiment-coercion man pages, and to
SpatialLayerList-class, documenting the values returned by the constructors,
accessors, replacement, coercion, combining, and subsetting methods. Resolves
the R CMD BiocCheck "missing \value" WARNING.readMERSCOPEMASE() and readCosMxMASE() now have runnable examples backed
by minimal mock output directories bundled under inst/extdata/
(merscope_mock/, cosmx_mock/; generated by inst/scripts/make-example-mocks.R).
This raises the share of exported-object man pages with runnable examples above
the 80% BiocCheck threshold, resolving the R CMD BiocCheck ERROR.BiocCheck flags); its quick-reference content is now a table in the
Introduction.VignetteIndexEntry,
BiocStyle::doc_date() compiled dates, and structured author metadata.