Returns a compact field-coverage overview as an AlphaVarOverview object.
The $summary tibble contains one row per tracked field showing the
number of unique values, missing values (NA), and empty values
(zero-length or whitespace-only strings). A special "entries" row
reports the total row count.
Arguments
- obj
An object of class
AlphaVarSet.- extra_cols
Character vector of additional column names (internal names as they exist in
obj$data) to include in the summary.- balance_by
Character or
NULL. Variable to balance the score statistics over (e.g."output_type"). WhenNULL(default),mean_scoreandmedian_scoreare computed over all rows, which weights each modality by its track count (CHIP_HISTONEcontributes far more rows thanCAGE). When set, a two-step aggregation (within each element, then across elements) gives every element equal weight. Must differ from the active score column.
Value
An object of class AlphaVarOverview, a named list with:
$summaryTibble with columns
field,n_unique,n_missing,n_empty.$score_colName of the currently active score column.
$mean_scoreMean of the active score column (balanced if
balance_byis set).$median_scoreMedian of the active score column (balanced if
balance_byis set).$balance_byThe balancing variable, or
NULLwhen the statistics are unbalanced.$breakdownsNamed list, initially empty. Populate with
av_overview_breakdown()results for reuse in reports or Shiny.
Details
The default tracked fields are variant_id, coords,
gene, modality, transcription_factor,
histone_mark, and biosample_name. Fields not present in the
data are silently skipped. Fields in extra_cols that are not found
in the data produce a warning and are skipped.
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_summary(obj)
#> === AlphaVarOverview Summary ===
#> Score: quantile_score | mean: 0.3797 median: 0.4218 (unbalanced)
#>
#> # A tibble: 8 × 7
#> field n_unique pct_unique n_missing pct_missing n_empty pct_empty
#> <chr> <int> <dbl> <int> <dbl> <int> <dbl>
#> 1 entries 2676 100 0 0 0 0
#> 2 variant_id 2 0.07 0 0 0 0
#> 3 scored_interval 1 0.04 0 0 0 0
#> 4 gene_name 23 0.86 1712 64.0 0 0
#> 5 output_type 11 0.41 0 0 0 0
#> 6 transcription_fac… 205 7.66 2348 87.7 0 0
#> 7 histone_mark 22 0.82 2356 88.0 0 0
#> 8 biosample_name 620 23.2 4 0.15 0 0
av_overview_summary(obj, extra_cols = c("biosample_type", "data_source"))
#> === AlphaVarOverview Summary ===
#> Score: quantile_score | mean: 0.3797 median: 0.4218 (unbalanced)
#>
#> # A tibble: 10 × 7
#> field n_unique pct_unique n_missing pct_missing n_empty pct_empty
#> <chr> <int> <dbl> <int> <dbl> <int> <dbl>
#> 1 entries 2676 100 0 0 0 0
#> 2 variant_id 2 0.07 0 0 0 0
#> 3 scored_interval 1 0.04 0 0 0 0
#> 4 gene_name 23 0.86 1712 64.0 0 0
#> 5 output_type 11 0.41 0 0 0 0
#> 6 transcription_fa… 205 7.66 2348 87.7 0 0
#> 7 histone_mark 22 0.82 2356 88.0 0 0
#> 8 biosample_name 620 23.2 4 0.15 0 0
#> 9 biosample_type 5 0.19 4 0.15 0 0
#> 10 data_source 4 0.15 4 0.15 0 0
av_overview_summary(obj, balance_by = "output_type")
#> === AlphaVarOverview Summary ===
#> Score: quantile_score | mean: 0.3869 median: 0.4358 (balanced by output_type)
#>
#> # A tibble: 8 × 7
#> field n_unique pct_unique n_missing pct_missing n_empty pct_empty
#> <chr> <int> <dbl> <int> <dbl> <int> <dbl>
#> 1 entries 2676 100 0 0 0 0
#> 2 variant_id 2 0.07 0 0 0 0
#> 3 scored_interval 1 0.04 0 0 0 0
#> 4 gene_name 23 0.86 1712 64.0 0 0
#> 5 output_type 11 0.41 0 0 0 0
#> 6 transcription_fac… 205 7.66 2348 87.7 0 0
#> 7 histone_mark 22 0.82 2356 88.0 0 0
#> 8 biosample_name 620 23.2 4 0.15 0 0