R: Tabulates V(D)J allele, gene or family usage.

countGenes {alakazam} | R Documentation

## Tabulates V(D)J allele, gene or family usage.

### Description

Determines the count and relative abundance of V(D)J alleles, genes or families within groups.

### Usage

    countGenes(data, gene, groups = NULL, copy = NULL, clone = NULL,
      fill = FALSE, mode = c("gene", "allele", "family", "asis"))

### Arguments

`data` | data.frame with Change-O style columns.
`gene` | column containing allele assignments. Only the first allele in the column will be considered when `mode` is "gene", "family" or "allele". The value will be used as it is with `mode="asis"`.
`groups` | columns containing grouping variables. If `NULL` do not group.
`copy` | name of the `data` column containing copy numbers for each sequence. If this value is specified, then total copy abundance is determined by the sum of copy numbers within each gene. This argument is ignored if `clone` is specified.
`clone` | name of the `data` column containing clone identifiers for each sequence. If this value is specified, then one gene will be considered for each clone. Note, this is accomplished by using the most common gene within each `clone` identifier. As such, ambiguous alleles within a clone will not be accurately represented.
`fill` | logical of `c(TRUE, FALSE)` specifying when if groups (when specified) lacking a particular gene should be counted as 0 if TRUE or not (omitted)
`mode` | one of `c("gene", "family", "allele", "asis")` defining the degree of specificity regarding allele calls. Determines whether to return counts for genes (calling `getGene`), families (calling `getFamily`), alleles (calling `getAllele`) or using the value as it is in the column `gene`, without any processing.

### Value

A data.frame summarizing family, gene or allele counts and frequencies with columns:

- `GENE`: name of the family, gene or allele

- `SEQ_COUNT`: total number of sequences for the gene.

- `SEQ_FREQ`: frequency of the gene as a fraction of the total number of sequences within each grouping.

- `COPY_COUNT`: sum of the copy counts in the `copy` column. for each gene. Only present if the `copy` argument is specified.

- `COPY_FREQ`: frequency of the gene as a fraction of the total copy number within each group. Only present if the `copy` argument is specified.

- `CLONE_COUNT`: total number of clones for the gene.

- `CLONE_FREQ`: frequency of the gene as a fraction of the total number of clones within each grouping.

Additional columns defined by the `groups` argument will also be present.

### Examples

    # Without copy numbers
    genes <- countGenes(ExampleDb, gene="V_CALL", groups="SAMPLE", mode="family")
    genes <- countGenes(ExampleDb, gene="V_CALL", groups="SAMPLE", mode="gene")
    genes <- countGenes(ExampleDb, gene="V_CALL", groups="SAMPLE", mode="allele")

    # With copy numbers and multiple groups
    genes <- countGenes(ExampleDb, gene="V_CALL", groups=c("SAMPLE", "ISOTYPE"),
                        copy="DUPCOUNT", mode="family")

    # Count by clone
    genes <- countGenes(ExampleDb, gene="V_CALL", groups=c("SAMPLE", "ISOTYPE"),
                        clone="CLONE", mode="family")

    # Count absent genes
    genes <- countGenes(ExampleDb, gene="V_CALL", groups="SAMPLE",
                        mode="allele", fill=TRUE)

[Package alakazam version 0.3.0 Index]