From 58869f3a277362051f5e91b0766d2d49de5c448e Mon Sep 17 00:00:00 2001 From: Roberto Rossini <71787608+robomics@users.noreply.github.com> Date: Mon, 29 Jan 2024 18:18:03 +0100 Subject: [PATCH] Improve performance when generating All_All matrix --- .../include/hictk/hic/impl/file_writer_impl.hpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/libhictk/hic/include/hictk/hic/impl/file_writer_impl.hpp b/src/libhictk/hic/include/hictk/hic/impl/file_writer_impl.hpp index c04235c3..dad25fdf 100644 --- a/src/libhictk/hic/include/hictk/hic/impl/file_writer_impl.hpp +++ b/src/libhictk/hic/include/hictk/hic/impl/file_writer_impl.hpp @@ -348,25 +348,13 @@ inline void HiCFileWriter::write_all_matrix(std::uint32_t target_num_bins) { genome_size += chrom.size(); } - auto base_resolution = resolutions().front(); + const auto base_resolution = resolutions().back(); auto target_resolution = static_cast((genome_size + target_num_bins - 1) / target_num_bins); - auto factor = std::max(std::uint32_t(1), target_resolution / base_resolution); + const auto factor = std::max(std::uint32_t(1), target_resolution / base_resolution); target_resolution = factor * base_resolution; const auto target_resolution_scaled = target_resolution / DEFAULT_CHROM_ALL_SCALE_FACTOR; - for (const auto &res : resolutions()) { - if (res > target_resolution) { - break; - } - - if (target_resolution % res == 0) { - base_resolution = res; - } - } - - factor = target_resolution / base_resolution; - SPDLOG_INFO(FMT_STRING("writing pixels for {}:{} matrix..."), chromosomes().at(0).name(), chromosomes().at(0).name());