Skip to content

Commit

Permalink
Update to print any-to-any migration rates in mig skyline.
Browse files Browse the repository at this point in the history
  • Loading branch information
trvrb committed Aug 6, 2015
1 parent df1644c commit 8ac38b4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions coaltree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
14 changes: 14 additions & 0 deletions io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion param.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) );
Expand Down

0 comments on commit 8ac38b4

Please sign in to comment.