Skip to content

Commit

Permalink
Improve performance when generating All_All matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
robomics committed Jan 29, 2024
1 parent 7da082d commit 58869f3
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/libhictk/hic/include/hictk/hic/impl/file_writer_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::uint32_t>((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());

Expand Down

0 comments on commit 58869f3

Please sign in to comment.