Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
release version 1.6.4. Allow specifying 6 GTR rates and G-T to be zer…
Browse files Browse the repository at this point in the history
…o (requested by Ben Redelings).
  • Loading branch information
bqminh committed Apr 29, 2018
1 parent ce72557 commit da46490
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions model/modeldna.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,24 +244,25 @@ void ModelDNA::readRates(string str) throw(const char*) {
for (j = 0; j < param_spec.length(); j++)
rates[j] = 1.0;
num_params = 0;
for (i = 0; i < nrates && end_pos < str.length(); i++) {
for (i = 0; i <= nrates && end_pos < str.length(); i++) {
int new_end_pos;
double rate = 0;
int id = (i < nrates) ? i+1 : 0;
if (str[end_pos] == '?') {
param_fixed[i+1] = false;
param_fixed[id] = false;
end_pos++;
rate = 1.0;
num_params++;
} else {
if (Params::getInstance().optimize_rate_matrix) {
num_params++;
param_fixed[i+1] = false;
param_fixed[id] = false;
} else
if (Params::getInstance().optimize_from_given_params) {
num_params++;
param_fixed[i+1] = false;
param_fixed[id] = false;
} else {
param_fixed[i+1] = true;
param_fixed[id] = true;
}
try {
rate = convert_double(str.substr(end_pos).c_str(), new_end_pos);
Expand All @@ -272,15 +273,15 @@ void ModelDNA::readRates(string str) throw(const char*) {
}
if (rate < 0.0)
outError("Negative rates found");
if (i == nrates-1 && end_pos < str.length())
if (i == nrates && end_pos < str.length())
outError("More than " + convertIntToString(nrates) + " rate parameters specified in " + str);
if (i < nrates-1 && end_pos >= str.length())
outError("Unexpected end of string ", str);
if (end_pos < str.length() && str[end_pos] != ',')
outError("Comma to separate rates not found in ", str);
end_pos++;
for (j = 0; j < param_spec.length(); j++)
if (param_spec[j] == i+1)
if (param_spec[j] == id)
rates[j] = rate;
}
}
Expand Down Expand Up @@ -365,7 +366,10 @@ bool ModelDNA::setRateType(string rate_str) {
for (i = 0; i <= num_params; i++)
avg_rates[i] /= num_rates[i];
for (i = 0; i < param_spec.size(); i++) {
rates[i] = avg_rates[(int)param_spec[i]] / avg_rates[0];
if (avg_rates[0] > 0.0)
rates[i] = avg_rates[(int)param_spec[i]] / avg_rates[0];
else
rates[i] = avg_rates[(int)param_spec[i]];
}
if (verbose_mode >= VB_DEBUG) {
cout << "Initialized rates: ";
Expand Down

0 comments on commit da46490

Please sign in to comment.