View source: R/genomicRegions.R
df2granges | R Documentation |
Converts a data.frame
that defines genomic regions to object of type GRanges
.
df2granges(
df,
ids = rownames(df),
chrom.col = 1L,
start.col = 2L,
end.col = 3L,
strand.col = NULL,
coord.format = "B1RI",
assembly = NULL,
doSort = FALSE,
adjNumChromNames = FALSE
)
df |
Table defining genomic regions. |
ids |
Region names (identifiers) as a |
chrom.col |
Column name or index that lists the chromosome names. |
start.col |
Column name or index that lists the start positions of the regions. |
end.col |
Column name or index that lists the end positions of the regions. |
strand.col |
Column name or index that lists the strands on which the regions are located. Set this to
|
coord.format |
Coordinate format |
assembly |
Genome assembly of interest. See |
doSort |
Should the resulting table be sorted |
adjNumChromNames |
Should numeric chromosome names be adjusted for by adding the prefix "chr". Additionally chrMT becomes chrM. useful for converting GRC identifiers to NCBI identifiers |
GRanges
object encapsulating of regions included in df
.
As GRanges, the coordinates will be 1-based right-inclusive.
Columns other that the ones listed as parameters in this function are included as elementMetadata.
df <- data.frame(chrom=c(rep("chr5", 7), rep("chr21", 3)), start=1:10, end=seq(20, by=10, length.out=10), strand=rep(c("+","+", "-", "*"), length.out=10), letter=letters[1:10], score=rnorm(10))
df
df2granges(df, assembly="GRCh38_chr")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.