Sample information is kept in metadata. bc_meta is for accessing and updating metadata in BarcodeObj object

bc_meta(barcodeObj)

bc_meta(barcodeObj, key = NULL) <- value

# S4 method for class 'BarcodeObj'
bc_meta(barcodeObj)

# S4 method for class 'BarcodeObj'
bc_meta(barcodeObj, key = NULL) <- value

Arguments

barcodeObj

A BarcodeObj object.

key

A string, identifying the metadata record name to be modified.

value

A string vector or a data.frame. If the value is a vector, it should have the same length of sample number in the BarcodeObj object. Otherwise, if the value is data.frame, the row name of the data.frame should be the sample name, and each column as a metadata variable.

Value

A data.frame

Examples

data(bc_obj)

# get the metadata data.frame
bc_meta(bc_obj)
#>       raw_read_count barcode_read_count depth_cutoff
#> test1            184                178            5
#> test2            124                118            5

# assign value to metadata by $ operation
bc_meta(bc_obj)$phenotype <- c("l", "b")

# assign value to metadata by "key" argument
bc_meta(bc_obj, key = "sample_type") <- c("l", "b")

# show the updated metadata
bc_meta(bc_obj)
#>       raw_read_count barcode_read_count depth_cutoff phenotype sample_type
#> test1            184                178            5         l           l
#> test2            124                118            5         b           b

# assign new data.frame to metadata
metadata <- data.frame(
    sample_name <- c("test1", "test2"),
    phenotype <- c("l", "b")
    )
rownames(metadata) = bc_names(bc_obj)
bc_meta(bc_obj) <- metadata
###