A vector of linker sites. More...
#include <ms_linker_site_vector.hpp>
Public Member Functions | |
ms_linker_site_vector () | |
Create an empty linker site vector. | |
ms_linker_site_vector (const ms_linker_site_vector &src) | |
Copying constructor. | |
ms_linker_site_vector (const std::list< ms_linker_site > &v, const int alphaVarModsLen, const int betaVarModsLen) | |
Create a linker site vector from an STL list. | |
ms_linker_site_vector (const std::vector< ms_linker_site > &v, const int alphaVarModsLen, const int betaVarModsLen) | |
Create a linker site vector from an STL vector. | |
~ms_linker_site_vector () | |
Destructor. | |
void | append (const ms_linker_site_vector &src) |
Appends all content from another instance of the class. | |
void | clear () |
Clear the vector. | |
bool | containsVarModIdx (int idx) const |
Return true if the vector contains a link with the given variable mod index. | |
void | copyFrom (const ms_linker_site_vector *src) |
Copies all content from another instance of the class. | |
bool | empty () const |
Boolean test: is the vector empty? | |
ms_linker_site | get (int idx) const |
Return the linker site at the given index. | |
int | getAlphaVarModsStrLength () const |
Return the alpha peptide sequence length. | |
int | getBetaVarModsStrLength () const |
Return the beta peptide sequence length. | |
int | getVarModIdxOfLinkedSite (const ms_peptide::PSM psmComponent, const int i) const |
Return the variable mod index if the PSM component has a link at position i. | |
ms_linker_site_vector & | operator= (const ms_linker_site_vector &right) |
C++ assignment operator. | |
ms_linker_site | pop () |
Pop a value from the end of the vector. | |
void | push (const ms_linker_site &linkerSite) |
Push a new linker site at the end of the vector. | |
void | set (int idx, const ms_linker_site &linkerSite) |
Set the value at the given index. | |
int | size () const |
Return the size of the container. | |
void | swap (ms_linker_site_vector &right) |
Swap the contents with another linker site vector. | |
const std::vector< ms_linker_site > & | toVector () const |
C++ conversion to std::vector. | |
A vector of linker sites.
ms_linker_site_vector is a wrapper around the C++ vector class std::vector, specialised to contain ms_linker_site objects. The ms_peptide class returns such vectors.
The interface to this class follows that of vectori and vectorString, as described in Using STL vector classes vectori, vectord and VectorString in Perl, Java, Python and C#.
ms_linker_site_vector | ( | const std::vector< ms_linker_site > & | v, |
const int | alphaVarModsLen, | ||
const int | betaVarModsLen | ||
) |
Create a linker site vector from an STL vector.
The alpha and beta variable mods string lengths are not optional, but one or both can be set to zero. See getVarModIdxOfLinkedSite().
v | STL vector to initialise with. |
alphaVarModsLen | length of the alpha peptide variable mods string. |
betaVarModsLen | length of the beta peptide variable mods string. |
ms_linker_site_vector | ( | const std::list< ms_linker_site > & | v, |
const int | alphaVarModsLen, | ||
const int | betaVarModsLen | ||
) |
Create a linker site vector from an STL list.
The alpha and beta variable mods string lengths are not optional, but one or both can be set to zero. See getVarModIdxOfLinkedSite().
v | STL list to initialise with. |
alphaVarModsLen | length of the alpha peptide variable mods string. |
betaVarModsLen | length of the beta peptide variable mods string. |
void append | ( | const ms_linker_site_vector & | src | ) |
Appends all content from another instance of the class.
This method does not change getAlphaVarModsStrLength() or getBetaVarModsStrLength().
src | is another ms_linker_site_vector to append the sites from. |
void clear | ( | ) |
Clear the vector.
After clear, the vector will be empty. Alpha and beta variable mods string lengths are set to zero.
bool containsVarModIdx | ( | int | idx | ) | const |
Return true if the vector contains a link with the given variable mod index.
idx | Variable mod index. |
bool empty | ( | ) | const |
Boolean test: is the vector empty?
ms_linker_site get | ( | int | idx | ) | const |
Return the linker site at the given index.
Note that idx must be within the 0-indexed range. Otherwise the method will throw an exception.
idx | The element index, 0..size()-1. |
int getAlphaVarModsStrLength | ( | ) | const |
Return the alpha peptide sequence length.
int getBetaVarModsStrLength | ( | ) | const |
Return the beta peptide sequence length.
int getVarModIdxOfLinkedSite | ( | const ms_peptide::PSM | psmComponent, |
const int | i | ||
) | const |
Return the variable mod index if the PSM component has a link at position i.
There are two use cases.
If psmComponent is ms_peptide::PSM_CROSSLINK_ALPHA or ms_peptide::PSM_CROSSLINK_BETA, the position i indexes the alpha or the beta variable mods string returned by ms_peptide::getVarModsStr(psmComponent). This method returns a non-zero variable mod number if there is a link in the given psmComponent at position i.
If psmComponent is ms_peptide::PSM_COMPLETE, the position i indexes the concatenated variable mods string returned by ms_peptide::getVarModsStr(PSM_COMPLETE). A simple calculation is done to determine whether i is a position in the alpha or the beta peptide:
One or both of alpha or beta variable mods string lengths can be zero.
psmComponent | One of ms_peptide::PSM. |
i | Position within the variable mods string. |
ms_linker_site pop | ( | ) |
Pop a value from the end of the vector.
Note that the vector must be nonempty (it must contain at least one element). If it doesn't, the method throws an exception.
void push | ( | const ms_linker_site & | linkerSite | ) |
Push a new linker site at the end of the vector.
linkerSite | Linker site to append to the vector. |
void set | ( | int | idx, |
const ms_linker_site & | linkerSite | ||
) |
int size | ( | ) | const |
Return the size of the container.
void swap | ( | ms_linker_site_vector & | src | ) |
Swap the contents with another linker site vector.
After this method returns, the data of src is stored inside this object, and src stores the old contents of this object.
This method swaps getAlphaVarModsStrLength() and getBetaVarModsStrLength() with src.
src | Linker site vector to swap contents with. |
const std::vector< ms_linker_site > & toVector | ( | ) | const |
C++ conversion to std::vector.