20 unsigned mcount = numeric_limits<unsigned>::max();
21 mcount = sc.a ? min(mcount,sc.a) : mcount;
22 mcount = sc.g ? min(mcount,sc.g) : mcount;
23 mcount = sc.c ? min(mcount,sc.c) : mcount;
24 mcount = sc.t ? min(mcount,sc.t) : mcount;
25 return double(mcount)/double(p.second.size()-sc.n);
28 std::vector<std::string::size_type> local_has_missing(
const polymorphicSite & p )
31 typedef std::vector<std::string::size_type> rvtype;
34 string::size_type f = p.second.find(
'N');
35 while (f != string::npos)
38 f = p.second.find(
'N',f+1);
43 int main(
int argc,
char ** argv )
50 cout <<
"The data:\n";
53 cout << _x.first <<
' ' << _x.second <<
'\n';
58 for_each( x.begin(),x.end(), [&mafs](
const polymorphicSite & __p){ mafs.push_back(local_maf(__p)); } );
59 cout <<
"The minor allele frequencies:\n";
60 for(
auto __maf : mafs )
62 cout << __maf <<
'\n';
70 cout <<
"The data after sorting:\n";
73 cout << _x.first <<
' ' << _x.second <<
'\n';
77 std::vector<std::string::size_type> missing;
79 std::vector<std::string::size_type> __temp = local_has_missing(__p);
80 copy(__temp.begin(),__temp.end(),back_inserter(missing));
83 cout <<
"Index of individuals with missing data:\n";
84 for(
auto __m : missing )
91 x.erase( remove_if(x.begin(),x.end(),[](
const polymorphicSite & __p){
return local_maf(__p) <= 0.25; } ),x.end() );
93 cout <<
"The data after applying MAF filter:\n";
96 cout << _x.first <<
' ' << _x.second <<
'\n';
102 cout <<
"Print out the classic object:\n" keep track of state counts at a site in an alignment or along a sequence
Polymorphism tables for sequence data.
The namespace in which this library resides.
std::vector< polymorphicSite > polySiteVector
Site-major variation tables in ASCII format.
Sequence::PolySites, generates polymorphism tables from data.
declaration of Sequence::stateCounter, a class to keep track of nucleotide counts either at a site in...
std::pair< double, std::string > polymorphicSite