addPlottingFactor: Add plotting factor to 'SpatialOverlay' object

addPlottingFactorR Documentation

Add plotting factor to SpatialOverlay object

Description

Add plotting factor to SpatialOverlay object

Usage

addPlottingFactor(overlay, annots, plottingFactor, ...)

## S4 method for signature 'NanoStringGeoMxSet'
addPlottingFactor(overlay, annots, plottingFactor, countMatrix = "exprs")

## S4 method for signature 'matrix'
addPlottingFactor(overlay, annots, plottingFactor)

## S4 method for signature 'tbl_df'
addPlottingFactor(overlay, annots, plottingFactor)

## S4 method for signature 'tbl'
addPlottingFactor(overlay, annots, plottingFactor)

## S4 method for signature 'data.frame'
addPlottingFactor(overlay, annots, plottingFactor)

## S4 method for signature 'character'
addPlottingFactor(overlay, annots, plottingFactor)

## S4 method for signature 'numeric'
addPlottingFactor(overlay, annots, plottingFactor)

## S4 method for signature 'factor'
addPlottingFactor(overlay, annots, plottingFactor)

Arguments

overlay

SpatialOverlay object

annots

factor vector with the plottingFactor. if names match sample names in overlay vector will be matched on those, otherwise assumed in the correct order

plottingFactor

name of the new plotting factor

...

if using NanoStringGeoMxSet, name of count matrix to pull counts from

countMatrix

name of count matrix to pull counts from

Value

SpatialOverlay object with new plotting factor

Examples

muBrain <- readRDS(unzip(system.file("extdata", "muBrainSubset_SpatialOverlay.zip", 
                                    package = "SpatialOmicsOverlay")))

muBrainLW <- system.file("extdata", "muBrain_LabWorksheet.txt", 
                         package = "SpatialOmicsOverlay")

muBrainLW <- readLabWorksheet(muBrainLW, slideName = "D5761 (3)")

muBrain <- addPlottingFactor(overlay = muBrain, 
                             annots = muBrainLW, 
                             plottingFactor = "segment")

muBrainGxT <- readRDS(unzip(system.file("extdata", "muBrain_GxT.zip", 
                                  package = "SpatialOmicsOverlay")))

muBrain <- addPlottingFactor(overlay = muBrain, 
                             annots = muBrainGxT, 
                             plottingFactor = "Calm1",
                             countMatrix = "exprs")

muBrain <- addPlottingFactor(overlay = muBrain,
                             annots = seq_len(length(sampNames(muBrain))),
                             plottingFactor = "ROINum")

head(plotFactors(muBrain))

muBrain <- readRDS(unzip(system.file("extdata", "muBrainSubset_SpatialOverlay.zip", 
                                    package = "SpatialOmicsOverlay")))

muBrain <- addPlottingFactor(overlay = muBrain,
                             annots = as.factor(seq_len(length(sampNames(muBrain)))),
                             plottingFactor = "ROINum")

head(plotFactors(muBrain))

Nanostring-Biostats/SpatialOmicsOverlay documentation built on April 20, 2024, 5:36 a.m.