% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/knn.R
\name{knnOutliers}
\alias{knnOutliers}
\title{Find outliers in terms of their distance in the k-nearest neighbor network}
\usage{
knnOutliers(
  object,
  nn.1 = 1,
  nn.2 = 20,
  x.max,
  slope.r,
  int.r,
  slope.b,
  int.b,
  title = "",
  invert = F
)
}
\arguments{
\item{object}{An URD object}

\item{nn.1}{(Numeric) Nearest neighbor to compare on x-axis}

\item{nn.2}{(Numeric) Nearest neighbor to compare on y-axis}

\item{x.max}{(Numeric) Maximum distance to nearest neighbor \code{nn.1} (green line)}

\item{slope.r}{(Numeric) Slope of red line}

\item{int.r}{(Numeric) y-intercept of red line}

\item{slope.b}{(Numeric) Slope of blue line}

\item{int.b}{(Numeric) y-intercept of blue line}

\item{title}{(Character) Title of the plot}
}
\value{
Character vector of outlier cells (or non-outliers, if \code{invert=T})
}
\description{
Plots density of cells, given their distance in gene expression to their
nearest and nth nearest neighbors.
}
\details{
Since the diffusion map is calcated on a k-nearest neighbor graph in gene
expression space, cells that have unusual distances to their nearest
neighbors in a k-nearest neighbor graph often cause poor resulting diffusion
maps. Cropping cells based on their distance to their nearest neighbor, and
cropping cells that have unusually large distances to an nth nearest neighbor,
given the distance to their nearest neighbor, generally produces better results.
}
