Skip to content

Commit

Permalink
Fix verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
robomics committed Jun 21, 2023
1 parent f0536f7 commit bb73da6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/cooler/balancing_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ inline Weights::Weights(const BinTable& bins, const Dataset& dset, bool rescale)

inline Weights::Weights(const BinTable& bins, const Dataset& dset, Type type, bool rescale)
: _weights(dset.read_all<std::vector<double>>()), _type(type) {
[[maybe_unused]] const HighFive::SilenceHDF5 silencer{}; // NOLINT
if (_type == Type::INFER || type == Type::UNKNOWN) {
if (dset.has_attribute("divisive_weights")) {
_type = dset.read_attribute<bool>("divisive_weights") ? Type::DIVISIVE : Type::MULTIPLICATIVE;
Expand Down
2 changes: 1 addition & 1 deletion src/cooler/dataset_read_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ inline hictk::internal::GenericVariant Dataset::read_last() const {
template <typename T>
inline T Dataset::read_attribute(std::string_view key) const {
if constexpr (std::is_same_v<T, bool>) {
return static_cast<bool>(this->_dataset.getAttribute(std::string{key}).read<int>());
return static_cast<bool>(this->_dataset.getAttribute(std::string{key}).read<std::uint8_t>());
} else {
return Attribute::read<T>(this->_dataset, key);
}
Expand Down
3 changes: 3 additions & 0 deletions src/hictk/include/hictk/tools/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct DumpConfig {
hic::MatrixType matrix_type{hic::MatrixType::observed};
hic::MatrixUnit matrix_unit{hic::MatrixUnit::BP};
std::uint32_t resolution{};
std::uint8_t verbosity{3};
};

struct LoadConfig {
Expand All @@ -57,6 +58,7 @@ struct LoadConfig {
bool count_as_float{false};
bool assume_sorted{true};
bool force{false};
std::uint8_t verbosity{3};
};

struct MergeConfig {
Expand All @@ -65,6 +67,7 @@ struct MergeConfig {
std::size_t chunk_size{1'000'000};

bool force{false};
std::uint8_t verbosity{3};
};

// clang-format off
Expand Down
13 changes: 11 additions & 2 deletions src/hictk/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <stdexcept>
#include <string_view>

#include "hictk/common.hpp"
#include "hictk/tools/cli.hpp"
#include "hictk/tools/tools.hpp"
#include "hictk/version.hpp"
Expand Down Expand Up @@ -51,8 +52,16 @@ static std::tuple<int, Cli::subcommand, Config> parse_cli_and_setup_logger(int a
cli = std::make_unique<Cli>(argc, argv);
auto config = cli->parse_arguments();
const auto subcmd = cli->get_subcommand();
setup_logger_console(1, // config.verbosity,
subcmd != Cli::subcommand::help);
std::visit(
[&](const auto& config_) {
using T = hictk::remove_cvref_t<decltype(config_)>;
constexpr auto is_monostate = std::is_same_v<T, std::monostate>;
if constexpr (!is_monostate) {
setup_logger_console(config_.verbosity, subcmd != Cli::subcommand::help &&
subcmd != Cli::subcommand::dump);
}
},
config);

return std::make_tuple(0, subcmd, config);
} catch (const CLI::ParseError& e) {
Expand Down

0 comments on commit bb73da6

Please sign in to comment.