generateMap | R Documentation |
This function helps create a sampleMap in preparation of a
MultiAssayExperiment
object. This especially useful when the
sample identifiers are not very different, as in the case of TCGA barcodes.
An idConverter
function can be provided to truncate such sample
identifiers and obtain patient identifiers.
generateMap(
experiments,
colData,
idConverter = identity,
sampleCol,
patientCol,
...
)
experiments |
A named |
colData |
A |
idConverter |
A function to be used against the sample or specimen
identifiers to match those in the rownames of the |
sampleCol |
A single string indicating the sample identifiers column in the colData dataset |
patientCol |
A single string indicating the patient identifiers in colData, "row.names" extracts the colData row names |
... |
Additonal arguments to pass to the 'idConverter' function. |
A DataFrame
class object of mapped samples and patient
identifiers including assays
M. Ramos, M. Morgan, L. Schiffer
## Minimal example
expList <- list(assay1 = matrix(1:6, ncol = 2L,
dimnames = list(paste0("feature", 1:3), c("A-J", "B-J"))),
assay2 = matrix(1:4, ncol = 2,
dimnames = list(paste0("gene", 1:2), c("A-L", "B-L"))))
## Mock colData
myPheno <- data.frame(var1 = c("Yes", "No"), var2 = c("High", "Low"),
row.names = c("a", "b"))
## A look at the identifiers
vapply(expList, colnames, character(2L))
rownames(myPheno)
## Use 'idConverter' to correspond sample names to patient identifiers
generateMap(expList, myPheno,
idConverter = function(x) substr(tolower(x), 1L, 1L))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.