common_clonotypes

Description

Reports clonotypes common between libraries.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
common_clonotypes(group1, group2, mode, data)

## S4 method for signature 'character,missing,missing,data.frame'
common_clonotypes(group1, data)

## S4 method for signature 'character,character,missing,data.frame'
common_clonotypes(group1,
  group2, data)

## S4 method for signature 'missing,missing,ANY,data.frame'
common_clonotypes(mode = "count",
  data)

## S4 method for signature 'missing,missing,ANY,matrix'
common_clonotypes(mode, data)

Arguments

group1

A character vector containing clonotype library names.

group2

A character vector containing clonotype library names.

mode

Only when producing a matrix of pairwise comparisons: “count” (default) or “abundance”, see below.

data

A clonotype table where the data is stored.

Details

When given one group of libraries, lists the clonotypes that have been observed at least in one library of that group. The returned list can be used to subset a data frame produced by clonotype_table.

When given two groups of libraries, lists the clonotypes that have been observed at least in one library of each group. Groups can contain a single library, in which case the returned list is simply the clonotypes found in both libraries.

When given a table of clonotypes, produces a matrix in which each cell reportsquantitatively the overlap between each pair of libraries.

Value

In “count” mode, each value in a matrix is the number of clonotypes seen in both of the two libraries considered. The matrix is therefore symmetric.

In “abundance” mode, each value indicates, for a given pair of libraries, the cumulative abundance of the common clonotypes (seen in both libraries), calculated for the library indicated by the row. The matrix is therefore not symmetric. For instance, a pair of libraries A and B can have 100 sequences each in total, one clonotype in common, which is found 8 times in A, but 54 times in B.

Methods (by class)

  • group1 = character,group2 = missing,mode = missing,data = data.frame: Reports clonotypes common between libraries.

  • group1 = character,group2 = character,mode = missing,data = data.frame: Reports clonotypes common between libraries.

  • group1 = missing,group2 = missing,mode = ANY,data = data.frame: Reports clonotypes common between libraries.

  • group1 = missing,group2 = missing,mode = ANY,data = matrix: Reports clonotypes common between libraries.

See Also

clonotype_table, unique_clonotypes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Load example data
clonotypes.long <- read_clonotypes(system.file('extdata', 'clonotypes.txt.gz', package = "clonotypeR"))
clonotypes <- clonotype_table(levels(clonotypes.long$lib), data=clonotypes.long)
summary(clonotypes)

# List clonotypes found in library A, and B or C.
common_clonotypes(group1="A", group2=c("B","C"), data=clonotypes)

# Count clonotypes found in library A, and B or C.
length(common_clonotypes(group1="A", group2=c("B","C"), data=clonotypes))

# Matrix of numbers of common clonotypes
common_clonotypes(data=clonotypes)

# Matrix of abundance of common clonotypes
common_clonotypes(data=clonotypes, mode="abundance")