gb_extract: Extract elements of a GenBank record

View source: R/extract-tools.R

gb_extractR Documentation

Extract elements of a GenBank record

Description

Return elements of GenBank record e.g. sequence, definition ...

Usage

gb_extract(
  record,
  what = c("accession", "version", "organism", "sequence", "definition", "locus",
    "features", "keywords")
)

Arguments

record

GenBank record in text format, character

what

Which element to extract

Details

This function uses a REGEX to extract particular elements of a GenBank record. All of the what options return a single character with the exception of 'locus' or 'keywords' that return character vectors and 'features' that returns a list of lists for all features.

The accuracy of these functions cannot be guaranteed due to the enormity of the GenBank database. But the function is regularly tested on a range of GenBank records.

Note: all non-latin1 characters are converted to '-'.

Value

character or list of lists (what='features') or named character vector (what='locus')

Examples

library(restez)
data('record')
(gb_extract(record = record, what = 'locus'))

ropensci/restez documentation built on Oct. 26, 2023, 5:38 a.m.