% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Palantir.R
\name{Palantir.Magic}
\alias{Palantir.Magic}
\title{Run MAGIC for Gene Expression Smoothing}
\usage{
Palantir.Magic(
  seu,
  n_top_genes = 2000,
  n_components = 20,
  conda_env = "seuratextend"
)
}
\arguments{
\item{seu}{A Seurat object containing single-cell RNA-seq data to which the MAGIC algorithm will be applied.}

\item{n_top_genes}{The number of top variable genes to consider in the MAGIC algorithm, which helps in focusing the smoothing on the most informative genes. Default: 2000}

\item{n_components}{The number of principal components to use in dimensionality reduction before applying MAGIC. Useful for preprocessing the data to enhance the effects of MAGIC. Default: 20}

\item{conda_env}{The name of the Conda environment where the necessary Python dependencies for running MAGIC are installed. This environment is used to run Python code from R, ensuring smooth integration of the two platforms. Default: 'seuratextend'}
}
\value{
Updates the provided Seurat object by adding a new assay named 'magic', which contains the denoised and smoothed gene expression data.
}
\description{
Applies the MAGIC (Markov Affinity-based Graph Imputation of Cells) algorithm to a Seurat object to denoise and smooth gene expression data. This technique enhances data interpretability by imputing missing data and reducing technical noise.
}
\details{
MAGIC uses a graph-based approach to infer and smooth gene expression across similar cells, effectively filling in gaps in the data where measurements are sparse or noisy. This process is especially beneficial in datasets with high levels of technical noise or when trying to resolve subtle biological signals that might be obscured by this noise.
}
\examples{
library(Seurat)
library(SeuratExtend)

# Download the example Seurat Object
mye_small <- readRDS(url("https://zenodo.org/records/10944066/files/pbmc10k_mye_small_velocyto.rds", "rb"))

# Run MAGIC
mye_small <- Palantir.Magic(mye_small)

# Visualizing the effects of MAGIC on selected genes
DimPlot2(mye_small, features = c("CD14", "magic_CD14", "FLT3", "magic_FLT3"))

}
