% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/getBackgroundKNN.R
\name{getBackgroundKNN}
\alias{getBackgroundKNN}
\title{getBackgroundKNN}
\usage{
getBackgroundKNN(
  se,
  expectation = NULL,
  bias = NULL,
  k = 50,
  weights = c("linear", "poly", "none"),
  pseudo = 0.1,
  ...
)
}
\arguments{
\item{se}{A SummarizedExperiment containing a 'counts' assay, or a matrix of
counts.}

\item{expectation}{A vector of expectations. If NULL, will use the mean
counts of \code{se}}

\item{bias}{A data.frame of sources of bias (beside \code{expectation}) to
consider (one per column), with the same nrow as \code{se}.}

\item{k}{Number of nearest neighbors to use.}

\item{weights}{How to weigh the different bias dimensions. If "none", they
will not be re-weighted. If 'linear' (default), they are weighted by the
absolute Pearson correlation with the over-dispersion. If "poly", by the
R^2 of a 2nd degree polynomial fit of the over-dispersion.}

\item{pseudo}{Pseudocount for log transformation.}

\item{...}{Passed to \code{\link[BiocNeighbors]{findKNN}}.}
}
\value{
A sparse peak-by-peak kNN matrix.
}
\description{
Computes k-nearest neighbors for each peaks based on the continuous,
multidimensional bias space. This is inpsired by Ruochi Zhang's approach in
scPrinter.
}
\examples{
SE <- getDummyData()$counts
bg <- getBackgroundKNN(SE)
}
