plot_cluster_factors {CellaRepertorium}R Documentation

Visualization of pairs of cluster factor

Description

With factors, a pair of variables present in the contig_tbl and the cluster_tbl, generate and plot cross-tabs of the number of contigs, or its pearson residual.

Usage

plot_cluster_factors(
  ccdb,
  factors,
  type = c("heatmap", "network"),
  statistic = c("pearson", "contigs"),
  ncluster = 0,
  chaintype
)

Arguments

ccdb

A ContigCellDB object.

factors

character length 2 of fields present

type

Type of visualization, a heatmap or a node-edge network plot

statistic

Cluster characteristics visualized by pearson residuals or raw contig counts

ncluster

integer. Omit factors that occur less than nclusters. For clarity of visualization.

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'

See Also

canonicalize_cluster to "roll-up" additional contig variables into the 'cluster_tbl“

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)

[Package CellaRepertorium version 1.3.1 Index]