df.to.gr: Convert a data.frame to a GRanges object

Description Usage Arguments Value Author(s) Examples

View source: R/ngscopy.R

Description

Convert a data.frame to a GRanges object

Usage

1
2
3
df.to.gr(x, which.chr = "chr", which.start = "start", which.end = "end",
  which.width = "width", which.name = "name", chrlength = NULL,
  start0 = TRUE)

Arguments

x

data.frame or matrix

which.chr

character, the column name of 'chr'

which.start

character, the column name of 'start'

which.end

character, the column name of 'end'

which.width

character, the column name of 'width'

which.name

character, the column name of 'name'

chrlength

numeric, the lengths of the chromosomes

start0

logical, wheter the 'start' is 0-based.

Value

a GRanges object

Author(s)

Xiaobei Zhao

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
x <- data.frame(
  chr=c('chr1','chr2'),start=0,end=100,
  name=paste0('ID',1:2),score=1:2
  )
df.to.gr(x)
df.to.gr(x,chrlength=c(chr1=1000,chr2=1200))

## End(Not run)

NGScopy documentation built on Nov. 17, 2017, noon