Convert a Biobase::ExpressionSet to a gene-expression matrix.

eset_to_matrix(eset, column)

Arguments

eset

ExpressionSet

column

column name of the fData() table, which contains the HGNC gene symbols.

Value

A matrix with gene symbols as rownames and sample identifiers as colnames.

Examples


data(dataset_racle)
dim(dataset_racle$expr_mat)
#> [1] 32467     4

library("Biobase")
#> Loading required package: BiocGenerics
#> 
#> Attaching package: ‘BiocGenerics’
#> The following objects are masked from ‘package:stats’:
#> 
#>     IQR, mad, sd, var, xtabs
#> The following objects are masked from ‘package:base’:
#> 
#>     Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
#>     as.data.frame, basename, cbind, colnames, dirname, do.call,
#>     duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
#>     lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
#>     pmin.int, rank, rbind, rownames, sapply, setdiff, table, tapply,
#>     union, unique, unsplit, which.max, which.min
#> Welcome to Bioconductor
#> 
#>     Vignettes contain introductory material; view with
#>     'browseVignettes()'. To cite Bioconductor, see
#>     'citation("Biobase")', and for packages 'citation("pkgname")'.
es_racle <- ExpressionSet(assayData = dataset_racle$expr_mat)
featureData(es_racle)$gene_symbol <- rownames(dataset_racle$expr_mat)

es_racle
#> ExpressionSet (storageMode: lockedEnvironment)
#> assayData: 32467 features, 4 samples 
#>   element names: exprs 
#> protocolData: none
#> phenoData: none
#> featureData
#>   featureNames: A1BG A1CF ... ZZEF1 (32467 total)
#>   fvarLabels: gene_symbol
#>   fvarMetadata: labelDescription
#> experimentData: use 'experimentData(object)'
#> Annotation:  

head(eset_to_matrix(es_racle, "gene_symbol"))
#>         LAU125 LAU355 LAU1255 LAU1314
#> A1BG      0.82   0.58    0.81    0.71
#> A1CF      0.00   0.01    0.00    0.00
#> A2M     247.15  24.88 2307.94   20.30
#> A2M-AS1   1.38   0.20    2.60    0.28
#> A2ML1     0.03   0.00    0.05    0.02
#> A3GALT2   0.00   0.00    0.00    0.00