AdjustAPOTC {APackOfTheClones} | R Documentation |
Adjust the parameters of the APackOfTheClones reduction in a seurat object
Description
If the user is unsatisfied with the clonal expansion plot that
was generated from RunAPOTC
and APOTCPlot
, this function has a range of
arguments to modify the data and/or parameters of the visualization. Note
that some of the arguments may conflict with eachother.
Usage
AdjustAPOTC(
seurat_obj,
reduction_base = NULL,
clonecall = NULL,
...,
extra_filter = NULL,
run_id = NULL,
new_rad_scale_factor = NULL,
new_clone_scale_factor = NULL,
repulse = FALSE,
repulsion_threshold = 1,
repulsion_strength = 1,
max_repulsion_iter = 10L,
relocate_cluster = NULL,
relocation_coord = NULL,
nudge_cluster = NULL,
nudge_vector = NULL,
recolor_cluster = NULL,
new_color = NULL,
rename_label = NULL,
new_label = NULL,
relocate_label = NULL,
label_relocation_coord = NULL,
nudge_label = NULL,
label_nudge_vector = NULL,
verbose = TRUE
)
Arguments
seurat_obj |
The seurat object to be adjusted. |
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 |
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 |
new_rad_scale_factor |
a single numeric in (0, 1]. changes the radius scaling factor of all circles. |
new_clone_scale_factor |
a single numeric in (0, 1]. changes the clone_scale_factor |
repulse |
If |
repulsion_threshold |
numeric. The radius that clonal circle clusters overlap is acceptable when repulsing. |
repulsion_strength |
numeric. The smaller the value the less the clusters repulse each other per iteration, and vice versa. |
max_repulsion_iter |
integer. The number of repulsion iterations. |
relocate_cluster |
Numeric or Character. Indicates which cluster(s) based on the index or label to relocate to new coordinates. |
relocation_coord |
numeric of length two or a list of numerics of length
two of length of |
nudge_cluster |
Numeric or Character. Indicates which cluster(s) based on the index or label to "nudge"/translate their coordinate(s) by. |
nudge_vector |
numeric of length two or a list of numerics of length
two of length of |
recolor_cluster |
Numeric or Character. Indicates which cluster(s) based on the index or label to change their color by. |
new_color |
character of arbitrary length. Indicates the corresponding
new colors that selected clusters in |
rename_label |
Numeric or character. Indicates the index or name of label(s) to be renamed. |
new_label |
Character. Indicates the corresponding new label(s) that
selected label(s) in |
relocate_label |
Numeric or character. Indicates the index or name of label(s) to be relocated. |
label_relocation_coord |
Numeric of length two or a list of numerics of
length two of length of |
nudge_label |
Numeric or character. Indicates the index or name of label(s) to be "nudged"/translated. |
label_nudge_vector |
Numeric of length two or a list of numerics of
length two of length of |
verbose |
logical. Decides if visual cues are displayed to the R console of the progress. |
Value
The adjusted seurat_obj
Examples
# do an APackOfTheClones run
pbmc <- RunAPOTC(get(data("combined_pbmc")), verbose = FALSE)
# adjust the rad_scale_factor, and nudge cluster 1 by x = 1, y = 1
pbmc <- AdjustAPOTC(
pbmc,
new_rad_scale_factor = 0.9,
nudge_cluster = 1,
nudge_vector = c(1, 1),
verbose = FALSE
)
# plot the result
APOTCPlot(pbmc)
# rename some labels
pbmc <- AdjustAPOTC(
pbmc, rename_label = c(2, 5), new_label = c("Foo", "Bar")
)
# perhaps multiple clusters need to be relocated and repulsed
pbmc <- AdjustAPOTC(
pbmc,
relocate_cluster = c("Foo", "C10"), # using labels works too
relocation_coord = list(c(2, 3.5), c(0, 5)),
repulse = TRUE,
verbose = FALSE
)
# plot again to check results
APOTCPlot(pbmc, show_labels = TRUE, verbose = FALSE)