read_annotations: Read custom annotations

Description Usage Arguments Value Examples

View source: R/read.R

Description

read_annotations() is a wrapper for the rtracklayer::import() function that creates a GRanges object matching the structure of annotations built with build_annotations(). The structure is defined by GRanges, with the mcols() with names c('id','gene_id','symbol','type').

Usage

1
read_annotations(con, name, genome = NA, format, extraCols = character(), ...)

Arguments

con

A path, URL, connection or BEDFile object. See rtracklayer::import.bed() documentation.

name

A string for the name of the annotations to be used in the name of the object, [genome]_custom_[name]

genome

From rtracklayer::import(): The identifier of a genome, or NA if unknown. Typically, this is a UCSC identifier like 'hg19'. An attempt will be made to derive the seqinfo on the return value using either an installed BSgenome package or UCSC, if network access is available.

format

From rtracklayer::import(): The format of the output. If not missing, should be one of 'bed', 'bed15', 'bedGraph' or 'bedpe'. If missing and 'con' is a filename, the format is derived from the file extension. This argument is unnecessary when 'con' is a derivative of 'RTLFile'.

extraCols

From rtracklayer::import.bed(): A character vector in the same form as 'colClasses' from 'read.table'. It should indicate the name and class of each extra/special column to read from the BED file. As BED does not encode column names, these are assumed to be the last columns in the file. This enables parsing of the various BEDX+Y formats.

...

Parameters to pass onto the format-specific method of rtracklayer::import().

Value

A GRanges object stored in annotatr_cache. To view a custom annotation, do annotatr_cache$get(name). To add a custom annotation to the set of annotations, include '[genome]_custom_[name]' in the call to build_annotations(). See example below.

Examples

1
2
3
4
5
6
 # Read in a BED3 file as a custom annotation
 file = system.file('extdata', 'test_annotations_3.bed', package='annotatr')
 read_annotations(con = file, name = 'test', genome = 'hg19')
 build_annotations(genome = 'hg19', annotations = 'hg19_custom_test')

 print(annotatr_cache$get('hg19_custom_test'))

annotatr documentation built on Nov. 8, 2020, 8:16 p.m.