Learn R Programming

tcR (version 2.3.2)

group.clonotypes: Get all unique clonotypes.

Description

Get all unique clonotypes with merged counts. Unique clonotypes are those with either equal CDR3 sequence or with equal CDR3 sequence and equal gene segments. Counts of equal clonotypes will be summed up.

Usage

group.clonotypes(
  .data,
  .gene.col = "V.gene",
  .count.col = "Read.count",
  .prop.col = "Read.proportion",
  .seq.col = "CDR3.amino.acid.sequence"
)

Arguments

.data

Either tcR data frame or a list with data frames.

.gene.col

Either name of the column with gene segments used to compare clonotypes or NA if you don't need comparing using gene segments.

.count.col

Name of the column with counts for each clonotype.

.prop.col

Name of the column with proportions for each clonotype.

.seq.col

Name of the column with clonotypes' CDR3 sequences.

Value

Data frame or a list with data frames with updated counts and proportion columns and rows with unique clonotypes only.

Examples

Run this code
# NOT RUN {
tmp <- data.frame(A = c('a','a','b','c', 'a')
B = c('V1', 'V1','V1','V2', 'V3')
C = c(10,20,30,40,50), stringsAsFactors = F)
tmp
#   A  B  C
# 1 a V1 10
# 2 a V1 20
# 3 b V1 30
# 4 c V2 40
# 5 a V3 50
group.clonotypes(tmp, 'B', 'C', 'A')
#  A  B  C
#  1 a V1 30
#  3 b V1 50
#  4 c V2 30
#  5 a V3 40
group.clonotypes(tmp, NA, 'C', 'A')
#   A  B  C
# 1 a V1 80
# 3 b V1 30
# 4 c V2 40
# For tcR data frame:
data(twb)
twb1.gr <- group.clonotypes(twb[[1]])
twb.gr <- group.clonotypes(twb)
# }

Run the code above in your browser using DataLab