15 #include "../App/PhylogeneticsApplicationTools.h"
16 #include "../Model/AbstractBiblioMixedTransitionModel.h"
17 #include "../Model/BinarySubstitutionModel.h"
18 #include "../Model/D1WalkSubstitutionModel.h"
19 #include "../Model/Codon/AbstractCodonAAFitnessSubstitutionModel.h"
20 #include "../Model/Codon/AbstractCodonAARateSubstitutionModel.h"
21 #include "../Model/Codon/AbstractCodonBGCSubstitutionModel.h"
22 #include "../Model/Codon/AbstractCodonClusterAASubstitutionModel.h"
23 #include "../Model/Codon/AbstractCodonCpGSubstitutionModel.h"
24 #include "../Model/Codon/AbstractCodonDistanceSubstitutionModel.h"
25 #include "../Model/Codon/AbstractCodonDistanceSubstitutionModel.h"
26 #include "../Model/Codon/AbstractCodonFitnessSubstitutionModel.h"
27 #include "../Model/Codon/AbstractCodonFrequenciesSubstitutionModel.h"
28 #include "../Model/Codon/AbstractCodonPhaseFrequenciesSubstitutionModel.h"
29 #include "../Model/Codon/CodonAdHocSubstitutionModel.h"
30 #include "../Model/Codon/CodonSameAARateSubstitutionModel.h"
31 #include "../Model/Codon/DFP07.h"
32 #include "../Model/Codon/GY94.h"
33 #include "../Model/Codon/KCM.h"
34 #include "../Model/Codon/KroneckerCodonDistanceFrequenciesSubstitutionModel.h"
35 #include "../Model/Codon/KroneckerCodonDistanceSubstitutionModel.h"
36 #include "../Model/Codon/MG94.h"
37 #include "../Model/Codon/SENCA.h"
38 #include "../Model/Codon/TripletSubstitutionModel.h"
39 #include "../Model/Codon/YN98.h"
40 #include "../Model/Codon/YNGP_M10.h"
41 #include "../Model/Codon/YNGP_M7.h"
42 #include "../Model/Codon/YNGP_M8.h"
43 #include "../Model/Codon/YNGP_M9.h"
44 #include "../Model/EquiprobableSubstitutionModel.h"
45 #include "../Model/FromMixtureSubstitutionModel.h"
46 #include "../Model/G2001.h"
47 #include "../Model/InMixedSubstitutionModel.h"
48 #include "../Model/KroneckerWordSubstitutionModel.h"
49 #include "../Model/MixtureOfATransitionModel.h"
50 #include "../Model/MixtureOfTransitionModels.h"
51 #include "../Model/Nucleotide/F81.h"
52 #include "../Model/Nucleotide/F84.h"
53 #include "../Model/Nucleotide/GTR.h"
54 #include "../Model/Nucleotide/HKY85.h"
55 #include "../Model/Nucleotide/JCnuc.h"
56 #include "../Model/Nucleotide/K80.h"
57 #include "../Model/Nucleotide/L95.h"
58 #include "../Model/Nucleotide/NucleotideSubstitutionModel.h"
59 #include "../Model/Nucleotide/RN95.h"
60 #include "../Model/Nucleotide/RN95s.h"
61 #include "../Model/Nucleotide/SSR.h"
62 #include "../Model/Nucleotide/T92.h"
63 #include "../Model/Nucleotide/TN93.h"
64 #include "../Model/Nucleotide/YpR.h"
65 #include "../Model/Nucleotide/gBGC.h"
66 #include "../Model/OneChangeRegisterTransitionModel.h"
67 #include "../Model/OneChangeTransitionModel.h"
68 #include "../Model/POMO.h"
69 #include "../Model/Protein/Coala.h"
70 #include "../Model/Protein/CoalaCore.h"
71 #include "../Model/Protein/DSO78.h"
72 #include "../Model/Protein/JCprot.h"
73 #include "../Model/Protein/JTT92.h"
74 #include "../Model/Protein/LG08.h"
75 #include "../Model/Protein/LGL08_CAT.h"
76 #include "../Model/Protein/ProteinSubstitutionModel.h"
77 #include "../Model/Protein/UserProteinSubstitutionModel.h"
78 #include "../Model/Protein/WAG01.h"
79 #include "../Model/RE08.h"
80 #include "../Model/RegisterRatesSubstitutionModel.h"
81 #include "../Model/TS98.h"
82 #include "../Model/TwoParameterBinarySubstitutionModel.h"
83 #include "../Model/WordSubstitutionModel.h"
119 shared_ptr<const Alphabet> alphabet,
120 const string& modelDescription,
121 const std::map<
size_t, std::shared_ptr<const AlignmentDataInterface>>& mData,
125 unparsedArguments_.clear();
126 unique_ptr<SubstitutionModelInterface> model;
127 string modelName =
"";
128 map<string, string> args;
136 if (modelName ==
"InMixed")
138 if (args.find(
"model") == args.end())
139 throw Exception(
"'model' argument missing to define the InMixed model.");
144 if (args.find(
"numMod") == args.end())
146 if (args.find(
"nameMod") == args.end())
147 throw Exception(
"'numMod' and 'nameMod' arguments missing to define the InMixed submodel.");
149 nameMod = args[
"nameMod"];
154 string modelDesc2 = args[
"model"];
158 unique_ptr<TransitionModelInterface> nestedModelTmp = nestedReader.
readTransitionModel(alphabet, modelDesc2, mData, nData,
false);
165 throw Exception(
"Unknown mixed model " + modelDesc2 +
".");
171 nestedModel->model(nameMod);
175 throw Exception(
"BppOSubstitutionModelFormat::read. " + nestedModel->getName() +
"argument for model 'InMixed' has no submodel with name " + nameMod +
".");
177 model = make_unique<InMixedSubstitutionModel>(std::move(nestedModel), nameMod, modelDesc2);
181 if (numMod == 0 || (nestedModel->getNumberOfModels() < numMod))
182 throw Exception(
"BppOSubstitutionModelFormat::read. " + nestedModel->getName() +
"argument for model 'InMixed' has no submodel with number " +
TextTools::toString(numMod) +
".");
183 model = make_unique<InMixedSubstitutionModel>(std::move(nestedModel), numMod - 1, modelDesc2);
187 for (
auto& it :unparsedParameterValuesNested)
189 unparsedArguments_[it.first] = it.second;
197 else if (modelName ==
"FromRegister")
200 if (args.find(
"model") == args.end())
201 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'model' for model 'FromRegister'.");
203 string nestedModelDescription = args[
"model"];
208 auto nestedModel = nestedReader.
readSubstitutionModel(alphabet, nestedModelDescription, mData, nData,
false);
212 if (args.find(
"register") == args.end())
213 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'register' for model 'FromRegister'.");
215 string registerDescription = args[
"register"];
216 shared_ptr<AlphabetIndex2> weights =
nullptr;
217 shared_ptr<AlphabetIndex2> distances =
nullptr;
224 if (args.find(
"isNormalized") != args.end() && args[
"isNormalized"] ==
"true")
227 model = make_unique<RegisterRatesSubstitutionModel>(std::move(nestedModel), *reg, isNorm);
230 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'register' for model 'FromRegister'.");
233 for (
auto& it : unparsedParameterValuesNested)
235 unparsedArguments_[
"FromRegister." + it.first] = it.second;
239 else if (modelName ==
"POMO")
241 auto allelic = dynamic_pointer_cast<const AllelicAlphabet>(alphabet);
243 throw Exception(
"BppOSubstitutionModelFormat;;read. POMO model with no allelic alphabet.");
246 if (args.find(
"model") == args.end())
247 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'model' for model 'POMO'.");
249 map<string, string> unparsedParameterValuesNested;
251 unique_ptr<FrequencySetInterface> nestedFreq(
nullptr);
253 if (args.find(
"fitness") != args.end())
255 string nestedFreqDescription = args[
"fitness"];
258 nestedFreq = nestedFreqReader.
readFrequencySet(allelic->getStateAlphabet(), nestedFreqDescription, mData, nData,
false);
261 for (
auto& it : unparsedParameterValuesNested)
263 unparsedParameterValuesNested[
"fit_" + it.first] = it.second;
269 string nestedModelDescription = args[
"model"];
273 auto nestedModel = nestedReader.
readSubstitutionModel(allelic->getStateAlphabet(), nestedModelDescription, mData, nData,
false);
278 model = make_unique<POMO>(allelic, std::move(nestedModel), std::move(nestedFreq));
281 for (
auto& it : unparsedParameterValuesNested)
283 unparsedArguments_[
"POMO." + it.first] = it.second;
292 else if ((modelName ==
"Word") || (modelName.substr(0, 4) ==
"Kron") || (modelName ==
"Triplet") || (modelName.substr(0, 5) ==
"Codon") || (modelName ==
"SENCA") )
293 model = readWord_(alphabet, modelDescription, mData, nData);
299 else if (((modelName ==
"MG94") || (modelName ==
"YN98") || (modelName ==
"YNGP_M0") ||
300 (modelName ==
"GY94") || (modelName.substr(0, 3) ==
"KCM") || (modelName ==
"SameAARate"))
301 && (alphabetCode_ & CODON))
303 if (!(alphabetCode_ & CODON))
304 throw Exception(
"BppOSubstitutionModelFormat::read. Codon alphabet not supported.");
306 throw Exception(
"BppOSubstitutionModelFormat::readSubstitionModel(). No genetic code specified! Consider using 'setGeneticCode'.");
309 throw Exception(
"Alphabet should be Codon Alphabet.");
311 auto pCA = dynamic_pointer_cast<const CodonAlphabet>(alphabet);
313 if (args.find(
"genetic_code") != args.end())
315 ApplicationTools::displayWarning(
"'genetic_code' argument is no longer supported inside model description, and has been supersided by a global 'genetic_code' option.");
316 throw Exception(
"BppOSubstitutionModelFormat::read. Deprecated 'genetic_code' argument.");
319 if (geneticCode_->getSourceAlphabet()->getAlphabetType() != pCA->getAlphabetType())
320 throw Exception(
"Mismatch between genetic code and codon alphabet");
322 unique_ptr<CodonFrequencySetInterface> codonFreqs(
nullptr);
324 if (args.find(
"frequencies") != args.end())
334 unparsedArguments_[modelName +
"." + it.first] = it.second;
339 if (modelName !=
"SameAARate")
340 throw Exception(
"Missing 'frequencies' for model " + modelName);
342 if (modelName ==
"MG94")
343 model = make_unique<MG94>(geneticCode_, std::move(codonFreqs));
344 else if (modelName ==
"GY94")
345 model = make_unique<GY94>(geneticCode_, std::move(codonFreqs));
346 else if ((modelName ==
"YN98") || (modelName ==
"YNGP_M0"))
347 model = make_unique<YN98>(geneticCode_, std::move(codonFreqs));
348 else if (modelName ==
"KCM7")
349 model = make_unique<KCM>(geneticCode_,
true);
350 else if (modelName ==
"KCM19")
351 model = make_unique<KCM>(geneticCode_,
false);
352 else if (modelName ==
"SameAARate")
354 if (args.find(
"protmodel") == args.end())
355 throw Exception(
"Missing 'protmodel in model " + modelName +
".");
358 auto tmpProtModel = nestedProtReader.
readSubstitutionModel(geneticCode_->getTargetAlphabet(), args[
"protmodel"], mData, nData,
false);
362 unparsedArguments_.insert(unparsedParameterValuesNested.begin(), unparsedParameterValuesNested.end());
364 if (args.find(
"codonmodel") == args.end())
365 throw Exception(
"Missing 'codonmodel in model " + modelName +
".");
370 auto tmpSubstitutionModel = nestedCodonReader.
readSubstitutionModel(alphabet, args[
"codonmodel"], mData, nData,
false);
374 for (
const auto& it:unparsedParameterValuesNested)
376 unparsedArguments_[
"SameAARate." + it.first] = it.second;
379 model = make_unique<CodonSameAARateSubstitutionModel>(std::move(nestedProtModel), std::move(nestedCodonModel), std::move(codonFreqs), geneticCode_);
382 throw Exception(
"Unknown Codon model: " + modelName);
390 else if (modelName ==
"YpR_Sym")
392 if (!(alphabetCode_ & NUCLEOTIDE))
393 throw Exception(
"BppOSubstitutionModelFormat::read. Nucleotide alphabet not supported.");
395 throw Exception(
"Mismatch alphabet: " + alphabet->getAlphabetType() +
" for model: " + modelName);
396 auto prny = dynamic_pointer_cast<const RNY>(alphabet);
398 string nestedModelDescription = args[
"model"];
400 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'model' for model 'YpR_sym'.");
404 auto tmpModel = nestedReader.
readSubstitutionModel(prny->getLetterAlphabet(), nestedModelDescription, mData, nData,
false);
407 for (
auto& it : unparsedParameterValuesNested)
409 unparsedArguments_[
"YpR_Sym." + it.first] = it.second;
412 model = make_unique<YpR_Sym>(prny, std::move(nestedModel));
414 else if (modelName ==
"YpR_Gen")
416 if (!(alphabetCode_ & NUCLEOTIDE))
417 throw Exception(
"BppOSubstitutionModelFormat::read. Nucleotide alphabet not supported.");
419 throw Exception(
"Mismatch alphabet: " + alphabet->getAlphabetType() +
" for model: " + modelName);
420 auto prny = dynamic_pointer_cast<const RNY>(alphabet);
422 string nestedModelDescription = args[
"model"];
424 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'model' for model 'YpR_gen'.");
428 auto tmpModel = nestedReader.
readSubstitutionModel(prny->getLetterAlphabet(), nestedModelDescription, mData, nData,
false);
432 for (
auto& it : unparsedParameterValuesNested)
434 unparsedArguments_[
"YpR_Gen." + it.first] = it.second;
437 model = make_unique<YpR_Gen>(prny, std::move(nestedModel));
445 else if (modelName ==
"RE08")
448 throw Exception(
"BppOSubstitutionModelFormat::read. No Gap model allowed here.");
451 string nestedModelDescription = args[
"model"];
453 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'model' for model 'RE08'.");
459 auto tmpModel = nestedReader.
readSubstitutionModel(alphabet, nestedModelDescription, mData, nData,
false);
466 if (!(alphabetCode_ & NUCLEOTIDE))
467 throw Exception(
"BppOSubstitutionModelFormat::read. Nucleic alphabet not supported.");
469 model = make_unique<RE08Nucleotide>(std::move(nestedModel));
471 throw Exception(
"BppOSubstitutionModelFormat::readSubstitionModel(). Invalid submodel, must be 'reversible' and 'nucleotide'.");
475 if (!(alphabetCode_ & PROTEIN))
476 throw Exception(
"BppOSubstitutionModelFormat::read. Protein alphabet not supported.");
478 model = make_unique<RE08Protein>(std::move(nestedModel));
480 throw Exception(
"BppOSubstitutionModelFormat::readSubstitionModel(). Invalid submodel, must be 'reversible' and 'protein'.");
484 if (!(alphabetCode_ & CODON))
485 throw Exception(
"BppOSubstitutionModelFormat::read. Codon alphabet not supported.");
487 model = make_unique<RE08Codon>(std::move(nestedModel));
489 throw Exception(
"BppOSubstitutionModelFormat::readSubstitionModel(). Invalid submodel, must be 'reversible' and 'codon'.");
494 model = make_unique<RE08>(std::move(nestedModel));
498 for (
auto& it : unparsedParameterValuesNested)
500 unparsedArguments_[
"RE08.model_" + it.first] = it.second;
508 else if (modelName ==
"TS98")
510 if (!allowCovarions_)
511 throw Exception(
"BppOSubstitutionModelFormat::read. No Covarion model allowed here.");
514 string nestedModelDescription = args[
"model"];
516 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'model' for model 'TS98'.");
522 auto tmpModel = nestedReader.
readSubstitutionModel(alphabet, nestedModelDescription, mData, nData,
false);
527 model = make_unique<TS98>(std::move(nestedModel));
530 for (
auto& it : unparsedParameterValuesNested)
532 unparsedArguments_[
"TS98.model_" + it.first] = it.second;
540 else if (modelName ==
"G01")
542 if (!allowCovarions_)
543 throw Exception(
"BppOSubstitutionModelFormat::read. No Covarion model allowed here.");
546 string nestedModelDescription = args[
"model"];
548 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'model' for model 'G01'.");
549 string nestedRateDistDescription = args[
"rdist"];
551 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'rdist' for model 'G01'.");
557 auto tmpModel = nestedReader.
readSubstitutionModel(alphabet, nestedModelDescription, mData, nData,
false);
566 model = make_unique<G2001>(std::move(nestedModel), std::move(nestedRDist));
569 for (
auto& it : unparsedParameterValuesNestedModel)
571 unparsedArguments_[
"G01.model_" + it.first] = it.second;
573 for (
auto& it : unparsedParameterValuesNestedDist)
575 unparsedArguments_[
"G01.rdist_" + it.first] = it.second;
593 if (modelName ==
"Equi")
599 if (!(alphabetCode_ & NUCLEOTIDE))
600 throw Exception(
"BppOSubstitutionModelFormat::read. Nucleotide alphabet not supported.");
601 auto alpha = dynamic_pointer_cast<const NucleicAlphabet>(alphabet);
606 if (modelName.find(
"+gBGC") != string::npos)
608 string subModName = modelName.substr(0, modelName.find(
"+gBGC"));
613 string nestedModelDescription = subModName;
615 if (modelDescription.find_first_of(
"(") != string::npos)
617 string::size_type begin = modelDescription.find_first_of(
"(");
618 string::size_type end = modelDescription.find_last_of(
")");
620 nestedModelDescription += modelDescription.substr(begin, end - begin + 1);
624 auto tmpModel = nestedReader.
readSubstitutionModel(alphabet, nestedModelDescription, mData, nData,
false);
629 model = make_unique<gBGC>(alpha, std::move(nestedModel));
632 for (
auto& it : unparsedParameterValuesNested)
634 unparsedArguments_[
"gBGC." + it.first] = it.second;
643 else if (modelName ==
"GTR")
645 model = make_unique<GTR>(alpha);
653 else if (modelName ==
"SSR")
655 model = make_unique<SSR>(alpha);
662 else if (modelName ==
"L95")
664 model = make_unique<L95>(alpha);
671 else if (modelName ==
"RN95")
673 model = make_unique<RN95>(alpha);
680 else if (modelName ==
"RN95s")
682 model = make_unique<RN95s>(alpha);
689 else if (modelName ==
"TN93")
691 model = make_unique<TN93>(alpha);
698 else if (modelName ==
"HKY85")
700 model = make_unique<HKY85>(alpha);
707 else if (modelName ==
"F81")
709 model = make_unique<F81>(alpha);
715 else if (modelName ==
"F84")
717 model = make_unique<F84>(alpha);
724 else if (modelName ==
"T92")
726 model = make_unique<T92>(alpha);
733 else if (modelName ==
"K80")
735 model = make_unique<K80>(alpha);
743 else if (modelName ==
"JC69")
745 model = make_unique<JCnuc>(alpha);
748 throw Exception(
"Model '" + modelName +
"' unknown, or does not fit nucleic alphabet.");
755 if (!(alphabetCode_ & PROTEIN))
756 throw Exception(
"BppOSubstitutionModelFormat::read. Protein alphabet not supported.");
757 auto alpha = dynamic_pointer_cast<const ProteicAlphabet>(alphabet);
759 if (modelName.find(
"+F") != string::npos)
763 auto tmpFreq = freqReader.
readFrequencySet(alpha, freqOpt, mData, nData,
true);
768 for (
auto& it : unparsedParameterValuesNested)
770 unparsedArguments_[modelName +
"." + it.first] = it.second;
773 if (modelName ==
"JC69+F")
774 model = make_unique<JCprot>(alpha, std::move(protFreq));
775 else if (modelName ==
"DSO78+F")
776 model = make_unique<DSO78>(alpha, std::move(protFreq));
777 else if (modelName ==
"JTT92+F")
778 model = make_unique<JTT92>(alpha, std::move(protFreq));
779 else if (modelName ==
"LG08+F")
780 model = make_unique<LG08>(alpha, std::move(protFreq));
781 else if (modelName ==
"WAG01+F")
782 model = make_unique<WAG01>(alpha, std::move(protFreq));
783 else if (modelName ==
"Empirical+F")
785 string prefix = args[
"name"];
787 throw Exception(
"'name' argument missing for user-defined substitution model.");
788 string fname = args[
"file"];
790 throw Exception(
"'file' argument missing for user-defined substitution model.");
791 model = make_unique<UserProteinSubstitutionModel>(alpha, args[
"file"], std::move(protFreq), prefix +
"+F.");
794 else if (modelName ==
"JC69")
795 model = make_unique<JCprot>(alpha);
796 else if (modelName ==
"DSO78")
797 model = make_unique<DSO78>(alpha);
798 else if (modelName ==
"JTT92")
799 model = make_unique<JTT92>(alpha);
800 else if (modelName ==
"LG08")
801 model = make_unique<LG08>(alpha);
802 else if (modelName ==
"WAG01")
803 model = make_unique<WAG01>(alpha);
805 else if (modelName.substr(0, 9) ==
"LGL08_CAT")
807 string subModelName = modelName.substr(10);
809 size_t posp = modelDescription.find(
"(");
811 string modelDesc2 = modelName.substr(0, 9) + modelDescription.substr(posp);
815 auto tmpModel = nestedReader.
readTransitionModel(alphabet, modelDesc2, mData, nData,
false);
820 throw Exception(
"Unknown model " + modelName +
".");
824 nestedModel->model(subModelName);
828 throw Exception(
"BppOSubstitutionModelFormat::read. " + nestedModel->getName() +
"argument for model 'FromMixture' has no submodel with name " + subModelName +
".");
832 model = make_unique<FromMixtureSubstitutionModel>(*nestedModel, subModelName, modelDesc2);
834 else if (modelName ==
"Empirical")
836 string prefix = args[
"name"];
838 throw Exception(
"'name' argument missing for user-defined substitution model.");
839 model = make_unique<UserProteinSubstitutionModel>(alpha, args[
"file"], prefix);
841 else if (modelName ==
"Coala")
843 string exchangeability = args[
"exch"];
845 throw Exception(
"BppOSubstitutionModelFormat::read. missing argument 'exch' for model 'Coala'.");
846 string prefix = args[
"name"];
848 throw Exception(
"'name' argument missing to specify the exchangeabilities of the user-defined empirical model.");
852 string nbrOfParametersPerBranch = args[
"nbrAxes"];
854 throw Exception(
"'nbrAxes' argument missing to define the number of axis of the Correspondence Analysis.");
856 model = make_unique<Coala>(alpha, *nestedModel, TextTools::to<unsigned int>(nbrOfParametersPerBranch));
858 model->setFreqFromData(*mData.at(nData));
861 throw Exception(
"Model '" + modelName +
"' is unknown, or does not fit proteic alphabet.");
865 if (!(alphabetCode_ & BINARY))
866 throw Exception(
"BppOSubstitutionModelFormat::read. Binary alphabet not supported.");
868 auto balpha = dynamic_pointer_cast<const BinaryAlphabet>(alphabet);
870 if (modelName ==
"Binary")
871 model = make_unique<BinarySubstitutionModel>(balpha);
872 else if (modelName ==
"TwoParameterBinary")
873 model = make_unique<TwoParameterBinarySubstitutionModel>(balpha);
875 throw Exception(
"Model '" + modelName +
"' unknown, or does not fit binary alphabet.");
879 if (!(alphabetCode_ & INTEGER))
880 throw Exception(
"BppOSubstitutionModelFormat::read. Integer alphabet not supported.");
882 auto balpha = dynamic_pointer_cast<const IntegerAlphabet>(alphabet);
884 if (modelName ==
"D1Walk")
887 throw Exception(
"Model '" + modelName +
"' unknown, or does not fit integer alphabet.");
890 throw Exception(
"Model '" + modelName +
"' unknown, or does not fit " + alphabet->getAlphabetType() +
" alphabet.");
896 updateParameters_(*model, args);
902 initialize_(*model, mData.at(nData));
904 initialize_(*model, 0);
913 map<std::string, std::string>& args)
920 for (
auto pname : pnames)
923 if (args.find(name) != args.end())
924 unparsedArguments_[pref + name] = args[name];
929 string pname, pval, pname2;
930 for (
size_t i = 0; i < pl.
size(); ++i)
934 if (args.find(pname) == args.end())
939 (pval.find(
"(") != string::npos))
943 for (
size_t j = 0; j < pl.
size() && !found; ++j)
965 if (args.find(
"useObservedFreqs") != args.end())
966 throw Exception(
"useObservedFreqs argument is obsolete. Please use 'initFreqs=observed' instead.");
967 if (args.find(
"useObservedFreqs.pseudoCount") != args.end())
968 throw Exception(
"useObservedFreqs.pseudoCount argument is obsolete. Please use 'initFreqs.observedPseudoCount' instead.");
970 if (args.find(
"initFreqs") != args.end())
973 unparsedArguments_[pref +
"initFreqs"] = args[
"initFreqs"];
974 if (args.find(
"initFreqs.observedPseudoCount") != args.end())
975 unparsedArguments_[pref +
"initFreqs.observedPseudoCount"] = args[
"initFreqs.observedPseudoCount"];
977 if (args.find(
"rate") != args.end())
980 unparsedArguments_[pref +
"rate"] = args[
"rate"];
986 std::shared_ptr<const Alphabet> alphabet,
987 const std::string& modelDescription,
988 const std::map<
size_t, std::shared_ptr<const AlignmentDataInterface>>& mData,
991 unique_ptr<SubstitutionModelInterface> model;
992 string modelName =
"";
993 map<string, string> args;
996 vector<string> v_nestedModelDescription;
997 vector< unique_ptr<SubstitutionModelInterface>> v_pSM;
998 shared_ptr<const CoreWordAlphabet> pWA;
1000 string s, nestedModelDescription;
1001 unsigned int nbmodels;
1006 + alphabet->getAlphabetType() +
" for model " + modelName +
".");
1008 pWA = dynamic_pointer_cast<const CoreWordAlphabet>(alphabet);
1014 if (args.find(
"model") != args.end())
1016 v_nestedModelDescription.push_back(args[
"model"]);
1017 nbmodels = (modelName ==
"Word" || modelName ==
"Kron") ? pWA->getLength() : 3;
1021 if (args.find(
"model1") == args.end())
1022 throw Exception(
"Missing argument 'model' or 'model1' for model " + modelName +
".");
1031 throw Exception(
"Missing nested models for model " + modelName +
".");
1033 if (pWA->getLength() != nbmodels)
1035 + alphabet->getAlphabetType() +
" for model " + modelName +
".");
1037 if (v_nestedModelDescription.size() != nbmodels)
1040 model = nestedReader.
readSubstitutionModel(pWA->getNAlphabet(0), v_nestedModelDescription[0], mData, nData,
false);
1043 for (
unsigned int i = 0; i < nbmodels; ++i)
1048 for (
auto& it : unparsedParameterValuesNested)
1050 unparsedArguments_[modelName +
"." + pref +
"_" + it.first] = it.second;
1053 v_pSM.push_back(std::move(model));
1057 for (
unsigned i = 0; i < v_nestedModelDescription.size(); ++i)
1060 model = nestedReader.
readSubstitutionModel(pWA->getNAlphabet(i), v_nestedModelDescription[i], mData, nData,
false);
1062 for (
auto& it : unparsedParameterValuesNested)
1064 unparsedArguments_[modelName +
"." +
TextTools::toString(i + 1) +
"_" + it.first] = it.second;
1067 v_pSM.push_back(std::move(model));
1076 vector<set<size_t>> vposKron;
1077 if (modelName.substr(0, 4) ==
"Kron")
1079 if (args.find(
"positions") != args.end())
1095 vposKron.push_back(ss);
1104 if (modelName ==
"Word")
1106 if (v_nestedModelDescription.size() != nbmodels)
1108 model = make_unique<WordSubstitutionModel>(std::move(v_pSM[0]), nbmodels);
1113 model = make_unique<WordSubstitutionModel>(ml);
1121 else if (modelName ==
"Kron")
1123 if (vposKron.size() == 0)
1125 if (v_nestedModelDescription.size() != nbmodels)
1127 model = make_unique<KroneckerWordSubstitutionModel>(std::move(v_pSM[0]), nbmodels);
1132 model = make_unique<KroneckerWordSubstitutionModel>(ml);
1137 if (v_nestedModelDescription.size() != nbmodels)
1139 model = make_unique<KroneckerWordSubstitutionModel>(std::move(v_pSM[0]), nbmodels, vposKron);
1144 model = make_unique<KroneckerWordSubstitutionModel>(ml, vposKron);
1155 auto pCA = dynamic_pointer_cast<const CodonAlphabet>(pWA);
1157 throw Exception(
"Non codon Alphabet for model" + modelName +
".");
1159 unique_ptr<AlphabetIndex2> pai2;
1160 unique_ptr<CodonFrequencySetInterface> pFS;
1163 ((v_nestedModelDescription.size() == 3) &&
1165 throw Exception(
"Non simple NucleotideSubstitutionModel embedded in " + modelName +
" model.");
1167 if (args.find(
"genetic_code") != args.end())
1169 ApplicationTools::displayWarning(
"'genetic_code' argument is no longer supported inside model description, and has been supersided by a global 'genetic_code' option.");
1170 throw Exception(
"BppOSubstitutionModelFormat::read. Deprecated 'genetic_code' argument.");
1174 throw Exception(
"BppOSubstitutionModelFormat::readWord_(). No genetic code specified! Consider using 'setGeneticCode'.");
1180 if ((modelName.find(
"Dist") != string::npos) || (modelName ==
"SENCA"))
1186 if (modelName.find(
"Freq") != string::npos)
1188 if (args.find(
"frequencies") == args.end())
1189 throw Exception(
"Missing equilibrium frequencies.");
1193 auto tmp = bIOFreq.
readFrequencySet(pCA, args[
"frequencies"], mData, nData);
1196 throw IOException(
"BppOSubstitutionModelFormat::readWord_(). Incorrect codon frequencies.");
1199 for (
auto& it : unparsedParameterValuesNested)
1201 unparsedArguments_[modelName +
"." + it.first] = it.second;
1208 if (modelName ==
"Triplet")
1209 model = (v_nestedModelDescription.size() != 3)
1210 ? make_unique<TripletSubstitutionModel>(
1212 unique_ptr<NucleotideSubstitutionModelInterface>(
1216 : make_unique<TripletSubstitutionModel>(
1218 unique_ptr<NucleotideSubstitutionModelInterface>(
1221 unique_ptr<NucleotideSubstitutionModelInterface>(
1224 unique_ptr<NucleotideSubstitutionModelInterface>(
1229 else if (modelName.find(
"Codon") != string::npos)
1231 vector< unique_ptr<CoreCodonSubstitutionModelInterface>> vCSM;
1232 string name =
"Codon";
1233 map<string, string> unparsedParameterValuesNested;
1235 if (modelName.find(
"Dist") != string::npos)
1239 vCSM.push_back(make_unique<AbstractCodonDistanceSubstitutionModel>(std::move(pai2), geneticCode_,
""));
1241 else if (modelName.find(
"BGC") != string::npos)
1245 vCSM.push_back(make_unique<AbstractCodonBGCSubstitutionModel>(geneticCode_,
""));
1247 else if (modelName.find(
"Prot") != string::npos)
1251 if (args.find(
"protmodel") == args.end())
1252 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'protmodel' for codon model argument 'Prot'.");
1254 nestedModelDescription = args[
"protmodel"];
1257 shared_ptr<SubstitutionModelInterface> tmpModel = nestedReader.
readSubstitutionModel(geneticCode_->getTargetAlphabet(), nestedModelDescription, mData, nData,
false);
1258 auto nestedModel = dynamic_pointer_cast<ProteinSubstitutionModelInterface>(tmpModel);
1262 vCSM.push_back(make_unique<AbstractCodonAARateSubstitutionModel>(nestedModel, geneticCode_,
""));
1264 if (modelName.find(
"AAClust") != string::npos)
1269 vector<uint> partition;
1270 if (args.find(
"partition") != args.end())
1272 string rf = args[
"partition"];
1276 partition.push_back(TextTools::to<uint>(strtok.
nextToken()));
1279 unique_ptr<AbstractCodonClusterAASubstitutionModel> aca = partition.size() != 0 ?
1280 make_unique<AbstractCodonClusterAASubstitutionModel>(geneticCode_,
"", partition) :
1281 make_unique<AbstractCodonClusterAASubstitutionModel>(geneticCode_,
"");
1283 vCSM.push_back(std::move(aca));
1287 if (vCSM.size() == 0)
1290 if (modelName.find(
"CpG") != string::npos)
1293 vCSM.push_back(make_unique<AbstractCodonCpGSubstitutionModel>(pCA,
""));
1296 if (modelName.find(
"AAFit") != string::npos)
1300 if (args.find(
"fitness") == args.end())
1301 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'fitness' for codon model argument 'AAFit'.");
1303 string nestedFreqDescription = args[
"fitness"];
1306 auto nestedFreq = nestedReader.
readFrequencySet(geneticCode_->getTargetAlphabet(), nestedFreqDescription, mData, nData,
false);
1310 unparsedParameterValuesNested[
"fit_" + it.first] = it.second;
1313 auto aca = make_unique<AbstractCodonAAFitnessSubstitutionModel>(std::move(nestedFreq), geneticCode_,
"");
1315 if (args.find(
"Ns") != args.end())
1316 aca->addNsParameter();
1318 vCSM.push_back(std::move(aca));
1320 else if (modelName.find(
"Fit") != string::npos)
1322 if (args.find(
"fitness") == args.end())
1323 throw Exception(
"BppOSubstitutionModelFormat::read. Missing argument 'fitness' for codon model argument 'Fit'.");
1324 string nestedFreqDescription = args[
"fitness"];
1329 auto nestedFreq = nestedReader.
readFrequencySet(alphabet, nestedFreqDescription, mData, nData,
false);
1333 unparsedParameterValuesNested[
"fit_" + it.first] = it.second;
1336 vCSM.push_back(make_unique<AbstractCodonFitnessSubstitutionModel>(std::move(nestedFreq), geneticCode_,
""));
1339 if (modelName.find(
"PhasFreq") != string::npos)
1342 vCSM.push_back(make_unique<AbstractCodonPhaseFrequenciesSubstitutionModel>(std::move(pFS),
""));
1344 else if (modelName.find(
"Freq") != string::npos)
1347 vCSM.push_back(make_unique<AbstractCodonFrequenciesSubstitutionModel>(std::move(pFS),
""));
1351 for (
auto it : unparsedParameterValuesNested)
1353 unparsedArguments_[name +
"." + it.first] = it.second;
1356 model = (v_nestedModelDescription.size() != 3)
1357 ? make_unique<CodonAdHocSubstitutionModel>(
1359 unique_ptr<NucleotideSubstitutionModelInterface>(
1364 : make_unique<CodonAdHocSubstitutionModel>(
1366 unique_ptr<NucleotideSubstitutionModelInterface>(
1369 unique_ptr<NucleotideSubstitutionModelInterface>(
1372 unique_ptr<NucleotideSubstitutionModelInterface>(
1378 else if (modelName ==
"KronDistFreq")
1380 if (v_nestedModelDescription.size() != 3)
1382 if (vposKron.size() == 0)
1383 model = make_unique<KroneckerCodonDistanceFrequenciesSubstitutionModel>(geneticCode_,
1384 unique_ptr<NucleotideSubstitutionModelInterface>(
1386 std::move(pFS), std::move(pai2));
1388 model = make_unique<KroneckerCodonDistanceFrequenciesSubstitutionModel>(geneticCode_,
1389 unique_ptr<NucleotideSubstitutionModelInterface>(
1391 vposKron, std::move(pFS), std::move(pai2));
1395 if (vposKron.size() != 0)
1396 model = make_unique<KroneckerCodonDistanceFrequenciesSubstitutionModel>(
1398 unique_ptr<NucleotideSubstitutionModelInterface>(
1401 unique_ptr<NucleotideSubstitutionModelInterface>(
1404 unique_ptr<NucleotideSubstitutionModelInterface>(
1410 model = make_unique<KroneckerCodonDistanceFrequenciesSubstitutionModel>(
1412 unique_ptr<NucleotideSubstitutionModelInterface>(
1415 unique_ptr<NucleotideSubstitutionModelInterface>(
1418 unique_ptr<NucleotideSubstitutionModelInterface>(
1426 else if (modelName ==
"KronDist")
1428 if (v_nestedModelDescription.size() != 3)
1430 if (vposKron.size() == 0)
1431 model = make_unique<KroneckerCodonDistanceSubstitutionModel>(geneticCode_,
1435 model = make_unique<KroneckerCodonDistanceSubstitutionModel>(geneticCode_,
1437 vposKron, std::move(pai2));
1441 if (vposKron.size() != 0)
1442 model = make_unique<KroneckerCodonDistanceSubstitutionModel>(
1444 unique_ptr<NucleotideSubstitutionModelInterface>(
1447 unique_ptr<NucleotideSubstitutionModelInterface>(
1450 unique_ptr<NucleotideSubstitutionModelInterface>(
1455 model = make_unique<KroneckerCodonDistanceSubstitutionModel>(
1457 unique_ptr<NucleotideSubstitutionModelInterface>(
1460 unique_ptr<NucleotideSubstitutionModelInterface>(
1463 unique_ptr<NucleotideSubstitutionModelInterface>(
1471 else if (modelName ==
"SENCA")
1473 if (args.find(
"fitness") == args.end())
1474 throw Exception(
"Missing fitness in model " + modelName +
".");
1479 auto pFit(bIOFreq.
readFrequencySet(pCA, args[
"fitness"], mData, nData,
false));
1482 for (
auto& it : unparsedParameterValuesNested)
1484 unparsedArguments_[modelName +
".fit_" + it.first] = it.second;
1487 if (v_nestedModelDescription.size() != 3)
1489 model = make_unique<SENCA>(geneticCode_,
1490 unique_ptr<NucleotideSubstitutionModelInterface>(
1493 std::move(pFit), std::move(pai2));
1496 model = make_unique<SENCA>(
1498 unique_ptr<NucleotideSubstitutionModelInterface>(
1501 unique_ptr<NucleotideSubstitutionModelInterface>(
1504 unique_ptr<NucleotideSubstitutionModelInterface>(
1517 std::map<std::string, std::string>& globalAliases,
1518 std::vector<std::string>& writtenNames)
const
1531 auto parend = (name.rfind(
")") == name.size() - 1);
1533 out << (parend ? name.substr(0, name.size() - 1) : name +
"(");
1539 out <<
"file=" << userModel.
getPath();
1543 ns = ns.substr(0, ns.size() - 3);
1545 ns = ns.substr(0, ns.size() - 1);
1547 out <<
", name=" << ns;
1558 write(mmModel.
nestedModel(), out, globalAliases, writtenNames);
1562 const G2001& gModel =
dynamic_cast<const G2001&
>(model);
1579 const RE08& reModel =
dynamic_cast<const RE08&
>(model);
1581 write(reModel.
nestedModel(), out, globalAliases, writtenNames);
1590 const YpR& yprModel =
dynamic_cast<const YpR&
>(model);
1592 write(yprModel.
nestedModel(), out, globalAliases, writtenNames);
1603 write(oneChangeTransitionModel.
model(), out, globalAliases, writtenNames);
1613 write(oneChangeRegisterTransitionModel.
model(), out, globalAliases, writtenNames);
1615 out <<
", register=";
1626 write(registerRatesSubstitutionModel.
model(), out, globalAliases, writtenNames);
1628 out <<
", register=";
1638 const gBGC& gbgcModel =
dynamic_cast<const gBGC&
>(model);
1640 write(gbgcModel.
nestedModel(), sout, globalAliases, writtenNames);
1642 string ss = sout.
str();
1643 auto begin = ss.find_first_of(
"(");
1644 auto end = ss.find_last_of(
")");
1646 out << ss.substr(begin + 1, end - begin - 1);
1662 write(mod0, out, globalAliases, writtenNames);
1670 write(mod0, out, globalAliases, writtenNames);
1675 write(mod0, out, globalAliases, writtenNames);
1676 for (
unsigned int i = 1; i < nmod; ++i)
1679 write(wM.
nModel(i), out, globalAliases, writtenNames);
1691 const Coala& coalaModel =
dynamic_cast<const Coala&
>(model);
1703 write(inModel.
mixedModel(), out, globalAliases, writtenNames);
1711 const POMO* pomo =
dynamic_cast<const POMO*
>(&model);
1715 write(pomo->
mutationModel(), out, globalAliases, writtenNames);
1719 out <<
", fitness=";
1736 string fd = freqdesc.
str();
1741 out <<
"frequencies=" + fd;
1752 for (
size_t i = 0; i < casm.getNumberOfModels(); ++i)
1759 out <<
"protmodel=";
1761 write(acr.aaModel(), out, globalAliases, writtenNames);
1786 out <<
"partition=(";
1787 const vector<uint>& vass = acc.getAssign();
1789 for (
size_t j = 0; j < vass.size(); ++j)
1809 auto& pCF =
dynamic_cast<const SENCA&
>(model);
1825 auto& pM7 =
dynamic_cast<const YNGP_M7&
>(model);
1828 out <<
"n=" << pM7.getNumberOfModels();
1836 auto& pM8 =
dynamic_cast<const YNGP_M8&
>(model);
1839 out <<
"n=" << pM8.getNumberOfModels() - 1;
1847 auto& pM9 =
dynamic_cast<const YNGP_M9&
>(model);
1850 out <<
"nbeta=" << pM9.getNBeta() <<
", ngamma=" << pM9.getNGamma();
1859 auto& pM10 =
dynamic_cast<const YNGP_M10&
>(model);
1862 out <<
"nbeta=" << pM10.getNBeta() <<
", ngamma=" << pM10.getNGamma();
1871 auto& pLGL =
dynamic_cast<const LGL08_CAT&
>(model);
1874 out <<
"nbCat=" << pLGL.getNumberOfCategories();
1883 auto& pDFP =
dynamic_cast<const DFP07&
>(model);
1887 out <<
"protmodel=";
1888 write(pDFP.proteinModel(), out, globalAliases, writtenNames);
1901 out <<
"codonmodel=";
1902 write(pSameAA.codonModel(), out, globalAliases, writtenNames);
1904 out <<
", protmodel=";
1905 write(pSameAA.proteinModel(), out, globalAliases, writtenNames);
1918 size_t wNs = writtenNames.size();
1920 for (
size_t i = 0; i < wNs; ++i)
1924 writtenNames.push_back(absm.getNamespace() + absm.getParNameFromPmodel(writtenNames[i]));
1941 std::map<std::string, std::string>& globalAliases,
1942 std::vector<std::string>& writtenNames)
const
1949 for (
unsigned int i = 0; i < pMS.getNumberOfModels(); ++i)
1954 write(pMS.nModel(i), out, globalAliases, writtenNames);
1962 out <<
"MixedModel(model=";
1963 auto& eM = pMS.model(0);
1968 for (
auto& pn : vpl)
1970 if (find(writtenNames.begin(), writtenNames.end(), pn) == writtenNames.end())
1972 if (pMS.hasDistribution(pn))
1974 auto& pDD = pMS.distribution(pn);
1980 globalAliases[pn] = sout.
str();
1986 write(eM, out, globalAliases, writtenNames);
1988 if (pMS.from() != -1)
1989 out <<
", from=" << model.
getAlphabet()->intToChar(pMS.from()) <<
", to=" << model.
getAlphabet()->intToChar(pMS.to());
2002 std::shared_ptr<const AlignmentDataInterface> data)
2008 if (initFreqs !=
"")
2013 if (initFreqs ==
"observed")
2016 throw Exception(
"BppOSubstitutionModelFormat::initialize_(). Missing data for observed frequencies");
2017 unsigned int psi = ApplicationTools::getParameter<unsigned int>(model.
getNamespace() +
"initFreqs.observedPseudoCount", unparsedArguments_, 0,
"",
true, warningLevel_);
2018 tmodel.setFreqFromData(*data, psi);
2020 else if (initFreqs.substr(0, 6) ==
"values")
2023 map<int, double> frequencies;
2025 string rf = initFreqs.substr(6);
2030 tmodel.setFreq(frequencies);
2033 throw Exception(
"Unknown initFreqs argument");
2039 unparsedArguments_.erase(unparsedArguments_.find(model.
getNamespace() +
"initFreqs"));
2040 if (unparsedArguments_.find(model.
getNamespace() +
"initFreqs.observedPseudoCount") != unparsedArguments_.end())
2041 unparsedArguments_.erase(unparsedArguments_.find(model.
getNamespace() +
"initFreqs.observedPseudoCount"));
2045 for (
size_t i = 0; i < pl.
size(); ++i)
2053 for (
size_t i = 0; i < pl.
size(); i++)
2055 const string pName = pl[i].getName();
2057 posp = pName.rfind(
".");
2058 bool test1 = (initFreqs ==
"");
2059 bool test2 = (pName.size() < posp + 6) || (pName.substr(posp + 1, 5) !=
"theta");
2060 bool test3 = (unparsedArguments_.find(pName) != unparsedArguments_.end());
2063 if (test1 || test2 || test3)
2065 if (!test1 && !test2 && test3)
2069 pl[i].setValue(value);
2071 if (unparsedArguments_.find(pName) != unparsedArguments_.end())
2072 unparsedArguments_.erase(unparsedArguments_.find(pName));
Abstract class for mixture models based on the bibliography.
Partial implementation of the SubstitutionModel interface for models that are set for matching the bi...
Abstract class for modelling of ratios of substitution rates between codons, whatever they are synony...
Abstract class for modelling of non-synonymous and synonymous substitution rates in codon models,...
Abstract class for modelling of non-synonymous and synonymous substitution rates in codon models,...
const BranchModelInterface & model() const override
std::string getNamespace() const override
Abstract Basal class for words of substitution models.
size_t getNumberOfModels() const
const SubstitutionModelInterface & nModel(size_t i) const
returns the ith model, or throw an exception if i is not a valid number.
const BranchModelInterface & model() const override
virtual void setMessageHandler(std::shared_ptr< OutputStream > mh)
Interface for all Branch models.
virtual const FrequencySetInterface & frequencySet() const =0
virtual std::string getName() const =0
Get the name of the model.
virtual std::shared_ptr< const Alphabet > getAlphabet() const =0
virtual void addRateParameter()=0
size_t getNbrOfAxes() const
The Coala branch-heterogeneous amino-acid substitution model.
std::string getExch() const
Class for substitution models of codons with several layers of codon models.
Parametrize a set of state frequencies for codons.
Interface for reversible codon models.
Class for modelling of non-synonymous rates in codon models, such that the substitution rates between...
The D1Walk substitution model for Integer alphabet [0;N-1]. In this model, substitutions are possible...
Class for non-synonymous substitution models on codons with parameterized equilibrium frequencies and...
The EquiprobableSubstitutionModel substitution model for any kind of alphabet. Jukes-Cantor models ar...
Galtier's 2001 covarion model.
const DiscreteDistributionInterface & rateDistribution() const
SubModel taken from a MixedTransitionModel, kept in the context of the MixedTransitionModel (see From...
const MixedTransitionModelInterface & mixedModel() const
size_t getSubModelNumber() const
The Le et al (2008) CAT substitution model for proteins.
Partial implementation of the Markov-modulated class of substitution models.
const ReversibleSubstitutionModelInterface & nestedModel() const
Interface for Transition models, defined as a mixture of "simple" transition models.
Transition models defined as a mixture of nested substitution models.
Transition models defined as a mixture of several substitution models.
A list of models, for building a WordSubstitutionModel.
Specialisation interface for rversible nucleotide substitution model.
Specialisation interface for nucleotide substitution model.
From a model, compute transition probabilities given there is at least a change of a category (ie a n...
const std::string & getRegisterName() const
const std::vector< size_t > & getRegisterNumbers() const
From a model, compute transition probabilities given there is at least a change in the branch.
const FrequencySetInterface & fitness() const
const SubstitutionModelInterface & mutationModel() const
virtual const ParameterList & getIndependentParameters() const=0
virtual void aliasParameters(const std::string &p1, const std::string &p2)=0
virtual std::vector< std::string > getParameterNames() const
virtual void setParameter(size_t index, const Parameter ¶m)
virtual std::string getParameterNameWithoutNamespace(const std::string &name) const=0
virtual bool matchParametersValues(const ParameterList ¶meters)=0
virtual std::string getNamespace() const=0
virtual const ParameterList & getParameters() const=0
Parametrize a set of state frequencies for proteins.
Specialized interface for protein reversible substitution model.
Specialized interface for protein substitution model.
The Rivas-Eddy substitution model with gap characters.
const ReversibleSubstitutionModelInterface & nestedModel() const
From a model, substitution rates are set into categories following a given register....
const std::string & getRegisterName() const
Interface for reversible substitution models.
Class for non-synonymous and synonymous substitution models on codons with parameterized equilibrium ...
const std::string & nextToken()
bool hasMoreToken() const
Interface for all transition models.
Build an empirical protein substitution model from a file.
const std::string & getPath() const
The Yang et al (2000) M10 substitution model for codons.
The Yang et al (2000) M7 substitution model for codons.
The Yang et al (2000) M8 substitution model for codons.
The Yang et al (2000) M9 substitution model for codons.
const NucleotideSubstitutionModelInterface & nestedModel() const
const SubstitutionModelInterface & nestedModel() const
int toInt(const std::string &s, char scientificNotation='e')
double toDouble(const std::string &s, char dec='.', char scientificNotation='e')
bool hasSubstring(const std::string &s, const std::string &pattern)
bool isEmpty(const std::string &s)
bool isDecimalInteger(const std::string &s, char scientificNotation='e')
std::string toString(T t)
Defines the basic types of data flow nodes.