Skip to contents

This function extracts sampleId from the cellId column using grep matching.

Usage

mapCellsToSamples(cells, samples)

Arguments

cells

character. Cell identifiers.

samples

character. Sample identifiers.

Value

factor. Cells as the names and samples as the levels.

Note

Updated 2022-05-04.

Examples

samples <- paste0("sample", seq_len(2L))
print(samples)
#> [1] "sample1" "sample2"
cells <- paste(samples, c("AAAAAAAA", "CCCCCCCC"), sep = "_")
print(cells)
#> [1] "sample1_AAAAAAAA" "sample2_CCCCCCCC"
mapCellsToSamples(cells, samples)
#> sample1_AAAAAAAA sample2_CCCCCCCC 
#>          sample1          sample2 
#> Levels: sample1 sample2