clonotype_table: Create a table count of clonotypes or other features.

Description Usage Arguments Value Author(s) See Also Examples

Description

Using a clonotype data frame loaded with read_clonotypes, clonotype_table will create a table counting how many times each clonotypes have been seen in each libraries. By default, the unproductive rearrangements are filtered out.

Usage

1
clonotype_table(libs, feats=c("V","pep","J"), data, filter=(data$unproductive | data$ambiguous), minscore=0, minqual=1, sample=FALSE)

Arguments

libs

A character vector containing the name of one or many libraries. Same names must not appear twice. If no library names are provided, all the libraries present in the clonotypes data frame will be used.

feats

What to count. By default, it counts clonotypes, defined as c("V","pep","J"). But it can also count single features, such as the V or J segments.

data

Data frame as loaded by read_clonotypes.

filter

Logical vector to filter out clonotypes. By default it relies on the clonotypes data frame to provide a “unproductive” column that indicates clonotypes with a stop codon or a frame shift, and a “ambiguous” column that indicates clonotypes where the DNA sequences has ambiguous (“N”) nucleotides.

minscore

Minimum alignment score. Clonotypes with an alignment score lower than this value are discarded.

minqual

Minimum mapping quality. Clonotypes with a mapping quality lower than this value are discarded.

sample

Indicate the number of clonotypes to randomly sample from the library (no replacement). Default: no subsampling.

Value

clonotype_table returns a data frame, where row names are features (clonotypes, segment names, ...), column names are libraries, and values are number of times each feature was found in each library.

Author(s)

Charles Plessy

See Also

read_clonotypes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Read the package's example data
clonotypes <- read_clonotypes(system.file('extdata', 'clonotypes.txt.gz', package = "clonotypeR"))

# Inspect the alignment scores
hist(clonotypes$score)

# Count J segments
j <- clonotype_table(levels(clonotypes$lib), "J", data=clonotypes)

# Normalise counts in parts per million
J <- data.frame(prop.table(as.matrix(j),2) * 1000000)

charles-plessy/clonotypeR.old documentation built on May 13, 2019, 3:31 p.m.