@@ -6207,18 +6207,6 @@ void addModel(string model_str, string& new_model_str, string new_subst) {
62076207 }
62086208}
62096209
6210- void addModelBack (string model_str, string& new_model_str, string new_subst) {
6211- size_t pos;
6212- int n;
6213- n = getClassNum (model_str);
6214- if (n == 1 ) {
6215- new_model_str = " MIX{" + new_subst + " ," + new_subst + " }" ;
6216- } else {
6217- pos = model_str.find_last_of (' ,' );
6218- new_model_str = model_str.substr (0 , pos) + " ," + new_subst + " ," + new_subst + " }" ;
6219- }
6220- }
6221-
62226210// initialise model frequency set in MixtureFinder for different sequence types
62236211char * initFreqSet (SeqType seq_type) {
62246212 switch (seq_type) {
@@ -6361,7 +6349,7 @@ CandidateModel findMixtureComponent(Params ¶ms, IQTree &iqtree, ModelCheckpo
63616349 skip_all_when_drop = false ;
63626350 } else if (mixture_action == MA_NUMBER_CLASS) {
63636351 // 2025/05/14 @HS6986
6364- // I don't know when MA_NUMBER_CLASS is used and what should be expected in MA_NUMBER_CLASS for morphology!
6352+ // I don't know when MA_NUMBER_CLASS is used and what should be expected in it for morphology!
63656353 params.ratehet_set = iqtree.getModelFactory ()->site_rate ->name ;
63666354 // generate candidate models for the possible mixture models
63676355 multi_class_str = " " ;
@@ -6381,7 +6369,7 @@ CandidateModel findMixtureComponent(Params ¶ms, IQTree &iqtree, ModelCheckpo
63816369 skip_all_when_drop = true ;
63826370 } else if (mixture_action == MA_FIND_CLASS) {
63836371 // 2025/05/14 @HS6986
6384- // I don't know when MA_FIND_CLASS is used and what should be expected in MA_FIND_CLASS for morphology!
6372+ // I don't know when MA_FIND_CLASS is used and what should be expected in it for morphology!
63856373 char * init_state_freq_set = initFreqSet (iqtree.aln ->seq_type );
63866374 if (!params.state_freq_set ) {
63876375 params.state_freq_set = init_state_freq_set;
@@ -6459,46 +6447,35 @@ CandidateModel findMixtureComponent(Params ¶ms, IQTree &iqtree, ModelCheckpo
64596447 }
64606448 }
64616449
6462- for (i=0 ; i<model_names.size (); i++) {
6463- string new_model_str;
6464- if (params.morph_mix_finder ) {
6465- int countGTRX = 0 ;
6466- size_t posGTRX = 0 ;
6467- while (((posGTRX = model_str.find (" GTR" , posGTRX)) != string::npos)) {
6468- ++countGTRX;
6469- posGTRX += 3 ;
6470- }
6471- int countFO = 0 ;
6472- size_t posFO = 0 ;
6473- while (((posFO = model_str.find (" +FO" , posFO)) != string::npos)) {
6474- ++countFO;
6475- posFO += 3 ;
6476- }
6477- if (((model_names[i].length () >= 3 && model_names[i].substr (0 , 3 ) == " GTR" ) && countGTRX == 0 ) ||
6478- ((model_names[i].length () >= 3 && model_names[i].substr (model_names[i].length () - 3 ) == " +FO" ) && countFO == 0 )) {
6479- addModelBack (model_str, new_model_str, model_names[i]);
6480- } else {
6481- addModel (model_str, new_model_str, model_names[i]);
6482- }
6483- int newModelCountGTRX = 0 ;
6484- size_t newModelPosGTRX = 0 ;
6485- while (((newModelCountGTRX = new_model_str.find (" GTR" , newModelPosGTRX)) != string::npos)) {
6486- ++newModelCountGTRX;
6487- newModelPosGTRX += 3 ;
6488- }
6489- int newModelCountFO = 0 ;
6490- size_t newModelPosFO = 0 ;
6491- while (((newModelPosFO = new_model_str.find (" +FO" , newModelPosFO)) != string::npos)) {
6492- ++newModelCountFO;
6493- newModelPosFO += 3 ;
6494- }
6495- if (newModelCountGTRX == 1 || newModelCountFO == 1 ) {
6496- continue ;
6497- }
6498- } else {
6450+ if (getClassNum (model_str) == 1 && params.morph_mix_finder ) {
6451+ const char *new_model_strs_two_classes[] = {" MIX{MK+FQ,MK+FQ}" , " MIX{MK+FO,MK+FO}" , " MIX{GTRX+FQ,GTRX+FQ}" , " MIX{GTRX+FO,GTRX+FO}" };
6452+ for (i=0 ; i<4 ; i++) {
6453+ string new_model_str = new_model_strs_two_classes[i];
6454+ candidate_models.push_back (CandidateModel (new_model_str, best_rate_name, iqtree.aln , 0 ));
6455+ }
6456+ } else {
6457+ for (i=0 ; i<model_names.size (); i++) {
6458+ string new_model_str;
64996459 addModel (model_str, new_model_str, model_names[i]);
6460+ if (params.morph_mix_finder ) {
6461+ int newModelCountGTRX = 0 ;
6462+ size_t newModelPosGTRX = 0 ;
6463+ while (((newModelCountGTRX = new_model_str.find (" GTR" , newModelPosGTRX)) != string::npos)) {
6464+ ++newModelCountGTRX;
6465+ newModelPosGTRX += 3 ;
6466+ }
6467+ int newModelCountFO = 0 ;
6468+ size_t newModelPosFO = 0 ;
6469+ while (((newModelPosFO = new_model_str.find (" +FO" , newModelPosFO)) != string::npos)) {
6470+ ++newModelCountFO;
6471+ newModelPosFO += 3 ;
6472+ }
6473+ if (newModelCountGTRX == 1 || newModelCountFO == 1 ) {
6474+ continue ;
6475+ }
6476+ }
6477+ candidate_models.push_back (CandidateModel (new_model_str, best_rate_name, iqtree.aln , 0 ));
65006478 }
6501- candidate_models.push_back (CandidateModel (new_model_str, best_rate_name, iqtree.aln , 0 ));
65026479 }
65036480
65046481 skip_all_when_drop = false ;
0 commit comments