This function extracts sampleId
from the cellId
column using grep
matching.
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