Mentions légales du service

Skip to content
Snippets Groups Projects
Commit ae7bbcd0 authored by ROUZAUD-CORNABAS Jonathan's avatar ROUZAUD-CORNABAS Jonathan
Browse files

Fix issue 22: IndividualTest seg fault

parent a6c5bd31
No related branches found
No related tags found
No related merge requests found
......@@ -75,94 +75,115 @@ class IndividualTest : public testing::Test {
// ===========================================================================
void IndividualTest::SetUp(void)
{
// Build ad-hoc genomes
// (and reverse to test the same things on the lagging strand.):
//
// indiv1: (AS + prom + AS + AG + AS + term + AS + prom + AS)
// indiv2: reverse
// indiv3: (AS + AG + AS + term + AS + prom + AS)
// indiv4: reverse
//
// AS = Arbitrary Sequence
// AG = Arbitrary Gene
// Do not modify the sequences !
ExpSetup* exp_s = new ExpSetup(nullptr);
for (int i = 0; i <= 1; i++) {
exp_s->set_fuzzy_flavor(i);
// Define a few arbitrary sequences
char as[5][10] = {
"0011",
"11101",
"110011",
"11000",
"000101"
};
if (FuzzyFactory::fuzzyFactory == NULL)
FuzzyFactory::fuzzyFactory = new FuzzyFactory(exp_s);
else {
delete FuzzyFactory::fuzzyFactory;
FuzzyFactory::fuzzyFactory = new FuzzyFactory(exp_s);
}
printf("F %d\n", i);
// Build ad-hoc genomes
// (and reverse to test the same things on the lagging strand.):
//
// indiv1: (AS + prom + AS + AG + AS + term + AS + prom + AS)
// indiv2: reverse
// indiv3: (AS + AG + AS + term + AS + prom + AS)
// indiv4: reverse
//
// AS = Arbitrary Sequence
// AG = Arbitrary Gene
// Do not modify the sequences !
// Define an arbitrary gene
char gene[255];
sprintf(gene, "%s0011000100110110010001", SHINE_DAL_SEQ);
// Define a few arbitrary sequences
char as[5][10] = {
"0011",
"11101",
"110011",
"11000",
"000101"
};
// Define an arbitrary terminator
char term[TERM_SIZE+1] = "01000001101";
// Define an arbitrary gene
char gene[255];
sprintf(gene, "%s0011000100110110010001", SHINE_DAL_SEQ);
// Define a few arbitrary promoters
char prom[2][23] = {
"0101010001110110010110", // dist from consensus: 2 => basal level: 0.6
"0101011001110010010010" // dist from consensus: 1 => basal level: 0.8
};
// Define an arbitrary terminator
char term[TERM_SIZE + 1] = "01000001101";
// Construct a gene with these arbitrary sequences
char* genome = new char[1024];
sprintf(genome, "%s%s%s%s%s%s%s%s%s", as[0], prom[0], as[1], gene, as[2],
term, as[3], prom[1], as[4]);
// Define a few arbitrary promoters
char prom[2][23] = {
"0101010001110110010110", // dist from consensus: 2 => basal level: 0.6
"0101011001110010010010" // dist from consensus: 1 => basal level: 0.8
};
// Construct a gene with these arbitrary sequences
char* genome = new char[1024];
sprintf(genome, "%s%s%s%s%s%s%s%s%s", as[0], prom[0], as[1], gene, as[2],
term, as[3], prom[1], as[4]);
// Build indiv1
MutationParams params_mut;
indiv1 = new Individual(nullptr, nullptr, nullptr, std::make_shared<MutationParams>(params_mut), 1.0, 10, 1000, false, 1, "anon-strain-1", 0);
indiv1->add_GU(genome, strlen(genome));
genome = NULL;
// Build indiv1
MutationParams params_mut;
indiv1 = new Individual(nullptr, nullptr, nullptr,
std::make_shared<MutationParams>(params_mut), 1.0,
10, 1000, false, 1, "anon-strain-1", 0);
indiv1->add_GU(genome, strlen(genome));
genome = NULL;
// Do transcription and translation
indiv1->do_transcription();
indiv1->do_translation();
// Do transcription and translation
indiv1->do_transcription();
indiv1->do_translation();
// Build indiv2
// Reverse the whole genome
genome = indiv1->genetic_unit(0).dna()->subsequence(0,0,LAGGING);
indiv2 = new Individual(nullptr, nullptr, nullptr, std::make_shared<MutationParams>(params_mut), 1.0, 10, 1000, false, 1, "anon-strain-2", 0);
indiv2->add_GU(genome, strlen(genome));
genome = NULL;
// Build indiv2
// Reverse the whole genome
genome = indiv1->genetic_unit(0).dna()->subsequence(0, 0, LAGGING);
indiv2 = new Individual(nullptr, nullptr, nullptr,
std::make_shared<MutationParams>(params_mut), 1.0,
10, 1000, false, 1, "anon-strain-2", 0);
indiv2->add_GU(genome, strlen(genome));
genome = NULL;
// Do transcription and translation
indiv2->do_transcription();
indiv2->do_translation();
// Do transcription and translation
indiv2->do_transcription();
indiv2->do_translation();
// Build indiv3
genome = new char[1024];
sprintf(genome, "%s%s%s%s%s%s%s", as[0], gene, as[1], term, as[2], prom[1], as[3]);
indiv3 = new Individual(nullptr, nullptr, nullptr, std::make_shared<MutationParams>(params_mut), 1.0, 10, 1000, false, 1, "anon-strain-3", 0);
indiv3->add_GU(genome, strlen(genome));
genome = NULL;
// Build indiv3
genome = new char[1024];
sprintf(genome, "%s%s%s%s%s%s%s", as[0], gene, as[1], term, as[2], prom[1],
as[3]);
indiv3 = new Individual(nullptr, nullptr, nullptr,
std::make_shared<MutationParams>(params_mut), 1.0,
10, 1000, false, 1, "anon-strain-3", 0);
indiv3->add_GU(genome, strlen(genome));
genome = NULL;
// Do transcription and translation
indiv3->do_transcription();
indiv3->do_translation();
// Do transcription and translation
indiv3->do_transcription();
indiv3->do_translation();
// Build indiv4
genome = indiv3->genetic_unit(0).dna()->subsequence(0,0,LAGGING);
indiv4 = new Individual(nullptr, nullptr, nullptr, std::make_shared<MutationParams>(params_mut), 1.0, 10, 1000, false, 1, "anon-strain-4", 0);
indiv4->add_GU(genome, strlen(genome));
genome = NULL;
// Build indiv4
genome = indiv3->genetic_unit(0).dna()->subsequence(0, 0, LAGGING);
indiv4 = new Individual(nullptr, nullptr, nullptr,
std::make_shared<MutationParams>(params_mut), 1.0,
10, 1000, false, 1, "anon-strain-4", 0);
indiv4->add_GU(genome, strlen(genome));
genome = NULL;
// Do transcription and translation
indiv4->do_transcription();
indiv4->do_translation();
// Do transcription and translation
indiv4->do_transcription();
indiv4->do_translation();
}
// ***************************************************************************
......@@ -191,7 +212,6 @@ void IndividualTest::SetUp(void)
// protein_node->obj()->concentration(),
// protein_node->obj()->rna_list()->size());
ExpSetup* exp_s = new ExpSetup(nullptr);
for (int i = 0; i <= 1; i++) {
exp_s->set_fuzzy_flavor(i);
......
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