Matrix Science header
Public Member Functions

ms_linker_site_vector Class Reference
[Mascot results file module]

A vector of linker sites. More...

#include <ms_linker_site_vector.hpp>

List of all members.

Public Member Functions

 ms_linker_site_vector ()
 Create an empty linker site vector.
 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 (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 ()
 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_vectoroperator= (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.

Detailed Description

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#.


Constructor & Destructor Documentation

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.

Note:
This constructor can only be used from C++.

The alpha and beta variable mods string lengths are not optional, but one or both can be set to zero. See getVarModIdxOfLinkedSite().

Parameters:
vSTL vector to initialise with.
alphaVarModsLenlength of the alpha peptide variable mods string.
betaVarModsLenlength 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.

Note:
This constructor can only be used from C++.

The alpha and beta variable mods string lengths are not optional, but one or both can be set to zero. See getVarModIdxOfLinkedSite().

Parameters:
vSTL list to initialise with.
alphaVarModsLenlength of the alpha peptide variable mods string.
betaVarModsLenlength of the beta peptide variable mods string.

Member Function Documentation

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().

Parameters:
srcis 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.

Parameters:
idxVariable mod index.
Returns:
True if any linker object uses idx at either end of the link.
bool empty (  ) const

Boolean test: is the vector empty?

Returns:
True if the vector is empty (has size 0); false otherwise.
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.

Parameters:
idxThe element index, 0..size()-1.
Returns:
The element at the corresponding index.
int getAlphaVarModsStrLength (  ) const

Return the alpha peptide sequence length.

Returns:
Length of the alpha variable mods string, or 0 if not set.
int getBetaVarModsStrLength (  ) const

Return the beta peptide sequence length.

Returns:
Length of the beta variablem mods string, or 0 if not set.
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.

Parameters:
psmComponentOne of ms_peptide::PSM.
iPosition within the variable mods string.
Returns:
Variable mod index if the there is a link at position i. If there is no link, returns 0.
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.

Returns:
The value popped from the end of the vector.
void push ( const ms_linker_site linkerSite )

Push a new linker site at the end of the vector.

Parameters:
linkerSiteLinker site to append to the vector.
void set ( int  idx,
const ms_linker_site linkerSite 
)

Set the value at the given index.

Note that idx must be within the 0-indexed range. Otherwise the method will throw an exception. If you need to extend the vector, use push().

Parameters:
idxThe element index, 0..size()-1.
linkerSiteThe new value to be set at that index.
int size (  ) const

Return the size of the container.

Returns:
The number of elements in the vector, or 0 if the vector is empty.
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.

Parameters:
srcLinker site vector to swap contents with.
const std::vector< ms_linker_site > & toVector (  ) const

C++ conversion to std::vector.

Note:
This method can only be used from C++.
Returns:
A copy of the linker site vector as an STL vector.

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

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:33