% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pairing-methods.R
\name{rank_prevalence_ccdb}
\alias{rank_prevalence_ccdb}
\alias{rank_chain_ccdb}
\title{Rank contigs, per cell, by experiment-wide prevalence of \code{cluster_pk}, which is added as the \code{prevalence} field}
\usage{
rank_prevalence_ccdb(
  ccdb,
  contig_filter_args = TRUE,
  tie_break_keys = c("umis", "reads")
)

rank_chain_ccdb(
  ccdb,
  contig_filter_args = TRUE,
  tie_break_keys = c("umis", "reads"),
  chain_key = "chain",
  contig_fields = tie_break_keys,
  chain_levels = c("IGL", "IGK", "TRA", "TRB", "IGH")
)
}
\arguments{
\item{ccdb}{\code{\link[=ContigCellDB]{ContigCellDB()}}}

\item{contig_filter_args}{an expression passed to \code{\link[dplyr:filter]{dplyr::filter()}}.
Unlike \code{filter}, multiple criteria must be \code{&} together, rather than using
commas to separate. These act on \code{ccdb$contig_tbl}}

\item{tie_break_keys}{(optional) \code{character} naming fields in \code{contig_tbl}
that are used sort the contig table in descending order.
Used to break ties if \code{contig_filter_args} does not return a unique contig
for each cluster}

\item{chain_key}{\code{character} naming the field in \code{contig_tbl} to be sorted on.}

\item{contig_fields}{Optional fields from \code{contig_tbl} that will be copied into
the \code{cluster_tbl} from the canonical contig.}

\item{chain_levels}{an optional \code{character} vector providing the sort order of the \code{chain} column in \code{tbl}.  If set to length zero, then the the ordering will be alphabetical}
}
\value{
\code{ContigCellDB} with modified \code{contig_tbl}
}
\description{
Rank contigs, per cell, by experiment-wide prevalence of \code{cluster_pk}, which is added as the \code{prevalence} field
}
\section{Functions}{
\itemize{
\item \code{rank_chain_ccdb}: return a canonical contig by chain type, with TRB/IGH returned first. By default, ties are broken by umis and reads.
}}

\examples{
data(ccdb_ex)
ccdb_ex = cluster_germline(ccdb_ex)
rank_prev = rank_prevalence_ccdb(ccdb_ex)
rank_prev$contig_tbl
rank_chain = rank_chain_ccdb(ccdb_ex)
rank_chain$contig_tbl
}
