% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/coerce-methods.R
\name{GraphExperiment-coerce}
\alias{GraphExperiment-coerce}
\alias{coerce,SingleCellExperiment,GraphExperiment-method}
\alias{coerce,SummarizedExperiment,GraphExperiment-method}
\alias{coerce,RangedSummarizedExperiment,GraphExperiment-method}
\title{Coercion methods for \code{GraphExperiment} objects}
\arguments{
\item{from}{An object of class \code{SingleCellExperiment},
\code{SummarizedExperiment}, or \code{RangedSummarizedExperiment} to be
coerced to \code{GraphExperiment}.}
}
\value{
A \code{GraphExperiment} object.
}
\description{
The \code{GraphExperiment} class inherits from \code{SingleCellExperiment},
which in turn inherits from \code{(Ranged)SummarizedExperiment}. To ensure
\code{GraphExperiment} easily interoperates with these classes, we provide
users with traditional \code{as()} coercion methods.
}
\examples{
# Simulate a count matrix
gene_ids <- paste0("gene", seq_len(200))
cell_ids <- paste0("cell", seq_len(100))
mat <- matrix(rpois(20000, 5), ncol = 100, dimnames = list(gene_ids, cell_ids))

# Coerce from `SummarizedExperiment`
se <- SummarizedExperiment(assays = list(mat))
as(se, "GraphExperiment")

# Coerce from `RangedSummarizedExperiment`
rse <- as(se, "RangedSummarizedExperiment")
as(rse, "GraphExperiment")

# Coerce from `SingleCellExperiment`
sce <- as(se, "SingleCellExperiment")
as(sce, "GraphExperiment")
}
