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 |
the rows are the panel names, the columns are the single cells,the column are the single cells to match the SCE designs (scRNA)
.checkSpatialDimension(object)
.checkSpatialDimension(object)
object |
imcExperiment object, class imcExperiment container |
imcExperiment container that has proper dimensions
map to point pattern from imcExperiment class.
.imcExperimentToPPP(caseExperiment = NULL, phenotypeToUse = 1)
.imcExperimentToPPP(caseExperiment = NULL, phenotypeToUse = 1)
caseExperiment |
the subset IMC experiment to cast into a point pattern |
phenotypeToUse |
the cluster id to annotate the pattern |
imcExperiment container converted to a point pattern set
finds the intensities getter.
sets cell Intensity slot to a new matrix. rows protein, columns are cells.
cellIntensity(object, ...) ## S4 method for signature 'imcExperiment' cellIntensity(object) cellIntensity(object) <- value ## S4 replacement method for signature 'imcExperiment,matrix' cellIntensity(object) <- value
cellIntensity(object, ...) ## S4 method for signature 'imcExperiment' cellIntensity(object) cellIntensity(object) <- value ## S4 replacement method for signature 'imcExperiment,matrix' cellIntensity(object) <- value
object |
IMC container |
... |
additional arguments |
value |
matrix rows protein, columns are cells |
imcExperiment container
imcExperiment container
imcExperiment container
imcExperiment container
data(imcdata) dim(cellIntensity(imcdata)) data(imcdata);dim(cellIntensity(imcdata)) head(t(cellIntensity(imcdata))) data(imcdata) x<-asinh(counts(imcdata)) cellIntensity(imcdata)<-x
data(imcdata) dim(cellIntensity(imcdata)) data(imcdata);dim(cellIntensity(imcdata)) head(t(cellIntensity(imcdata))) data(imcdata) x<-asinh(counts(imcdata)) cellIntensity(imcdata)<-x
Data set containing 1,000 cells and 73 features which include panel antibody, neighborhood computations, and phenograph clustering.
data(data)
data(data)
A data frame of 1,000 cells and histoCAT features
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
feature from histoCAT
finds the spatial coords, getter.
getCoordinates(object) ## S4 method for signature 'imcExperiment' getCoordinates(object) ## S4 replacement method for signature 'imcExperiment,matrix' getCoordinates(object) <- value
getCoordinates(object) ## S4 method for signature 'imcExperiment' getCoordinates(object) ## S4 replacement method for signature 'imcExperiment,matrix' getCoordinates(object) <- value
object |
is IMC container |
value |
matrix rows cells, columns are x,y |
imcExperiment container
imcExperiment container
imcExperiment container
data(imcdata) getCoordinates(imcdata) data(imcdata) getCoordinates(imcdata) data(imcdata) x<-getCoordinates(imcdata) getCoordinates(imcdata)<-as.matrix(x)
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.
getCoordinates(object) <- value
getCoordinates(object) <- value
object |
is IMC container |
value |
matrix rows cells, columns are x,y |
imcExperiment container
data(imcdata) x<-getCoordinates(imcdata) getCoordinates(imcdata)<-as.matrix(x)
data(imcdata) x<-getCoordinates(imcdata) getCoordinates(imcdata)<-as.matrix(x)
re-assigns the distance matrix (rows are cells)
getDistance(object) <- value
getDistance(object) <- value
object |
is IMC container |
value |
matrix rows cells, columns are distance measurements |
imcExperiment container
data(imcdata) newD<-matrix(1,nrow=ncol(imcdata),ncol=1) getDistance(imcdata)<-newD
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.
getMorphology(object) <- value
getMorphology(object) <- value
object |
is IMC container |
value |
matrix rows cells, columns are Area, Eccentricity, etc. |
imcExperiment container
data(imcdata) x<-matrix(1,nrow=ncol(imcdata),ncol=4) getMorphology(imcdata)<-x
data(imcdata) x<-matrix(1,nrow=ncol(imcdata),ncol=4) getMorphology(imcdata)<-x
finds the neighborhood information.
slow assignment for the histoCAT neighborhood data (matrix) columns are the neighbors
getNeighborhood(object, ...) ## S4 method for signature 'imcExperiment' getNeighborhood(object) getNeighborhood(object) <- value ## S4 replacement method for signature 'imcExperiment,matrix' getNeighborhood(object) <- value
getNeighborhood(object, ...) ## S4 method for signature 'imcExperiment' getNeighborhood(object) getNeighborhood(object) <- value ## S4 replacement method for signature 'imcExperiment,matrix' getNeighborhood(object) <- value
object |
is IMC container |
... |
additional arguments |
value |
matrix rows cells, columns are neighborhood histoCAT output |
imcExperiment container
imcExperiment container data(imcdata) getNeighborhood(imcdata)
imcExperiment container
imcExperiment container
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
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)
getNetwork(object) <- value
getNetwork(object) <- value
object |
is IMC container |
value |
data.frame rows cells, columns are phenograph network ID |
imcExperiment container
data(imcdata) x<-data.frame(ID=seq_len(ncol(imcdata))) getNetwork(imcdata)<-x
data(imcdata) x<-data.frame(ID=seq_len(ncol(imcdata))) getNetwork(imcdata)<-x
histoCAT output containerized as IMC container. IMC S4 data set containing 2,452 cells and 44 antibody features which include panel antibody.
data(imcdata)
data(imcdata)
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.
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)), ... )
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)), ... )
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 |
imcExperiment container
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)))
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.#'
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)
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)
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)
object |
imcExperiment |
value |
matrix rows cells, columns are Area, etc. |
imcExperiment container
imcExperiment container
imcExperiment container
imcExperiment container
imcExperiment container
imcExperiment container
imcExperiment container
imcExperiment container
imcExperiment container
imcExperiment container
imcExperiment container
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
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)
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.
imcExperimentToHyperFrame(imcExperiment = NULL, phenotypeToUse = 1)
imcExperimentToHyperFrame(imcExperiment = NULL, phenotypeToUse = 1)
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. |
a hyperframe of point patterns
data(imcdata) H<-imcExperimentToHyperFrame(imcExperiment=imcdata,phenotypeToUse = 1)
data(imcdata) H<-imcExperimentToHyperFrame(imcExperiment=imcdata,phenotypeToUse = 1)
given a matrix of intensity counts, perform min/max norm.
percentilenormalize(data = NULL, percentile = NULL)
percentilenormalize(data = NULL, percentile = NULL)
data |
matrix of numeric data only |
percentile |
numeric value 0.99 default. |
normalized data, each column on [0,1] scale.
data(data) dim(data) expr<-data[,3:36] normExp<-percentilenormalize(data=expr,percentile=0.99) normExp<-as.matrix(normExp)
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.
method to subset the slots, requires colData with column "ROIID"
selectCases(object, value, ...) ## S4 method for signature 'imcExperiment' selectCases(object, value)
selectCases(object, value, ...) ## S4 method for signature 'imcExperiment' selectCases(object, value)
object |
IMC container |
value |
this is ROIID vector |
... |
additional parameters |
imcExperiment container of selected cases
imcExperiment container of selected cases
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)
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
method to subset the slots, requires colData with column "ROIID"
subsetCase(object, value, ...) ## S4 method for signature 'imcExperiment' subsetCase(object, value)
subsetCase(object, value, ...) ## S4 method for signature 'imcExperiment' subsetCase(object, value)
object |
IMC container |
value |
this is ROIID a single character ID |
... |
additional parameters |
returns IMC object of a single case
roi imcExperiment
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
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