Scaffolding  0.1
This program can assemble genome scaffolds using the pairing information in paired-end reads.
scoring.hpp
Go to the documentation of this file.
1 
2 
7 #ifndef SCORING_HPP
8 #define SCORING_HPP
9 
10 #include "utils/predicates.hpp"
11 
12 namespace scaffold{ namespace scoring {
13 
15  template<typename Element>
16  struct IdentityScore{
17  unsigned operator()(const std::pair<Element, unsigned>& e) const
18  {
19  return e.second;
20  }
21  };
22 
24  template<typename Element>
25  struct DistanceScore{
26  const unsigned reference_point;
27 
28  DistanceScore(const unsigned _reference_point): reference_point(_reference_point) {}
29  unsigned operator()(const std::pair<Element, unsigned>& e) const
30  {
31  return (unsigned)abs((long)e.second - (long)reference_point);
32  }
33  };
34 
36  template<typename Element, class Predicate>
37  struct PredicatedDistanceScore: public DistanceScore<Element>{
39  const Predicate predicate;
40 
41  PredicatedDistanceScore(const Predicate& _predicate, const unsigned _reference_point):
42  DistanceScore<Element>::DistanceScore(_reference_point), predicate(_predicate) {}
43 
44  unsigned operator()(const std::pair<Element, unsigned>& e) const
45  {
46  if(predicate(e.first))
47  return UINT_MAX;
48  else
50  //(unsigned)abs((long)e.second - (long)reference_point);
51  }
52  };
53 
54 }}//namespace
55 
56 #endif
57 
a scoring returning the distance to a reference score if a predicate evaluates to true and UINT_MAX o...
Definition: scoring.hpp:37
Definition: read_adj_list.hpp:22
prototype predicate
Definition: predicates.hpp:14
a scoring function for a pair of something and unsigned that just returns the unsigned ...
Definition: scoring.hpp:16
a scoring function returning the distance to a reference score given at construction ...
Definition: scoring.hpp:25