Sample annotations can be used to store information about
each sample such as tumor type or treatment status. These are used in
downstream plotting functions such as plot_exposures
or
plot_umap
to group or color samples by a particular annotation.
Usage
samp_annot(object)
# S4 method for class 'musica'
samp_annot(object)
samp_annot(object, name) <- value
# S4 method for class 'musica,character,vector'
samp_annot(object, name) <- value
Arguments
- object
A
musica
object generated by the create_musica_from_variants or create_musica_from_counts function.- name
The name of the new annotation to add.
- value
A vector containing the new sample annotations. Needs to be the same length as the number of samples in the object.
See also
See sample_names
to get a vector of sample names in
the musica
object.
Examples
data(res_annot)
samp_annot(res_annot)
#> Samples Tumor_Subtypes
#> 1 TCGA-94-7557-01A-11D-2122-08 Lung
#> 2 TCGA-56-7582-01A-11D-2042-08 Lung
#> 3 TCGA-77-7335-01A-11D-2042-08 Lung
#> 4 TCGA-97-7938-01A-11D-2167-08 Lung
#> 5 TCGA-EE-A3J5-06A-11D-A20D-08 Breast
#> 6 TCGA-ER-A197-06A-32D-A197-08 Breast
#> 7 TCGA-ER-A19O-06A-11D-A197-08 Breast
# Add new annotation
samp_annot(res_annot, "New_Annotation") <- rep(c("A", "B"), c(3, 4))
samp_annot(res_annot)
#> Samples Tumor_Subtypes New_Annotation
#> 1 TCGA-94-7557-01A-11D-2122-08 Lung A
#> 2 TCGA-56-7582-01A-11D-2042-08 Lung A
#> 3 TCGA-77-7335-01A-11D-2042-08 Lung A
#> 4 TCGA-97-7938-01A-11D-2167-08 Lung B
#> 5 TCGA-EE-A3J5-06A-11D-A20D-08 Breast B
#> 6 TCGA-ER-A197-06A-32D-A197-08 Breast B
#> 7 TCGA-ER-A19O-06A-11D-A197-08 Breast B
data(musica)
samp_annot(musica, "example") <- rep("ex", 7)