df.to.gr {NGScopy} | R Documentation

## Convert a data.frame to a GRanges object

### Description

Convert a data.frame to a GRanges object

### Usage

    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

    ## 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)

[Package NGScopy version 1.14.0 Index]