34 const std::string& vstring = internal_json::extract_version_for_type(metadata.
other,
"bigwig_file");
35 auto version = ritsuko::parse_version_string(vstring.c_str(), vstring.size(),
true);
36 if (version.major != 1) {
37 throw std::runtime_error(
"unsupported version string '" + vstring +
"'");
42 auto ipath = path /
"file.bw";
43 std::array<unsigned char, 4> store;
44 internal_files::extract_signature(ipath, store.data(), store.size());
46 std::array<unsigned char, 4> be_magic { 0x26, 0xFC, 0x8F, 0x88 };
47 std::array<unsigned char, 4> le_magic { 0x88, 0x8F, 0xFC, 0x26 };
48 if (store != be_magic && store != le_magic) {
49 throw std::runtime_error(
"incorrect bigWig file signature for '" + ipath.string() +
"'");