Can be used to add cell types to cluster numbers

add_label(fsce, labels, by = NULL, expt = "rnaseq")

Arguments

fsce

An object of class FunctionalSingleCellExperiment

labels

dataframe of new labels. Must contain at least one column of matching variables (e.g. cell_id or k_cluster)

by

column name labels to match in colData of expt. If NULL, will match by all matching column names

expt

Data to use for match labels (default is rnaseq). Must be present in names(fsce).

Value

fsce with all labels in expt colData.

Examples

# Add cell_type labels to PBMC data labels <- data.frame(k_cluster = as.factor(c("1", "2", "3", "4", "5", "6")), label = c("MC", "NK", "NK+T", "MC", "MK", "CD4/8 T")) fsce <- add_label(fsce_small, labels)
#> Joining, by = "k_cluster"
#> Warning: Column `k_cluster` joining character vector and factor, coercing into character vector
SingleCellExperiment::colData(fsce[["rnaseq"]])
#> DataFrame with 250 rows and 5 columns #> cell_id k_cluster leiden_cluster cell_cycle #> <character> <character> <character> <character> #> TGCGGGTGTAGAGTGC TGCGGGTGTAGAGTGC 2 2 S #> TGGTTCCCATCTATGG TGGTTCCCATCTATGG 6 4 S #> CATATTCCACGTCAGC CATATTCCACGTCAGC 2 2 G2M #> TCACAAGTCCTGCTTG TCACAAGTCCTGCTTG 5 3 G1 #> GGAATAATCCAGGGCT GGAATAATCCAGGGCT 4 4 G1 #> ... ... ... ... ... #> CTACGTCCACCACGTG CTACGTCCACCACGTG 6 4 G1 #> TGTGGTAAGGTGCTTT TGTGGTAAGGTGCTTT 3 6 G1 #> AGCGTCGGTCGAGTTT AGCGTCGGTCGAGTTT 3 6 G1 #> CTCGAAAAGTTCGATC CTCGAAAAGTTCGATC 6 5 G2M #> TGACAACGTCGCATAT TGACAACGTCGCATAT 6 4 S #> label #> <factor> #> TGCGGGTGTAGAGTGC NK #> TGGTTCCCATCTATGG CD4/8 T #> CATATTCCACGTCAGC NK #> TCACAAGTCCTGCTTG MK #> GGAATAATCCAGGGCT MC #> ... ... #> CTACGTCCACCACGTG CD4/8 T #> TGTGGTAAGGTGCTTT NK+T #> AGCGTCGGTCGAGTTT NK+T #> CTCGAAAAGTTCGATC CD4/8 T #> TGACAACGTCGCATAT CD4/8 T