This function extracts sampleID from the cellID column using grep matching.

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 2019-08-11.

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