From e403efa1e4abdff5f182c9e1b7188708a6bc622f Mon Sep 17 00:00:00 2001 From: Thomas Wong Date: Fri, 5 Jul 2024 10:11:13 +1000 Subject: [PATCH 1/7] Fixed #261 issue of init model name that has to be in all caps for linked exchangeabilities --- model/modelprotein.cpp | 4 +++- utils/tools.cpp | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/model/modelprotein.cpp b/model/modelprotein.cpp index 4e5d7196e..4359c5446 100644 --- a/model/modelprotein.cpp +++ b/model/modelprotein.cpp @@ -995,7 +995,9 @@ void ModelProtein::init(const char *model_name, string model_params, StateFreqTy } else { // initialize rate matrix with a model (default: POISSON) -JD nxs_model = models_block->findModel(Params::getInstance().gtr20_model); - ASSERT(nxs_model); + if (nxs_model == nullptr) { + outError("Unknown init model: " + Params::getInstance().gtr20_model); + } readParametersString(nxs_model->description, false); rescaleRates(rates, getNumRateEntries()); } diff --git a/utils/tools.cpp b/utils/tools.cpp index 10930e466..a7e91dc2f 100644 --- a/utils/tools.cpp +++ b/utils/tools.cpp @@ -1689,8 +1689,9 @@ void parseArg(int argc, char *argv[], Params ¶ms) { if (strcmp(argv[cnt], "--gtr20-model") == 0 || strcmp(argv[cnt], "--init-exchange") == 0) { cnt++; if (cnt >= argc) - throw "Use --gtr20-model "; + throw "Use " + string(argv[cnt-1]) + " "; params.gtr20_model = argv[cnt]; + transform(params.gtr20_model.begin(), params.gtr20_model.end(), params.gtr20_model.begin(), ::toupper); continue; } if (strcmp(argv[cnt], "--guess-multiplier") == 0) { From 8891b7d2427925b6b48367a75a1f81d7741279fb Mon Sep 17 00:00:00 2001 From: Thomas Wong Date: Thu, 11 Jul 2024 10:39:11 +1000 Subject: [PATCH 2/7] Fixed the issue when using linked exchangeabilities under the mixture of protein + FO model. --- model/modelmixture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/modelmixture.cpp b/model/modelmixture.cpp index 5a7008a35..de8772e39 100644 --- a/model/modelmixture.cpp +++ b/model/modelmixture.cpp @@ -2429,8 +2429,8 @@ void ModelMixture::setBounds(double *lower_bound, double *upper_bound, bool *bou // only consider the first class as this is a linked substitution matrix iterator it = begin(); auto freq = (*it)->freq_type; - int ndim = (*it)->getNDim(); (*it)->freq_type=FREQ_USER_DEFINED; + int ndim = (*it)->getNDim(); (*it)->setBounds(&lower_bound[dim], &upper_bound[dim], &bound_check[dim]); (*it)->freq_type=freq; //manually set these params for the restartParameters method; TODO: properly fix this -JD From eb52e3809dc47b38dc07bdf162c2c17253036b77 Mon Sep 17 00:00:00 2001 From: Thomas Wong Date: Thu, 11 Jul 2024 11:48:26 +1000 Subject: [PATCH 3/7] Fixed the issue #272 in writing best_model.nex file --- tree/phylosupertree.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tree/phylosupertree.cpp b/tree/phylosupertree.cpp index 21fabf81d..0dfe21284 100644 --- a/tree/phylosupertree.cpp +++ b/tree/phylosupertree.cpp @@ -1535,10 +1535,12 @@ void PhyloSuperTree::printBestPartitionParams(const char *filename) { if (!saln->partitions[part]->aln_file.empty()) out << saln->partitions[part]->aln_file << ": "; /*if (saln->partitions[part]->seq_type == SEQ_CODON) out << "CODON, ";*/ - out << saln->partitions[part]->sequence_type << ", "; + out << saln->partitions[part]->sequence_type; string pos = saln->partitions[part]->position_spec; replace(pos.begin(), pos.end(), ',' , ' '); - out << pos << ";" << endl; + if (!pos.empty()) + out << ", " << pos; + out << ";" << endl; } out << " charpartition mymodels =" << endl; for (part = 0; part < size(); part++) { From 84a17aa89ccd7ddeb9c00fd82a6f481975ddb670 Mon Sep 17 00:00:00 2001 From: Thomas Wong Date: Mon, 15 Jul 2024 14:34:47 +1000 Subject: [PATCH 4/7] not outputting comma in bestmodel.nex --- tree/phylosupertree.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tree/phylosupertree.cpp b/tree/phylosupertree.cpp index 0dfe21284..a15afd490 100644 --- a/tree/phylosupertree.cpp +++ b/tree/phylosupertree.cpp @@ -1538,9 +1538,7 @@ void PhyloSuperTree::printBestPartitionParams(const char *filename) { out << saln->partitions[part]->sequence_type; string pos = saln->partitions[part]->position_spec; replace(pos.begin(), pos.end(), ',' , ' '); - if (!pos.empty()) - out << ", " << pos; - out << ";" << endl; + out << pos << ";" << endl; } out << " charpartition mymodels =" << endl; for (part = 0; part < size(); part++) { From d2056c59558759195e3655a899f7847bbca8d9d5 Mon Sep 17 00:00:00 2001 From: Thomas Wong Date: Thu, 25 Jul 2024 10:03:03 +1000 Subject: [PATCH 5/7] Add a missing ";" by the end of the model definition inside GTRPMIX.nex file. --- main/phyloanalysis.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/phyloanalysis.cpp b/main/phyloanalysis.cpp index e712707bc..ac71027f4 100644 --- a/main/phyloanalysis.cpp +++ b/main/phyloanalysis.cpp @@ -323,7 +323,7 @@ void reportNexusFile(ostream &out, ModelSubst *m) { double f = 1.0 / m->num_states; for (i = 0; i < m->num_states; i++) out << " " << f; - out << endl; + out << ";" << endl; out.precision(4); out << "end;" << endl; } From d0d77329bbdd51d4677f2c5b611c077b4eceab2c Mon Sep 17 00:00:00 2001 From: Thomas Wong Date: Fri, 26 Jul 2024 11:55:52 +1000 Subject: [PATCH 6/7] update the version number --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca5ebac72..2f7eb503a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ endif() # The version number. set (iqtree_VERSION_MAJOR 2) set (iqtree_VERSION_MINOR 3) -set (iqtree_VERSION_PATCH ".5") +set (iqtree_VERSION_PATCH ".6") option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF) From 67850827e76c40f13af9197c61a79c470ff70022 Mon Sep 17 00:00:00 2001 From: Thomas Wong Date: Fri, 26 Jul 2024 20:12:46 +1000 Subject: [PATCH 7/7] Fixed the issue in writing best_model.nex file For the "charset" line, a comma will be outputted when both sequence type and position are not empty. --- tree/phylosupertree.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tree/phylosupertree.cpp b/tree/phylosupertree.cpp index a15afd490..dcde7a0ed 100644 --- a/tree/phylosupertree.cpp +++ b/tree/phylosupertree.cpp @@ -1538,6 +1538,9 @@ void PhyloSuperTree::printBestPartitionParams(const char *filename) { out << saln->partitions[part]->sequence_type; string pos = saln->partitions[part]->position_spec; replace(pos.begin(), pos.end(), ',' , ' '); + if (!saln->partitions[part]->sequence_type.empty() && !pos.empty()) { + out << ", "; + } out << pos << ";" << endl; } out << " charpartition mymodels =" << endl;