void Formatter::process_header() throw (FormatterException) { Descriptor* descriptor = NULL; char header_separator = '\0'; char* header = NULL; char* token = NULL; int column_position = 0; const char* column_name = NULL; const char* new_column_name = NULL; Column* column = NULL; if (gwafile == NULL) { return; } try { if (reader.read_line() <= 0) { throw FormatterException("Formatter", "process_header()", __LINE__, 5, gwafile->get_descriptor()->get_name()); } descriptor = gwafile->get_descriptor(); header_separator = gwafile->get_header_separator(); header = *reader.line; token = auxiliary::strtok(&header, header_separator); while (token != NULL) { column = new Column(); new_column_name = descriptor->get_renamed_column(token); if (new_column_name == NULL) { new_column_name = token; } column_name = descriptor->get_default_column(new_column_name, gwafile->is_case_sensitive()); if (column_name != NULL) { if (strcmp(column_name, Descriptor::MARKER) == 0) { } else if (strcmp(column_name, Descriptor::CHR) == 0) { } else if (strcmp(column_name, Descriptor::POSITION) == 0) { } else if (strcmp(column_name, Descriptor::ALLELE1) == 0) { } else if (strcmp(column_name, Descriptor::ALLELE2) == 0) { } else if (strcmp(column_name, Descriptor::STRAND) == 0) { } else if (strcmp(column_name, Descriptor::EFFECT) == 0) { } else if (strcmp(column_name, Descriptor::STDERR) == 0) { stderr_column = column; } else if (strcmp(column_name, Descriptor::PVALUE) == 0) { pvalue_column = column; pvalue_column_pos = column_position; } else if (strcmp(column_name, Descriptor::FREQLABEL) == 0) { maf_column = column; maf_column_pos = column_position; } else if (strcmp(column_name, Descriptor::HWE_PVAL) == 0) { } else if (strcmp(column_name, Descriptor::CALLRATE) == 0) { } else if (strcmp(column_name, Descriptor::N_TOTAL) == 0) { n_total_column = column; } else if (strcmp(column_name, Descriptor::IMPUTED) == 0) { } else if (strcmp(column_name, Descriptor::USED_FOR_IMP) == 0) { } else if (strcmp(column_name, Descriptor::OEVAR_IMP) == 0) { oevar_imp_column = column; oevar_imp_column_pos = column_position; } else if (strcmp(column_name, Descriptor::AVPOSTPROB) == 0) { } } column->set_header(new_column_name); column->set_order(descriptor->get_column_order(new_column_name, gwafile->is_case_sensitive())); input_columns.push_back(column); token = auxiliary::strtok(&header, header_separator); column_position += 1; } } catch (ReaderException &e) { FormatterException new_e(e); new_e.add_message("Formatter", "process_header()", __LINE__, 6, gwafile->get_descriptor()->get_name()); throw new_e; } catch (DescriptorException &e) { FormatterException new_e(e); new_e.add_message("Formatter", "process_header()", __LINE__, 6, gwafile->get_descriptor()->get_name()); throw new_e; } }