34 #ifndef __POLY_FUNCTIONAL_HPP__ 35 #define __POLY_FUNCTIONAL_HPP__ 51 template<
typename charItr>
54 const bool & haveOutgroup =
false,
55 const size_t & outgroup = 0 )
66 if(beg>=end || beg+outgroup>=end)
return c;
67 for( charItr itr=beg ;
73 || ( haveOutgroup && (
unsigned(itr-beg) != outgroup ) ) )
88 template<
typename charItr>
91 const bool & haveOutgroup =
true,
92 const size_t & outgroup = 0 )
103 if(beg>=end || beg+outgroup>=end || haveOutgroup ==
false)
return c;
104 for( charItr itr=beg ;
109 if ( (
unsigned(itr-beg) != outgroup)
110 && (*itr != *(beg+outgroup)) )
152 struct __attribute__ ((deprecated)) ssh :
public std::binary_function< double,polymorphicSite,double >
157 const bool & haveOutgroup =
false,
158 const unsigned & outgroup = 0 )
const 170 haveOutgroup,outgroup);
172 unsigned nsam = site.second.length() -
173 unsigned( haveOutgroup==
true ? 1 : 0 ) - c.n;
175 if (c.gap==0 && nsam > 1)
177 hom += (c.a > 0) ?
double(c.a) * double(c.a-1) : 0.;
178 hom += (c.g > 0) ?
double(c.g) * double(c.g-1) : 0.;
179 hom += (c.c > 0) ?
double(c.c) * double(c.c-1) : 0.;
180 hom += (c.t > 0) ?
double(c.t) * double(c.t-1) : 0.;
181 hom += (c.zero > 0) ?
double(c.zero) * double(c.zero-1) : 0.;
182 hom += (c.one > 0) ?
double(c.one) * double(c.one-1) : 0.;
184 return _ssh += (hom > 0.) ? 1.- (hom/( double(nsam)*double(nsam-1) )) : 0.;
223 template<
typename counter>
232 const bool & haveOutgroup =
false,
233 const unsigned & outgroup = 0 ) const
245 haveOutgroup,outgroup);
247 n += (c.a > 0) ? 1 : 0;
248 n += (c.g > 0) ? 1 : 0;
249 n += (c.c > 0) ? 1 : 0;
250 n += (c.t > 0) ? 1 : 0;
251 n += (c.zero > 0) ? 1 : 0;
252 n += (c.one > 0) ? 1 : 0;
253 return nm += (n>=2) ? n-1 : 0;
bool operator()(const std::pair< key, value > &l, const std::pair< key, value > &r) const
keep track of state counts at a site in an alignment or along a sequence
The namespace in which this library resides.
unsigned operator()(unsigned &nm, const polymorphicSite &site, const bool &haveOutgroup=false, const unsigned &outgroup=0) const
class __attribute__((deprecated)) FST
Functor to count the number of states, excluding gaps and missing data, in a range of characters...
typedefs used by libsequence
Functor to count the number of derived states, excluding gaps and missing data, in a range of charact...
stateCounter operator()(charItr beg, charItr end, const bool &haveOutgroup=true, const size_t &outgroup=0)
Calculate the number of mutations at a polymorphic site.
declaration of Sequence::stateCounter, a class to keep track of nucleotide counts either at a site in...
std::pair< double, std::string > polymorphicSite