Learn R Programming

tcR (version 2.3.2)

geneUsage: Gene usage.

Description

Compute frequencies or counts of gene segments ("V / J - usage").

Usage

geneUsage(
  .data,
  .genes = HUMAN_TRBV_MITCR,
  .quant = c(NA, "read.count", "umi.count", "read.prop", "umi.prop"),
  .norm = F,
  .ambig = F
)

Arguments

.data

Cloneset data frame or a list with clonesets.

.genes

Either one of the gene alphabet (e.g., HUMAN_TRBV, genealphabets) or list with two gene alphabets for computing joint distribution.

.quant

Which column to use for the quantity of clonotypes: NA for computing only number of genes without using clonotype counts, "read.count" for the "Read.count" column, "umi.count" for the "Umi.count" column, "read.prop" for the "Read.proportion" column, "umi.prop" for the "Umi.proportion" column.

.norm

If T then return proportions of resulting counting of genes.

.ambig

If F than remove from counting genes which are not presented in the given gene alphabet(s).

Value

If .data is a cloneset and .genes is NOT a list than return a data frame with first column "Gene" with genes and second with counts / proportions.

If .data is a list with clonesets and .genes is NOT a list than return a data frame with first column "Gene" with genes and other columns with counts / proportions for each cloneset in the input list.

If .data is a cloneset and .genes IS a list than return a matrix with gene segments for the first gene in .genes and column names for the second gene in .genes. See "Examples".

If .data is a list with clonesets and .genes IS a list than return a list with matrices like in the previous case.

See Also

genealphabets, vis.gene.usage, pca.segments

Examples

Run this code
# NOT RUN {
# Load your data
data(twb)
# compute V-segments frequencies of human TCR beta.
seg <- geneUsage(twb, HUMAN_TRBV, .norm = T)
# plot V-segments frequencies as a heatmap
vis.heatmap(seg, .labs = c("Sample", "V gene"))
# plot V-segments frequencies directly from clonesets
vis.gene.usage(twb, HUMAN_TRBV)
# plot V-segments frequencies from the gene frequencies
vis.gene.usage(seg, NA)
# Compute V-J joint usage.
geneUsage(twb, list(HUMAN_TRBV, HUMAN_TRBJ))
# for future:
# geneUsage(twb, "human", "trbv")
# }

Run the code above in your browser using DataLab