Read the header of a local DRAGEN or Rastair VCF and optionally check whether its index opens. The inspection stops at the column header and does not decode methylation records.
Arguments
- file
Path to a local VCF or gVCF, optionally compressed.
- format
The expected caller,
"dragen"or"rastair". WithNULL, identify the caller from the header when possible.- check_index
Logical. Try to open the index that
readMethylVcf()would select. Set toFALSEto check only for its presence.
Value
A list of class methylVCF_inspection with a console summary and
the following components:
file,caller,source,vcf_version,caller_versionandreferencedescribe the input and its declared provenance. Unavailable values areNA.formatis the caller used for the header checks.samplescontains VCF sample IDs in file order.seqinfoholds the contigs, lengths and any assembly tags declared per contig. The file-level reference declaration is returned asreference.fieldsis a data frame of INFO and FORMAT declarations withsection,id,numberandtypecolumns.checksis a data frame of header findings withcheck,status("pass","warning"or"error") andmessagecolumns.indexis a list with the chosenpath,type("TBI"or"CSI"),status("absent","detected","readable"or"unreadable"), indexedcontigs, and amessageif opening fails.
Details
The selected CSI index takes precedence over TBI, including when the CSI index is unreadable. A readable index can be opened and its contigs listed. Its relationship to the VCF and the VCF records themselves remain to be checked during a regional import.
A missing methylation declaration is reported in checks. A path
that cannot be opened or a structurally invalid VCF header raises an
error. The checks do not infer missing reference builds or require
a particular declared methylation-vector cardinality.
See also
readMethylVcf() to query and interpret the records.
Examples
file <- system.file("extdata", "dragen-multisample.g.vcf", package = "methylVCF")
info <- inspectMethylVcf(file)
info
#>
#> ── Methylation VCF inspection ──────────────────────────────────────────────────
#>
#> File: dragen-multisample.g.vcf
#> Caller: DRAGEN (version not declared)
#> VCF version: "4.5"
#> Reference: not declared
#> Samples (2): sample_a, sample_b
#> Contigs (1): chr21 (46,709,983 bp)
#>
#> ── Declared methylation fields ──
#>
#> INFO/M5mC: Allele masks
#> FORMAT/M5mC: Methylation fraction
#> FORMAT/DPM5mC: Informative depth
#>
#> ── Diagnostics ──
#>
#> ℹ Access: sequential (no index found)
#> ✔ Header checks: passed
info$samples
#> [1] "sample_a" "sample_b"
