IntaRNA 3.4.1
RNA-RNA interaction prediction | C++ API
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Static Protected Attributes | Friends | List of all members
IntaRNA::RnaSequence Class Reference

#include <RnaSequence.h>

Collaboration diagram for IntaRNA::RnaSequence:
Collaboration graph
[legend]

Public Types

typedef std::string String_type
 type for sequence string representation
 
typedef short Code_type
 
typedef std::vector< Code_type > CodeSeq_type
 type for sequence integer encoded representation
 

Public Member Functions

 RnaSequence (const std::string &id, const std::string &seqString, const long idxPos0=1, const size_t seqNumber=1)
 
virtual ~RnaSequence ()
 
const std::string & getId () const
 
const size_t getSeqNumber () const
 
size_t size () const
 
long getInOutIndex (const size_t i) const
 
size_t getIndex (const long i) const
 
size_t getReversedIndex (const size_t i) const
 
const String_type & asString () const
 
const CodeSeq_type & asCodes () const
 
bool isAmbiguous () const
 
bool isAmbiguous (const size_t i) const
 
const bool operator== (const RnaSequence &rna2) const
 

Static Public Member Functions

static String_type getUpperCase (const std::string &seqString)
 
static CodeSeq_type getCodeForString (const String_type &seqString)
 
static Code_type getCodeForChar (const char nucleotide)
 
static bool isValidSequence (const std::string &sequence)
 
static bool isValidSequenceIUPAC (const std::string &sequence)
 
static bool areComplementary (const RnaSequence &s1, const RnaSequence &s2, const size_t p1, const size_t p2)
 
static bool isGU (const RnaSequence &s1, const RnaSequence &s2, const size_t p1, const size_t p2)
 

Static Public Attributes

static const std::string SequenceAlphabetIUPAC
 
static const std::string SequenceAlphabet
 
static const size_t lastPos
 

Protected Attributes

std::string id
 ID of this sequence.
 
String_type seqString
 The sequence's string representation.
 
CodeSeq_type seqCode
 Integer encoding of the sequence.
 
bool ambiguous
 Whether or not the sequence contains ambiguous nucleotide encodings.
 
long idxPos0
 Input/output index of the first sequence position.
 
size_t seqNumber
 

Static Protected Attributes

static std::locale codeLocale
 the locale to use for integer encoding
 
static int bpGUcodes []
 codes for G and U to check for GU base pairs
 

Friends

std::ostream & operator<< (std::ostream &out, const RnaSequence &rna)
 

Detailed Description

Represents an RNA sequence within IntaRNA and holds all necessary utility functions.

The integer sequence encoding uses the Vienna RNA package encoding functions.

Author
Martin Mann 2014

Member Typedef Documentation

◆ Code_type

type for integer encoding of a single sequence letter (currently same as in Vienna package)

◆ CodeSeq_type

type for sequence integer encoded representation

◆ String_type

typedef std::string IntaRNA::RnaSequence::String_type

type for sequence string representation

Constructor & Destructor Documentation

◆ RnaSequence()

IntaRNA::RnaSequence::RnaSequence ( const std::string &  id,
const std::string &  seqString,
const long  idxPos0 = 1,
const size_t  seqNumber = 1 
)
inline

Creates a sequence.

Parameters
idthe name of the sequence
seqStringthe nucleotide string encoding the sequence
idxPos0input/output index of the first sequence position
seqNumberindex of the sequence among the respective sequence set in this call. relevant for accessibility parsing

◆ ~RnaSequence()

IntaRNA::RnaSequence::~RnaSequence ( )
inlinevirtual

Destruction and garbage collection

Member Function Documentation

◆ areComplementary()

bool IntaRNA::RnaSequence::areComplementary ( const RnaSequence &  s1,
const RnaSequence &  s2,
const size_t  p1,
const size_t  p2 
)
inlinestatic

Whether or not two positions of two RNAs are complementary, ie. can form a base pair

Parameters
s1first RNA
s2second RNA
p1position within s1
p2position within s2
Returns
true if s1[p1] can form a base pair with s2[p2]; false otherwise

◆ asCodes()

const RnaSequence::CodeSeq_type & IntaRNA::RnaSequence::asCodes ( ) const
inline

Access to the sequence in integer coding using the Vienna RNA package encoding.

Returns
the integer encoding of the sequence

◆ asString()

const RnaSequence::String_type & IntaRNA::RnaSequence::asString ( ) const
inline

Access to the sequence in character encoding.

Returns
the character encoding of the sequence

◆ getCodeForChar()

RnaSequence::Code_type IntaRNA::RnaSequence::getCodeForChar ( const char  nucleotide)
inlinestatic

Utility function that converts a nucleotide's char representation into its integer encoding.

NOTE: encoding covers only upper case characters! Otherwise an exception is raised.

Parameters
nucleotidethe char to encode
Returns
the integer encoding
Exceptions
std::runtime_errorif an unsupported nucleotide character is given

◆ getCodeForString()

RnaSequence::CodeSeq_type IntaRNA::RnaSequence::getCodeForString ( const String_type &  seqString)
inlinestatic

Utility function that converts a sequence's string representation into its integer encoding

NOTE: encoding covers only upper case characters! Otherwise an exception is raised.

Parameters
seqStringthe string to encode
Returns
the integer encoding
Exceptions
std::runtime_errorif an unsupported nucleotide character is given

◆ getId()

const std::string & IntaRNA::RnaSequence::getId ( ) const
inline

Access to the sequence's ID.

Returns
the ID of the sequence.

◆ getIndex()

size_t IntaRNA::RnaSequence::getIndex ( const long  i) const
inline

Provides the internal sequence position of an input/output index given that the first position represents idxPos0.

Parameters
ithe input/output index of interest
Returns
the internal position, i.e. i shifted by idxPos0

◆ getInOutIndex()

long IntaRNA::RnaSequence::getInOutIndex ( const size_t  i) const
inline

Provides the input/output index of a given sequence position.

Parameters
ithe position of interest
Returns
the input/output index shifted by idxPos0

◆ getReversedIndex()

size_t IntaRNA::RnaSequence::getReversedIndex ( const size_t  i) const
inline

Provides the reverse index of a given sequence position.

Parameters
ithe index of interest
Returns
the reverse index, i.e. (seq.size()-i-1)

◆ getSeqNumber()

const size_t IntaRNA::RnaSequence::getSeqNumber ( ) const
inline

Access to the sequence's index among the respective input sequence set of the call arguments

Returns
the sequence index among the input sequence set (1-based)

◆ getUpperCase()

RnaSequence::String_type IntaRNA::RnaSequence::getUpperCase ( const std::string &  seqString)
inlinestatic

Utility function that converts a string into the internal sequence's string representation. This covers an upper case conversion.

Parameters
seqStringsequence string
Returns
the internally used sequence string representation

◆ isAmbiguous() [1/2]

bool IntaRNA::RnaSequence::isAmbiguous ( ) const
inline

Whether or not the sequence contains ambiguous nucleotide encodings.

Returns
true if the sequence contains ambiguous nucleotide encodings; false otherwise

◆ isAmbiguous() [2/2]

bool IntaRNA::RnaSequence::isAmbiguous ( const size_t  i) const
inline

Whether or not a specific sequence position shows an ambiguous nucleotide encoding.

Parameters
ithe sequence position of interest
Returns
true if the sequence contains an ambiguous nucleotide encoding at position i; false otherwise

◆ isGU()

bool IntaRNA::RnaSequence::isGU ( const RnaSequence &  s1,
const RnaSequence &  s2,
const size_t  p1,
const size_t  p2 
)
inlinestatic

Whether or not two positions of two RNAs are forming a GU base pair

Parameters
s1first RNA
s2second RNA
p1position within s1
p2position within s2
Returns
true if (s1[p1]=G and s2[p2]==U) or (s1[p1]=U and s2[p2]==G); false otherwise

◆ isValidSequence()

bool IntaRNA::RnaSequence::isValidSequence ( const std::string &  sequence)
inlinestatic

Utility function that tests whether or not a given sequence is a valid RNA sequence

◆ isValidSequenceIUPAC()

bool IntaRNA::RnaSequence::isValidSequenceIUPAC ( const std::string &  sequence)
inlinestatic

Utility function that tests whether or not a given sequence is a valid RNA sequence according to IUPAC encoding

◆ operator==()

const bool IntaRNA::RnaSequence::operator== ( const RnaSequence &  rna2) const
inline

Checks for equality

Parameters
rna2the RnaSequence to compare to
Returns
true if both are describing the same sequence with the same identifier.

◆ size()

size_t IntaRNA::RnaSequence::size ( ) const
inline

Access to the length of the sequence.

Returns
the length of the sequence.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const RnaSequence &  rna 
)
friend

prints the sequence id and the sequence to stream

Parameters
outthe ostream to write to
rnathe RnaSequence object to add
Returns
the altered stream out

Member Data Documentation

◆ ambiguous

bool IntaRNA::RnaSequence::ambiguous
protected

Whether or not the sequence contains ambiguous nucleotide encodings.

◆ bpGUcodes

int IntaRNA::RnaSequence::bpGUcodes[]
staticprotected

codes for G and U to check for GU base pairs

◆ codeLocale

std::locale IntaRNA::RnaSequence::codeLocale
staticprotected

the locale to use for integer encoding

◆ id

std::string IntaRNA::RnaSequence::id
protected

ID of this sequence.

◆ idxPos0

long IntaRNA::RnaSequence::idxPos0
protected

Input/output index of the first sequence position.

◆ lastPos

const size_t IntaRNA::RnaSequence::lastPos
static

constant that serves as a placeholder for the last position within a sequence independent of its real size

◆ seqCode

CodeSeq_type IntaRNA::RnaSequence::seqCode
protected

Integer encoding of the sequence.

◆ seqNumber

size_t IntaRNA::RnaSequence::seqNumber
protected

index of the sequence within the overall input (1-based). relevant for reading accessibility files

◆ seqString

String_type IntaRNA::RnaSequence::seqString
protected

The sequence's string representation.

◆ SequenceAlphabet

const std::string IntaRNA::RnaSequence::SequenceAlphabet
static

Allowed nucleotide single letter character alphabet (uppercase only)

◆ SequenceAlphabetIUPAC

const std::string IntaRNA::RnaSequence::SequenceAlphabetIUPAC
static

Allowed nucleotide single letter character alphabet according to IUPAC codes and their lower case variants.


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