dt2gr: Convert data.table to GRanges

View source: R/gUtils.R

dt2grR Documentation

Convert data.table to GRanges

Description

Takes as input a data.table which must have the following fields: start, end, strand, seqnames. Will throw an error if any one of these is not present. All of the remaining fields are added as metadata to the GRanges.

Usage

dt2gr(dt, key = NULL, seqlengths = NULL, seqinfo = Seqinfo())

Arguments

dt

data.table or data.frame to convert to GRanges

seqlengths

named integer vector representing genome (default = hg_seqlengths())

seqinfo

seqinfo of output GRanges object

Value

GRanges object of length = nrow(dt)

Examples

converted_gr = dt2gr(data.table(start=c(1,2), seqnames=c("X", "1"), end=c(10,20), strand = c('+', '-')))

mskilab/gUtils documentation built on June 6, 2023, 12:08 a.m.