#include <iostream>
#include <algorithm>
#include <limits>
{
unsigned mcount = numeric_limits<unsigned>::max();
mcount = sc.a ? min(mcount,sc.a) : mcount;
mcount = sc.g ? min(mcount,sc.g) : mcount;
mcount = sc.c ? min(mcount,sc.c) : mcount;
mcount = sc.t ? min(mcount,sc.t) : mcount;
return double(mcount)/double(p.second.size()-sc.n);
}
std::vector<std::string::size_type> local_has_missing(
const polymorphicSite & p )
{
typedef std::vector<std::string::size_type> rvtype;
rvtype rv;
string::size_type f = p.second.find('N');
while (f != string::npos)
{
rv.push_back(f);
f = p.second.find('N',f+1);
}
return rv;
}
int main( int argc, char ** argv )
{
cout << "The data:\n";
for( auto _x : x )
{
cout << _x.first << ' ' << _x.second << '\n';
}
vector<double> mafs;
for_each( x.begin(),x.end(), [&mafs](
const polymorphicSite & __p){ mafs.push_back(local_maf(__p)); } );
cout << "The minor allele frequencies:\n";
for( auto __maf : mafs )
{
cout << __maf << '\n';
}
cout << "The data after sorting:\n";
for( auto _x : x )
{
cout << _x.first << ' ' << _x.second << '\n';
}
std::vector<std::string::size_type> missing;
std::vector<std::string::size_type> __temp = local_has_missing(__p);
copy(__temp.begin(),__temp.end(),back_inserter(missing));
});
cout << "Index of individuals with missing data:\n";
for( auto __m : missing )
{
cout << __m << '\n';
}
x.erase( remove_if(x.begin(),x.end(),[](
const polymorphicSite & __p){
return local_maf(__p) <= 0.25; } ),x.end() );
cout << "The data after applying MAF filter:\n";
for( auto _x : x )
{
cout << _x.first << ' ' << _x.second << '\n';
}
cout << "Print out the classic object:\n"
<< ps << '\n';
}