Convert GenBank to FASTA Format
This function reads a GenBank file, extracts the sequence and writes it to a new file in FASTA format. It parses the DEFINITION and VERSION for the header and sequences from the ORIGIN section. A record without a VERSION is named by its ACCESSION, else its LOCUS name, else the file name.
Usage
r
genbank_to_fasta(path, output_dir = tempdir())Arguments
| Argument | Description |
|---|---|
path | Path to the GenBank file. |
output_dir | Directory for the output FASTA file, which gets the base name of the input file with a .fasta extension. Defaults to tempdir(). Use NULL to save it next to the input file. |
Value
The path of the FASTA file, invisibly.
Examples
r
# Path to the example GenBank file in the package
gbk_file <- system.file("extdata", "BGC0000001.gbk", package = "geneviewer")
# Convert the GenBank file to FASTA format in a temporary folder
genbank_to_fasta(gbk_file, output_dir = tempdir())