Skip to contents

Reads an AlphaGenome CSV file and creates an AlphaVarSet object. AlphaGenome ships a stable schema. Column names are preserved verbatim (e.g. variant_id, quantile_score, raw_score, output_type, gene_name, scored_interval).

Usage

av_import_csv(file, sep = ",", verbose = TRUE)

Arguments

file

Path to the AlphaGenome CSV file.

sep

Field separator (default ",").

verbose

Logical. If TRUE (default), emit progress messages.

Value

An AlphaVarSet object with all CSV columns preserved.

Examples

example_file <- system.file(
  "extdata", "bcl11a_rs1427407_example.csv",
  package = "AlphaVaR"
)
obj <- av_import_csv(example_file, verbose = FALSE)
obj
#> === AlphaVarSet Object ===
#> Entries:    2,676 
#> Variants:   2 
#> Modalities: 11 
#> Columns:    25 (incl. 19 extra)
#> Score Mode: quantile_score 
#> Source:     bcl11a_rs1427407_example.csv 

# All 25 AlphaGenome columns survive import. Only low-cardinality metadata
# is cast to factor, which keeps large score tables in memory.
dim(obj$data)
#> [1] 2676   25
levels(obj$data$output_type)
#>  [1] "ATAC"              "CAGE"              "CHIP_HISTONE"     
#>  [4] "CHIP_TF"           "CONTACT_MAPS"      "DNASE"            
#>  [7] "PROCAP"            "RNA_SEQ"           "SPLICE_JUNCTIONS" 
#> [10] "SPLICE_SITES"      "SPLICE_SITE_USAGE"

# quantile_score becomes the active score whenever the CSV carries it.
obj$meta$active_score
#> [1] "quantile_score"
av_set_active_score(obj, "raw")$meta$active_score
#> Switched active score: quantile_score -> raw_score. Statistics cleared.
#> [1] "raw_score"
head(av_get_scores(obj))
#> [1] 0.9812546 0.9780051 0.9828931 0.7844907 0.8069733 0.6133556