Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 317c8f0e authored by FOLEY Marco's avatar FOLEY Marco
Browse files

Mutation length in aevol_post_neutral_mut_acc are now correctly computed

parent 0323ed13
No related branches found
No related tags found
No related merge requests found
......@@ -113,7 +113,9 @@ int main(int argc, char ** argv) {
std::cout << " - output file = " << outputFile << std::endl;
IOJson inputJson(inputFile);
out::init("result.txt", "mutation.txt");
std::string result = "result_seed_" + std::to_string(seed_prng) + ".txt";
std::string mutation = "mutation_seed_" + std::to_string(seed_prng) + ".csv";
out::init(result.c_str(), mutation.c_str());
auto mut_prng = std::make_shared<JumpingMT>(seed_prng);
auto stoch_prng = std::make_shared<JumpingMT>(seed_prng);
......
......@@ -135,7 +135,7 @@ Individual *neutral_mutation_closer_to(Individual *individual, int32_t size_want
child->clear_everything_except_dna_and_promoters();
child->compute_phenotype();
if (individual->phenotype()->is_identical_to(*child->phenotype(), 0) &&
std::abs(size_wanted - individual->amount_of_dna()) >
std::abs(size_wanted - individual->amount_of_dna()) >=
std::abs(size_wanted - child->amount_of_dna())) {
break;
} else {
......
......@@ -105,12 +105,12 @@ int32_t mutation_event_invert(MutationEvent &mutationEvent) {
int32_t mutation_event_length_mutation(MutationEvent &mutationEvent,
unsigned int size) {
if (mutationEvent.type() == MutationEventType::DELETION
|| mutationEvent.type() == MutationEventType::DUPLICATION) {
if (mutationEvent.pos_2() > mutationEvent.pos_1()) {
return mutationEvent.pos_2() - mutationEvent.pos_1();
} else {
return mutationEvent.pos_1() + size - mutationEvent.pos_2();
}
|| mutationEvent.type() == MutationEventType::DUPLICATION
|| mutationEvent.type() == MutationEventType::INVERSION
|| mutationEvent.type() == MutationEventType::TRANSLOCATION){
int intern_mut_size = std::max(mutationEvent.pos_1()-mutationEvent.pos_2() , mutationEvent.pos_2()-mutationEvent.pos_1()); //length of the segment that do not cover the origin
int extern_mut_size = size - std::max(mutationEvent.pos_1(),mutationEvent.pos_2()) + std::min(mutationEvent.pos_1(),mutationEvent.pos_2()); //length of the segment covering the origin
return std::min(intern_mut_size, extern_mut_size);
} else {
if (mutationEvent.type() == MutationEventType::SMALL_INSERTION
|| mutationEvent.type() == MutationEventType::SMALL_DELETION) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment