Description Usage Arguments Value Author(s) See Also Examples
View source: R/makeGRangesListFromDataFrame.R
makeGRangesListFromDataFrame
extends the
makeGRangesFromDataFrame functionality from
GenomicRanges
. It can take a data-frame-like object as input
and tries to automatically find the columns that describe the genomic
ranges. It returns a GRangesList object. This is different from the
makeGRangesFromDataFrame
function by requiring a
split.field
. The split.field
acts like the
"f" argument in the split
function. This factor
must be of the same length as the number of rows in the DataFrame
argument. The split.field
may also be a character vector.
1 2 3 4 | makeGRangesListFromDataFrame(df,
split.field = NULL,
names.field = NULL,
...)
|
df |
A |
split.field |
A character string of a recognized column name in |
names.field |
An optional single |
... |
Additional arguments passed on to makeGRangesFromDataFrame |
A GRangesList of the same length as the number of levels or
unique character strings in the df
column indicated by
split.field
. When split.field
is not provided the df
is split by row and the resulting GRangesList has the
same length as nrow(df).
Names on the individual ranges are taken from the names.field
argument. Names on the outer list elements of the GRangesList
are propagated from split.field
.
M. Ramos
makeGRangesFromDataFrame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## ---------------------------------------------------------------------
## BASIC EXAMPLES
## ---------------------------------------------------------------------
df <- data.frame(chr="chr1", start=11:15, end=12:16,
strand=c("+","-","+","*","."), score=1:5,
specimen = c("a", "a", "b", "b", "c"),
gene_symbols = paste0("GENE", letters[1:5]))
df
grl <- makeGRangesListFromDataFrame(df, split.field = "specimen",
names.field = "gene_symbols")
grl
names(grl)
## Keep metadata columns
makeGRangesListFromDataFrame(df, split.field = "specimen",
keep.extra.columns = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.