% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/seurat_integration.R
\name{gedi_to_seurat}
\alias{gedi_to_seurat}
\title{Convert GEDI Model to Seurat Object}
\usage{
gedi_to_seurat(
  model,
  M = NULL,
  project = "GEDI",
  assay = "RNA",
  use_imputed = TRUE,
  add_projections = TRUE,
  add_embeddings = TRUE,
  min_cells = 0,
  min_features = 0,
  verbose = TRUE
)
}
\arguments{
\item{model}{GEDI model object (trained)}

\item{M}{Original count matrix (optional). If not provided, will use
back-transformed imputed values as approximate counts.}

\item{project}{Character, project name for Seurat object (default: "GEDI")}

\item{assay}{Character, name for the main assay (default: "RNA")}

\item{use_imputed}{Logical, whether to add imputed data as separate assay
(default: TRUE)}

\item{add_projections}{Logical, whether to add ZDB and DB projections as
separate assays (default: TRUE)}

\item{add_embeddings}{Logical, whether to add UMAP and PCA embeddings if
available (default: TRUE)}

\item{min_cells}{Integer, filter genes with counts in < min_cells (default: 0)}

\item{min_features}{Integer, filter cells with < min_features genes (default: 0)}

\item{verbose}{Logical, whether to print progress messages (default: TRUE)}
}
\value{
Seurat object with:
\itemize{
\item RNA assay: Original or back-transformed counts
\item imputed assay: GEDI imputed expression (if use_imputed = TRUE)
\item ZDB/DB/ADB assays: GEDI projections (if add_projections = TRUE)
\itemize{
\item ZDB: Batch-corrected gene expression (genes x cells)
\item DB: Cell embeddings in latent factor space (K x cells)
\item ADB: Pathway activities (pathways x cells) - only if C matrix provided
}
\item umap/pca reductions: Embeddings (if add_embeddings = TRUE and cached)
\item meta.data: Sample labels and colData from GEDI model
}
}
\description{
Creates a Seurat object from a trained GEDI model, including imputed data,
projections, and embeddings.
}
\examples{
\donttest{
# Load example data
pbmc <- SeuratObject::pbmc_small

# Train GEDI model
gedi_model <- seurat_to_gedi(pbmc, K = 15)
gedi_model$train(iterations = 10)

# Convert back to Seurat
seurat_obj <- gedi_to_seurat(
  gedi_model,
  use_imputed = TRUE,
  add_projections = TRUE,
  add_embeddings = TRUE
)

# Now can use Seurat functions
library(Seurat)
DefaultAssay(seurat_obj) <- "imputed"
seurat_obj <- FindVariableFeatures(seurat_obj)
}

}
