clonalSizeDistribution: Hierarchical clustering of clones using Gamma-GPD spliced...

View source: R/clonalSizeDistribution.R

clonalSizeDistributionR Documentation

Hierarchical clustering of clones using Gamma-GPD spliced threshold model

Description

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).

Usage

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

How to call the clone - VDJC gene (gene), CDR3 nucleotide (nt), CDR3 amino acid (aa), VDJC gene + CDR3 nucleotide (strict) or a custom variable in the data.

chain

indicate if both or a specific chain should be used - e.g. "both", "TRA", "TRG", "IGH", "IGL".

method

The clustering parameter for the dendrogram.

threshold

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

group.by

The variable to use for grouping.

exportTable

Returns the data frame used for forming the graph.

palette

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

Details

The probability density function (pdf) for the Generalized Pareto Distribution (GPD) is given by:

f(x|\mu, \sigma, \xi) = \frac{1}{\sigma} \left( 1 + \xi \left( \frac{x - \mu}{\sigma} \right) \right)^{-\left( \frac{1}{\xi} + 1 \right)}

Where:

  • \mu is a location parameter

  • \sigma > 0 is a scale parameter

  • \xi is a shape parameter

  • x \ge \mu if \xi \ge 0 and \mu \le x \le \mu - \sigma/\xi if \xi < 0

The probability density function (pdf) for the Gamma Distribution is given by:

f(x|\alpha, \beta) = \frac{x^{\alpha-1} e^{-x/\beta}}{\beta^\alpha \Gamma(\alpha)}

Where:

  • \alpha > 0 is the shape parameter

  • \beta > 0 is the scale parameter

  • x \ge 0

  • \Gamma(\alpha) is the gamma function of \alpha

Value

ggplot dendrogram of the clone size distribution

Author(s)

Hillary Koch

Examples

#Making combined contig data
combined <- combineTCR(contig_list, 
                        samples = c("P17B", "P17L", "P18B", "P18L", 
                                    "P19B","P19L", "P20B", "P20L"))
clonalSizeDistribution(combined, cloneCall = "strict", method="ward.D2")


ncborcherding/scRepertoire documentation built on Nov. 5, 2024, 2:05 p.m.