OpenMS
NASequence Class Reference

Representation of a nucleic acid sequence. More...

#include <OpenMS/CHEMISTRY/NASequence.h>

Collaboration diagram for NASequence:
[legend]

Classes

class  ConstIterator
 ConstIterator of NASequence class. More...
 
class  Iterator
 Iterator of NASequence class. More...
 

Public Types

enum  NASFragmentType {
  Full = 0 , Internal , FivePrime , ThreePrime ,
  AIon , BIon , CIon , XIon ,
  YIon , ZIon , Precursor , BIonMinusH20 ,
  YIonMinusH20 , BIonMinusNH3 , YIonMinusNH3 , NonIdentified ,
  Unannotated , WIon , AminusB , DIon ,
  SizeOfNASFragmentType
}
 an enum of all possible fragment ion types More...
 
using ConstRibonucleotidePtr = const Ribonucleotide *
 

Public Member Functions

 NASequence ()=default
 
 NASequence (const NASequence &)=default
 default constructor More...
 
 NASequence (NASequence &&)=default
 Move constructor. More...
 
NASequenceoperator= (const NASequence &) &=default
 Copy assignment operator. More...
 
NASequenceoperator= (NASequence &&) &=default
 Move assignment operator. More...
 
 NASequence (std::vector< const Ribonucleotide * > s, const RibonucleotideChainEnd *five_prime, const RibonucleotideChainEnd *three_prime)
 full constructor More...
 
virtual ~NASequence ()=default
 
bool operator== (const NASequence &rhs) const
 destructor More...
 
bool operator!= (const NASequence &rhs) const
 not quality More...
 
bool operator< (const NASequence &rhs) const
 less operator More...
 
void setSequence (const std::vector< const Ribonucleotide * > &seq)
 getter / setter for sequence More...
 
const std::vector< const Ribonucleotide * > & getSequence () const
 
std::vector< const Ribonucleotide * > & getSequence ()
 
void set (size_t index, const Ribonucleotide *r)
 getter / setter for ribonucleotide elements (easily wrapped using pyOpenMS) More...
 
const Ribonucleotideget (size_t index)
 
const Ribonucleotide *& operator[] (size_t index)
 getter / setter for sequence elements (C++ container style) More...
 
const Ribonucleotide *const & operator[] (size_t index) const
 
bool empty () const
 
size_t size () const
 
void clear ()
 
bool hasFivePrimeMod () const
 5' and 3' modifications More...
 
void setFivePrimeMod (const RibonucleotideChainEnd *r)
 
const RibonucleotideChainEndgetFivePrimeMod () const
 
bool hasThreePrimeMod () const
 
void setThreePrimeMod (const RibonucleotideChainEnd *r)
 
const RibonucleotideChainEndgetThreePrimeMod () const
 
Iterator begin ()
 iterators More...
 
ConstIterator begin () const
 
Iterator end ()
 
ConstIterator end () const
 
ConstIterator cbegin () const
 
ConstIterator cend () const
 
double getMonoWeight (NASFragmentType type=Full, Int charge=0) const
 utility functions More...
 
double getAverageWeight (NASFragmentType type=Full, Int charge=0) const
 Get the Average Weight of a NASequence. NB returns the uncharged mass + or - proton masses to match the charge param. More...
 
EmpiricalFormula getFormula (NASFragmentType type=Full, Int charge=0) const
 Get the formula for a NASequence. More...
 
NASequence getPrefix (Size length) const
 Return sequence prefix of the given length (not end index!) More...
 
NASequence getSuffix (Size length) const
 Return sequence suffix of the given length (not start index!) More...
 
NASequence getSubsequence (Size start=0, Size length=Size(-1)) const
 Return subsequence with given starting position and length. More...
 

Static Public Member Functions

static NASequence fromString (const String &s)
 create NASequence object by parsing an OpenMS string More...
 

Stream operators

writes a NASequence to an output stream

std::vector< const Ribonucleotide * > seq_
 
const RibonucleotideChainEndfive_prime_ = nullptr
 
const RibonucleotideChainEndthree_prime_ = nullptr
 
std::string toString () const
 
static NASequence fromString (const char *s)
 create NASequence object by parsing a C string (character array) More...
 
std::ostream & operator<< (std::ostream &os, const NASequence &seq)
 
static void parseString_ (const String &s, NASequence &nas)
 
static String::ConstIterator parseMod_ (const String::ConstIterator str_it, const String &str, NASequence &nas)
 Parses modifications in square brackets. More...
 

Detailed Description

Representation of a nucleic acid sequence.

NASequence represents nucleic acid sequences (RNA) in OpenMS. Each NASequence consists of a vector of pointers to Ribonucleotides as well as RibonucleotideChainEnds representing the 5' and 3' ends of the sequence. Each Ribonucleotide has only a single instance. These are accessible through RibonucleotideDB. Modified Ribonucleotides are included in RibonucleotideDB and are expressed as the Modomics Short name surrounded by brackets when converted to string.

Member Typedef Documentation

◆ ConstRibonucleotidePtr

Member Enumeration Documentation

◆ NASFragmentType

an enum of all possible fragment ion types

Enumerator
Full 

with N-terminus and C-terminus

Internal 

internal, without any termini

FivePrime 

only 5' terminus

ThreePrime 

only 3' terminus

AIon 

MS:1001229 N-terminus up to the C-alpha/carbonyl carbon bond.

BIon 

MS:1001224 N-terminus up to the peptide bond.

CIon 

MS:1001231 N-terminus up to the amide/C-alpha bond.

XIon 

MS:1001228 amide/C-alpha bond up to the C-terminus.

YIon 

MS:1001220 peptide bond up to the C-terminus.

ZIon 

MS:1001230 C-alpha/carbonyl carbon bond.

Precursor 

MS:1001523 Precursor ion.

BIonMinusH20 

MS:1001222 b ion without water.

YIonMinusH20 

MS:1001223 y ion without water.

BIonMinusNH3 

MS:1001232 b ion without ammonia.

YIonMinusNH3 

MS:1001233 y ion without ammonia.

NonIdentified 

MS:1001240 Non-identified ion.

Unannotated 

no stored annotation

WIon 

W ion, added for nucleic acid support.

AminusB 

A ion with base loss, added for nucleic acid support.

DIon 

D ion, added for nucleic acid support.

SizeOfNASFragmentType 

Constructor & Destructor Documentation

◆ NASequence() [1/4]

NASequence ( )
default

◆ NASequence() [2/4]

NASequence ( const NASequence )
default

default constructor

Copy constructor

◆ NASequence() [3/4]

NASequence ( NASequence &&  )
default

Move constructor.

◆ NASequence() [4/4]

NASequence ( std::vector< const Ribonucleotide * >  s,
const RibonucleotideChainEnd five_prime,
const RibonucleotideChainEnd three_prime 
)

full constructor

◆ ~NASequence()

virtual ~NASequence ( )
virtualdefault

Member Function Documentation

◆ begin() [1/2]

Iterator begin ( )
inline

iterators

◆ begin() [2/2]

ConstIterator begin ( ) const
inline

◆ cbegin()

ConstIterator cbegin ( ) const
inline

◆ cend()

ConstIterator cend ( ) const
inline

◆ clear()

void clear ( )

◆ empty()

bool empty ( ) const

◆ end() [1/2]

Iterator end ( )
inline

◆ end() [2/2]

ConstIterator end ( ) const
inline

◆ fromString() [1/2]

static NASequence fromString ( const char *  s)
static

create NASequence object by parsing a C string (character array)

Parameters
sInput string
Exceptions
Exception::ParseErrorif an invalid string representation of a nucleic acid sequence is passed

◆ fromString() [2/2]

static NASequence fromString ( const String s)
static

create NASequence object by parsing an OpenMS string

Parameters
sInput string
Exceptions
Exception::ParseErrorif an invalid string representation of a nucleic acid sequence is passed

◆ get()

const Ribonucleotide* get ( size_t  index)
inline

◆ getAverageWeight()

double getAverageWeight ( NASFragmentType  type = Full,
Int  charge = 0 
) const

Get the Average Weight of a NASequence. NB returns the uncharged mass + or - proton masses to match the charge param.

Parameters
typefragment type to return
chargehow many protons to add or subtract, NB the mass returned is the UNCHARGED MASS
Returns
double

◆ getFivePrimeMod()

const RibonucleotideChainEnd* getFivePrimeMod ( ) const

◆ getFormula()

EmpiricalFormula getFormula ( NASFragmentType  type = Full,
Int  charge = 0 
) const

Get the formula for a NASequence.

Parameters
typefragment type for formula
chargehow many H to add or subtract
Returns
EmpiricalFormula

◆ getMonoWeight()

double getMonoWeight ( NASFragmentType  type = Full,
Int  charge = 0 
) const

utility functions

Get the Monoisotopic Weight of a NASequence. NB returns the uncharged mass + or - proton masses to match the charge param

Parameters
typefragment type to return
chargehow many protons to add or subtract, NB the mass returned is the UNCHARGED MASS
Returns
double

◆ getPrefix()

NASequence getPrefix ( Size  length) const

Return sequence prefix of the given length (not end index!)

Parameters
length
Returns
NASequence

◆ getSequence() [1/2]

std::vector<const Ribonucleotide*>& getSequence ( )
inline

◆ getSequence() [2/2]

const std::vector<const Ribonucleotide*>& getSequence ( ) const
inline

◆ getSubsequence()

NASequence getSubsequence ( Size  start = 0,
Size  length = Size(-1) 
) const

Return subsequence with given starting position and length.

Parameters
start
length
Returns
NASequence

◆ getSuffix()

NASequence getSuffix ( Size  length) const

Return sequence suffix of the given length (not start index!)

Parameters
length
Returns
NASequence

◆ getThreePrimeMod()

const RibonucleotideChainEnd* getThreePrimeMod ( ) const

◆ hasFivePrimeMod()

bool hasFivePrimeMod ( ) const

5' and 3' modifications

◆ hasThreePrimeMod()

bool hasThreePrimeMod ( ) const

◆ operator!=()

bool operator!= ( const NASequence rhs) const

not quality

◆ operator<()

bool operator< ( const NASequence rhs) const

less operator

◆ operator=() [1/2]

NASequence& operator= ( const NASequence ) &
default

Copy assignment operator.

◆ operator=() [2/2]

NASequence& operator= ( NASequence &&  ) &
default

Move assignment operator.

◆ operator==()

bool operator== ( const NASequence rhs) const

destructor

element-wise equality

◆ operator[]() [1/2]

const Ribonucleotide*& operator[] ( size_t  index)
inline

getter / setter for sequence elements (C++ container style)

◆ operator[]() [2/2]

const Ribonucleotide* const& operator[] ( size_t  index) const
inline

◆ parseMod_()

static String::ConstIterator parseMod_ ( const String::ConstIterator  str_it,
const String str,
NASequence nas 
)
staticprivate

Parses modifications in square brackets.

Parameters
str_itCurrent position in the string to be parsed
strFull input string
nasCurrent AASequence object (will be modified with the correct ribo added)
Returns
Position at which to continue parsing

◆ parseString_()

static void parseString_ ( const String s,
NASequence nas 
)
staticprivate

◆ set()

void set ( size_t  index,
const Ribonucleotide r 
)

getter / setter for ribonucleotide elements (easily wrapped using pyOpenMS)

◆ setFivePrimeMod()

void setFivePrimeMod ( const RibonucleotideChainEnd r)

◆ setSequence()

void setSequence ( const std::vector< const Ribonucleotide * > &  seq)

getter / setter for sequence

◆ setThreePrimeMod()

void setThreePrimeMod ( const RibonucleotideChainEnd r)

◆ size()

◆ toString()

std::string toString ( ) const

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const NASequence seq 
)
friend

Member Data Documentation

◆ five_prime_

const RibonucleotideChainEnd* five_prime_ = nullptr
private

◆ seq_

std::vector<const Ribonucleotide*> seq_
private

◆ three_prime_

const RibonucleotideChainEnd* three_prime_ = nullptr
private