CS 19: Protein Class
|
Represents the primary structure of a protein as a sequence of amino acids. More...
#include <cs19_protein.h>
Public Member Functions | |
Protein () | |
Constructs a new "empty" Protein (i.e. More... | |
Protein (const char *amino_acids) | |
Constructs a new Protein object with an initial primary structure. More... | |
template<typename Sequence > | |
Protein (const Sequence &amino_acids) | |
Constructs a new Protein object with an initial primary structure. More... | |
template<class InputIterator > | |
Protein (InputIterator first, InputIterator last) | |
Constructs a new Protein object from a range of values [first, last) . More... | |
Protein (std::initializer_list< char > list) | |
Constructs a new Protein object with an initial primary structure. More... | |
char | operator[] (std::size_t index) const |
Returns the amino-acid character at a specified index in this protein. More... | |
template<typename Sequence > | |
Protein | operator+ (const Sequence &that) const |
Returns a concatenation of this protein with another. More... | |
Protein | operator+ (const char *that) const |
Returns a concatenation of this protein with another. More... | |
Protein | operator* (std::size_t repeat_count) const |
Returns a repeated concatenation of this protein. More... | |
template<typename Sequence > | |
bool | operator== (const Sequence &that) const |
Determines whether this protein's sequence of amino acids is equal to another sequence. More... | |
template<typename Sequence > | |
bool | operator!= (const Sequence &that) const |
Determines whether this protein's sequence of amino acids is not equal to another sequence. More... | |
bool | operator== (const char *that) const |
Determines whether this protein's sequence of amino acids is equal to another sequence. More... | |
bool | operator!= (const char *that) const |
Determines whether this protein's sequence of amino acids is not equal to another sequence. More... | |
auto | begin () const |
Returns an iterator pointing to the first amino acid in this protein. More... | |
auto | end () const |
Returns an iterator referring to the past-the-end element in this protein. More... | |
double | mass () const |
Computes and returns this protein's mass. More... | |
std::size_t | size () const |
Returns the length of this protein's primary structure. More... | |
std::string | to_string () const |
Returns a string representing the protein's amino-acid sequence. More... | |
template<typename Sequence > | |
Protein & | operator= (const Sequence &that) |
Replaces this protein's contents with another sequence. More... | |
Protein & | operator= (const char *that) |
Replaces this protein's contents with another sequence. More... | |
template<typename Sequence > | |
Protein * | operator+= (const Sequence &appendage) |
Appends a sequence of amino acids to this protein's primary structure. More... | |
Protein * | operator+= (const char *appendage) |
Appends a sequence of amino acids to this protein's primary structure. More... | |
Protein * | operator+= (char appendage) |
Appends a single amino acid to this protein's primary structure. More... | |
void | set (std::size_t index, char amino_acid) |
Replaces the amino acid at a given index in this protein. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Protein &protein) |
Inserts a protein's sequence of amino-acid characters into an output stream. More... | |
std::istream & | operator>> (std::istream &in, Protein &protein) |
Replaces the contents of this protein with characters extracted from an input stream, using the same rules as string extraction. More... | |
Represents the primary structure of a protein as a sequence of amino acids.
|
inline |
Constructs a new "empty" Protein (i.e.
with no amino acids).
|
inline |
Constructs a new Protein object with an initial primary structure.
amino_acids | a C-string denoting the primary structure |
std::domain_error | amino_acids contains any illegal characters |
|
inline |
Constructs a new Protein object with an initial primary structure.
Sequence | an iterable type assumed to contain amino-acid characters |
amino_acids | a sequence of characters denoting the primary structure |
std::domain_error | if amino_acids contains any illegal characters |
|
inline |
Constructs a new Protein object from a range of values [first, last)
.
InputIterator | an iterator type assumed to point to values convertible to char |
first | the initial position in the range |
last | the final position in the range |
std::domain_error | if the range contains any illegal characters |
|
inline |
Constructs a new Protein object with an initial primary structure.
list | a list assumed to contain amino-acid characters |
std::domain_error | if list contains any illegal characters |
|
inline |
Returns an iterator pointing to the first amino acid in this protein.
|
inline |
Returns an iterator referring to the past-the-end element in this protein.
|
inline |
Computes and returns this protein's mass.
See: http://rosalind.info/problems/prtm/
|
inline |
Determines whether this protein's sequence of amino acids is not equal to another sequence.
that | a C-string with which to compare |
true
if that
does not contain the same sequence of amino-acid characters as this protein, otherwise false
|
inline |
Determines whether this protein's sequence of amino acids is not equal to another sequence.
Sequence | an iterable type assumed to contain amino-acid characters |
that | the sequence with which to compare |
true
if that
does not contain the same sequence of amino-acid characters as this protein, otherwise false
|
inline |
Returns a repeated concatenation of this protein.
repeat_count | the desired number of concatenations |
repeat_count
times
|
inline |
Returns a concatenation of this protein with another.
that | a C-string containing the sequence to concatenate |
that
std::domain_error | if that contains any illegal characters |
|
inline |
Returns a concatenation of this protein with another.
Sequence | an iterable type assumed to contain amino-acid characters |
that | the sequence to concatenate |
that
std::domain_error | if that contains any illegal characters |
|
inline |
Appends a single amino acid to this protein's primary structure.
appendage | a char denoting the amino acid to append |
std::domain_error | if appendage is an illegal character |
|
inline |
Appends a sequence of amino acids to this protein's primary structure.
appendage | a C-string denoting the amino acids to append |
std::domain_error | if appendage contains any illegal characters |
|
inline |
Appends a sequence of amino acids to this protein's primary structure.
Sequence | an iterable type assumed to contain amino-acid characters |
appendage | a sequence of characters denoting the amino acids to append |
std::domain_error | if appendage contains any illegal characters |
|
inline |
Replaces this protein's contents with another sequence.
that | a C-string with which to replace this protein's contents |
std::domain_error | if that contains any illegal characters |
|
inline |
Replaces this protein's contents with another sequence.
Sequence | an iterable type assumed to contain amino-acid characters |
that | the sequence with which to replace this protein's contents |
std::domain_error | if that contains any illegal characters |
|
inline |
Determines whether this protein's sequence of amino acids is equal to another sequence.
that | a C-string with which to compare |
true
if that
contains the same sequence of amino-acid characters as this protein, otherwise false
|
inline |
Determines whether this protein's sequence of amino acids is equal to another sequence.
Sequence | an iterable type assumed to contain amino-acid characters |
that | the sequence with which to compare |
true
if that
contains the same sequence of amino-acid characters as this protein, otherwise false
|
inline |
Returns the amino-acid character at a specified index in this protein.
index | the desired index in the sequence |
index
std::out_of_range | if index is an invalid index in this protein |
|
inline |
Replaces the amino acid at a given index in this protein.
index | the index of the amino acid to replace |
amino_acid | the replacement amino acid |
std::domain_error | if amino_acid is an illegal character |
std::out_of_range | if index is an invalid index in this protein |
|
inline |
Returns the length of this protein's primary structure.
|
inline |
Returns a string representing the protein's amino-acid sequence.
|
friend |
Inserts a protein's sequence of amino-acid characters into an output stream.
out | the destination stream |
protein | the Protein from which to insert |
out
|
friend |
Replaces the contents of this protein with characters extracted from an input stream, using the same rules as string extraction.
in | the source stream |
protein | the Protein receiving the characters |
in
std::domain_error | if the token from the stream contains any illegal characters |