Changeset 275


Ignore:
Timestamp:
12/22/14 00:17:01 (10 years ago)
Author:
Maciej Komosinski
Message:

Inheritance information during crossing over properly stored as a single genetic operation with a single child (affects phylogenetic analysis window)

Location:
cpp/frams/genetics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/genman.cpp

    r257 r275  
    288288        }
    289289        mutchg += chg;
    290         if (history) saveLink((const char*)g.getGene(), (const char*)gv.getGene(), chg);
     290        if (history) saveLink((const char*)g.getGene(), "", (const char*)gv.getGene(), chg);
    291291        SString mutinfo;
    292292        if (extmutinfo == 0) mutinfo = SString::sprintf("%.2f%% mutation of '%s'", 100 * chg, (const char*)g.getName()); else
     
    356356        // result in g1v
    357357        xochg += chg;
    358         if (history) saveLink((const char*)g1.getGene(), (const char*)g1v.getGene(), chg);
     358        if (history) saveLink((const char*)g1.getGene(), (const char*)g2.getGene(), (const char*)g1v.getGene(), chg);
    359359        SString xoinfo = SString::sprintf("Crossing over of '%s' (%.2f%%) and '%s' (%.2f%%)",
    360360                (const char*)g1.getName(), 100 * chg, (const char*)g2.getName(), 100 * (1 - chg));
     
    490490}
    491491
    492 void GenMan::saveLink(string prz, string pot, float& chg)
     492void GenMan::saveLink(const string parent1, const string parent2, const string child, const float chg)
    493493{
    494494        GenoLink l;
    495495        l.count = count;
    496         l.g1 = prz;
    497         l.g2 = pot;
     496        l.parent1 = parent1;
     497        l.parent2 = parent2;
     498        l.child = child;
    498499        l.chg = chg;
    499500        l.fit = 0; //temporarily. Will be set when the genotype dies
     501        //FMprintf("GenMan","saveLink",0,"#%d: [%d] '%s' + '%s' -> '%s'",GenoLinkList.size(),count,parent1.c_str(),parent2.c_str(),child.c_str());
    500502        GenoLinkList.push_back(l);
    501503}
  • cpp/frams/genetics/genman.h

    r247 r275  
    1919{
    2020        int count;
    21         string g1, g2;
     21        string parent1, parent2, child;
    2222        float chg;
    2323        float fit;
     
    5555private:
    5656        vector<GenoOperators*> oper_fx_list;
    57         void saveLink(string prz, string pot, float& chg);
     57        void saveLink(const string parent1, const string parent2, const string child, const float chg);
    5858        GenoOperators* getOper_f(char format);
    5959        SString HTMLize(const char *g, bool shorten);
Note: See TracChangeset for help on using the changeset viewer.