ngs_tools.fasta.Fasta

Module Contents

Classes

Fasta

Represents a single FASTA file.

exception ngs_tools.fasta.Fasta.FastaError

Bases: Exception

Common base class for all non-exit exceptions.

class ngs_tools.fasta.Fasta.Fasta(path: str, mode: typing_extensions.Literal[r, w] = 'r')

Bases: ngs_tools.utils.FileWrapper

Represents a single FASTA file.

_header

Variable that temporarily holds the header string for the next FASTA entry; for internal use only.

read() ngs_tools.fasta.FastaEntry.FastaEntry

Read a single FASTA entry as a FastaEntry instance.

Returns:

The next FASTA entry

Raises:
  • FastaError – If the file was not opened for reading, or the file was closed.

  • StopIteration – When there are no more entries to read.

write(entry: ngs_tools.fasta.FastaEntry.FastaEntry)

Write a single FASTA entry.

Parameters:

entry – The FASTA entry to write

Raises:

FastaError – If the file was not opened for writing, or the file was closed.