Scaffolding  0.1
This program can assemble genome scaffolds using the pairing information in paired-end reads.
branching_vector.hpp
Go to the documentation of this file.
1 
2 
8 #ifndef BRANCHING_VECTOR_HPP
9 #define BRANCHING_VECTOR_HPP
10 
11 #include <vector>
12 #include <cmath>
13 
14 #define BRANCHING_NUMBER_PRECISION 5
15 
16 namespace scaffolding{ namespace solv {
17 
19  typedef std::vector<unsigned> BranchingVector;
20 
21  // branching number code by Joseph, Chuang-Chieh Lin (lincc@cs.ccu.edu.tw or josephcclin@gmail.com)
22  inline float CH_POLY(const BranchingVector& BV, const float var){
23  float s = 0;
24  for(size_t i : BV) s += pow(var, i);
25  return 1-s;
26  }
27 
29  float branching_number(const BranchingVector& BV){
30  float temp = 0;
31  float poly_result;
32  for(unsigned char d = 1; d <= BRANCHING_NUMBER_PRECISION; ++d) {
33  poly_result = 1;
34  while (poly_result > 0) {
35  temp += pow(0.1, d);
36  poly_result = CH_POLY(BV, temp);
37  } // while
38  temp -= pow(0.1, d);
39  } // for
40  return (1/temp);
41  } // function
42 }} // namespace
43 
44 #endif
Definition: branching_vector.hpp:16