This function reads GFF files from a specified directory or file path and combines them into a single data frame.
Arguments
- path
A character string specifying the directory containing GFF files or the file path to a single GFF file.
- fields
An optional vector of character strings specifying the fields to extract from the GFF files.
Details
This function can read multiple GFF files from a directory or a single GFF file. It processes each file, extracts the specified fields (if provided), adds a 'name' column with the filename, and combines the data frames from all files into one.
Examples
gff_file <- system.file("extdata", "HQ113105.1.gff3", package = "geneviewer")
# Read a single GFF file
gff_data <- read_gff(gff_file)
# Read GFF files from a directory
gff_data <- read_gff(dirname(gff_file))
# Read specific fields
gff_data <- read_gff(
gff_file,
fields = c("seqid", "type", "start", "end", "strand", "Name")
)
