mapCellsToSamples: Define Cell to Sample Mappings

Description Usage Arguments Value Author(s) See Also Examples

Description

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

Usage

1
mapCellsToSamples(cells, samples)

Arguments

cells

Cell identifiers.

samples

Sample identifiers.

Value

Named factor containing cells as the names, and samples as the factor levels.

Author(s)

Michael Steinbaugh

See Also

Other Data Functions: aggregateReplicates, cell2sample, fetchGeneData, metricsPerSample, sampleData, selectSamples, subsetPerSample, topBarcodes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# bcbioSingleCell ====
object <- indrops_small

cells <- colnames(object)
glimpse(cells)

# Use the sample ID for the mappings, which must be present in the cell ID
sampleNames(object)
samples <- names(sampleNames(object))
# samples <- rownames(sampleData(object))
samples

# Sample ID must be the prefix of the cell IDs
stopifnot(all(grepl(paste0("^", samples[[1]]), cells)))

x <- mapCellsToSamples(cells = cells, samples = samples)
glimpse(x)

WeiSong-bio/roryk-bcbioSinglecell documentation built on July 6, 2019, 12:03 a.m.