Skip to contents

This function determines the patterns between different conditions of each gene. It should be applied to the output of calculate_condition_mean_sd_per_gene.

Usage

make_pattern_matrix(tbl, n_sd = 2)

Arguments

tbl

the output of calculate_condition_mean_sd_per_gene

n_sd

number of standard deviations from the mean to use to construct the intervals; default is 2

Value

A matrix of single character patterns between conditions. The last column is named pattern and is a concatenation of all other columns.

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%
patmat <- make_pattern_matrix(tbl)
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |======================================================================| 100%
patmat
#>                    0h -> 12h 12h -> 36h pattern
#> ENSMUSG00000025902 "S"       "S"        "SS"   
#> ENSMUSG00000098104 "S"       "S"        "SS"   
#> ENSMUSG00000103922 "S"       "S"        "SS"   
#> ENSMUSG00000033845 "U"       "S"        "US"   
#> ENSMUSG00000102275 "S"       "S"        "SS"   
#> ENSMUSG00000025903 "S"       "S"        "SS"   
#> ENSMUSG00000033813 "S"       "S"        "SS"   
#> ENSMUSG00000002459 "S"       "S"        "SS"   
#> ENSMUSG00000085623 "S"       "S"        "SS"   
#> ENSMUSG00000033793 "D"       "U"        "DU"