Contents

1 Overview

The alabaster.vcf package implements methods to save VCF objects to file artifacts and load them back into R. This refers specifically to the SummarizedExperiment subclasses (i.e., CollapsedVCF and ExpandedVCF) that are used to represent the variant calling data in an R session, which may contain additional modifications that cannot be easily stored inside the original VCF file. Check out the alabaster.base for more details on the motivation and concepts of the alabaster framework.

2 Quick start

Given a VCF object, we can use saveObject() to save it inside a staging directory:

library(VariantAnnotation)
fl <- system.file("extdata", "structural.vcf", package="VariantAnnotation")
vcf <- readVcf(fl, genome="hg19")
vcf
## class: CollapsedVCF 
## dim: 7 1 
## rowRanges(vcf):
##   GRanges with 5 metadata columns: paramRangeID, REF, ALT, QUAL, FILTER
## info(vcf):
##   DataFrame with 10 columns: BKPTID, CIEND, CIPOS, END, HOMLEN, HOMSEQ, IMPR...
## info(header(vcf)):
##              Number Type    Description                                        
##    BKPTID    .      String  ID of the assembled alternate allele in the asse...
##    CIEND     2      Integer Confidence interval around END for imprecise var...
##    CIPOS     2      Integer Confidence interval around POS for imprecise var...
##    END       1      Integer End position of the variant described in this re...
##    HOMLEN    .      Integer Length of base pair identical micro-homology at ...
##    HOMSEQ    .      String  Sequence of base pair identical micro-homology a...
##    IMPRECISE 0      Flag    Imprecise structural variation                     
##    MEINFO    4      String  Mobile element info of the form NAME,START,END,P...
##    SVLEN     .      Integer Difference in length between REF and ALT alleles   
##    SVTYPE    1      String  Type of structural variant                         
## geno(vcf):
##   List of length 4: GT, GQ, CN, CNQ
## geno(header(vcf)):
##        Number Type    Description                                      
##    GT  1      String  Genotype                                         
##    GQ  1      Float   Genotype quality                                 
##    CN  1      Integer Copy number genotype for imprecise events        
##    CNQ 1      Float   Copy number genotype quality for imprecise events
library(alabaster.vcf)
tmp <- tempfile()
meta <- saveObject(vcf, tmp)

list.files(tmp, recursive=TRUE)
## [1] "OBJECT"            "_environment.json" "file.vcf.gz"

We can then load it back into the session with readObject().

roundtrip <- readObject(tmp)
class(roundtrip)
## [1] "CollapsedVCF"
## attr(,"package")
## [1] "VariantAnnotation"

Session information

sessionInfo()
## R version 4.6.1 (2026-06-24)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.4 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.24-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0  LAPACK version 3.12.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: America/New_York
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] alabaster.vcf_1.13.1        alabaster.base_1.13.4      
##  [3] VariantAnnotation_1.59.4    Rsamtools_2.29.0           
##  [5] Biostrings_2.81.9           XVector_0.53.0             
##  [7] SummarizedExperiment_1.43.0 Biobase_2.73.2             
##  [9] GenomicRanges_1.65.4        IRanges_2.47.5             
## [11] S4Vectors_0.51.9            Seqinfo_1.3.2              
## [13] MatrixGenerics_1.25.0       matrixStats_1.5.0          
## [15] BiocGenerics_0.59.12        generics_0.1.4             
## [17] BiocStyle_2.41.0           
## 
## loaded via a namespace (and not attached):
##  [1] KEGGREST_1.53.6          rjson_0.2.23             xfun_0.60               
##  [4] bslib_0.12.0             alabaster.string_1.13.1  rhdf5_2.57.12           
##  [7] lattice_0.23-1           rhdf5filters_1.25.4      vctrs_0.7.3             
## [10] tools_4.6.1              bitops_1.1-0             curl_8.0.0              
## [13] parallel_4.6.1           AnnotationDbi_1.75.2     RSQLite_3.53.3          
## [16] blob_1.3.0               BiocBaseUtils_1.15.1     Matrix_1.7-6            
## [19] BSgenome_1.81.1          cigarillo_1.3.1          lifecycle_1.0.5         
## [22] compiler_4.6.1           alabaster.se_1.13.1      codetools_0.2-20        
## [25] htmltools_0.5.9          sass_0.4.10              alabaster.matrix_1.13.2 
## [28] RCurl_1.98-1.20          yaml_2.3.12              crayon_1.5.3            
## [31] jquerylib_0.1.4          BiocParallel_1.47.0      DelayedArray_0.39.6     
## [34] cachem_1.1.0             abind_1.4-8              digest_0.6.39           
## [37] restfulr_0.0.17          bookdown_0.48            fastmap_1.2.0           
## [40] grid_4.6.1               cli_3.6.6                SparseArray_1.13.2      
## [43] S4Arrays_1.13.0          GenomicFeatures_1.65.0   h5mread_1.5.3           
## [46] XML_3.99-0.24            bit64_4.8.6              rmarkdown_2.32          
## [49] httr_1.4.9               bit_4.6.0                otel_0.2.0              
## [52] png_0.1-9                HDF5Array_1.41.3         memoise_2.0.1           
## [55] evaluate_1.0.5           knitr_1.51               BiocIO_1.23.3           
## [58] rtracklayer_1.73.0       rlang_1.3.0              Rcpp_1.1.2              
## [61] DBI_1.3.0                BiocManager_1.30.27      alabaster.ranges_1.13.1 
## [64] alabaster.schemas_1.13.0 jsonlite_2.0.0           Rhdf5lib_2.1.0          
## [67] R6_2.6.1                 GenomicAlignments_1.49.2