Commit c45739bf authored by Mathieu Giraud's avatar Mathieu Giraud

core/germline.{h,cpp}, vidjil.cpp: build_from_json() can consider only regular...

core/germline.{h,cpp}, vidjil.cpp: build_from_json() can consider only regular or incomplete germlines
parent 7ed4fb29
......@@ -221,10 +221,10 @@ void MultiGermline::add_germline(Germline *germline, string seed)
germlines.push_back(germline);
}
void MultiGermline::build(string path, int max_indexing)
void MultiGermline::build_from_json(string path, string json_filename, int filter, int max_indexing)
{
//parse germlines.data
ifstream germline_data(path + "/germlines.data");
ifstream germline_data(path + "/" + json_filename);
string content( (std::istreambuf_iterator<char>(germline_data) ),
(std::istreambuf_iterator<char>() ) );
......@@ -237,7 +237,20 @@ void MultiGermline::build(string path, int max_indexing)
char shortcut = it.value()["shortcut"].dump()[1];
string code = it.key();
string seed = it.value()["parameters"]["seed"];
switch (filter) {
case GERMLINES_REGULAR:
if (code.find("+") != string::npos) continue ;
break ;
case GERMLINES_INCOMPLETE:
if (code.find("+") == string::npos) continue ;
break ;
default:
break ;
}
map<string, string> seedMap;
seedMap["13s"] = SEED_S13;
seedMap["12s"] = SEED_S12;
......@@ -246,7 +259,7 @@ void MultiGermline::build(string path, int max_indexing)
//for each set of recombination 3/4/5
for (json::iterator it2 = recom.begin(); it2 != recom.end(); ++it2) {
add_germline(new Germline(code, shortcut, path, *it2 , max_indexing), seedMap[seed]);
add_germline(new Germline(code, shortcut, path + "/", *it2 , max_indexing), seedMap[seed]);
}
}
......
......@@ -86,6 +86,11 @@ class Germline {
ostream &operator<<(ostream &out, const Germline &germline);
enum GERMLINES_FILTER { GERMLINES_ALL,
GERMLINES_REGULAR,
GERMLINES_INCOMPLETE } ;
class MultiGermline {
private:
......@@ -103,7 +108,7 @@ class MultiGermline {
void add_germline(Germline *germline, string seed);
void build_default_set(string path, int max_indexing);
void build_incomplete_set(string path, int max_indexing);
void build(string path, int max_indexing);
void build_from_json(string path, string json_filename, int filter, int max_indexing);
// Creates and update an unique index for all the germlines
// If 'set_index' is set, set this index as the index for all germlines
......
......@@ -774,7 +774,7 @@ int main (int argc, char **argv)
if (multi_germline)
{
multigermline->build_default_set(multi_germline_file, trim_sequences);
//multigermline->build(multi_germline_file, trim_sequences);
//multigermline->build_from_json(multi_germline_file, "germlines.data", GERMLINES_REGULAR, trim_sequences);
}
else
{
......@@ -810,6 +810,7 @@ int main (int argc, char **argv)
if (multi_germline_incomplete) {
multigermline->one_index_per_germline = true; // Starting from now, creates new indexes
multigermline->build_incomplete_set(multi_germline_file, trim_sequences);
//multigermline->build_from_json(multi_germline_file, "germlines.data", GERMLINES_INCOMPLETE, trim_sequences);
}
if (multi_germline_mark)
......
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