getSharedClones {APackOfTheClones} | R Documentation |
Compute a list of clonotypes that are shared between seurat clusters
Description
This function allows users to get a list of clonotypes that are shared
between clusters based on the levels of the active cell identities / some
custom identity based on the alt_ident
. A list is returned with its
names being the shared clonotypes, and the values are numeric vectors
indicating the index of the clusters that clonotype is found in. The index
corresponds to the index in the default levels of the factored identities.
If run_id
is inputted, then the function will attempt to get the shared
clonotypes from the corresponding APackOfTheClones run generated from
RunAPOTC. Otherwise, it will use the filtering / subsetting parameters
to generate the shared clones.
Usage
getSharedClones(
seurat_obj,
reduction_base = "umap",
clonecall = "strict",
...,
extra_filter = NULL,
alt_ident = NULL,
run_id = NULL,
top = NULL,
top_per_cl = NULL,
intop = NULL,
intop_per_cl = NULL,
publicity = c(2L, Inf)
)
Arguments
seurat_obj |
Seurat object with one or more dimension reductions and
already have been integrated with a TCR/BCR library with
|
reduction_base |
character. The seurat reduction to base the clonal
expansion plotting on. Defaults to |
clonecall |
character. The column name in the seurat object metadata to
use. See |
... |
additional "subsetting" keyword arguments indicating the rows
corresponding to elements in the seurat object metadata that should be
filtered by. E.g., |
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 |
alt_ident |
character. By default, cluster identity is assumed to be
whatever is in |
run_id |
character. This will be the ID associated with the data of a
run, and will be used by other important functions like APOTCPlot and
AdjustAPOTC. Defaults to
where if keyword arguments and extra_filter are underscore characters if
there was no input for the |
top |
integer or numeric in (0, 1) - if not null, filters the output
clones so that only the shared clonotypes with counts the top |
top_per_cl |
integer or numeric in (0, 1) - if not null, filters the
output clones so that for each seurat cluster, only the clonotypes with the
|
intop |
integer or numeric in (0, 1) - if not null, filters the raw
clone sizes before computing the shared clonotypes so that only the
clonotypes that have their overall size in the top |
intop_per_cl |
integer or numeric in (0, 1) - if not null, filters
the raw clustered clone sizes before computing shared clones, so that
for every clone in a seurat cluster, the top |
publicity |
numeric pair. A simple filter range of
|
Value
a named list where each name is a clonotype, each element is a numeric indicating which seurat cluster(s) its in, in no particular order. If no shared clones are present, the output is an empty list.
Examples
data("combined_pbmc")
getSharedClones(combined_pbmc)
getSharedClones(
combined_pbmc,
orig.ident = c("P17B", "P18B"), # a named subsetting parameter
clonecall = "aa"
)
# extract shared clones from a past RunAPOTC run
combined_pbmc <- RunAPOTC(
combined_pbmc, run_id = "foo", verbose = FALSE
)
getSharedClones(
combined_pbmc, run_id = "foo", top = 5
)
# doing a run and then getting the clones works too
combined_pbmc <- RunAPOTC(combined_pbmc, run_id = "run1", verbose = FALSE)
getSharedClones(combined_pbmc, run_id = "run1")