samp_annot: Get or set sample annotations from a musica object

samp_annotR Documentation

Get or set sample annotations from a musica object

Description

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 signature 'musica'
samp_annot(object)

samp_annot(object, name) <- value

## S4 replacement method for signature '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.

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 object.

Examples

data(res_annot)
samp_annot(res_annot)

# Add new annotation
samp_annot(res_annot, "New_Annotation") <- rep(c("A", "B"), c(3, 4))
samp_annot(res_annot)
data(musica)
samp_annot(musica, "example") <- rep("ex", 7)

campbio/musicatk documentation built on Dec. 25, 2024, 9:34 p.m.