Skip to contents

Returns a frequency table for a single column, showing count and percentage of each value. NA values are labelled "(missing)" and zero-length / whitespace-only strings are labelled "(empty)".

Usage

av_overview_breakdown(obj, col, extended = FALSE, scores = c("active", "both"))

Arguments

obj

An object of class AlphaVarSet.

col

Character. Internal column name (as it exists in obj$data).

extended

Logical. If TRUE, appends per-element score statistics and emits a warning about their limited interpretability.

scores

Character. "active" (default) reports statistics for the active score column. "both" reports them for raw_score and quantile_score, with columns suffixed _raw / _quantile. Only relevant when extended = TRUE. A missing score column is skipped with a warning.

Value

A tibble with columns element, count, percent (and score statistics when extended = TRUE), sorted by descending count.

Details

When extended = TRUE, score statistics (mean, median, mode, IQR, min, max, range, sd) are appended per element. A warning is issued because these statistics are aggregated across all other grouping variables and have limited biological interpretability. scores selects which score column(s) the statistics describe: the active score (default) or both raw_score and quantile_score side by side, the latter being useful to spot quantile saturation against raw magnitude.

Examples

example_file <- system.file("extdata", "bcl11a_rs1427407_example.csv", package = "AlphaVaR")
obj <- av_import_csv(example_file)
#> Reading bcl11a_rs1427407_example.csv ...
av_overview_breakdown(obj, "output_type")
#> # A tibble: 11 × 3
#>    element           count percent
#>    <chr>             <int>   <dbl>
#>  1 CHIP_TF             328  12.3  
#>  2 ATAC                320  12.0  
#>  3 CAGE                320  12.0  
#>  4 CHIP_HISTONE        320  12.0  
#>  5 DNASE               320  12.0  
#>  6 RNA_SEQ             320  12.0  
#>  7 SPLICE_JUNCTIONS    320  12.0  
#>  8 SPLICE_SITE_USAGE   320  12.0  
#>  9 CONTACT_MAPS         56   2.09 
#> 10 PROCAP               48   1.79 
#> 11 SPLICE_SITES          4   0.149
av_overview_breakdown(obj, "output_type", extended = TRUE)
#> Warning: Score statistics in av_overview_breakdown(extended = TRUE) are aggregated across ALL output types, tissues, and other grouping variables. They reflect a mixture of contexts and have limited biological interpretability.
#> Score column(s) reported: quantile_score.
#> # A tibble: 11 × 11
#>    element   count percent  mean median    mode   iqr      min   max range    sd
#>    <chr>     <int>   <dbl> <dbl>  <dbl>   <dbl> <dbl>    <dbl> <dbl> <dbl> <dbl>
#>  1 CHIP_TF     328  12.3   0.385  0.431  0.312  0.522 -0.860   0.970 1.83  0.413
#>  2 ATAC        320  12.0   0.701  0.814  0.983  0.377 -0.871   0.994 1.86  0.307
#>  3 CAGE        320  12.0   0.347  0.541 -0.743  0.991 -0.930   0.995 1.93  0.606
#>  4 CHIP_HIS…   320  12.0   0.369  0.578  0.773  0.675 -0.979   0.994 1.97  0.526
#>  5 DNASE       320  12.0   0.299  0.406  0.219  0.463 -0.948   0.997 1.94  0.499
#>  6 RNA_SEQ     320  12.0   0.222  0.206  0.302  0.397 -0.927   0.948 1.88  0.381
#>  7 SPLICE_J…   320  12.0   0.302  0.277  0.186  0.275  0.00450 0.852 0.848 0.189
#>  8 SPLICE_S…   320  12.0   0.393  0.336  0.323  0.297  0.0565  0.954 0.897 0.225
#>  9 CONTACT_…    56   2.09  0.518  0.535  0.403  0.188  0.179   0.924 0.745 0.148
#> 10 PROCAP       48   1.79  0.345  0.436 -0.238  0.503 -0.863   0.926 1.79  0.448
#> 11 SPLICE_S…     4   0.149 0.374  0.436  0.0565 0.319  0.0565  0.569 0.512 0.244
av_overview_breakdown(obj, "output_type", extended = TRUE, scores = "both")
#> Warning: Score statistics in av_overview_breakdown(extended = TRUE) are aggregated across ALL output types, tissues, and other grouping variables. They reflect a mixture of contexts and have limited biological interpretability.
#> Score column(s) reported: raw_score, quantile_score.
#> # A tibble: 11 × 19
#>    element   count percent mean_raw median_raw mode_raw iqr_raw  min_raw max_raw
#>    <chr>     <int>   <dbl>    <dbl>      <dbl>    <dbl>   <dbl>    <dbl>   <dbl>
#>  1 CHIP_TF     328  12.3    1.74e+2 146.         0      3.32e+2 -3.20e-2 5.41e+2
#>  2 ATAC        320  12.0    7.89e+0   0.196      0.0253 1.69e+1 -5.36e-2 2.48e+1
#>  3 CAGE        320  12.0    1.59e+0   0.0252    -0.0104 9.22e-1 -3.87e-2 2.32e+1
#>  4 CHIP_HIS…   320  12.0    9.75e+2 696.         0      1.51e+3 -4.05e-2 1.02e+4
#>  5 DNASE       320  12.0    6.35e+0   3.96       0.0003 1.08e+1 -1.61e-1 5.45e+1
#>  6 RNA_SEQ     320  12.0    2.31e-2   0.000104   0      1.07e-3 -3.04e-3 6.05e-1
#>  7 SPLICE_J…   320  12.0    5.96e-3   0.00528    0.0058 5.36e-3  9.82e-5 2.29e-2
#>  8 SPLICE_S…   320  12.0    4.27e-3   0.00391    0.0039 0        9.77e-4 7.81e-3
#>  9 CONTACT_…    56   2.09   8.14e-4   0.000783   0.0008 1.41e-4  5.31e-4 1.30e-3
#> 10 PROCAP       48   1.79   1.85e-1   0.0239     0.0157 1.37e-1 -2.93e-2 1.22e+0
#> 11 SPLICE_S…     4   0.149  6.59e-3   0.00732    0.0078 1.71e-3  3.91e-3 7.81e-3
#> # ℹ 10 more variables: range_raw <dbl>, sd_raw <dbl>, mean_quantile <dbl>,
#> #   median_quantile <dbl>, mode_quantile <dbl>, iqr_quantile <dbl>,
#> #   min_quantile <dbl>, max_quantile <dbl>, range_quantile <dbl>,
#> #   sd_quantile <dbl>