genbank_to_fasta()
Write the sequences of a GenBank file to a FASTA file.
Each record becomes a FASTA record with the header >VERSION DEFINITION and the sequence of ORIGIN in capitals. A record without a VERSION is named by its ACCESSION, else its LOCUS name, else the file name; without a DEFINITION the header is the name only.
Usage
python
from geneviewer import genbank_to_fasta
genbank_to_fasta(path, output_dir=tempfile.gettempdir())Arguments
| Argument | Type | Description |
|---|---|---|
path | str or path-like | The GenBank file. |
output_dir | str or path-like or None, optional | The folder of the FASTA file, which gets the input's name with the extension .fasta. By default the temporary folder; None writes it next to the input. |
Value
pathlib.Path: The FASTA file.
Errors
| Error | When |
|---|---|
FileNotFoundError | When the file does not exist. |
ValueError | When the file has no sequence, or its records do not end in //. |
