countCloneSizes {APackOfTheClones}R Documentation

count the number of clonotype sizes in a seurat object combined with a VDJ library overall or by cluster

Description

[Stable]

Get clonotype frequencies from a seurat object's metadata, either as one whole table, or in a list of tables, based on the current / some custom ident of each cell. Note that depending on the ident (indicated by the by_cluster argument) there may be more or less clonotypes counted based on the number of rows containing NA for that column of that ident if it isn't the active ident.

Usage

countCloneSizes(
  seurat_obj,
  clonecall = "strict",
  extra_filter = NULL,
  ...,
  by_cluster = TRUE,
  sort_decreasing = NULL
)

Arguments

seurat_obj

a seurat object combined with a VDJ library with the scRepertoire.

clonecall

character. The column name in the seurat object metadata to use. See scRepertoire documentation for more information about this parameter that is central to both packages.

extra_filter

character. An additional string that should be formatted exactly like a statement one would pass into dplyr::filter that does additional filtering to cells in the seurat object - on top of the other keyword arguments - based on the metadata. This means that it will be logically AND'ed with any keyword argument filters. This is a more flexible alternative / addition to the filtering keyword arguments. For example, if one wanted to filter by the length of the amino acid sequence of TCRs, one could pass in something like extra_filter = "nchar(CTaa) - 1 > 10". When involving characters, ensure to enclose with single quotes.

...

additional "subsetting" keyword arguments indicating the rows corresponding to elements in the seurat object metadata that should be filtered by. E.g., seurat_clusters = c(1, 9, 10) will filter the cells to those in the seurat_clusters column with any of the values 1, 9, and 10. Unfortunately, column names in the seurat object metadata cannot conflict with the keyword arguments. MAJOR NOTE if any subsetting keyword arguments are a prefix of any preceding argument names (e.g. a column named reduction is a prefix of the reduction_base argument) R will interpret it as the same argument unless both arguments are named. Additionally, this means any subsequent arguments must be named.

by_cluster

Logical or Character. If TRUE, will output a list of table objects, with the table at each index corresponding to level in Idents(). Each table's names are the clonotype name indicated by clonecall after filtering, while the values are the actual clone sizes. If FALSE, outputs just the aggregate clone sizes for all cells. Note that if FALSE, the output should be identical to that produced by mergeCloneSizes(countCloneSizes(..., by_cluster = TRUE)). Otherwise, this argument can also be a character indicating some column in the seurat object metadata to use a cell identity guiding (e.g. "seurat_clusters").

sort_decreasing

a logical or NULL. If TRUE/FALSE, sorts each/the table by clonotype frequency with largest/smallest clones first with a stable sorting algorithm, and if NULL, no order is guaranteed but the output is deterministic.

Value

A list of tables or a single table depending on by_cluster

See Also

mergeCloneSizes

Examples

data("combined_pbmc")

countCloneSizes(combined_pbmc)
countCloneSizes(combined_pbmc, "aa")
countCloneSizes(combined_pbmc, "nt", orig.ident = c("P17B", "P17L"))


[Package APackOfTheClones version 1.2.0 Index]