format_inform_to_spe: Format an inForm image into a SpatialExperiment object

View source: R/format_inform_to_spe.R

format_inform_to_speR Documentation

Format an inForm image into a SpatialExperiment object

Description

Reads in inForm data in the form of cell coordinates, cell phenotypes (if available), and marker intensities and transforms to a SpatialExperiment object. The assay stores the intensity level of every marker (rows) for every cell (columns). Cell phenotype, x and y coordinates and other cell properties are stored under colData. The cell properties to include are Cell.Area, Nucleus.Area, Nucleus.Compactness, Nucleus.Axis.Ratio, and Cell.Axis.Ratio. Note that if the data does not include these parameters, we recommend adding it to the output from inForm with NAs in columns.

Usage

format_inform_to_spe(
  path,
  markers,
  locations = NULL,
  intensity_columns_interest = NULL
)

Arguments

path

String of the path location of inForm text file.

markers

String Vector containing the markers used for staining.

locations

(Optional) String Vector containing the locations of markers used for staining. Location can be either "Nucleus", "Cytoplasm" or "Membrane". This is used to select the Intensity column and can be used instead of 'intensity_columns_interest'.

intensity_columns_interest

(Optional) Use if 'locations' is not specified. Vector with the names of the columns with the level of each marker. Column names must match the order of the 'markers' parameter.

Value

A SpatialExperiment object is returned

Examples

raw_inform_data<-system.file("extdata","tiny_inform.txt.gz",package="SPIAT")
markers <- c("DAPI", "CD3", "PD-L1", "CD4", "CD8", "AMACR")
locations <- c("Nucleus", "Cytoplasm", "Membrane", "Cytoplasm", "Cytoplasm", 
"Cytoplasm")
formatted_inForm <- format_inform_to_spe(path=raw_inform_data, 
markers=markers, locations=locations)

TrigosTeam/SPIAT documentation built on Aug. 22, 2024, 7:50 p.m.