format_cellprofiler_to_spe: Format a cellprofiler image into a SpatialExperiment object

View source: R/format_cellprofiler_to_spe.R

format_cellprofiler_to_speR Documentation

Format a cellprofiler image into a SpatialExperiment object

Description

Reads in spatial 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 is stored under 'colData()'. Cell x and y coordinates are stored under 'spatialCoords()' Note that if the data does not include these parameters, we recommend adding it to the output from cellprofiler with NAs in columns.

Usage

format_cellprofiler_to_spe(
  path = NULL,
  markers = NULL,
  intensity_columns_interest = NULL
)

Arguments

path

String of the path location cellprofiler csv file.

markers

String Vector containing the markers used for staining.

intensity_columns_interest

String Vector with the names of the columns with the level of each marker. Column names must match the order of the 'markers' parameter.

Details

Note when specifying 'markers', please use "DAPI" to replace "DNA" due to implementation. The output data will include "DAPI" instead of "DNA".

Value

A SpatialExperiment object is returned

Examples

path <- system.file("extdata", "tiny_cellprofiler.txt.gz", package = "SPIAT")
markers <- c("Marker1", "Marker2", "Marker3", "Marker4", "Marker5", "DAPI", 
"Marker6")
intensity_columns_interest <- c("Intensity_MeanIntensity_Marker1_rs",
"Intensity_MeanIntensity_Marker2_rs", "Intensity_MeanIntensity_Marker3_rs",
"Intensity_MeanIntensity_Marker4_rs", "Intensity_MeanIntensity_Marker5_rs",
"Intensity_MeanIntensity_DAPI_rs", "Intensity_MeanIntensity_Marker6_rs")
formatted_cellprofiler <- format_cellprofiler_to_spe(path = path,
markers = markers, intensity_columns_interest = intensity_columns_interest)

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