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.

samp_annot(object)

# S4 method for musica
samp_annot(object)

# S4 method for musica_result
samp_annot(object)

samp_annot(object, name) <- value

# S4 method for musica,character,vector
samp_annot(object, name) <- value

# S4 method for musica_result,character,vector
samp_annot(object, name) <- value

Arguments

object

A musica object generated by the create_musica function or a musica_result object generated by a mutational discovery or prediction tool.

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.

Value

A new object with the sample annotations added to the table in the sample_annotations slot.

See also

See sample_names to get a vector of sample names in the musica or musica_result 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)