Skip to contents
0.16.6 documentation

Complete canonical API text; task articles explain the workflows. Tutorials

Site guide · find your task

file reads a single GFF3 file; files reads multiple files at once and combines them. files accepts a character vector of literal paths and/or wildcard patterns (e.g. "examples/gff3/*.gff3").

Usage

Code
read_gff3(
  file = NULL,
  files = NULL,
  feature_types = "CDS",
  anno_from = c("product", "Name", "gene", "ID"),
  unstranded = c("plus", "drop", "keep"),
  source_file = FALSE
)

Arguments

file

Optional path vector or glob patterns; read before files.

files

Optional character vector of GFF3 files (literal paths and/or wildcard patterns). All matched files are read and combined.

feature_types

Character vector of feature types to keep, default "CDS".

anno_from

Character vector of GFF3 attribute keys, tried in order to fill the anno column.

unstranded

"plus" (legacy default) assigns unknown strands to +; "drop" removes them. Use "keep" with geom_feature() to retain them as nondirectional . intervals. source_strand always records the input.

source_file

Logical. Add a .source_file column when reading one or more files, default FALSE.

Value

A data.frame with accver, start, end, strand, anno followed by type, source, score, phase, attributes, source_strand, feature_id (decoded GFF3 ID, or missing) and a parent_ids list-column. Repeated IDs for discontinuous features and multiple parents are retained; selecting feature types may omit parents. A ggchord_import attribute records files, per-file output row counts and the one-based inclusive coordinate convention.

Examples

Code
if (FALSE) { # \dontrun{
library(dplyr)
# Requires the source checkout or tutorial input bundle.
source <- read_gff3("examples/gff3/MT108731.1.gff3", unstranded = "keep")
features <- source |>
  select(accver, start, end, strand, anno)
} # }