read_fasta()
Read FASTA files into one table, a row per sequence.
The keys of each header become columns: [key=value] pairs, as NCBI writes them, or key=value pairs, as in UniProt headers. A key repeated in one header keeps its values joined with ",". With a location key, the table gets start and end, the full span of the location, and strand: "complement" or "forward". Sequences without any key are left out, with a warning; a file that cannot be read is skipped, with a warning.
Usage
python
from geneviewer import read_fasta
read_fasta(fasta_path, sequence=True, keys=None, file_extension='fasta')Arguments
| Argument | Type | Description |
|---|---|---|
fasta_path | str or path-like | A FASTA file (also gzip-compressed), or a folder of them. |
sequence | bool, default True | Whether to keep the sequences, in the column sequence. |
keys | sequence of str, optional | The columns to keep. |
file_extension | str, default "fasta" | The extension of the files read from a folder. |
Value
pandas.DataFrame: One row per sequence, with cluster, the file's name without its extension.
Errors
| Error | When |
|---|---|
FileNotFoundError | When the path does not exist. |
