loadSTProfiles | R Documentation |
This function loads a SpatialExperiment
object (or a list with several
SpatialExperiment
objects) into a
SpatialDDLS
object.
loadSTProfiles(
object,
st.data,
st.spot.ID.column,
st.gene.ID.column,
st.min.counts = 0,
st.min.spots = 0,
st.n.slides = 3,
verbose = TRUE
)
object |
A |
st.data |
A |
st.spot.ID.column |
Name or number of the column in spots metadata corresponding to spot names in the expression matrix. |
st.gene.ID.column |
Name or number of the column in genes metadata corresponding to names used for features/genes. |
st.min.counts |
Minimum gene counts to filter (0 by default). |
st.min.spots |
Minimum of spots with more than |
st.n.slides |
Minimum number of slides
( |
verbose |
Show informative messages during execution ( |
It is recommended to perform this step when creating the
SpatialDDLS
object using the
createSpatialDDLSobject
function in order to only keep genes
shared between the spatial transcriptomics and the single-cell
transcriptomics data used as reference. In addition, please, make sure the
gene identifiers used the spatial and single-cell transcriptomics data are
consistent.
A SpatialDDLS
object with the provided spatial
trainscriptomics data loaded into the spatial.experiments
slot.
createSpatialDDLSobject
trainDeconvModel
set.seed(123)
sce <- SingleCellExperiment::SingleCellExperiment(
assays = list(
counts = matrix(
rpois(100, lambda = 5), nrow = 40, ncol = 30,
dimnames = list(paste0("Gene", seq(40)), paste0("RHC", seq(30)))
)
),
colData = data.frame(
Cell_ID = paste0("RHC", seq(30)),
Cell_Type = sample(x = paste0("CellType", seq(4)), size = 30,
replace = TRUE)
),
rowData = data.frame(
Gene_ID = paste0("Gene", seq(40))
)
)
SDDLS <- createSpatialDDLSobject(
sc.data = sce,
sc.cell.ID.column = "Cell_ID",
sc.gene.ID.column = "Gene_ID",
sc.filt.genes.cluster = FALSE
)
## simulating a SpatialExperiment object
counts <- matrix(rpois(30, lambda = 5), ncol = 6)
rownames(counts) <- paste0("Gene", 1:5)
colnames(counts) <- paste0("Spot", 1:6)
coordinates <- matrix(
c(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3), ncol = 2
)
ste <- SpatialExperiment::SpatialExperiment(
assays = list(counts = as.matrix(counts)),
rowData = data.frame(Gene_ID = paste0("Gene", 1:5)),
colData = data.frame(Cell_ID = paste0("Spot", 1:6)),
spatialCoords = coordinates
)
## previous SpatialDDLS object
SDDLS <- loadSTProfiles(
object = SDDLS,
st.data = ste,
st.spot.ID.column = "Cell_ID",
st.gene.ID.column = "Gene_ID"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.