% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gene_query.R
\name{get.gene.expression}
\alias{get.gene.expression}
\title{Extract Gene Expression by Probe ID}
\usage{
get.gene.expression(expression, probe.id)
}
\arguments{
\item{expression}{Numeric matrix of gene expression values as returned by
\code{extract.expression()$expression}. Rows are probe IDs, columns are
sample IDs.}

\item{probe.id}{Integer vector of one or more probe IDs as returned by
\code{find.probe.by.gene()}.}
}
\value{
A numeric matrix with one row per probe and one column per sample.
Row names are the probe IDs; column names are the sample IDs. When a
single probe ID is supplied the result is still a matrix (not a vector),
ensuring that \code{build.analysis.df()} receives a consistent input type.
}
\description{
Retrieves expression values for one or more genes from the expression matrix
using their integer probe IDs.
}
\details{
The returned matrix is the direct input for \code{build.analysis.df()}.
Using \code{as.matrix()} ensures the single-probe case returns a one-row
matrix rather than a named vector, which keeps the \code{pivot_longer}
step in \code{build.analysis.df()} consistent regardless of how many genes
are queried.
}
\examples{
\donttest{
geo <- extract.expression(load.geo.soft(accession = "GDS3268", log.transform = TRUE))
probes <- find.probe.by.gene(geo$gene, c(
  "mucin 20, cell surface associated",
  "alcohol dehydrogenase 1A (class I), alpha polypeptide"
))
expr <- get.gene.expression(geo$expression, probes)
dim(expr)  # probes x samples
}

}
