18 #if __cplusplus < 201100L
25 template <
class T1,
class T2>
26 struct hash<std::pair<T1, T2>>
29 operator()(
const std::pair<T1, T2> &p)
const
30 noexcept(noexcept(hash<T1>()(p.first)) &&
31 noexcept(hash<T2>()(p.second))) {
32 return hash<T1>()(p.first) ^ (hash<T2>()(p.second) << 1);
37 #include "quadmath.hh"
41 using standard_pf_score_t = double;
42 using extended_pf_score_t =
long double;
44 #if defined(_GLIBCXX_USE_FLOAT128) && ! defined(__clang__)
45 using quad_pf_score_t = __float128;
47 using quad_pf_score_t =
long double;
61 std::cout <<
"Use extended precision for partition functions ("
62 <<
sizeof(extended_pf_score_t) <<
" bytes; usually 80bit precision)."
65 if (!(
sizeof(extended_pf_score_t) >
sizeof(standard_pf_score_t))) {
66 std::cerr <<
"WARNING: the extended precision type (long double) "
67 <<
"is not larger than the standard precision "
68 <<
"( double, "<<
sizeof(standard_pf_score_t)<<
" bytes )."
70 <<
"This issue is system and compiler dependent."
99 #if defined( _GLIBCXX_USE_FLOAT128 ) && ! defined( __clang__ )
105 std::cout <<
"Use quad precision for partition functions ("
106 <<
sizeof(quad_pf_score_t) <<
" bytes; 128bit precision)."
109 if (!(
sizeof(quad_pf_score_t) >
sizeof(standard_pf_score_t))) {
110 std::cerr <<
"WARNING: the quad precision type (__float128) "
111 <<
"is not larger than the standard precision "
112 <<
"( double, "<<
sizeof(standard_pf_score_t)<<
" bytes )."
171 : std::exception(), msg_(msg){};
176 explicit failure() : std::exception(), msg_(){};
185 what() const noexcept;
208 :
failure(
"Syntax error: " + msg) {}
219 return 1.0 / (2.0 * seqlen);
257 std::vector<std::string> &v);
269 std::vector<std::string>
305 return i + minlen <= j + 1;
348 has_prefix(
const std::string &s,
const std::string &p,
size_t start = 0);
371 sequence_identity(
const string1 &seqA,
const string1 &seqB);
379 template <
class Iterable,
typename KeyFun>
381 maximum(
const Iterable&x,
const KeyFun &key) {
382 auto maxelem_it = max_element(x.begin(), x.end(),
383 [&key](
const auto &x,
const auto &y) {
384 return key(x) < key(y);
386 return key(*maxelem_it);
395 template <
class Iterable,
typename KeyFun>
397 minimum(
const Iterable&x,
const KeyFun &key) {
398 auto minelem_it = min_element(x.begin(), x.end(),
399 [&key](
const auto &x,
const auto &y) {
400 return key(x) < key(y);
402 return key(*minelem_it);
406 template <
class Value,
class Function>
410 : fun_(fun), evaluated_(
false)
430 template <
class Value>
433 template <
class Function>
Simple exception class that supports a text message.
Definition: aux.hh:160
virtual const char * what() const noexcept
Provide message string.
Definition: aux.cc:14
failure()
Construct empty.
Definition: aux.hh:176
virtual ~failure()
Destruct.
Definition: aux.cc:11
failure(const std::string &msg)
Construct with message.
Definition: aux.hh:170
command_line_parameters clp
holds command line parameters of locarna
Definition: locarna.cc:80
Definition: aligner.cc:15
bool has_prefix(const std::string &s, const std::string &p, size_t start)
Test string prefix.
Definition: aux.cc:73
char gap_symbol(Gap gap)
simplified symbols of gaps
Definition: aux.cc:36
size_type pos_type
type of a sequence position
Definition: aux.hh:126
bool get_nonempty_line(std::istream &in, std::string &line)
Get next non-empty/non-comment line.
Definition: aux.cc:122
void normalize_rna_sequence(std::string &seq)
Transform an RNA sequence string.
Definition: aux.cc:65
char special_gap_symbol(Gap gap)
special symbols of gaps
Definition: aux.cc:41
std::string concat_with_separator(const std::vector< std::string > &v, char sep)
Concatenate strings, inserting separators.
Definition: aux.cc:111
void split_at_separator(const std::string &s, char sep, std::vector< std::string > &v)
Tokenize string at separator symbol.
Definition: aux.cc:81
constexpr size_t bp_span(size_t i, size_t j)
Definition: aux.hh:333
auto minimum(const Iterable &x, const KeyFun &key)
generic minimum value of iterable
Definition: aux.hh:397
Gap
different types of gaps
Definition: aux.hh:132
constexpr double prob_exp_f(int seqlen)
expected probability of a base pair (null-model)
Definition: aux.hh:218
constexpr size_t frag_len(size_t i, size_t j)
Definition: aux.hh:318
Gap gap_code(char symbol)
code of a gap symbol
Definition: aux.cc:46
auto maximum(const Iterable &x, const KeyFun &key)
generic maximum value of iterable
Definition: aux.hh:381
bool is_gap_symbol(char c)
Test for gap symbol.
Definition: aux.cc:31
void transform_toupper(std::string &s)
Converts char to upper case.
Definition: aux.cc:60
size_t size_type
general size type
Definition: aux.hh:120
constexpr bool frag_len_geq(size_t i, size_t j, size_t minlen)
Definition: aux.hh:304
double FLT_OR_DBL
select FLT_OR_DBL
Definition: aux.hh:291
thrown, when the format is recognized but syntax is incorrect
Definition: aux.hh:198
syntax_error_failure()
empty constructor
Definition: aux.hh:200
syntax_error_failure(const std::string &msg)
Construct with message string.
Definition: aux.hh:207