% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_clustering.R
\name{plot_cluster_factors}
\alias{plot_cluster_factors}
\title{Visualization of pairs of cluster factor}
\usage{
plot_cluster_factors(
  ccdb,
  factors,
  type = c("heatmap", "network"),
  statistic = c("pearson", "contigs"),
  ncluster = 0,
  chaintype
)
}
\arguments{
\item{ccdb}{A ContigCellDB object.}

\item{factors}{\code{character} length 2 of fields present}

\item{type}{Type of visualization, a heatmap or a node-edge network plot}

\item{statistic}{Cluster characteristics visualized by pearson residuals or raw contig counts}

\item{ncluster}{\code{integer}.  Omit factors that occur less than \code{nclusters}. For clarity of visualization.}

\item{chaintype}{Character in ccdb$contig_tbl$chain. If passed will subset contigs belonging to specified chain (IGH,IGK,IGL,TRA,TRB)}
}
\value{
A ggraph object if type == 'network', and a ggplot object if type == 'heatmap'
}
\description{
With \code{factors}, a pair of variables present in the \code{contig_tbl} and the \code{cluster_tbl},
generate and plot cross-tabs of the number of contigs, or its pearson residual.
}
\examples{
library(ggraph)
data(ccdb_ex)
ccdb_germline_ex = cluster_germline(ccdb_ex, segment_keys = c('v_gene', 'j_gene', 'chain'),
cluster_pk = 'segment_idx')
ccdb_germline_ex = fine_clustering(ccdb_germline_ex, sequence_key = 'cdr3_nt', type = 'DNA')
plot_cluster_factors(ccdb_germline_ex,factors = c('v_gene','j_gene'),
statistic = 'pearson', type = 'network' ,ncluster = 10, chaintype = 'TRB')
plot_cluster_factors(ccdb_germline_ex,factors = c('v_gene','j_gene'),
statistic = 'contigs', type = 'heatmap')
plot_cluster_factors(ccdb_germline_ex,factors = c('v_gene','j_gene'),
statistic = 'contigs', type = 'network', ncluster = 10)
}
\seealso{
canonicalize_cluster to "roll-up" additional contig variables into the `cluster_tbl``
}
