FASTAFile#

class pyopenms.FASTAFile#

Bases: object

Cython implementation of _FASTAFile

Original C++ documentation is available here

__init__(self) None#

This class serves for reading in and writing FASTA files

Methods

__init__(self)

This class serves for reading in and writing FASTA files

atEnd(self)

Boolean function to check if streams is at end of file

load(self, filename, data)

Loads a FASTA file given by 'filename' and stores the information in 'data'

readNext(self, protein)

Reads the next FASTA entry from file

readStart(self, filename)

Prepares a FASTA file given by 'filename' for streamed reading using readNext()

store(self, filename, data)

Stores the data given by 'data' at the file 'filename'

writeEnd(self)

Closes the file (flush).

writeNext(self, protein)

Stores the data given by protein.

writeStart(self, filename)

Prepares a FASTA file given by 'filename' for streamed writing using writeNext()

atEnd(self) bool#

Boolean function to check if streams is at end of file

load(self, filename: bytes | str | String, data: List[FASTAEntry]) None#

Loads a FASTA file given by ‘filename’ and stores the information in ‘data’

readNext(self, protein: FASTAEntry) bool#

Reads the next FASTA entry from file

If you want to read all entries in one go, use load()

Returns:

true if entry was read; false if eof was reached

Raises:

Exception:FileNotFound is thrown if the file does not exists

Raises:

Exception:ParseError is thrown if the file does not suit to the standard

readStart(self, filename: bytes | str | String) None#

Prepares a FASTA file given by ‘filename’ for streamed reading using readNext()

Raises:

Exception:FileNotFound is thrown if the file does not exists

Raises:

Exception:ParseError is thrown if the file does not suit to the standard

Reads the next FASTA entry from file

If you want to read all entries in one go, use load()

Returns:

true if entry was read; false if eof was reached

Raises:

Exception:FileNotFound is thrown if the file does not exists

Raises:

Exception:ParseError is thrown if the file does not suit to the standard

store(self, filename: bytes | str | String, data: List[FASTAEntry]) None#

Stores the data given by ‘data’ at the file ‘filename’

writeEnd(self) None#

Closes the file (flush). Called implicitly when FASTAFile object does out of scope

writeNext(self, protein: FASTAEntry) None#

Stores the data given by protein. Call writeStart() once before calling writeNext()

Call writeEnd() when done to close the file!

Raises:

Exception:UnableToCreateFile is thrown if the process is not able to write to the file (disk full?)

writeStart(self, filename: bytes | str | String) None#

Prepares a FASTA file given by ‘filename’ for streamed writing using writeNext()

Raises:

Exception:UnableToCreateFile is thrown if the process is not able to write to the file (disk full?)

Stores the data given by protein. Call writeStart() once before calling writeNext()

Call writeEnd() when done to close the file!

Raises:

Exception:UnableToCreateFile is thrown if the process is not able to write to the file (disk full?)