ranges-construct: Construct a I/GRanges object from a tibble or data.frame

Description Usage Arguments Value See Also Examples

Description

The as_i(g)ranges function looks for column names in .data called start, end, width, seqnames and strand in order to construct an IRanges or GRanges object. By default other columns in .data are placed into the mcols ( metadata columns) slot of the returned object.

Usage

1
2
3
as_iranges(.data, ..., keep_mcols = TRUE)

as_granges(.data, ..., keep_mcols = TRUE)

Arguments

.data

a data.frame() or tibble() to construct a Ranges object from

...

optional named arguments specifying which the columns in .data containin the core components a Ranges object.

keep_mcols

place the remaining columns into the metadata columns slot (default=TRUE)

Value

a Ranges object.

See Also

IRanges::IRanges()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
df <- data.frame(start=c(2:-1, 13:15), width=c(0:3, 2:0))
as_iranges(df)

df <- data.frame(start=c(2:-1, 13:15), width=c(0:3, 2:0), strand = "+")
# will return an IRanges object
as_iranges(df)

df <- data.frame(start=c(2:-1, 13:15), width=c(0:3, 2:0),
strand = "+", seqnames = "chr1")
as_granges(df)

# as_g/iranges understand alternate name specification
df <- data.frame(start=c(2:-1, 13:15), width=c(0:3, 2:0),
strand = "+", chr = "chr1")
as_granges(df, seqnames = chr)

plyranges documentation built on Nov. 1, 2018, 3:58 a.m.