Skip to contents

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.

Usage

inspectMethylVcf(file, format = NULL, check_index = TRUE)

Arguments

file

Path to a local VCF or gVCF, optionally compressed.

format

The expected caller, "dragen" or "rastair". With NULL, identify the caller from the header when possible.

check_index

Logical. Try to open the index that readMethylVcf() would select. Set to FALSE to 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_version and reference describe the input and its declared provenance. Unavailable values are NA. format is the caller used for the header checks.

  • samples contains VCF sample IDs in file order. seqinfo holds the contigs, lengths and any assembly tags declared per contig. The file-level reference declaration is returned as reference.

  • fields is a data frame of INFO and FORMAT declarations with section, id, number and type columns.

  • checks is a data frame of header findings with check, status ("pass", "warning" or "error") and message columns.

  • index is a list with the chosen path, type ("TBI" or "CSI"), status ("absent", "detected", "readable" or "unreadable"), indexed contigs, and a message if 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"