update_annotations: Update Sample Annotations

View source: R/params_functions.R View source: R/Package-Code5-Compiled.R

update_annotationsR Documentation

Update Sample Annotations

Description

Update sample annotations stored in annotations parameter of the params list object. See set_annotations for intially setting the annotations.

Usage

update_annotations(annotation, values)

Arguments

annotation

title of annotation to be updated or added. If already found in the colnames of the annotations data frame, the previous values for that column will be replaced with the supplied values here. If not found in the colnames of the annotations data frame, values will be added as a new annotation column under the name indicated.

values

values corresponding to the annotation to be updated or added.

Details

If the name of the supplied annotation already exists, will overwrite the previous values. Number of values in updated annotation do not need to be the same length as the pre-existing annotations. This function will merge the annotations, see full_join. Any missing values will be set to "No_Annot" signifying that no annotation was provided. This is especially useful if annotating clusters where the genes being clustered and annotated is a subset of all genes present, see extractClusters if added annotations are identifications of cluster groups. If new or updated values should be shown in the heatmap, must rerun set_annot_samps. To add specific colors for the new annotations, see set_annot_cols and update_annot_cols

Author(s)

~~Alison Moss~~

See Also

See set_annotations for how to set up the initial annotations

Examples

##initiate parameters and annotations
initiate_params()
set_annotations(RAGP_annots)
set_annot_samps(c("Connectivity","Animal","State"))

#view heatmap, extract samples for state A
myHeatmapByAnnotation(RAGP_norm, groupings = "State")
state.A <- subsetSamples(RAGP_norm, group = "State", take.out = "A")

##view heatmap of state A alone and identify clusters
myHeatmap(state.A, col.groups = 3)

##extract clusters of identified state A substates
heatmap.A <- myHeatmap(state.A, col.groups = 3, show.colnames = TRUE)
state.A.sub <- extractClusters(state.A, heatmap = heatmap.A, to.extract = "samples",
  nclusters = 3, SampleGroup_Name = "State_A_Substates")

##update annotations with new cluster identifications, function will properly merge samples
update_annotations("State_A_Substates", state.A.sub)

##reset tracks for heatmaps and visualize
set_annot_samps(c("Connectivity","Animal","State", "State_A_Substates"))
myHeatmapByAnnotation(RAGP_norm, groupings = "State")


axm323/dataVisEasy documentation built on Feb. 1, 2024, 11:53 p.m.