This function produces a hierarchical clustering of clones by sample using discrete gamma-GPD spliced threshold model. If using this model please read and cite powerTCR (more info available at PMID: 30485278).

clonalSizeDistribution(
  input.data,
  cloneCall = "strict",
  chain = "both",
  method = "ward.D2",
  threshold = 1,
  group.by = NULL,
  exportTable = FALSE,
  palette = "inferno",
  ...
)

Arguments

input.data

The product of combineTCR(), combineBCR(), or combineExpression().

cloneCall

Defines the clonal sequence grouping. Accepted values are: gene (VDJC genes), nt (CDR3 nucleotide sequence), aa (CDR3 amino acid sequence), or strict (VDJC + nt). A custom column header can also be used.

chain

The TCR/BCR chain to use. Use both to include both chains (e.g., TRA/TRB). Accepted values: TRA, TRB, TRG, TRD, IGH, IGL (for both light chains), both.

method

The clustering parameter for the dendrogram.

threshold

Numerical vector containing the thresholds the grid search was performed over.

group.by

A column header in the metadata or lists to group the analysis by (e.g., "sample", "treatment"). If NULL, data will be analyzed as by list element or active identity in the case of single-cell objects.

exportTable

If TRUE, returns a data frame or matrix of the results instead of a plot.

palette

Colors to use in visualization - input any hcl.pals.

...

Additional arguments passed to the ggplot theme

Value

A ggplot object visualizing dendrogram of clonal size distribution or a data.frame if exportTable = TRUE.

Details

The probability density function (pdf) for the Generalized Pareto Distribution (GPD) is given by: f(x|μ,σ,ξ)=1σ(1+ξ(xμσ))(1ξ+1)

Where:

  • μ is a location parameter

  • σ>0 is a scale parameter

  • ξ is a shape parameter

  • xμ if ξ0 and μxμσ/ξ if ξ<0

The probability density function (pdf) for the Gamma Distribution is given by: f(x|α,β)=xα1ex/ββαΓ(α)

Where:

  • α>0 is the shape parameter

  • β>0 is the scale parameter

  • x0

  • Γ(α) is the gamma function of α

Author

Hillary Koch

Examples

# Making combined contig data
combined <- combineTCR(contig_list,
                       samples = c("P17B", "P17L", "P18B", "P18L",
                                   "P19B","P19L", "P20B", "P20L"))

# Using clonalSizeDistribution()
clonalSizeDistribution(combined, 
                       cloneCall = "strict", 
                       method="ward.D2")