R/clonalSizeDistribution.R
clonalSizeDistribution.Rd
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"
)
The product of combineTCR()
,
combineBCR()
, or combineExpression()
.
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.
indicate if both or a specific chain should be used - e.g. "both", "TRA", "TRG", "IGH", "IGL".
The clustering parameter for the dendrogram.
Numerical vector containing the thresholds the grid search was performed over.
The variable to use for grouping.
Returns the data frame used for forming the graph.
Colors to use in visualization - input any hcl.pals.
ggplot dendrogram of the clone size distribution
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\)
#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")