Commit 49459e0a authored by Romain Feron's avatar Romain Feron
Browse files

More fixes to popmap loading + move popmap log before function started log

parent a5605685
......@@ -4,9 +4,11 @@
void depth(Parameters& parameters) {
std::chrono::steady_clock::time_point t_begin = std::chrono::steady_clock::now();
log("RADSex depth started");
Popmap popmap = load_popmap(parameters);
log("RADSex depth started");
Header header;
Depths depths(popmap.n_individuals);
......
......@@ -9,9 +9,12 @@ void distrib(Parameters& parameters) {
*/
std::chrono::steady_clock::time_point t_begin = std::chrono::steady_clock::now();
log("RADSex distrib started");
Popmap popmap = load_popmap(parameters);
log("RADSex distrib started");
log("Comparing groups \"" + parameters.group1 + "\" and \"" + parameters.group2 + "\"");
Header header;
sd_table results;
......
......@@ -13,7 +13,7 @@ void freq(Parameters& parameters) {
Header header = get_header(parameters.markers_table_path);
Popmap popmap; // Create dummy popmap
uint n_individuals = header.size() - 1; // Number of columns - 2 (id and seq columns) +1 (because range is 0 - n_individuals)
uint n_individuals = static_cast<uint>(header.size()) - 1; // Number of columns - 2 (id and seq columns) +1 (because range is 0 - n_individuals)
bool parsing_ended = false;
MarkersQueue markers_queue;
......
......@@ -20,10 +20,13 @@ void map(Parameters& parameters) {
*/
std::chrono::steady_clock::time_point t_begin = std::chrono::steady_clock::now();
log("RADSex map started");
// Popmap
Popmap popmap = load_popmap(parameters);
log("RADSex map started");
log("Comparing groups \"" + parameters.group1 + "\" and \"" + parameters.group2 + "\"");
Header header;
std::vector<AlignedMarker> aligned_markers;
......
......@@ -37,22 +37,22 @@ Popmap load_popmap(Parameters& parameters) {
exit(1);
}
if (popmap.counts.size() < 2) {
if (popmap.counts.size() < 2) { // Fewer than two groups in the popmap
log("Found <" + std::to_string(popmap.counts.size()) + "> groups in the popmap file (" + print_groups(popmap) + ") but at least two are required", LOG_ERROR);
exit(1);
} else if (popmap.counts.size() > 2 and (parameters.group1 == "" or parameters.group2 == "")) {
} else if (popmap.counts.size() > 2 and (parameters.group1 == "" or parameters.group2 == "")) { // More than two groups but groups to compare were not defined
log("Found <" + std::to_string(popmap.counts.size()) + "> groups in the popmap file (" + print_groups(popmap) + ") but groups to compare were not defined (use --groups group1,group2)", LOG_ERROR);
exit(1);
} else if (popmap.counts.size() > 2 and (popmap.counts.find(parameters.group1) == popmap.counts.end() or popmap.counts.find(parameters.group2) == popmap.counts.end())) {
} else if (popmap.counts.size() > 2 and (popmap.counts.find(parameters.group1) == popmap.counts.end() or popmap.counts.find(parameters.group2) == popmap.counts.end())) { // More than two groups and groups to compare were not found
log("Groups specified with --groups (\"" + parameters.group1 + "\", \"" + parameters.group2 + "\") were not found in popmap groups (" + print_groups(popmap) + ")", LOG_ERROR);
exit(1);
} else {
} else if (popmap.counts.size() == 2) { // If only two groups in popmap, use them (override user-specified groups for now)
auto i = std::begin(popmap.counts);
parameters.group1 = i->first;
......
......@@ -9,9 +9,11 @@ void signif(Parameters& parameters) {
*/
std::chrono::steady_clock::time_point t_begin = std::chrono::steady_clock::now();
Popmap popmap = load_popmap(parameters);
log("RADSex signif started");
log("Comparing groups \"" + parameters.group1 + "\" and \"" + parameters.group2 + "\"");
Popmap popmap = load_popmap(parameters);
Header header;
std::vector<Marker> candidate_markers;
......
......@@ -3,9 +3,12 @@
void subset(Parameters& parameters) {
std::chrono::steady_clock::time_point t_begin = std::chrono::steady_clock::now();
log("RADSex subset started");
Popmap popmap = load_popmap(parameters);
log("RADSex subset started");
log("Comparing groups \"" + parameters.group1 + "\" and \"" + parameters.group2 + "\"");
Header header;
bool parsing_ended = false;
......
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