#include "AbstractGenome.h" #include #include #include //Genotype::Genotype(const Genotype& _fDiplGenome, const Genotype& _mDiplGenome){ //} HaploidGenotype Genotype::recombinantHaploidGenotype(ChromosomeRearrangementStrategy* strategy) const { return strategy->buildRecombinantGenotype(this); } std::ostream& operator<< (std::ostream& os, const Genotype& g){ os<<"F"; for(unsigned int i = 0; i < g.fatherGenome.chromosomes.size(); i++){ os<<"ch"<<(i+1)<<":"; const std::vector genesF = g.fatherGenome.chromosomes.at(i).getGenesAsVector(); const std::vector genesM = g.motherGenome.chromosomes.at(i).getGenesAsVector(); for(unsigned int j = 0; j < genesF.size(); j++){ os<<"\t"; os<fatherGenome.chromosomes.size(); i++){ const std::vector genesF = this->fatherGenome.chromosomes.at(i).getGenesAsVector(); const std::vector genesM = this->motherGenome.chromosomes.at(i).getGenesAsVector(); for(unsigned int j = 0; j < genesF.size(); j++){ if(genesF.at(j).getGeneType() == Gene::Continious){ os<fatherGenome.chromosomes.size(); i++){ const std::vector genesF = this->fatherGenome.chromosomes.at(i).getGenesAsVector(); const std::vector genesM = this->motherGenome.chromosomes.at(i).getGenesAsVector(); for(unsigned int j = 0; j < genesF.size(); j++){ if(genesF.at(j).getGeneType() == Gene::Continious){ if(fabs(genesF.at(j).getGeneValueCont()) > fabs(genesM.at(j).getGeneValueCont())){ os<fatherGenome) : &(this->motherGenome); return genome->getChromosome(chromoNum).getGenesAsVector().at(geneNum).getSequence(); } void Genotype::doRawMutationSequence(unsigned int fatherMother, unsigned int chromoNum, unsigned int geneNum, std::string newSeq){ if(fatherMother==2){ this->fatherGenome.chromosomes.at(chromoNum).genes.at(geneNum).setGeneValue(newSeq); this->motherGenome.chromosomes.at(chromoNum).genes.at(geneNum).setGeneValue(newSeq); } } std::string Genotype::toSimpleFasta(bool onlyMother) const { std::stringstream os; for(unsigned int i = 0; i < this->motherGenome.chromosomes.size(); i++){ const std::vector genesF = this->fatherGenome.chromosomes.at(i).getGenesAsVector(); const std::vector genesM = this->motherGenome.chromosomes.at(i).getGenesAsVector(); os<<"> "<motherGenome.chromosomes.at(i).getName()<<"\n"; for(unsigned int j = 0; j < genesM.size(); j++){ if(genesM.at(i).getGeneType() == Gene::Sequence){ os<