Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose .hic file attributes #115

Merged
merged 1 commit into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/libhictk/hic/include/hictk/hic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class File {
[[nodiscard]] std::uint64_t nbins() const;
[[nodiscard]] std::uint64_t nchroms() const;
[[nodiscard]] const std::string &assembly() const noexcept;
[[nodiscard]] const phmap::flat_hash_map<std::string, std::string> &attributes() const noexcept;
[[nodiscard]] const std::vector<std::uint32_t> &avail_resolutions() const noexcept;
[[nodiscard]] bool has_normalization(std::string_view normalization) const;
[[nodiscard]] std::vector<balancing::Method> avail_normalizations() const;
Expand Down
4 changes: 4 additions & 0 deletions src/libhictk/hic/include/hictk/hic/impl/hic_file_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ inline const Reference& File::chromosomes() const noexcept { return bins().chrom

inline const std::string& File::assembly() const noexcept { return _fs->header().genomeID; }

inline const phmap::flat_hash_map<std::string, std::string>& File::attributes() const noexcept {
return _fs->header().attributes;
}

inline const std::vector<std::uint32_t>& File::avail_resolutions() const noexcept {
return _fs->header().resolutions;
}
Expand Down
1 change: 1 addition & 0 deletions test/units/hic/hic_file_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ TEST_CASE("HiC: file accessors", "[hic][short]") {
CHECK(f.version() == 8);
CHECK(f.chromosomes().size() == 9);
CHECK(f.assembly() == "dm6");
CHECK(f.attributes().at("software") == "Juicer Tools Version 1.22.01");

CHECK(f.avail_resolutions().size() == 10);
CHECK(f.avail_resolutions().front() == 1'000);
Expand Down
Loading