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
if (FALSE) {
# Read GFF files from a directory
gff_data <- read_gff("path/to/directory")
# Read a single GFF file
gff_data <- read_gff("path/to/file.gff")
# Read specific fields from GFF files
gff_data <- read_gff(
"path/to/directory",
fields = c("seqid", "start", "end", "attributes")
)
}