Compute log2(fold-change) based on the effect size.

add_logfc(results, effect_var = "estimate", force_new = FALSE)

Arguments

results

The cell type-phenotype enrichment results generated by gen_results and merged together with merge_results

effect_var

Name of the effect size column in the results.

force_new

Force the creation of a new logFC column even when one already exists.

Examples

results = load_example_results()[seq(5000)]
add_logfc(results)
#> Adding logFC column.
#>                  ctd                  model_id     hpo_id
#>               <char>                    <char>     <char>
#>    1: DescartesHuman model10000_35c3c515a8691a HP:0040231
#>    2: DescartesHuman model10000_35c3c517ae4e97 HP:0040231
#>    3: DescartesHuman model10000_35c3c51910bcca HP:0040231
#>    4: DescartesHuman model10000_35c3c5198399fa HP:0040231
#>    5: DescartesHuman model10000_35c3c519a5a6ba HP:0040231
#>   ---                                                    
#> 4996: DescartesHuman model10059_35d246780870b0 HP:0040416
#> 4997: DescartesHuman model10059_35d24678dd8ec1 HP:0040416
#> 4998: DescartesHuman model10059_35d24679dd709d HP:0040416
#> 4999: DescartesHuman model10059_35d2467b04897e HP:0040416
#> 5000: DescartesHuman model10059_35d2467b79e3c8 HP:0040416
#>                            CellType   term     estimate  std.error  statistic
#>                              <char> <char>        <num>      <num>      <num>
#>    1:                Lymphoid_cells      x -0.006377201 0.01435295 -0.4443128
#>    2:              Purkinje_neurons      x -0.010869399 0.01435240 -0.7573229
#>    3: PDE11A_FAM19A2_positive_cells      x -0.006265524 0.01435296 -0.4365317
#>    4:    Vascular_endothelial_cells      x -0.008501924 0.01435273 -0.5923560
#>    5:          Adrenocortical_cells      x -0.007390324 0.01435285 -0.5149027
#>   ---                                                                        
#> 4996:                Cardiomyocytes      x  0.003708823 0.01435315  0.2583979
#> 4997:                  Acinar_cells      x  0.007994311 0.01435279  0.5569867
#> 4998:                 Stromal_cells      x -0.007748407 0.01435281 -0.5398528
#> 4999:                      ENS_glia      x -0.005288765 0.01435304 -0.3684768
#> 5000:            Inhibitory_neurons      x -0.010224943 0.01435250 -0.7124157
#>               p model_p model_q model_estimate model_statistic         q
#>           <num>   <num>   <int>          <num>           <num>     <num>
#>    1: 0.6568363       1       1   2.834550e-16    1.975093e-14 0.9999989
#>    2: 0.4488932       1       1   2.834197e-16    1.974924e-14 0.9999989
#>    3: 0.6624704       1       1   2.837708e-16    1.977292e-14 0.9999989
#>    4: 0.5536398       1       1   2.843008e-16    1.981018e-14 0.9999989
#>    5: 0.6066444       1       1   2.842067e-16    1.980345e-14 0.9999989
#>   ---                                                                   
#> 4996: 0.7961108       1       1   1.306766e-16    9.105326e-15 0.9999989
#> 4997: 0.5775622       1       1   1.304462e-16    9.089496e-15 0.9999989
#> 4998: 0.5893233       1       1   1.305320e-16    9.095459e-15 0.9999989
#> 4999: 0.7125338       1       1   1.309416e-16    9.123854e-15 0.9999989
#> 5000: 0.4762416       1       1   1.312929e-16    9.148680e-15 0.9999989
#>       annotLevel fold_change      logFC
#>            <int>       <num>      <num>
#>    1:          2   0.3823447 -0.4183910
#>    2:          2   0.3659512 -0.8289973
#>    3:          2   0.3827488 -0.4095346
#>    4:          2   0.3746244 -0.5981572
#>    5:          2   0.3786709 -0.5013214
#>   ---                                  
#> 4996:          2   0.4182012  0.2195695
#> 4997:          2   0.4330556  0.4235201
#> 4998:          2   0.3773691 -0.5318115
#> 4999:          2   0.3862766 -0.3343068
#> 5000:          2   0.3683196 -0.7624138