Skip to contents

This function reshapes the tibble output of calculate_condition_mean_sd_per_gene into a matrix of average expression by condition. Its output can be used by expression_heatmap.

Usage

make_heatmap_matrix(tbl, genes = NULL)

Arguments

tbl

the output of calculate_condition_mean_sd_per_gene

genes

gene names to use for the output; if NULL (the default), all genes will be used

Value

A matrix of averaged expression per gene in each condition.

Examples

expression.matrix.preproc <- as.matrix(read.csv(
  system.file("extdata", "expression_matrix_preprocessed.csv", package = "bulkAnalyseR"), 
  row.names = 1
))[1:500,]

condition <- factor(rep(c("0h", "12h", "36h"), each = 2))
tbl <- calculate_condition_mean_sd_per_gene(expression.matrix.preproc[1:10, ], condition)
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
heatmat <- make_heatmap_matrix(tbl)
heatmat
#>                             0h         12h         36h
#> ENSMUSG00000025902   106.08333    60.83333    60.16667
#> ENSMUSG00000098104    95.79167    86.08333    78.00000
#> ENSMUSG00000103922   280.58333   376.25000   314.75000
#> ENSMUSG00000033845 10868.08333 15160.50000 14283.25000
#> ENSMUSG00000102275   128.00000   160.83333   178.00000
#> ENSMUSG00000025903  3631.16667  5029.83333  3911.41667
#> ENSMUSG00000033813  5351.91667  6687.16667  6705.16667
#> ENSMUSG00000002459    66.33333    79.33333   137.00000
#> ENSMUSG00000085623    47.41667   137.16667    95.58333
#> ENSMUSG00000033793  8102.83333  6115.25000  7749.75000