Skip to contents

Construct an AnnotationMatrix from a matrix and metadata.

Usage

AnnotationMatrix(annotations, snpRanges, annotationMeta, genome = "hg19")

Arguments

annotations

A numeric matrix or sparse matrix (SNPs x annotations).

snpRanges

A GRanges object with SNP positions.

annotationMeta

A data.frame with columns: name, tier, type.

genome

Character, genome build; recorded in seqinfo().

Value

An AnnotationMatrix object.

Examples

snpRanges <- GenomicRanges::GRanges(
  "22", IRanges::IRanges((1:10) * 100, width = 1))
annotations <- matrix(rbinom(50, 1, 0.3), 10, 5,
  dimnames = list(NULL, paste0("annot", 1:5)))
meta <- data.frame(name = paste0("annot", 1:5), tier = "baseline",
  type = "binary")
am <- AnnotationMatrix(annotations, snpRanges, annotationMeta = meta)
am
#> AnnotationMatrix: 10 SNPs x 5 annotations
#>   Baseline: 5, Candidate: 0
#>   Binary: 5, Continuous: 0
#>   Genome build: hg19
dim(am)
#> [1] 10  5