Antkeeper  0.0.1
Namespaces | Classes | Functions
genetics::sequence Namespace Reference

Functions and structures related to sequences of IUPAC degenerate base symbols. More...

Namespaces

 dna
 Functions which operate on sequences of IUPAC degenerate DNA base symbols.
 
 rna
 Functions which operate on sequences of IUPAC degenerate RNA base symbols.
 

Classes

struct  orf
 Open reading frame (ORF), defined by a start codon and stop codon, with the distance between divisible by three. More...
 

Functions

template<class ForwardIt1 , class ForwardIt2 , class URBG >
ForwardIt2 crossover (ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2, URBG &&g)
 Exchanges elements between two ranges, starting at a random offset. More...
 
template<class ForwardIt1 , class ForwardIt2 , class Size , class URBG >
void crossover_n (ForwardIt1 first1, ForwardIt1 last1, ForwardIt2 first2, Size count, URBG &&g)
 Exchanges elements between two ranges multiple times, starting at a random offset each time. More...
 
template<class ForwardIt >
orf< ForwardIt > find_orf (ForwardIt first, ForwardIt last, const codon::table &table)
 Searches a sequence for an open reading frame (ORF). More...
 
template<class ForwardIt , class UnaryOperation , class URBG >
ForwardIt mutate (ForwardIt first, ForwardIt last, UnaryOperation unary_op, URBG &&g)
 Applies the given function to a randomly selected element in a range. More...
 
template<class ForwardIt , class Size , class UnaryOperation , class URBG >
void mutate_n (ForwardIt first, ForwardIt last, Size count, UnaryOperation unary_op, URBG &&g)
 Applies the given function to a random selection of elements in a range. More...
 
template<class ForwardIt1 , class ForwardIt2 >
ForwardIt1 search (ForwardIt1 first, ForwardIt1 last, ForwardIt2 s_first, ForwardIt2 s_last, typename std::iterator_traits< ForwardIt1 >::difference_type stride)
 Searches a sequence of IUPAC base symbols for a pattern matching a search string of IUPAC degenerate base symbols. More...
 
template<class InputIt , class OutputIt >
OutputIt transcribe (InputIt first, InputIt last, OutputIt d_first)
 Transcribes a sequence of IUPAC base symbols between DNA and RNA, swapping T for U or U for T. More...
 
template<class InputIt , class OutputIt >
OutputIt translate (InputIt first, InputIt last, OutputIt d_first, const codon::table &table)
 Translates a sequence of codons into amino acids. More...
 

Detailed Description

Functions and structures related to sequences of IUPAC degenerate base symbols.

Function Documentation

◆ crossover()

template<class ForwardIt1 , class ForwardIt2 , class URBG >
ForwardIt2 genetics::sequence::crossover ( ForwardIt1  first1,
ForwardIt1  last1,
ForwardIt2  first2,
URBG &&  g 
)

Exchanges elements between two ranges, starting at a random offset.

Parameters
first1,last1First range of elements to crossover.
first2Beginning of the second range of elements to crossover.
gUniform random bit generator.
Returns
Iterator to the start of the crossover in the second range.

Definition at line 164 of file sequence.hpp.

◆ crossover_n()

template<class ForwardIt1 , class ForwardIt2 , class Size , class URBG >
void genetics::sequence::crossover_n ( ForwardIt1  first1,
ForwardIt1  last1,
ForwardIt2  first2,
Size  count,
URBG &&  g 
)

Exchanges elements between two ranges multiple times, starting at a random offset each time.

Parameters
first1,last1First range of elements to crossover.
first2Beginning of the second range of elements to crossover.
countNumber of times to crossover.
gUniform random bit generator.

Definition at line 176 of file sequence.hpp.

◆ find_orf()

template<class ForwardIt >
orf< ForwardIt > genetics::sequence::find_orf ( ForwardIt  first,
ForwardIt  last,
const codon::table table 
)

Searches a sequence for an open reading frame (ORF).

Parameters
first,lastRange of elements to search.
tableGenetic code translation table.
Returns
First ORF in the sequence, or {last, last} if no ORF was found.

Definition at line 198 of file sequence.hpp.

◆ mutate()

template<class ForwardIt , class UnaryOperation , class URBG >
ForwardIt genetics::sequence::mutate ( ForwardIt  first,
ForwardIt  last,
UnaryOperation  unary_op,
URBG &&  g 
)

Applies the given function to a randomly selected element in a range.

Parameters
first,lastRange of elements to mutate.
unary_opUnary operation function object that will be applied.
gUniform random bit generator.
Returns
Iterator to the mutated element.

Definition at line 247 of file sequence.hpp.

◆ mutate_n()

template<class ForwardIt , class Size , class UnaryOperation , class URBG >
void genetics::sequence::mutate_n ( ForwardIt  first,
ForwardIt  last,
Size  count,
UnaryOperation  unary_op,
URBG &&  g 
)

Applies the given function to a random selection of elements in a range.

Parameters
first,lastRange of elements to mutate.
countNumber of elements to mutate.
unary_opUnary operation function object that will be applied.
gUniform random bit generator.

Definition at line 262 of file sequence.hpp.

◆ search()

template<class ForwardIt1 , class ForwardIt2 >
ForwardIt1 genetics::sequence::search ( ForwardIt1  first,
ForwardIt1  last,
ForwardIt2  s_first,
ForwardIt2  s_last,
typename std::iterator_traits< ForwardIt1 >::difference_type  stride 
)

Searches a sequence of IUPAC base symbols for a pattern matching a search string of IUPAC degenerate base symbols.

Parameters
first,lastSequence of IUPAC base symbols to search.
s_first,s_lastSearch string of IUPAC degenerate base symbols.
strideDistance between consecutive searches.
Returns
Iterator to the beginning of the first subsequence matching [s_first, s_last) in the sequence [first, last). If no such occurrence is found, last is returned.

Definition at line 282 of file sequence.hpp.

◆ transcribe()

template<class InputIt , class OutputIt >
OutputIt genetics::sequence::transcribe ( InputIt  first,
InputIt  last,
OutputIt  d_first 
)
inline

Transcribes a sequence of IUPAC base symbols between DNA and RNA, swapping T for U or U for T.

Parameters
first,lastRange of elements to transcribe.
d_firstBeginning of the destination range.
Returns
Output iterator to the element past the last element transcribed.

Definition at line 307 of file sequence.hpp.

◆ translate()

template<class InputIt , class OutputIt >
OutputIt genetics::sequence::translate ( InputIt  first,
InputIt  last,
OutputIt  d_first,
const codon::table table 
)

Translates a sequence of codons into amino acids.

Parameters
first,lastOpen reading frame.
d_firstBeginning of destination range.
tableGenetic code translation table.
Returns
Output iterator to the element past the last element translated.

Definition at line 313 of file sequence.hpp.