Skip to contents

Project regional calls onto a shared set of reference sites. DRAGEN inputs contribute pooled reference-allele measurements. Rastair inputs contribute reference CpG context measurements. All inputs must use the same format and reference genome.

Usage

asMethylExperiment(calls, filters = c("PASS", "."))

Arguments

calls

A GRanges from readMethylVcf() containing one or more VCF samples, or a named list of these objects with one sample per element. List names become column names. Use the reader's samples argument to select a single sample from a multisample file for a list element.

filters

Exact VCF FILTER values to retain. By default, retain "PASS" and "." (filters not applied). Use NULL to include all records.

Value

A SummarizedExperiment::RangedSummarizedExperiment with one row per chromosome, 1-based anchor, strand, context, and modification across the union of selected sites. Each selected sample has a column, including samples without calls. colData() stores the original VCF sample ID and an import_index into S4Vectors::metadata(result)$imports, which retains the original imports' file metadata and diagnostics. The experiment metadata also record the chosen filters.

Details

The fraction assay contains fractions backed by positive informative depth. The reported_fraction assay preserves the raw VCF values. informative_depth, modified_depth and coverage_status preserve the original values independently. All assays use NA where there is no call for a site and sample. A reported zero-depth call keeps its depth of zero and its coverage status.

Strand-specific calls and collapsed dyads occupy separate rows. This projection excludes alternate, de novo, allele-specific and haplotype measurements. Use the original ranges to analyze those measurements. Multiple calls that pass the filters selection at one site in one sample signal an error with class methylVCF_duplicate_site.

Conflicting assemblies or sequence lengths signal an error. Different reference file locations are allowed when the inputs declare a common assembly. Other conflicting ##reference declarations signal an error. Confirm a common assembly when header information is incomplete. The assays use dense matrices intended for regional data.

See also

readMethylVcf() for importing the individual measurements and vignette("methylVCF") for the complete workflow.

Examples

file <- system.file(
    "extdata", "dragen-multisample.g.vcf", package = "methylVCF"
)
region <- GenomicRanges::GRanges("chr21", IRanges::IRanges(13204474L))
calls <- readMethylVcf(file, region)
experiment <- asMethylExperiment(calls)
SummarizedExperiment::assay(experiment, "fraction")
#>                         sample_a sample_b
#> chr21:13204474:*:CG:5mC   0.2381       NA
SummarizedExperiment::assay(experiment, "reported_fraction")
#>                         sample_a sample_b
#> chr21:13204474:*:CG:5mC   0.2381        0