% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gedi_plots.R
\name{plot_feature_ratio}
\alias{plot_feature_ratio}
\title{Plot Two-Feature Comparison}
\usage{
plot_feature_ratio(
  model,
  gene1,
  gene2,
  comparison = "difference",
  embedding = "umap",
  projection = "zdb",
  color_limits = NULL,
  randomize = TRUE,
  point_size = 0.3,
  alpha = 0.9,
  title = NULL
)
}
\arguments{
\item{model}{GEDI model object}

\item{gene1}{Character or integer, first gene name or index}

\item{gene2}{Character or integer, second gene name or index}

\item{comparison}{Character, type of comparison ("difference" or "correlation")}

\item{embedding}{Character specifying embedding type ("umap", "pca") or
a custom N x 2 matrix}

\item{projection}{Character, type of projection ("zdb" or "db")}

\item{color_limits}{Numeric vector c(low, high) or NULL for auto-compute}

\item{randomize}{Logical, whether to randomize point order}

\item{point_size}{Numeric, size of points}

\item{alpha}{Numeric, transparency of points}

\item{title}{Character, plot title}
}
\value{
ggplot2 object
}
\description{
Compares two features by computing their difference or correlation in
the projected space. Mathematically grounded for GEDI's log-space representation.
}
\details{
For comparison = "difference":
Computes \verb{(Z[gene1,] - Z[gene2,]) * D * B}, equivalent to \verb{ZDB[gene1,] - ZDB[gene2,]}.
In log-space, this represents log(gene1/gene2) in the original count space.
Positive values indicate gene1 > gene2, negative indicates gene2 > gene1.
}
\examples{
\donttest{
if (requireNamespace("SeuratObject", quietly = TRUE)) {
  pbmc_small <- SeuratObject::pbmc_small
  model <- CreateGEDIObject(
    Samples = pbmc_small@meta.data$orig.ident,
    M       = pbmc_small@assays$RNA@counts,
    K       = 3,
    verbose = 0
  )
  model$train(iterations = 5)
  gene1 <- rownames(pbmc_small)[1]
  gene2 <- rownames(pbmc_small)[2]
  plot_feature_ratio(model, gene1, gene2, comparison = "difference",
                     embedding = "pca")
}
}

}
