21 int main(
int argc,
char **argv)
23 const char *infilename = argv[1];
25 vector<Sequence::Fasta> data;
27 Sequence::Alignment::GetData(data,infilename);
29 if ( Sequence::Alignment::IsAlignment(data) &&
30 Sequence::Alignment::validForPolyAnalysis(data.begin(),data.end()) )
37 cout <<
"Original position order:\n";
38 copy(SNPs.pbegin(),SNPs.pend(),
39 ostream_iterator<double>(cout,
" "));
49 random_shuffle(SNPs.pbegin(),SNPs.pend());
51 cout <<
"Permuted positions:\n";
52 copy(SNPs.pbegin(),SNPs.pend(),
53 ostream_iterator<double>(cout,
" "));
60 cout <<
"Original data:\n";
61 copy(SNPs.begin(),SNPs.end(),ostream_iterator<string>(cout,
"\n"));
70 random_shuffle(SNPs.begin(),SNPs.end());
71 cout <<
"Permuted data:\n";
72 copy(SNPs.begin(),SNPs.end(),ostream_iterator<string>(cout,
"\n"));
88 Sequence::PolySites::const_site_iterator itr = SNPs.sbegin();
89 while( itr < SNPs.send() )
92 unsigned A = count(itr->second.begin(),itr->second.end(),
'A');
93 unsigned G = count(itr->second.begin(),itr->second.end(),
'G');
94 unsigned C = count(itr->second.begin(),itr->second.end(),
'C');
95 unsigned T = count(itr->second.begin(),itr->second.end(),
'T');
96 unsigned N = count(itr->second.begin(),itr->second.end(),
'N');
100 unsigned n = itr->second.length() - N;
107 SH -= (A>0) ? (
double(A)/double(n))*(
double(A-1)/double(n-1)) : 0.;
108 SH -= (G>0) ? (
double(G)/double(n))*(
double(G-1)/double(n-1)) : 0.;
109 SH -= (C>0) ? (
double(C)/double(n))*(
double(C-1)/double(n-1)) : 0.;
110 SH -= (T>0) ? (
double(T)/double(n))*(
double(T-1)/double(n-1)) : 0.;
114 cout <<
"Pi (for the entire region) = "<< pi << endl;
Polymorphism tables for sequence data.
declaration of Sequence::PolySNP, a class to analyze SNP data
Declaration of namespace Sequence::Alignment.
Sequence::PolySites, generates polymorphism tables from data.
Declaration of Sequence::Fasta streams.