Last data update: 2014.03.03

R: Create a table count of clonotypes or other features.
clonotype_tableR Documentation

Create a table count of clonotypes or other features.

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

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

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

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(clonotypeR)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/clonotypeR/clonotype_table.Rd_%03d_medium.png", width=480, height=480)
> ### Name: clonotype_table
> ### Title: Create a table count of clonotypes or other features.
> ### Aliases: clonotype_table
> ### Keywords: clonotype
> 
> ### ** Examples
> 
> # 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)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>