CycloBranch
cBricksDatabase Class Reference

The class representing a database of building blocks (bricks). More...

#include <cBricksDatabase.h>

Public Member Functions

bool nextCombination (vector< int > &combarray, int numberofbasicbricks, int maximumbricksincombination, double maximumcumulativemass, double neutralprecursormass)
 Get next combination of bricks. More...
 
bool nextCombinationFast (vector< int > &combarray, vector< int > &combcounts, vector< double > &combmasses, double &mass, int numberofbasicbricks, int maximumbricksincombination, double maximumcumulativemass, double neutralprecursormass)
 Get next combination of bricks. More...
 
bool nextCombinationFastLimited (vector< int > &combarray, vector< int > &combcounts, vector< int > &comblimits, vector< double > &combmasses, double &mass, int numberofbasicbricks, int maximumbricksincombination, double maximumcumulativemass, double neutralprecursormass)
 Get next combination of bricks. More...
 
 cBricksDatabase ()
 The constructor.
 
int loadFromPlainTextStream (ifstream &stream, string &errormessage, bool ignoreerrors, bool skiph2blocks)
 Load the database of bricks from a plain text stream. More...
 
void storeToPlainTextStream (ofstream &stream)
 Store the database of bricks into a plain text stream. More...
 
int size ()
 Get the number of bricks in the database. More...
 
void print ()
 Print the database of bricks.
 
void sortbyMass ()
 Sort the database of bricks by mass in ascending order.
 
cBrickoperator[] (int position)
 Overloaded operator []. More...
 
double getMassOfComposition (vector< int > &combarray, int numberofbasicbricks)
 Get the mass of a composition of bricks. More...
 
string getRealName (string &composition)
 Get the real name of a peptide from a composition. More...
 
string getAcronymName (string &composition, bool useHTMLReferences)
 Get the name of a peptide composed from acronyms of bricks. More...
 
string getTagName (string &composition)
 Get a peptide sequence tag from a composition. More...
 
string getAcronymNameOfTPeptide (const string &tcomposition, bool useHTMLReferences)
 Get the name of a branched peptide composed from acronyms of bricks. More...
 
string getTagNameOfTPeptide (string &tcomposition)
 Get a peptide sequence tag of a branched peptide from a composition. More...
 
void clear ()
 Clear the vector of bricks.
 
bool replaceAcronymsByIDs (string &sequence, string &errormessage)
 Replace acronyms of bricks by ids. More...
 
void push_back (cBrick &brick)
 Push a new brick into the vector of bricks. More...
 
void removeLastBrick ()
 Remove the last brick from the vector of bricks if possible.
 
string calculateSummaryFromComposition (int brickid)
 Calculate the summary formula of a composition. More...
 
void store (ofstream &os)
 Store the structure into an output stream. More...
 
void load (ifstream &is)
 Load the structure from an input stream. More...
 
bool checkKetideBlocks (cBrick &brickseries, bool regularblocksorder)
 Check if the numbers of H2 loss and H2O loss blocks are correct. More...
 
double getMassOfNeutralLosses (vector< int > &lossids)
 Get the summary mass of neutral losses. More...
 
string getSummaryFormulaOfNeutralLosses (vector< int > &lossids)
 Get the summary formula of neutral losses. More...
 
void getMapOfNeutralLosses (vector< int > &lossids, map< string, int > &summarymap)
 Get the summary map of neutral losses. More...
 

Detailed Description

The class representing a database of building blocks (bricks).

Member Function Documentation

◆ calculateSummaryFromComposition()

string cBricksDatabase::calculateSummaryFromComposition ( int  brickid)

Calculate the summary formula of a composition.

Parameters
brickidbrick id
Return values
stringsummary formula

◆ checkKetideBlocks()

bool cBricksDatabase::checkKetideBlocks ( cBrick brickseries,
bool  regularblocksorder 
)

Check if the numbers of H2 loss and H2O loss blocks are correct.

Parameters
brickseriesa tested combination of building blocks
regularblocksordercheck regular order of ketide blocks
Return values
booltrue when the numbers of blocks are correct

◆ getAcronymName()

string cBricksDatabase::getAcronymName ( string &  composition,
bool  useHTMLReferences 
)

Get the name of a peptide composed from acronyms of bricks.

Parameters
compositionreference to a string containing ids of bricks separated by '-'
useHTMLReferencesif true then each acronym is converted to a link to its reference (e.g., in ChemSpider)
Return values
stringname of the peptide

◆ getAcronymNameOfTPeptide()

string cBricksDatabase::getAcronymNameOfTPeptide ( const string &  tcomposition,
bool  useHTMLReferences 
)

Get the name of a branched peptide composed from acronyms of bricks.

Parameters
tcompositionreference to a string containing ids of bricks separated by '-', the branch is specified by '(' and ')'; example: 1-2-3(4-5)6-7
useHTMLReferencesif true then each acronym is converted to a link to its reference (e.g., in ChemSpider)
Return values
stringname of the peptide

◆ getMapOfNeutralLosses()

void cBricksDatabase::getMapOfNeutralLosses ( vector< int > &  lossids,
map< string, int > &  summarymap 
)

Get the summary map of neutral losses.

Parameters
lossidsan input vector of ids of neutral losses
summarymapan output map of atoms

◆ getMassOfComposition()

double cBricksDatabase::getMassOfComposition ( vector< int > &  combarray,
int  numberofbasicbricks 
)

Get the mass of a composition of bricks.

Parameters
combarrayreference to an input integer vector of ids
numberofbasicbricksnumber of basic building blocks
Return values
doublecumulative mass of the bricks in the combarray

◆ getMassOfNeutralLosses()

double cBricksDatabase::getMassOfNeutralLosses ( vector< int > &  lossids)

Get the summary mass of neutral losses.

Parameters
lossidsa vector of ids of neutral losses
Return values
doublemass

◆ getRealName()

string cBricksDatabase::getRealName ( string &  composition)

Get the real name of a peptide from a composition.

Parameters
compositionreference to a string containing ids of bricks separated by '-'
Return values
stringname of the peptide

◆ getSummaryFormulaOfNeutralLosses()

string cBricksDatabase::getSummaryFormulaOfNeutralLosses ( vector< int > &  lossids)

Get the summary formula of neutral losses.

Parameters
lossidsa vector of ids of neutral losses
Return values
stringformula

◆ getTagName()

string cBricksDatabase::getTagName ( string &  composition)

Get a peptide sequence tag from a composition.

Parameters
compositionreference to a string containing ids of bricks separated by '-'
Return values
stringsequence tag

◆ getTagNameOfTPeptide()

string cBricksDatabase::getTagNameOfTPeptide ( string &  tcomposition)

Get a peptide sequence tag of a branched peptide from a composition.

Parameters
tcompositionreference to a string containing ids of bricks separated by '-', the branch is specified by '(' and ')'; example: 1-2-3(4-5)6-7
Return values
stringsequence tag

◆ load()

void cBricksDatabase::load ( ifstream &  is)

Load the structure from an input stream.

Parameters
isan input stream

◆ loadFromPlainTextStream()

int cBricksDatabase::loadFromPlainTextStream ( ifstream &  stream,
string &  errormessage,
bool  ignoreerrors,
bool  skiph2blocks 
)

Load the database of bricks from a plain text stream.

Parameters
streamreference to an input file stream
errormessagereference to a string where an error message might be stored
ignoreerrorsif true errors are ignored
skiph2blocksignore ketide 2H loss blocks
Return values
int0 when the database was successfully loaded, -1 when an error occurred (errormessage is filled up)

◆ nextCombination()

bool cBricksDatabase::nextCombination ( vector< int > &  combarray,
int  numberofbasicbricks,
int  maximumbricksincombination,
double  maximumcumulativemass,
double  neutralprecursormass 
)

Get next combination of bricks.

Parameters
combarrayreference to an input/output vector of integers
numberofbasicbricksinitial number of bricks in a database
maximumbricksincombinationmaximum number of combined bricks
maximumcumulativemassmaximum cummulative mass of combined bricks
neutralprecursormassneutral precursor mass
Return values
booltrue when a valid vector is stored in combarray, false when all valid vectors were already generated

◆ nextCombinationFast()

bool cBricksDatabase::nextCombinationFast ( vector< int > &  combarray,
vector< int > &  combcounts,
vector< double > &  combmasses,
double &  mass,
int  numberofbasicbricks,
int  maximumbricksincombination,
double  maximumcumulativemass,
double  neutralprecursormass 
)

Get next combination of bricks.

Parameters
combarrayreference to an input/output vector of integers
combcountsreference to an input/output vector containing counts of elements in combarray
combmassesreference to an input vector containing masses of elements in combarray
masssum of masses of blocks
numberofbasicbricksinitial number of bricks in a database
maximumbricksincombinationmaximum number of combined bricks
maximumcumulativemassmaximum cummulative mass of combined bricks
neutralprecursormassneutral precursor mass
Return values
booltrue when a valid vector is stored in combarray, false when all valid vectors were already generated

◆ nextCombinationFastLimited()

bool cBricksDatabase::nextCombinationFastLimited ( vector< int > &  combarray,
vector< int > &  combcounts,
vector< int > &  comblimits,
vector< double > &  combmasses,
double &  mass,
int  numberofbasicbricks,
int  maximumbricksincombination,
double  maximumcumulativemass,
double  neutralprecursormass 
)

Get next combination of bricks.

Parameters
combarrayreference to an input/output vector of integers
combcountsreference to an input/output vector containing counts of elements in combarray
comblimitsreference to an input vector containing maximum allowed numbers of elements in combarray
combmassesreference to an input vector containing masses of elements in combarray
masssum of masses of blocks
numberofbasicbricksinitial number of bricks in a database
maximumbricksincombinationmaximum number of combined bricks
maximumcumulativemassmaximum cummulative mass of combined bricks
neutralprecursormassneutral precursor mass
Return values
booltrue when a valid vector is stored in combarray, false when all valid vectors were already generated

◆ operator[]()

cBrick & cBricksDatabase::operator[] ( int  position)

Overloaded operator [].

Parameters
positionof the brick in the vector of bricks
Return values
cBrickreference to a brick

◆ push_back()

void cBricksDatabase::push_back ( cBrick brick)

Push a new brick into the vector of bricks.

Parameters
brickan inserted brick

◆ replaceAcronymsByIDs()

bool cBricksDatabase::replaceAcronymsByIDs ( string &  sequence,
string &  errormessage 
)

Replace acronyms of bricks by ids.

Parameters
sequencereference to an input/output string containing acronyms/ids of bricks
errormessagereference to a string where an error message is stored when sequence contains an unknown building block
Return values
booltrue when the replacement was successful, false when an acronym of a brick is unknown

◆ size()

int cBricksDatabase::size ( )

Get the number of bricks in the database.

Return values
intnumber of bricks

◆ store()

void cBricksDatabase::store ( ofstream &  os)

Store the structure into an output stream.

Parameters
osan output stream

◆ storeToPlainTextStream()

void cBricksDatabase::storeToPlainTextStream ( ofstream &  stream)

Store the database of bricks into a plain text stream.

Parameters
streamreference to an output file stream

The documentation for this class was generated from the following files: