Initiates a SPATA2 object using the basic inputs: a coordinates data.frame and a count matrix.

initiateSpataObject(
  sample_name,
  count_mtr,
  modality,
  coords_df,
  img = NULL,
  img_dir = NULL,
  img_name = "image1",
  scale_factors = list(),
  spatial_method = "Undefined",
  verbose = TRUE,
  ...
)

Arguments

sample_name

Character value. The name with which to identify the SPATA2 object.

count_mtr

A count matrix. Column names correspond to the barcodes of the observations. Rownames correspond to the names of the molecular features (genes, proteins, metabolites etc.).

modality

Character value. Should best describe the molecular type of the count matrix. Additionally, it defines the assay name, that is created with the count matrix and further referred to via the argument assay_name. Read more on molecular modalities in SPATA2 here.

coords_df

Data.frame with a variable called barcodes as well as the x_orig and y_orig or x and y.

img

The reference image. See details for more information on how or how not to include an image.

img_dir

Character value or NULL. If character, the file directory to the reference image. See details for more information on how and why to include a file directory.

img_name

Character value. The name of the reference image. Only required if at least img or img_dir is specified.

scale_factors

A list of scale_factors set in slot @scale_factors of the HistoImage object (if the SPATA2 object is initiated with an image, see details) or slot @scale_factors of the SpatialData object, if no image is provided.

spatial_method

Character value or object of class SpatialMethod. If character, one of validSpatialMethods().

verbose

Logical. If TRUE, informative messages regarding the computational progress will be printed.

(Warning messages will always be printed.)

...

Used to absorb deprecated arguments or functions.

meta, misc

List of meta- and miscellaneous data for the SpatialData object.

Value

An object of class SPATA2.

Note

In contrast to initiateSpataObjectVisium() or initiateSpataObjectMERFISH(), a SPATA2 object of this function the output does not contain a tissue outline yet! Run identifyTissueOutline() with your choice of parameters afterwards.

Initiating the object with an image

SPATA2 allows to register multiple images with one object via file directories. This facilitates exchanging them during the analysis while they must not be loaded altogether in a SPATA2 object, which saves storage space. By default, the function takes a directory to the image you want to initiate your SPATA2 object with, then loads the image and saves the directory, too. If the image does not exist in a file on your device but only in the global environment you can use img directly. This way, no image directory is stored. In a scenario, where you want to register an additional image and use it for further analysis, you can not unload the image with which you initiated the object because it would be lost since there is not directory from which to retrieve it once you want to use it again. Therefore, we recommend to initiate the object with a file directory to the image and not with an image from the global environment.

Lastly, if img and img_dir is specified the image is saved under this directory as a .png file and the image is registered normally.

Tutorials

Extensive tutorials for how to use this function can be found on our website https://themilolab.github.io/SPATA2/ .