gds_annotate: Annotation with GDS File

View source: R/gds_annotation.R

gds_annotateR Documentation

Annotation with GDS File

Description

Retrieve variant annotation stored in a GDS file with chromosome location or rs.id.

Usage

gds_annotate(
  x,
  gdsfile = NULL,
  annot.method = "position",
  chr = NULL,
  pos = NULL,
  ref = NULL,
  alt = NULL,
  rs.id = NULL,
  concat_char = "/",
  verbose = TRUE,
  annotation_names = c("annotation/info/symbol", "annotation/info/consequence",
    "annotation/info/LoF")
)

Arguments

x

a data.frame object to be annotated.

gdsfile

a character for GDS filename. If NULL, the default GDS file included with the package is used.

annot.method

a method for searching variants. "position" requires chr, pos, ref, and alt. "rs.id" requires rs.id.

chr, pos, ref, alt, rs.id

column names of x that contain chromosome, position, reference allele, alternate allele, and rs.id, respectively.

concat_char

a character used to separate multiple annotations returned from the gds file.

verbose

output messages.

annotation_names

a character vector of nodes of the gdsfile that are to be extracted.

Value

A character vector the length of nrow(x) if concat_char is a character. A data frame with nrow(x) rows and length(annotation_names) if concat_char is null.

Examples

vardata <- data.frame(
  chr = c(11,20,14),
  pos = c(12261002, 10033792, 23875025),
  ref = c("G", "G", "CG"),
  alt = c("A", "A", "C")
)

annotations <- gds_annotate(
  x = vardata, annot.method = "position",
  chr = "chr", pos = "pos", ref = "ref", alt = "alt"
)

print(annotations)


leejs-abv/ggmanh documentation built on March 25, 2024, 11:17 a.m.