read_regions {annotatr} | R Documentation |
read_regions()
reads genomic regions by calling the rtracklayer::import()
function. This function can automatically deal with BEDX files from BED3 to BED6. For BED6+Y, the extraCols
argument should be used to correctly interpret the extra columns.
read_regions(con, genome = NA, format, extraCols = character(), rename_name, rename_score, ...)
con |
A path, URL, connection or BEDFile object. See |
genome |
From |
format |
From |
extraCols |
From |
rename_name |
A string to rename the name column of the BED file. For example, if the name column actually contains a categorical variable. |
rename_score |
A string to rename the score column of the BED file. For example, if the score column represents a quantity about the data besides the score in the BED specification. |
... |
Parameters to pass onto the format-specific method of |
NOTE: The name
(4th) and score
(5th) columns are so named. If these columns have a particular meaning for your data, they should be renamed with the rename_name
and/or rename_score
parameters.
A GRanges
object.
# Example of reading a BED6+3 file where the last 3 columns are non-standard file = system.file('extdata', 'IDH2mut_v_NBM_multi_data_chr9.txt.gz', package = 'annotatr') extraCols = c(diff_meth = 'numeric', mu0 = 'numeric', mu1 = 'numeric') gr = read_regions(con = file, genome = 'hg19', extraCols = extraCols, format = 'bed', rename_name = 'DM_status', rename_score = 'pval')