Inherits binary_function< std::pair< char, unsigned >, unsigned, void >.
#include <algorithm>
#include <iostream>
#include <functional>
: public std::binary_function<std::pair<char, unsigned>, unsigned, void>
{
inline void
operator()(
const std::pair<char, unsigned> &p,
const unsigned &u)
const {
std::cout << p.first << " (" << double(p.second) / double(u) << ") ";
}
};
int
main()
{
while (!cin.fail())
{
cin >> x;
cout << "Base composition for sequence " << x.name << "\n";
if (count.ndna == false)
{
unsigned len
= x.length() - count.gap
- count.n;
double percA
= (count.a > 0) ? double(count.a) / double(len) : 0.;
double percG
= (count.g > 0) ? double(count.g) / double(len) : 0.;
double percC
= (count.c > 0) ? double(count.c) / double(len) : 0.;
double percT
= (count.t > 0) ? double(count.t) / double(len) : 0.;
std::cout << "using Sequence::stateCounter: "
<< "A (" << percA << ") "
<< "G (" << percG << ") "
<< "C (" << percC << ") "
<< "T (" << percT << ")\n";
}
else
{
cout << "non-DNA character encountered. Skipping...\n";
}
std::map<char, unsigned> m
std::cout << "using Sequence::makeCountList(): ";
std::for_each(m.begin(), m.end(),
std::cout << std::endl;
}
}
Definition at line 18 of file baseComp.cc.