Commit b9588d63 authored by Mathieu Giraud's avatar Mathieu Giraud

vidjil.cpp: loads multigermlines in a common place for CMD_WINDOWS/CLONES/GERMLINES

This may help the upcoming modularization of vidjil.cpp

(Soissons)
parent e65a9d36
......@@ -171,6 +171,13 @@ void MultiGermline::insert_in_one_index(IKmerStore<KmerAffect> *_index)
}
}
void MultiGermline::build_with_one_index(string seed)
{
bool rc = true ;
index = KmerStoreFactory::createIndex<KmerAffect>(seed, rc);
insert_in_one_index(index);
}
void MultiGermline::out_stats(ostream &out)
{
for (list<Germline*>::const_iterator it = germlines.begin(); it != germlines.end(); ++it)
......
......@@ -67,6 +67,9 @@ class MultiGermline {
public:
list <Germline*> germlines;
// A unique index can be used
IKmerStore<KmerAffect> *index;
MultiGermline();
MultiGermline(string f_germlines_json);
~MultiGermline();
......@@ -76,6 +79,7 @@ class MultiGermline {
void load_standard_set(string path);
void insert_in_one_index(IKmerStore<KmerAffect> *_index);
void build_with_one_index(string seed);
void out_stats(ostream &out);
};
......
......@@ -639,6 +639,41 @@ int main (int argc, char **argv)
<< endl ;
}
/////////////////////////////////////////
// LOAD GERMLINES //
/////////////////////////////////////////
MultiGermline *multigermline = new MultiGermline();
if (command == CMD_GERMLINES || command == CMD_CLONES || command == CMD_WINDOWS)
{
cout << "Build Kmer indexes" << endl ;
if (multi_germline)
{
multigermline->build_default_set(multi_germline_file);
}
else if (command == CMD_GERMLINES)
{
multigermline->load_standard_set(multi_germline_file);
multigermline->build_with_one_index(seed);
}
else
{
// Custom germline
Fasta rep_V(f_rep_V, 2, "|", cout);
Fasta rep_D(f_rep_D, 2, "|", cout);
Fasta rep_J(f_rep_J, 2, "|", cout);
Germline *germline;
germline = new Germline(germline_system, 'X',
rep_V, rep_D, rep_J,
delta_min, delta_max);
germline->new_index(seed);
multigermline->insert(germline);
}
}
//////////////////////////////://////////
// DISCOVER GERMLINES //
......@@ -648,17 +683,8 @@ int main (int argc, char **argv)
#define KMER_AMBIGUOUS "?"
#define KMER_UNKNOWN "_"
MultiGermline *multigermline = new MultiGermline();
multigermline->load_standard_set(multi_germline_file);
// Read germline and build one unique index
bool rc = true ;
IKmerStore<KmerAffect> *index = KmerStoreFactory::createIndex<KmerAffect>(seed, rc);
map <char, int> stats_kmer, stats_max;
multigermline->insert_in_one_index(index);
IKmerStore<KmerAffect> *index = multigermline->index ;
// Initialize statistics, with two additional categories
index->labels.push_back(make_pair(KmerAffect::getAmbiguous(), KMER_AMBIGUOUS));
......@@ -779,31 +805,6 @@ int main (int argc, char **argv)
cout << " delta = [" << delta_min << "," << delta_max << "]" << endl ;
//////////////////////////////////
//$$ Build Kmer indexes
cout << "Build Kmer indexes" << endl ;
MultiGermline *multigermline = new MultiGermline();
if (multi_germline)
{
multigermline->build_default_set(multi_germline_file);
}
else
{
Fasta rep_V(f_rep_V, 2, "|", cout);
Fasta rep_D(f_rep_D, 2, "|", cout);
Fasta rep_J(f_rep_J, 2, "|", cout);
Germline *germline;
germline = new Germline(germline_system, 'X',
rep_V, rep_D, rep_J,
delta_min, delta_max);
germline->new_index(seed);
multigermline->insert(germline);
}
//////////////////////////////////
//$$ Kmer Segmentation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment