1#ifndef TAKANE_UTILS_PUBLIC_HPP
2#define TAKANE_UTILS_PUBLIC_HPP
6#include <unordered_map>
11#include "millijson/millijson.hpp"
12#include "byteme/byteme.hpp"
13#include "chihaya/chihaya.hpp"
14#include "utils_json.hpp"
35 std::unordered_map<std::string, std::shared_ptr<millijson::Base> >
other;
46 if (raw->type() != millijson::OBJECT) {
47 throw std::runtime_error(
"metadata should be a JSON object");
51 output.
other = std::move(
reinterpret_cast<millijson::Object*
>(raw)->values);
53 auto tIt = output.
other.find(
"type");
54 if (tIt == output.
other.end()) {
55 throw std::runtime_error(
"metadata should have a 'type' property");
58 const auto& tval = tIt->second;
59 if (tval->type() != millijson::STRING) {
60 throw std::runtime_error(
"metadata should have a 'type' string");
63 output.
type = std::move(
reinterpret_cast<millijson::String*
>(tval.get())->value);
64 output.
other.erase(tIt);
75 std::shared_ptr<millijson::Base> obj = internal_json::parse_file(path /
"OBJECT");
77}
catch (std::exception& e) {
78 throw std::runtime_error(
"failed to read the OBJECT file at '" + path.string() +
"'; " + std::string(e.what()));
takane validation functions.
Definition _derived_from.hpp:15
ObjectMetadata read_object_metadata(const std::filesystem::path &path)
Definition utils_public.hpp:74
ObjectMetadata reformat_object_metadata(millijson::Base *raw)
Definition utils_public.hpp:45
Validation options.
Definition utils_public.hpp:94
chihaya::Options delayed_array_options
Definition utils_public.hpp:234
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> bigwig_file_strict_check
Definition utils_public.hpp:184
bool parallel_reads
Definition utils_public.hpp:98
std::unordered_map< std::string, std::unordered_set< std::string > > custom_satisfies_interface
Definition utils_public.hpp:147
std::unordered_map< std::string, std::function< size_t(const std::filesystem::path &, const ObjectMetadata &m, Options &)> > custom_height
Definition utils_public.hpp:132
hsize_t hdf5_buffer_size
Definition utils_public.hpp:103
std::function< bool(const std::filesystem::path &, const ObjectMetadata &, Options &options)> data_frame_factor_any_duplicated
Definition utils_public.hpp:191
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> bam_file_strict_check
Definition utils_public.hpp:155
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> gmt_file_strict_check
Definition utils_public.hpp:222
std::unordered_map< std::string, std::function< std::vector< size_t >(const std::filesystem::path &, const ObjectMetadata &, Options &)> > custom_dimensions
Definition utils_public.hpp:125
std::unordered_map< std::string, std::unordered_set< std::string > > custom_derived_from
Definition utils_public.hpp:140
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &, bool)> gff_file_strict_check
Definition utils_public.hpp:215
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> bcf_file_strict_check
Definition utils_public.hpp:162
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> bigbed_file_strict_check
Definition utils_public.hpp:177
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &, bool)> fastq_file_strict_check
Definition utils_public.hpp:207
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> custom_global_validate
Definition utils_public.hpp:117
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> rds_file_strict_check
Definition utils_public.hpp:229
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &, bool)> fasta_file_strict_check
Definition utils_public.hpp:199
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &, bool)> bed_file_strict_check
Definition utils_public.hpp:170
std::unordered_map< std::string, std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> > custom_validate
Definition utils_public.hpp:111