Commit ae4dc3a8 authored by Jean-Benoist Leger's avatar Jean-Benoist Leger Committed by Jean-Benoist Leger
Browse files

treat differently conflict for supp cols and main cols

parent 3187d50a
......@@ -292,8 +292,10 @@ void fusion(std::string liststring, std::string filename_1,
std::string filename_2, std::string output_path,
std::string output_filename, std::ofstream &log_file,
std::list<Triple> merged_list_rows,
std::list<Triple> merged_list_cols, char comment_sign,
std::string unknown, char separator, int nb_supp_elements,
std::list<Triple> merged_list_supp_cols,
std::list<Triple> merged_list_main_cols,
char comment_sign,
std::string main_unknown, char separator, int nb_supp_elements,
int value_length, std::string file_extension, int nb_supp_lines,
bool last_iteration) {
......@@ -326,6 +328,16 @@ void fusion(std::string liststring, std::string filename_1,
output_file << comment_sign << comment_sign << '\n';
output_file << comment_sign << comment_sign << '\n';
std::list<Triple> merged_list_cols;
for(std::list<Triple>::iterator I = merged_list_supp_cols.begin();
I!=merged_list_supp_cols.end();
I++)
merged_list_cols.push_back(*I);
for(std::list<Triple>::iterator I = merged_list_main_cols.begin();
I!=merged_list_main_cols.end();
I++)
merged_list_cols.push_back(*I);
int nb_supp_lines1 = infer_nb_supp_lines(filename_1, comment_sign);
int nb_supp_lines2 = infer_nb_supp_lines(filename_2, comment_sign);
for (std::list<Triple>::iterator I = merged_list_cols.begin();
......@@ -349,8 +361,16 @@ void fusion(std::string liststring, std::string filename_1,
current_line_1 =
GetLine(VCFFile1, OfsFile1, current_row_1, nb_supp_lines1);
unsigned int colnum=0;
for (std::list<Triple>::iterator J = merged_list_cols.begin();
J != merged_list_cols.end(); J++) {
std::string unknown;
if(colnum>=merged_list_supp_cols.size())
unknown = main_unknown;
else
unknown = "[conflict]";
colnum++;
current_col_1 = (*J).GetIndex_1();
value = take_value_from_line(current_line_1, current_col_1,
OffsetSuppCols_1, nb_supp_elements,
......@@ -384,8 +404,16 @@ void fusion(std::string liststring, std::string filename_1,
} else if (current_row_1 == -1 && current_row_2 != -1) {
current_line_2 =
GetLine(VCFFile2, OfsFile2, current_row_2, nb_supp_lines2);
unsigned int colnum=0;
for (std::list<Triple>::iterator J = merged_list_cols.begin();
J != merged_list_cols.end(); J++) {
std::string unknown;
if(colnum>=merged_list_supp_cols.size())
unknown = main_unknown;
else
unknown = "[conflict]";
colnum++;
current_col_2 = (*J).GetIndex_2();
value = take_value_from_line(current_line_2, current_col_2,
OffsetSuppCols_2, nb_supp_elements,
......@@ -420,8 +448,16 @@ void fusion(std::string liststring, std::string filename_1,
current_line_2 =
GetLine(VCFFile2, OfsFile2, current_row_2, nb_supp_lines2);
unsigned int colnum=0;
for (std::list<Triple>::iterator J = merged_list_cols.begin();
J != merged_list_cols.end(); J++) {
std::string unknown;
if(colnum>=merged_list_supp_cols.size())
unknown = main_unknown;
else
unknown = "[conflict]";
colnum++;
current_col_1 = (*J).GetIndex_1();
current_col_2 = (*J).GetIndex_2();
if (current_col_1 != -1 && current_col_2 == -1) {
......@@ -585,7 +621,7 @@ void process_data(std::string liststring, std::string file_name_1,
list_colnames_main_2;
Couple *list_indexed_rows_1, *list_indexed_rows_2, *list_indexed_cols_1,
*list_indexed_cols_2;
std::list<Triple> general_list_rownames, general_list_colnames;
std::list<Triple> general_list_rownames, main_list_colnames, supp_list_colnames;
std::ofstream log_file((output_path + "log.txt").c_str(),
std::ios_base::app);
......@@ -623,10 +659,16 @@ void process_data(std::string liststring, std::string file_name_1,
general_list_rownames =
merge_list(list_indexed_rows_1, list_indexed_rows_2,
list_rownames_1.size(), list_rownames_2.size());
general_list_colnames =
main_list_colnames =
merge_list(list_indexed_cols_1+list_colnames_supp_1.size(), list_indexed_cols_2+list_colnames_supp_1.size(),
list_colnames_main_1.size(),
list_colnames_main_2.size());
supp_list_colnames =
merge_list(list_indexed_cols_1, list_indexed_cols_2,
list_colnames_supp_1.size() + list_colnames_main_1.size(),
list_colnames_supp_2.size() + list_colnames_main_2.size());
list_colnames_supp_1.size(),
list_colnames_supp_2.size());
delete[] list_indexed_rows_1;
delete[] list_indexed_rows_2;
......@@ -637,7 +679,7 @@ void process_data(std::string liststring, std::string file_name_1,
log_file << " - " << output_filename << std::endl;
fusion(liststring, file_name_1, file_name_2, output_path, output_filename,
log_file, general_list_rownames, general_list_colnames, comment_sign,
log_file, general_list_rownames, supp_list_colnames, main_list_colnames, comment_sign,
unknown, separator, nb_supp_elements, value_length, file_extension,
nb_supp_lines, last_iteration);
log_file << std::endl;
......
......@@ -45,7 +45,9 @@ void fusion(std::string liststring, std::string filename_1,
std::string filename_2, std::string output_path,
std::string output_filename, std::ofstream &log_file,
std::list<Triple> merged_list_rows,
std::list<Triple> merged_list_cols, char comment_sign = '#',
std::list<Triple> merged_list_supp_cols,
std::list<Triple> merged_list_main_cols,
char comment_sign = '#',
std::string unknown = "./.", char separator = '\t',
int nb_supp_elements = 9, int value_length = 3,
std::string file_extension = "vcf", int nb_supp_lines = 5,
......
Supports Markdown
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