90 identifier(::std::move(rhs.identifier)),
91 description(::std::move(rhs.description)),
92 sequence(::std::move(rhs.sequence))
174 void load(
const String& filename, std::vector<FASTAEntry>& data)
const;
182 void store(
const String& filename,
const std::vector<FASTAEntry>& data)
const;
189 bool readEntry_(std::string&
id, std::string& description, std::string& seq);
194 std::streampos fileSize_{};
This class serves for reading in and writing FASTA files If the protein/gene sequence contains unusua...
Definition: FASTAFile.h:61
void writeEnd()
Closes the file (flush). Called implicitly when FASTAFile object goes out of scope.
void load(const String &filename, std::vector< FASTAEntry > &data) const
loads a FASTA file given by 'filename' and stores the information in 'data' This uses more RAM than r...
bool readNext(FASTAEntry &protein)
Reads the next FASTA entry from file. If you want to read all entries in one go, use load().
virtual ~FASTAFile()=default
Destructor.
bool setPosition(const std::streampos &pos)
seek stream to pos
std::string seq_
sequence of currently read protein
Definition: FASTAFile.h:195
void readStart(const String &filename)
Prepares a FASTA file given by 'filename' for streamed reading using readNext().
void writeStart(const String &filename)
Prepares a FASTA file given by 'filename' for streamed writing using writeNext().
std::ofstream outfile_
filestream for writing; init using FastaFile::writeStart()
Definition: FASTAFile.h:192
FASTAFile()=default
Default constructor.
bool atEnd()
is stream at EOF?
bool readEntry_(std::string &id, std::string &description, std::string &seq)
Reads a protein entry from the current file position and returns the ID and sequence.
std::string id_
identifier of currently read protein
Definition: FASTAFile.h:196
void writeNext(const FASTAEntry &protein)
Stores the data given by protein. Call writeStart() once before calling writeNext()....
std::fstream infile_
filestream for reading; init using FastaFile::readStart()
Definition: FASTAFile.h:191
std::string description_
description of currently read protein
Definition: FASTAFile.h:197
void store(const String &filename, const std::vector< FASTAEntry > &data) const
stores the data given by 'data' at the file 'filename'
std::streampos position()
current stream position
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
A more convenient string class.
Definition: String.h:61
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
FASTA entry type (identifier, description and sequence) The first String corresponds to the identifie...
Definition: FASTAFile.h:72
bool headerMatches(const FASTAEntry &rhs) const
Definition: FASTAFile.h:106
String sequence
Definition: FASTAFile.h:75
String description
Definition: FASTAFile.h:74
FASTAEntry(const String &id, const String &desc, const String &seq)
Definition: FASTAFile.h:79
FASTAEntry(const FASTAEntry &rhs)=default
bool operator==(const FASTAEntry &rhs) const
Definition: FASTAFile.h:99
String identifier
Definition: FASTAFile.h:73
FASTAEntry & operator=(const FASTAEntry &rhs)=default
bool sequenceMatches(const FASTAEntry &rhs) const
Definition: FASTAFile.h:112
FASTAEntry(FASTAEntry &&rhs) noexcept
Definition: FASTAFile.h:88