Commit cc517039 authored by RomainFeron's avatar RomainFeron
Browse files

Fixed bug in 'map' for low number of samples

parent eeb59f14
......@@ -27,7 +27,7 @@
void Map::extra_setup() {
// Filtering
this->min_individuals = static_cast<uint16_t>(this->popmap.n_individuals * this->parameters.map_min_frequency);
this->min_individuals = std::max(static_cast<uint16_t>(1), static_cast<uint16_t>(this->popmap.n_individuals * this->parameters.map_min_frequency));
// Loading bwa index
this->load_bwa_index();
......
......@@ -22,6 +22,7 @@
*/
#pragma once
#include <algorithm>
#include <fstream>
#include <string>
#include <unordered_map>
......
......@@ -84,6 +84,7 @@ void MarkersTable::start_parser(bool store_sequence, bool compute_groups) {
char buffer[65536];
uint k = 0, field_n = 0, marker_n = 0;
Marker marker(this->header.n_individuals);
for (auto g: this->popmap->get_groups()) marker.group_counts[g] = 0; // Initialize group counts
std::vector<Marker> tmp_queue(TMP_QUEUE_SIZE); // Temporary block queue to avoid locking the shared blocks queue too often
uint tmp_queue_real_size = 0;
uint marker_queue_size = 0;
......
......@@ -134,6 +134,17 @@ uint Popmap::get_count(const std::string& group) const {
std::vector<std::string> Popmap::get_groups() const {
std::vector<std::string> groups;
for (auto g: this->group_counts) groups.push_back(g.first);
return groups;
}
std::string Popmap::print_groups(const bool counts) const {
......
......@@ -80,6 +80,15 @@ class Popmap {
uint get_count(const std::string& group) const;
/*!
* \brief Get a list of all groups found in the popmap
*
* \return A vector of group names
*/
std::vector<std::string> get_groups() const;
/*!
* \brief Print all the groups in the popmap
*
......
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