Permalink
Browse files

Update to print any-to-any migration rates in mig skyline.

  • Loading branch information...
1 parent df1644c commit 8ac38b4fe2e859c62cdf0c72a61d45a104762e66 @trvrb committed Aug 6, 2015
Showing with 21 additions and 1 deletion.
  1. +6 −0 coaltree.cpp
  2. +14 −0 io.cpp
  3. +1 −1 param.cpp
View
@@ -297,6 +297,12 @@ CoalescentTree::CoalescentTree(string paren) {
(*it).setX(xloc);
}
+ // iSNV
+ if (stringOne == "iSNV") {
+ double xloc = atof(stringTwo.c_str());
+ (*it).setX(xloc);
+ }
+
// LATITUDE
if (stringOne == "latitude") {
double xloc = atof(stringTwo.c_str());
View
@@ -844,6 +844,20 @@ void IO::printSkylines() {
// MIGRATION ///////////////////////
if (param.skyline_mig_rates) {
cout << "Printing migration skyline to " << outputFile << endl;
+
+ for (double t = start; t + step <= stop; t += step) {
+ Series s;
+ for (int i = 0; i < treelist.size(); i++) {
+ CoalescentTree ct = treelist[i];
+ ct.trimEnds(t,t+step);
+ double n = ct.getMigRate();
+ s.insert(n);
+ }
+ outStream << "mig_all\t";
+ outStream << t + step / (double) 2 << "\t";
+ outStream << s.quantile(0.025) << "\t" << s.mean() << "\t" << s.quantile(0.975) << endl;
+ }
+
for (is = lset.begin(); is != lset.end(); ++is) {
for (js = lset.begin(); js != lset.end(); ++js) {
string from = *is;
View
@@ -146,7 +146,7 @@ void Parameters::importLine(string line) {
break;
else if (*is >= 'a' && *is <= 'z' && vstring.size() == 0)
pstring += *is;
- else if ( (*is >= '0' && *is <= '9') || (*is >= 'a' && *is <= 'z') || (*is >= 'A' && *is <= 'Z') || *is == '.' || *is == '-' || *is == '/' || *is == '_')
+ else if ( (*is >= '0' && *is <= '9') || (*is >= 'a' && *is <= 'z') || (*is >= 'A' && *is <= 'Z') || *is == '.' || *is == '-' || *is == '/' || *is == '_' || *is == '|')
vstring += *is;
else if (vstring.size() > 0) {
values.push_back( atof(vstring.c_str()) );

0 comments on commit 8ac38b4

Please sign in to comment.