Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
robomics committed Nov 26, 2023
1 parent e2141b7 commit 1ca0334
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#pragma once

#include <fmt/format.h>
#include <parallel_hashmap/phmap.h>
#include <parallel_hashmap/btree.h>

#include <algorithm>
#include <cassert>
Expand Down Expand Up @@ -54,7 +54,8 @@ template <typename NameMap>

template <typename It>
inline void rename_chromosomes(std::string_view uri, It first_mapping, It last_mapping) {
return rename_chromosomes(uri, {first_mapping, last_mapping});
return rename_chromosomes(
uri, phmap::btree_map<std::string, std::string>{first_mapping, last_mapping});
}

template <typename NameMap, typename>
Expand Down
4 changes: 3 additions & 1 deletion test/units/cooler/utils_rename_chromosomes_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>
#include <filesystem>
#include <map>

#include "hictk/cooler/cooler.hpp"
#include "hictk/cooler/utils.hpp"
Expand All @@ -21,7 +22,8 @@ TEST_CASE("Cooler: rename chromosomes", "[cooler][short]") {

const Reference ref{{0, "chr1", 10}, {1, "chr2", 10}};
std::ignore = cooler::File::create(path.string(), ref, 1, true);
cooler::utils::rename_chromosomes(path.string(), {{"chr1", "1"}});
cooler::utils::rename_chromosomes(path.string(),
std::map<std::string, std::string>{{"chr1", "1"}});

{
const auto chroms = cooler::File(path.string()).chromosomes();
Expand Down

0 comments on commit 1ca0334

Please sign in to comment.