|
CycloBranch
|
Auxiliary funtions and structures. More...
#include <fstream>#include <iostream>#include <vector>#include <deque>#include <map>#include <unordered_map>#include <string>#include <sstream>#include <iomanip>#include <cfloat>#include <cmath>#include <QString>#include <QByteArray>#include <QMetaType>#include <QAbstractItemModel>#include <QModelIndex>#include <boost/regex.hpp>Go to the source code of this file.
Classes | |
| struct | cCoordinateInfo |
| Store aggregated information about a coordinate. More... | |
| struct | compareStringBySize |
| Compare items in a string vector by size. More... | |
Macros | |
| #define | WIN 0 |
| #define | UNX 1 |
| #define | OSX 2 |
| #define | OS_TYPE WIN |
Enumerations | |
| enum | eVendorType { unknownvendor = 0 , bruker = 1 , waters = 2 } |
| Vendor types. | |
| enum | eModeType { denovoengine = 0 , singlecomparison = 1 , databasesearch = 2 , dereplication = 3 , compoundsearch = 4 } |
| Running modes of the application. | |
| enum | ePeptideType { linear = 0 , cyclic = 1 , branched = 2 , branchcyclic = 3 , linearpolyketide = 4 , cyclicpolyketide = 5 , other = 6 } |
| The types of peptides supported by the application. | |
Functions | |
| void | storeIntVector (vector< int > &v, ofstream &os) |
| Store a vector of integers into an output stream. More... | |
| void | loadIntVector (vector< int > &v, ifstream &is) |
| Load a vector of integers from an input stream. More... | |
| void | storeDoubleVector (vector< double > &v, ofstream &os) |
| Store a vector of doubles into an output stream. More... | |
| void | loadDoubleVector (vector< double > &v, ifstream &is) |
| Load a vector of doubles from an input stream. More... | |
| void | storeString (string &s, ofstream &os) |
| Store a string into an output stream. More... | |
| void | loadString (string &s, ifstream &is) |
| Load a string from an input stream. More... | |
| void | storeStringVector (vector< string > &v, ofstream &os) |
| Store a vector of strings into an output stream. More... | |
| void | loadStringVector (vector< string > &v, ifstream &is) |
| Load a vector of strings from an input stream. More... | |
| void | storeStringIntMap (map< string, int > &map, ofstream &os) |
| Store a map<string, int> into an output stream. More... | |
| void | loadStringIntMap (map< string, int > &map, ifstream &is) |
| Load a map<string, int> from an input stream. More... | |
| void | storeStringIntMapVector (vector< map< string, int > > &vector, ofstream &os) |
| Store a vector of map<string, int> into an output stream. More... | |
| void | loadStringIntMapVector (vector< map< string, int > > &vector, ifstream &is) |
| Load a vector of map<string, int> from an input stream. More... | |
| void | storeIntStringMap (map< int, string > &map, ofstream &os) |
| Store a map<int, string> into an output stream. More... | |
| void | loadIntStringMap (map< int, string > &map, ifstream &is) |
| Load a map<int, string> from an input stream. More... | |
| void | convertStringIntUnorderedMapToStringVector (unordered_map< string, int > &map, vector< string > &vector) |
| Convert an unordered_map<string, int> to a vector<string>. More... | |
| bool | isWhiteSpace (char c) |
| Check if c is a white space. More... | |
| bool | isWhiteSpaceExceptSpace (char c) |
| Check if c is a white space (except normal space). More... | |
| string & | removeWhiteSpacesExceptSpaces (string &s) |
| Remove white spaces except normal spaces from a string. More... | |
| bool | checkRegex (ePeptideType peptidetype, string &sequence, string &errormessage) |
| Check the syntax of a peptide sequence. More... | |
| bool | checkFile (string filename) |
| Check if a file exists. More... | |
| bool | compareDoubles (double &first, double &second, double epsilon=0.0000001f) |
| Check if two doubles are equal. More... | |
| bool | compareStringVectors (vector< string > &first, vector< string > &second) |
| Check if two vectors of strings are equal. More... | |
| bool | compareMapsIntDouble (map< int, double > &first, map< int, double > &second, double epsilon=0.0000001f) |
| Check if two maps of doubles are equal. More... | |
| void | parseBranch (ePeptideType peptidetype, string &composition, vector< string > &vectorcomposition, int &branchstart, int &branchend) |
| Parse a position of a branch from a peptide sequence. More... | |
| ePeptideType | getPeptideTypeFromString (string &s) |
| Convert a string to peptide type. More... | |
| string | getStringFromPeptideType (ePeptideType peptidetype) |
| Convert the peptide type to a string. More... | |
| double | cropPrecisionToSixDecimals (double value) |
| Crop a precision of a double to six decimal places. More... | |
| QByteArray | cropDecimalsByteArray (double value) |
| Crop decimals of a double. More... | |
| QByteArray | cropPrecisionToSixDecimalsByteArray (double value) |
| Crop a precision of a double to six decimal places. More... | |
| string | getShortFileName (string filename) |
| Get a short filename from a string. More... | |
| Q_DECLARE_METATYPE (vector< cCoordinateInfo >) | |
| Register vector<cCoordinateInfo> by Qt. | |
| double | fact (int value) |
| Get factorial of a value. More... | |
| double | median (vector< double > &vector) |
| Get median from a vector of doubles. More... | |
| string | stripHTML (string &htmlstring) |
| Strip HTML tags from a HTML string. More... | |
| void | stripIsomers (string &peptidesequence) |
| Strip isomers of building blocks from an input peptide sequence. More... | |
| void | stripIsomersFromStringVector (vector< string > &acronyms) |
| Strip isomers of building blocks from an input string vector. More... | |
| bool | proxyModelCheckInt (QAbstractItemModel *model, int index, int row, int column, QString str, const QModelIndex &parent) |
| Proxy model - int comparator. More... | |
| bool | proxyModelCheckDouble (QAbstractItemModel *model, int index, int row, int column, QString str, const QModelIndex &parent) |
| Proxy model - double comparator. More... | |
| bool | proxyModelCheckString (QAbstractItemModel *model, int index, int row, int column, QString &itemstr, QString str, const QModelIndex &parent, bool wholeword, Qt::CaseSensitivity casesensitive) |
| Proxy model - string comparator. More... | |
| bool | isCompatibleVersion (int fileversionpart1, int fileversionpart2, int fileversionpart3, int lastcompatiblepart1, int lastcompatiblepart2, int lastcompatiblepart3) |
| Check the compatibility of CycloBranch version. More... | |
| string | fixLabelCharge (string &str, int sourcecharge, int targetcharge) |
| Fix the name of a multiply charged ion in MS mode. More... | |
Auxiliary funtions and structures.
| bool checkFile | ( | string | filename | ) |
Check if a file exists.
| filename | filename |
| bool | true if the file exists, false otherwise |
| bool checkRegex | ( | ePeptideType | peptidetype, |
| string & | sequence, | ||
| string & | errormessage | ||
| ) |
Check the syntax of a peptide sequence.
| peptidetype | peptide type |
| sequence | peptide sequence |
| errormessage | an error message if false is returned |
| bool | true when the syntax is correct, false otherwise |
| bool compareDoubles | ( | double & | first, |
| double & | second, | ||
| double | epsilon = 0.0000001f |
||
| ) |
Check if two doubles are equal.
| first | first value |
| second | second value |
| epsilon | epsilon value for comparison |
| bool | true if the values are equal |
| bool compareMapsIntDouble | ( | map< int, double > & | first, |
| map< int, double > & | second, | ||
| double | epsilon = 0.0000001f |
||
| ) |
Check if two maps of doubles are equal.
| first | first map |
| second | second map |
| epsilon | epsilon value for double comparison |
| bool | true if the maps are equal |
| bool compareStringVectors | ( | vector< string > & | first, |
| vector< string > & | second | ||
| ) |
Check if two vectors of strings are equal.
| first | first vector |
| second | second vector |
| bool | true if the vectors are equal |
| void convertStringIntUnorderedMapToStringVector | ( | unordered_map< string, int > & | map, |
| vector< string > & | vector | ||
| ) |
Convert an unordered_map<string, int> to a vector<string>.
| map | an input map |
| vector | an output vector |
| QByteArray cropDecimalsByteArray | ( | double | value | ) |
Crop decimals of a double.
| value | an input value |
| QByteArray | a value with the limited precision |
| double cropPrecisionToSixDecimals | ( | double | value | ) |
Crop a precision of a double to six decimal places.
| value | an input value |
| double | a value with the limited precision |
| QByteArray cropPrecisionToSixDecimalsByteArray | ( | double | value | ) |
Crop a precision of a double to six decimal places.
| value | an input value |
| QByteArray | a value with the limited precision |
| double fact | ( | int | value | ) |
Get factorial of a value.
| value | value |
| double | factorial of the value |
| string fixLabelCharge | ( | string & | str, |
| int | sourcecharge, | ||
| int | targetcharge | ||
| ) |
Fix the name of a multiply charged ion in MS mode.
| str | original ion name |
| sourcecharge | source charge |
| targetcharge | target charge |
| string | fixed name |
| ePeptideType getPeptideTypeFromString | ( | string & | s | ) |
Convert a string to peptide type.
| s | string |
| ePeptideType | type of peptide |
| string getShortFileName | ( | string | filename | ) |
Get a short filename from a string.
| filename | long filename |
| string | short filename |
| string getStringFromPeptideType | ( | ePeptideType | peptidetype | ) |
Convert the peptide type to a string.
| peptidetype | type of peptide |
| string | string |
| bool isCompatibleVersion | ( | int | fileversionpart1, |
| int | fileversionpart2, | ||
| int | fileversionpart3, | ||
| int | lastcompatiblepart1, | ||
| int | lastcompatiblepart2, | ||
| int | lastcompatiblepart3 | ||
| ) |
Check the compatibility of CycloBranch version.
| fileversionpart1 | tested version (part 1) |
| fileversionpart2 | tested version (part 2) |
| fileversionpart3 | tested version (part 3) |
| lastcompatiblepart1 | last compatible version (part 1) |
| lastcompatiblepart2 | last compatible version (part 2) |
| lastcompatiblepart3 | last compatible version (part 3) |
| bool | true if the versions are compatible |
| bool isWhiteSpace | ( | char | c | ) |
Check if c is a white space.
| c | char |
| bool | true if c is a white space; false otherwise. |
| bool isWhiteSpaceExceptSpace | ( | char | c | ) |
Check if c is a white space (except normal space).
| c | char |
| bool | true if c is a white space (except normal space); false otherwise. |
| void loadDoubleVector | ( | vector< double > & | v, |
| ifstream & | is | ||
| ) |
Load a vector of doubles from an input stream.
| v | reference to a vector of doubles |
| is | reference to an input stream |
| void loadIntStringMap | ( | map< int, string > & | map, |
| ifstream & | is | ||
| ) |
Load a map<int, string> from an input stream.
| map | reference to a map |
| is | reference to an input stream |
| void loadIntVector | ( | vector< int > & | v, |
| ifstream & | is | ||
| ) |
Load a vector of integers from an input stream.
| v | reference to a vector of integers |
| is | reference to an input stream |
| void loadString | ( | string & | s, |
| ifstream & | is | ||
| ) |
Load a string from an input stream.
| s | reference to a string |
| is | reference to an input stream |
| void loadStringIntMap | ( | map< string, int > & | map, |
| ifstream & | is | ||
| ) |
Load a map<string, int> from an input stream.
| map | reference to a map |
| is | reference to an input stream |
| void loadStringIntMapVector | ( | vector< map< string, int > > & | vector, |
| ifstream & | is | ||
| ) |
Load a vector of map<string, int> from an input stream.
| vector | reference to a vector |
| is | reference to an input stream |
| void loadStringVector | ( | vector< string > & | v, |
| ifstream & | is | ||
| ) |
Load a vector of strings from an input stream.
| v | reference to a vector of strings |
| is | reference to an input stream |
| double median | ( | vector< double > & | vector | ) |
Get median from a vector of doubles.
| vector | vector of doubles |
| double | median value |
| void parseBranch | ( | ePeptideType | peptidetype, |
| string & | composition, | ||
| vector< string > & | vectorcomposition, | ||
| int & | branchstart, | ||
| int & | branchend | ||
| ) |
Parse a position of a branch from a peptide sequence.
| peptidetype | peptide type |
| composition | a peptide sequence where all blocks "[blockX]-[blockY]" were replaced by ids "1-2"; but "\(" and "\)" are still included |
| vectorcomposition | an output vector with ids of blocks represented as strings |
| branchstart | start position of a branch (an output value) |
| branchend | end position of a branch (an output value) |
| bool proxyModelCheckDouble | ( | QAbstractItemModel * | model, |
| int | index, | ||
| int | row, | ||
| int | column, | ||
| QString | str, | ||
| const QModelIndex & | parent | ||
| ) |
Proxy model - double comparator.
| model | model |
| index | index |
| row | row |
| column | column |
| str | query string |
| parent | parent |
| bool | true if the item is valid |
| bool proxyModelCheckInt | ( | QAbstractItemModel * | model, |
| int | index, | ||
| int | row, | ||
| int | column, | ||
| QString | str, | ||
| const QModelIndex & | parent | ||
| ) |
Proxy model - int comparator.
| model | model |
| index | index |
| row | row |
| column | column |
| str | query string |
| parent | parent |
| bool | true if the item is valid |
| bool proxyModelCheckString | ( | QAbstractItemModel * | model, |
| int | index, | ||
| int | row, | ||
| int | column, | ||
| QString & | itemstr, | ||
| QString | str, | ||
| const QModelIndex & | parent, | ||
| bool | wholeword, | ||
| Qt::CaseSensitivity | casesensitive | ||
| ) |
Proxy model - string comparator.
| model | model |
| index | index |
| row | row |
| column | column |
| itemstr | string of current item |
| str | query string |
| parent | parent |
| wholeword | wholeword |
| casesensitive | casesensitive |
| bool | true if the item is valid |
| string & removeWhiteSpacesExceptSpaces | ( | string & | s | ) |
Remove white spaces except normal spaces from a string.
| s | reference to a string |
| string | reference to the input string |
| void storeDoubleVector | ( | vector< double > & | v, |
| ofstream & | os | ||
| ) |
Store a vector of doubles into an output stream.
| v | reference to a vector of doubles |
| os | reference to an output stream |
| void storeIntStringMap | ( | map< int, string > & | map, |
| ofstream & | os | ||
| ) |
Store a map<int, string> into an output stream.
| map | reference to a map |
| os | reference to an output stream |
| void storeIntVector | ( | vector< int > & | v, |
| ofstream & | os | ||
| ) |
Store a vector of integers into an output stream.
| v | reference to a vector of integers |
| os | reference to an output stream |
| void storeString | ( | string & | s, |
| ofstream & | os | ||
| ) |
Store a string into an output stream.
| s | reference to a string |
| os | reference to an output stream |
| void storeStringIntMap | ( | map< string, int > & | map, |
| ofstream & | os | ||
| ) |
Store a map<string, int> into an output stream.
| map | reference to a map |
| os | reference to an output stream |
| void storeStringIntMapVector | ( | vector< map< string, int > > & | vector, |
| ofstream & | os | ||
| ) |
Store a vector of map<string, int> into an output stream.
| vector | reference to a vector |
| os | reference to an output stream |
| void storeStringVector | ( | vector< string > & | v, |
| ofstream & | os | ||
| ) |
Store a vector of strings into an output stream.
| v | reference to a vector of strings |
| os | reference to an output stream |
| string stripHTML | ( | string & | htmlstring | ) |
Strip HTML tags from a HTML string.
| htmlstring | reference to a string with HTML tags |
| string | stripped string |
| void stripIsomers | ( | string & | peptidesequence | ) |
Strip isomers of building blocks from an input peptide sequence.
| peptidesequence | a peptide sequence |
| void stripIsomersFromStringVector | ( | vector< string > & | acronyms | ) |
Strip isomers of building blocks from an input string vector.
| acronyms | vector of building block acronyms with isomers |