Skip to contents

Read genomic annotations from files (BED, BigWig, S-LDSC .annot format, or GRanges objects) and create an AnnotationMatrix.

Usage

readAnnotations(paths, snpRanges, annotationMeta = NULL, genome = "hg19", ...)

# S4 method for class 'character'
readAnnotations(paths, snpRanges, annotationMeta = NULL, genome = "hg19", ...)

Arguments

paths

Named character vector of file paths, or a named list of GRanges objects. Names become annotation names.

snpRanges

A GRanges object defining SNP positions.

annotationMeta

A data.frame with annotation metadata (name, tier, type). If NULL, auto-detected from file format.

genome

Character, genome build.

...

Additional arguments.

Value

An AnnotationMatrix object.

Examples

bedFile <- tempfile(fileext = ".bed")
writeLines("chr1\t100\t500\tregion1", bedFile)
snpRanges <- GenomicRanges::GRanges(
  rep("chr1", 3), IRanges::IRanges(c(50, 200, 600), width = 1))
readAnnotations(c(enhancer = bedFile), snpRanges, genome = "hg38")
#> AnnotationMatrix: 3 SNPs x 1 annotations
#>   Baseline: 0, Candidate: 1
#>   Binary: 1, Continuous: 0
#>   Genome build: hg38