Package 'imcExperiment'

Title: Mass Cytometry S4 Class Structure Pipeline for Images
Description: Containerizes cytometry data and allows for S4 class structure to extend slots related to cell morphology, spatial coordinates, phenotype network information, and unique cellular labeling.
Authors: Anthony Colombo [aut, cre]
Maintainer: Anthony Colombo <[email protected]>
License: MIT + file LICENSE
Version: 0.99.0
Built: 2025-03-05 06:04:14 UTC
Source: https://github.com/arcolombo/imcexperiment

Help Index


the rows are the panel names, the columns are the single cells,the column are the single cells to match the SCE designs (scRNA)

Description

the rows are the panel names, the columns are the single cells,the column are the single cells to match the SCE designs (scRNA)

Usage

.checkSpatialDimension(object)

Arguments

object

imcExperiment object, class imcExperiment container

Value

imcExperiment container that has proper dimensions


map to point pattern from imcExperiment class.

Description

map to point pattern from imcExperiment class.

Usage

.imcExperimentToPPP(caseExperiment = NULL, phenotypeToUse = 1)

Arguments

caseExperiment

the subset IMC experiment to cast into a point pattern

phenotypeToUse

the cluster id to annotate the pattern

Value

imcExperiment container converted to a point pattern set


finds the intensities getter.

Description

finds the intensities getter.

sets cell Intensity slot to a new matrix. rows protein, columns are cells.

Usage

cellIntensity(object, ...)

## S4 method for signature 'imcExperiment'
cellIntensity(object)

cellIntensity(object) <- value

## S4 replacement method for signature 'imcExperiment,matrix'
cellIntensity(object) <- value

Arguments

object

IMC container

...

additional arguments

value

matrix rows protein, columns are cells

Value

imcExperiment container

imcExperiment container

imcExperiment container

imcExperiment container

Examples

data(imcdata)
dim(cellIntensity(imcdata))
data(imcdata);dim(cellIntensity(imcdata))
head(t(cellIntensity(imcdata)))
data(imcdata)
x<-asinh(counts(imcdata))
cellIntensity(imcdata)<-x

data

Description

Data set containing 1,000 cells and 73 features which include panel antibody, neighborhood computations, and phenograph clustering.

Usage

data(data)

Format

A data frame of 1,000 cells and histoCAT features

ImageId

feature from histoCAT

CellId

feature from histoCAT

marker1

feature from histoCAT

marker2

feature from histoCAT

marker3

feature from histoCAT

marker4

feature from histoCAT

marker5

feature from histoCAT

marker6

feature from histoCAT

marker7

feature from histoCAT

marker8

feature from histoCAT

marker9

feature from histoCAT

marker10

feature from histoCAT

marker11

feature from histoCAT

marker12

feature from histoCAT

marker13

feature from histoCAT

marker14

feature from histoCAT

marker15

feature from histoCAT

marker16

feature from histoCAT

marker17

feature from histoCAT

marker18

feature from histoCAT

marker19

feature from histoCAT

marker20

feature from histoCAT

marker21

feature from histoCAT

marker22

feature from histoCAT

marker23

feature from histoCAT

marker24

feature from histoCAT

marker25

feature from histoCAT

marker26

feature from histoCAT

marker27

feature from histoCAT

marker28

feature from histoCAT

marker29

feature from histoCAT

marker30

feature from histoCAT

marker31

feature from histoCAT

marker32

feature from histoCAT

marker33

feature from histoCAT

marker34

feature from histoCAT

Area

feature from histoCAT

Eccentricity

feature from histoCAT

Solidity

feature from histoCAT

Extent

feature from histoCAT

EulerNumber

feature from histoCAT

Perimeter

feature from histoCAT

MajorAxisLength

feature from histoCAT

MinorAxisLength

feature from histoCAT

Orientation

feature from histoCAT

X_position

feature from histoCAT

Y_position

feature from histoCAT

Percent_Touching

feature from histoCAT

Number_Neighbors

feature from histoCAT

neighbour_4_CellId1

feature from histoCAT

neighbour_4_CellId2

feature from histoCAT

neighbour_4_CellId3

feature from histoCAT

neighbour_4_CellId4

feature from histoCAT

neighbour_4_CellId5

feature from histoCAT

neighbour_4_CellId6

feature from histoCAT

neighbour_4_CellId7

feature from histoCAT

neighbour_4_CellId8

feature from histoCAT

neighbour_4_CellId9

feature from histoCAT

neighbour_4_CellId10

feature from histoCAT

Phenograph7851534969

feature from histoCAT

tSNE4148542692_1

feature from histoCAT

tSNE4148542692_2

feature from histoCAT


finds the spatial coords, getter.

Description

finds the spatial coords, getter.

Usage

getCoordinates(object)

## S4 method for signature 'imcExperiment'
getCoordinates(object)

## S4 replacement method for signature 'imcExperiment,matrix'
getCoordinates(object) <- value

Arguments

object

is IMC container

value

matrix rows cells, columns are x,y

Value

imcExperiment container

imcExperiment container

imcExperiment container

Examples

data(imcdata)
getCoordinates(imcdata)
data(imcdata)
getCoordinates(imcdata)
data(imcdata)
x<-getCoordinates(imcdata)
getCoordinates(imcdata)<-as.matrix(x)

Sets the coordinate positions of each cell (matrix), columns are X,Y positions.

Description

Sets the coordinate positions of each cell (matrix), columns are X,Y positions.

Usage

getCoordinates(object) <- value

Arguments

object

is IMC container

value

matrix rows cells, columns are x,y

Value

imcExperiment container

Examples

data(imcdata)
x<-getCoordinates(imcdata)
getCoordinates(imcdata)<-as.matrix(x)

re-assigns the distance matrix (rows are cells)

Description

re-assigns the distance matrix (rows are cells)

Usage

getDistance(object) <- value

Arguments

object

is IMC container

value

matrix rows cells, columns are distance measurements

Value

imcExperiment container

Examples

data(imcdata)
newD<-matrix(1,nrow=ncol(imcdata),ncol=1)
getDistance(imcdata)<-newD

re-assigns morphological features can be stored (matrix) rows are cells and columns are Area, etc.

Description

re-assigns morphological features can be stored (matrix) rows are cells and columns are Area, etc.

Usage

getMorphology(object) <- value

Arguments

object

is IMC container

value

matrix rows cells, columns are Area, Eccentricity, etc.

Value

imcExperiment container

Examples

data(imcdata)
x<-matrix(1,nrow=ncol(imcdata),ncol=4)
getMorphology(imcdata)<-x

finds the neighborhood information.

Description

finds the neighborhood information.

slow assignment for the histoCAT neighborhood data (matrix) columns are the neighbors

Usage

getNeighborhood(object, ...)

## S4 method for signature 'imcExperiment'
getNeighborhood(object)

getNeighborhood(object) <- value

## S4 replacement method for signature 'imcExperiment,matrix'
getNeighborhood(object) <- value

Arguments

object

is IMC container

...

additional arguments

value

matrix rows cells, columns are neighborhood histoCAT output

Value

imcExperiment container

imcExperiment container data(imcdata) getNeighborhood(imcdata)

imcExperiment container

imcExperiment container

Examples

data(imcdata)
getNeighborhood(imcdata)
data(imcdata)
x<-matrix(1,nrow=ncol(imcdata),ncol=2)
getNeighborhood(imcdata)<-x
data(imcdata)
x<-matrix(1,nrow=ncol(imcdata),ncol=2)
getNeighborhood(imcdata)<-x

re-assigns the network assignment (matrix)

Description

re-assigns the network assignment (matrix)

Usage

getNetwork(object) <- value

Arguments

object

is IMC container

value

data.frame rows cells, columns are phenograph network ID

Value

imcExperiment container

Examples

data(imcdata)
x<-data.frame(ID=seq_len(ncol(imcdata)))
getNetwork(imcdata)<-x

imcdata

Description

histoCAT output containerized as IMC container. IMC S4 data set containing 2,452 cells and 44 antibody features which include panel antibody.

Usage

data(imcdata)

Format

A data frame of 2,452 cells and histoCAT features which are containerized into the imcExperiment


Initializes a imcExperiment and performs some rudimentary checks. Many of the arguments CAN be NULL; determination of which is required is done at run-time. A imcExperiment must contain at least the expressions and spatial/coordinate assays.

Description

Initializes a imcExperiment and performs some rudimentary checks. Many of the arguments CAN be NULL; determination of which is required is done at run-time. A imcExperiment must contain at least the expressions and spatial/coordinate assays.

Usage

imcExperiment(
  coordinates = matrix(1, 3, 3),
  cellIntensity = matrix(1, 3, 3),
  neighborHood = matrix(1, 3, 3),
  network = data.frame(matrix(1, 3, 3)),
  distance = matrix(1, 3, 3),
  morphology = matrix(1, 3, 3),
  uniqueLabel = rep("A", 3),
  panel = as.character(seq_len(3)),
  ROIID = data.frame(ROIID = rep("A", 3)),
  ...
)

Arguments

coordinates

matrix of spatial coordinates (x,y)

cellIntensity

matrix of counts

neighborHood

neighborhood results

network

network assignments for each cell

distance

distances for each cell, can be square

morphology

morphology features for each cell, can be square

uniqueLabel

character class each cell is assigned a uniqueLabel

panel

antibody panel rownames set to rowData

ROIID

character for ROI

...

additional arguments

Value

imcExperiment container

Examples

x<-imcExperiment(cellIntensity=matrix(1,nrow=10,ncol=10),
coordinates=matrix(1,nrow=10,ncol=2),
neighborHood=matrix(1,nrow=10,ncol=10),
network=data.frame(matrix(1,nrow=10,ncol=10)),
distance=matrix(1,nrow=10,ncol=10),
morphology=matrix(1,nrow=10,ncol=10),
uniqueLabel=paste0("A",seq_len(10)),
panel=letters[1:10],
ROIID=data.frame(ROIID=rep("A",10)))

a summarized experiment of IMC runs, dimensions of the spatial and intensity data are regulated.#'

Description

a summarized experiment of IMC runs, dimensions of the spatial and intensity data are regulated.#'

finds the network information.

assigns cell cluster assignment to the container. rows are cells and column is the cluster ID

finds the distance information.

distance matrix can be stored in the distance slot for pairwise distance

finds the morphology information.

morphological features can be stored (matrix) rows are cells and columns are Area, etc.

finds the label information.

unique cell labels can be assigned (vector)

Usage

getNetwork(object)

## S4 method for signature 'imcExperiment'
getNetwork(object)

## S4 replacement method for signature 'imcExperiment,data.frame'
getNetwork(object) <- value

getDistance(object)

## S4 method for signature 'imcExperiment'
getDistance(object)

## S4 replacement method for signature 'imcExperiment,matrix'
getDistance(object) <- value

getMorphology(object)

## S4 method for signature 'imcExperiment'
getMorphology(object)

## S4 replacement method for signature 'imcExperiment,matrix'
getMorphology(object) <- value

getLabel(object)

## S4 method for signature 'imcExperiment'
getLabel(object)

Arguments

object

imcExperiment

value

matrix rows cells, columns are Area, etc.

Value

imcExperiment container

imcExperiment container

imcExperiment container

imcExperiment container

imcExperiment container

imcExperiment container

imcExperiment container

imcExperiment container

imcExperiment container

imcExperiment container

imcExperiment container

Slots

coordinates

matrix class containing x,y coordinates

cellIntensity

matrix class containing intensity

neighborHood

matrix class containing x,y neighbor

network

data frame class containing network

distance

matrix class containing x,y distances

morphology

matrix class containing morphology

uniqueLabel

labels

Examples

x<-imcExperiment(cellIntensity=matrix(1,nrow=10,ncol=10),
coordinates=matrix(1,nrow=10,ncol=2),
neighborHood=matrix(1,nrow=10,ncol=10),
network=data.frame(matrix(1,nrow=10,ncol=10)),
distance=matrix(1,nrow=10,ncol=10),
morphology=matrix(1,nrow=10,ncol=10),
uniqueLabel=paste0("A",seq_len(10)),
panel=letters[1:10],
ROIID=data.frame(ROIID=rep("A",10)))
data(imcdata)
getNetwork(imcdata)
data(imcdata)
getNetwork(imcdata)
data(imcdata)
x<-data.frame(ID=seq_len(ncol(imcdata)))
getNetwork(imcdata)<-x
data(imcdata)
getDistance(imcdata)
data(imcdata)
getDistance(imcdata)
data(imcdata)
newD<-matrix(1,nrow=ncol(imcdata),ncol=1)
getDistance(imcdata)<-newD
data(imcdata)
getMorphology(imcdata)
data(imcdata)
getMorphology(imcdata)
data(imcdata)
x<-matrix(1,nrow=ncol(imcdata),ncol=4)
getMorphology(imcdata)<-x
data(imcdata)
getLabel(imcdata)
data(imcdata)
getLabel(imcdata)

map to point pattern from imcExperiment class.

Description

map to point pattern from imcExperiment class.

Usage

imcExperimentToHyperFrame(imcExperiment = NULL, phenotypeToUse = 1)

Arguments

imcExperiment

imcExperiment class

phenotypeToUse

the network slot can often have many columns, this is the ID for the column number to use in the network slot.

Value

a hyperframe of point patterns

Examples

data(imcdata)
H<-imcExperimentToHyperFrame(imcExperiment=imcdata,phenotypeToUse = 1)

given a matrix of intensity counts, perform min/max norm.

Description

given a matrix of intensity counts, perform min/max norm.

Usage

percentilenormalize(data = NULL, percentile = NULL)

Arguments

data

matrix of numeric data only

percentile

numeric value 0.99 default.

Value

normalized data, each column on [0,1] scale.

Examples

data(data)
 dim(data)
 expr<-data[,3:36]
 normExp<-percentilenormalize(data=expr,percentile=0.99)
 normExp<-as.matrix(normExp)

subsets the imcExperiment to a case along with all slots for a selected multiple ROIs.

Description

subsets the imcExperiment to a case along with all slots for a selected multiple ROIs.

method to subset the slots, requires colData with column "ROIID"

Usage

selectCases(object, value, ...)

## S4 method for signature 'imcExperiment'
selectCases(object, value)

Arguments

object

IMC container

value

this is ROIID vector

...

additional parameters

Value

imcExperiment container of selected cases

imcExperiment container of selected cases

Examples

data(imcdata)
myCases<-selectCases(imcdata,c("30-BM16-202_7Pre_s1_p1_r4_a4_ac","B17_350_14post_s1_p1_r5_a5_ac"))
myCases
table(colData(myCases)$ROIID)
data(imcdata)
myCases<-selectCases(imcdata,c("30-BM16-202_7Pre_s1_p1_r4_a4_ac","B17_350_14post_s1_p1_r5_a5_ac"))
myCases
table(colData(myCases)$ROIID)

subsets the imcExperiment to a case along with all slots for a single ROI, using for distance analysis

Description

subsets the imcExperiment to a case along with all slots for a single ROI, using for distance analysis

method to subset the slots, requires colData with column "ROIID"

Usage

subsetCase(object, value, ...)

## S4 method for signature 'imcExperiment'
subsetCase(object, value)

Arguments

object

IMC container

value

this is ROIID a single character ID

...

additional parameters

Value

returns IMC object of a single case

roi imcExperiment

Examples

data(imcdata)
myCase<-subsetCase(imcdata,"30-BM16-202_7Pre_s1_p1_r4_a4_ac")
myCase
data(imcdata)
myCase<-subsetCase(imcdata,"30-BM16-202_7Pre_s1_p1_r4_a4_ac")
myCase