addMoleculeCoordinates.Rd
Adds or updates the molecule coordinates for a specified assay in the given object.
addMoleculeCoordinates(
object,
coordinates = NULL,
assay_name = activeAssay(object)
)
An object of class SPATA2
or, in case of S4 generics,
objects of classes for which a method has been defined.
A data frame containing the coordinates to be added. The data frame must contain the following variables:
molecule or <assay_name> Identifier for the molecules. E.g. if
x_orig or x: x-coordinates (original or to be scaled back to original).
y_orig or y: y-coordinates (original or to be scaled back to original).
Only relevant if the SPATA2
object contains more than
one assay: Denotes the assay of interest and thus the
molecular modality to use. Defaults to the active assay
as set by activateAssay()
.
The updated input object, containing the added, removed or computed results.
This function processes the provided coordinates data frame to ensure
it contains the necessary variables (molecule
or the assay name, x
or x_orig
,
and y
or y_orig
). If only the scaled coordinates (x
and y
) are provided,
they are scaled back to the original coordinate frame using the image scale factor.
The resulting data frame is then nested by the assay modality and integrated into
the molecular metadata variables of the object.
Results are stored in a nested column in the molecular meta variable data.frame called coords.
getMolecularCoordinates()
, getMetaVarDf()