View source: R/Seurat.Utils.Metadata.R
matchBestIdentity | R Documentation |
This function matches the best identity from ident_to_rename
to reference_ident
in an object,
in other words, it replaces original categories with the most frequent ones from the reference,
hence helps to filter out less important categories.
matchBestIdentity(
obj,
ident_to_rename,
reference_ident = GetOrderedClusteringRuns(obj)[1],
prefix = reference_ident,
suffix = gsub(prefix, "", x = reference_ident),
new_ident_name = kpp(prefix, ident_to_rename, "match.to", suffix),
plot_suffix = prefix,
barplot_match = TRUE,
barplot_fractions = TRUE,
rnd_colors = T,
w = 12,
h = 9,
...
)
obj |
The object to update. This object must have a |
ident_to_rename |
A string. The name of the column in |
reference_ident |
A string. The name of the column in |
prefix |
A string to add to the new identity column name. Default is prefix = Reference. |
suffix |
... |
new_ident_name |
A string. The name for the newly created identity column in |
plot_suffix |
A string. The suffix to add to the final UMAP. |
barplot_match |
Draw a barplot to show the % match between the original and new identities. Default: TRUE |
barplot_fractions |
Draw a barplot to show the % of each category in the original and new
identities, using |
w |
Width for the saved image. Default: 9 |
h |
Height for the saved image. Default: 12 |
... |
Additional parameters to be passed to |
An updated version of obj
with an additional column in obj@meta.data
named as new_ident_name
representing the new identity. The function also generates a UMAP plot based on this new identity.
clUMAP
, kpp
, FixPlotName
,
.replace_by_most_frequent_categories
## Not run:
updated_obj <- matchBestIdentity(my_obj, "origin_identity", "target_identity")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.