clonalOverlap {scRepertoire} | R Documentation

## Examining the clonal overlap between groups or samples

### Description

This functions allows for the caclulation and visualizations of the overlap coefficient or morisita index for clonotypes using the product of combineTCR(), combineBCR() or expression2list(). The overlap coefficient is calculated using the intersection of clonotypes divided by the length of the smallest componenet. Morisita index is estimating the dispersion of a population, more information can be found [here](https://en.wikipedia.org/wiki/Morisita If a matrix output for the data is preferred, set exportTable = TRUE.

### Usage

    clonalOverlap(
      df,
      cloneCall = c("gene", "nt", "aa", "gene+nt"),
      method = c("overlap", "morisita"),
      exportTable = FALSE
    )

### Arguments

`df` | The product of combineTCR(), combineBCR(), or expression2List().
`cloneCall` | How to call the clonotype - CDR3 gene (gene), CDR3 nucleotide (nt) or CDR3 amino acid (aa), or CDR3 gene+nucleotide (gene+nt).
`method` | The method to calculate the overlap, either the overlap coefficient or morisita index.
`exportTable` | Exports a table of the data into the global environment in addition to the visualization

### Value

ggplot of the clonotypic overlap between elements of a list

### Examples

    #Making combined contig data
    x <- contig_list
    combined <- combineTCR(x, rep(c("PX", "PY", "PZ"), each=2),
    rep(c("P", "T"), 3), cells ="T-AB")

    clonalOverlap(combined, cloneCall = "gene", method = "overlap")

[Package scRepertoire version 1.2.0 Index]