From 4a624fe5f0faab6451dade056bf74e04d7d710dc Mon Sep 17 00:00:00 2001 From: Roberto Rossini <71787608+robomics@users.noreply.github.com> Date: Sun, 24 Sep 2023 13:28:44 +0200 Subject: [PATCH] Bugfix --- .../balancing/include/hictk/balancing/ice.hpp | 2 +- .../include/hictk/balancing/impl/ice_impl.hpp | 20 ++++++------------- .../include/hictk/balancing/sparse_matrix.hpp | 4 ++-- .../cooler/include/hictk/cooler/cooler.hpp | 10 ++++------ 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/libhictk/balancing/include/hictk/balancing/ice.hpp b/src/libhictk/balancing/include/hictk/balancing/ice.hpp index ce08b580..4c05d2f1 100644 --- a/src/libhictk/balancing/include/hictk/balancing/ice.hpp +++ b/src/libhictk/balancing/include/hictk/balancing/ice.hpp @@ -14,7 +14,7 @@ namespace hictk::balancing { class ICE { - std::vector _chrom_offsets{}; + std::vector _chrom_offsets{}; std::vector _biases{}; std::vector _variance{}; std::vector _scale{}; diff --git a/src/libhictk/balancing/include/hictk/balancing/impl/ice_impl.hpp b/src/libhictk/balancing/include/hictk/balancing/impl/ice_impl.hpp index ff806751..4a29cb79 100644 --- a/src/libhictk/balancing/include/hictk/balancing/impl/ice_impl.hpp +++ b/src/libhictk/balancing/include/hictk/balancing/impl/ice_impl.hpp @@ -145,14 +145,10 @@ inline void ICE::balance_cis(const MatrixT& matrix, const BinTable& bins, std::s template auto ICE::construct_sparse_matrix(const File& f, Type type, std::size_t num_masked_diags) -> SparseMatrix { - switch (type) { - case Type::cis: - return construct_sparse_matrix_cis(f, num_masked_diags); - case Type::trans: - [[fallthrough]]; - case Type::gw: - return construct_sparse_matrix_gw(f, num_masked_diags); + if (type == Type::cis) { + return construct_sparse_matrix_cis(f, num_masked_diags); } + return construct_sparse_matrix_gw(f, num_masked_diags); } template @@ -252,14 +248,10 @@ template auto ICE::construct_sparse_matrix_chunked(const File& f, Type type, std::size_t num_masked_diags, const std::filesystem::path& tmpfile, std::size_t chunk_size) -> SparseMatrixChunked { - switch (type) { - case Type::cis: - return construct_sparse_matrix_chunked_cis(f, num_masked_diags, tmpfile, chunk_size); - case Type::trans: - [[fallthrough]]; - case Type::gw: - return construct_sparse_matrix_chunked_gw(f, num_masked_diags, tmpfile, chunk_size); + if (type == Type::cis) { + return construct_sparse_matrix_chunked_cis(f, num_masked_diags, tmpfile, chunk_size); } + return construct_sparse_matrix_chunked_gw(f, num_masked_diags, tmpfile, chunk_size); } template diff --git a/src/libhictk/balancing/include/hictk/balancing/sparse_matrix.hpp b/src/libhictk/balancing/include/hictk/balancing/sparse_matrix.hpp index b5b21b21..4bcecf3e 100644 --- a/src/libhictk/balancing/include/hictk/balancing/sparse_matrix.hpp +++ b/src/libhictk/balancing/include/hictk/balancing/sparse_matrix.hpp @@ -21,8 +21,8 @@ class SparseMatrix { std::vector _counts{}; std::uint32_t _chrom_id{}; // ID of the chromosome that is being procesed - std::vector _chrom_offsets{}; - std::vector _bin1_offsets{}; + std::vector _chrom_offsets{}; + std::vector _bin1_offsets{}; mutable std::vector _marg{}; static constexpr auto _gw_id = std::numeric_limits::max(); diff --git a/src/libhictk/cooler/include/hictk/cooler/cooler.hpp b/src/libhictk/cooler/include/hictk/cooler/cooler.hpp index 9737b07a..064a4178 100644 --- a/src/libhictk/cooler/include/hictk/cooler/cooler.hpp +++ b/src/libhictk/cooler/include/hictk/cooler/cooler.hpp @@ -118,12 +118,10 @@ class File { File(File &&other) noexcept(noexcept_move_ctor()) = default; // NOLINT // Simple constructor. Open file in read-only mode. Automatically detects pixel count type - [[nodiscard]] explicit File(std::string_view uri, - std::size_t cache_size_bytes = DEFAULT_HDF5_CACHE_SIZE, - bool validate = true); - [[nodiscard]] explicit File(RootGroup entrypoint, - std::size_t cache_size_bytes = DEFAULT_HDF5_CACHE_SIZE, - bool validate = true); + explicit File(std::string_view uri, std::size_t cache_size_bytes = DEFAULT_HDF5_CACHE_SIZE, + bool validate = true); + explicit File(RootGroup entrypoint, std::size_t cache_size_bytes = DEFAULT_HDF5_CACHE_SIZE, + bool validate = true); [[nodiscard]] static File open_random_access( std::string_view uri, std::size_t cache_size_bytes = DEFAULT_HDF5_CACHE_SIZE,