read_format: Quick and easy reading of gtf/gff/bed/bam files

Description Usage Arguments Value See Also Examples

Description

read_gtf, read_gff, read_bed and read_bam are specific functions corresponding to respective file formats.

read_format is a top-level convenience function that detects and reads automatically from the extension and is sufficient in most cases.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
read_format(file, format = detect_format(file), filter = FALSE,
  chromosomes = NULL, tags = c("NM", "MD"), verbose = FALSE)

read_gtf(file, filter = FALSE, verbose = FALSE)

read_gff(file, filter = FALSE, verbose = FALSE)

read_bed(file, filter = FALSE, verbose = FALSE)

read_bam(file, filter = FALSE, chromosomes = NULL, tags = c("NM", "MD"),
  verbose = FALSE)

Arguments

file

Complete path to the input file.

format

Type of annotation. Currently allowed values are "gtf", "gff", "bed" and "bam". If no input is provided, then it will be guessed from input file's extension.

filter

Filter rows where start/stop are invalid, and where start > end. Default (FALSE) is to not filter, i.e., retain all invalid rows as well.

chromosomes

Argument to read_bam. If specified only reads from those chromosomes will be loaded.

tags

Additional (optional) tags to load from the bam file. By default, the tags "NM" and "MD" are loaded.

verbose

If TRUE, sends useful status messages to the console. Default is FALSE.

Value

An object of class gtf, gff, bed or bam, corresponding to the input file format, that inherits from GRanges.

See Also

supported_formats extract construct_introns

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
path <- system.file("tests", package="gread")
gff_file <- file.path(path, "sample.gff")
gtf_file <- file.path(path, "sample.gtf")
bed_file <- file.path(path, "sample.bed")
bam_file <- file.path(path, "sample.bam")

read_format(gff_file) # read gff
read_gff(gff_file)    # same as above
read_format(gtf_file) # read gtf
read_gtf(gtf_file)    # same as above
read_format(bed_file) # read bed
read_bed(bed_file)    # same as above
read_format(bam_file) # read bam
read_bam(bam_file)    # same as above

gtf_filter_file <- file.path(path, "sample_filter.gtf")
read_format(gtf_filter_file, filter=TRUE) # filter invalid rows
read_gtf(gtf_filter_file, filter=TRUE)    # same as above

asrinivasan-oa/gread documentation built on May 10, 2019, 2:04 p.m.