Conversions | R Documentation |
All functions to convert a COTAN object to/from other
data classes used by the BioConductor
analysis packages
convertToSingleCellExperiment(objCOTAN)
convertFromSingleCellExperiment(objSCE, clNamesPattern = "")
objCOTAN |
a |
objSCE |
A SingleCellExperiment object to be converted |
clNamesPattern |
A regular expression pattern used to identify the
clustering columns in |
convertToSingleCellExperiment()
converts a COTAN object
into a SingleCellExperiment object. Stores the raw counts in the
"counts"
Assays, the metadata for genes and cells as rowData
and colData
slots respectively and finally the genes' and cells' coex
along the dataset metadata into the metadata
slot.
The function performs the following steps:
Extracts the raw counts matrix, gene metadata, cell metadata, gene
and cell co-expression matrix from the COTAN
object; the clustersCoex
slot is not converted
Identifies clusterizations and conditions in the cell metadata by the
prefixes "CL_"
and "COND_"
Renames clusterization columns with the prefix "COTAN_clusters_"
and
condition columns with the prefix "COTAN_conditions_"
Constructs a SingleCellExperiment
object with the counts matrix, gene
metadata, updated cell metadata, and stores the co-expression matrices
in the metadata
slot.
The resulting SingleCellExperiment
object is compatible with downstream
analysis packages and workflows within the Bioconductor ecosystem
convertFromSingleCellExperiment()
converts a
SingleCellExperiment object back into a COTAN object. It
supports SCE
objects that were originally created from either a COTAN
object or a Seurat
object. The function extracts the "counts"
matrix,
genes' metadata, cells' metadata, co-expression matrices (if available),
and reconstructs the COTAN
object accordingly.
The function performs the following steps:
Extracts the raw matrix from the "counts"
Assays
Extracts gene metadata from rowData
Extracts cell metadata from colData
, excluding any clusterizations or
conditions present
Attempts to retrieve co-expression matrices from the metadata
slot if
they exist
Constructs a COTAN
object using the extracted data
Adds back the clusterizations and conditions using COTAN
methods
If the COEX is not present (e.g., in SCE
objects created from Seurat
),
the genesCoex
and cellsCoex
slots in the resulting COTAN
object will
be empty matrices
A SingleCellExperiment object containing the data from the input COTAN object, with clusterizations and conditions appropriately prefixed and stored in the cell metadata.
A COTAN object containing the data extracted from the input SingleCellExperiment object
COTAN, SingleCellExperiment
COTAN, SingleCellExperiment
data("test.dataset")
obj <- COTAN(raw = test.dataset)
obj <- proceedToCoex(obj, calcCoex = FALSE, saveObj = FALSE)
sce <- convertToSingleCellExperiment(objCOTAN = obj)
newObj <- convertFromSingleCellExperiment(sce)
identical(getDims(newObj), getDims(obj))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.