1#ifndef TAKANE_UTILS_PUBLIC_HPP
2#define TAKANE_UTILS_PUBLIC_HPP
6#include <unordered_map>
11#include "millijson/millijson.hpp"
12#include "chihaya/chihaya.hpp"
13#include "utils_json.hpp"
34 std::unordered_map<std::string, std::shared_ptr<millijson::Base> >
other;
45 if (raw->type() != millijson::OBJECT) {
46 throw std::runtime_error(
"metadata should be a JSON object");
50 output.
other = std::move(
reinterpret_cast<millijson::Object*
>(raw)->value());
52 auto tIt = output.
other.find(
"type");
53 if (tIt == output.
other.end()) {
54 throw std::runtime_error(
"metadata should have a 'type' property");
57 const auto& tval = tIt->second;
58 if (tval->type() != millijson::STRING) {
59 throw std::runtime_error(
"metadata should have a 'type' string");
62 output.
type = std::move(
reinterpret_cast<millijson::String*
>(tval.get())->value());
63 output.
other.erase(tIt);
74 std::shared_ptr<millijson::Base> obj = internal_json::parse_file(path /
"OBJECT");
76}
catch (std::exception& e) {
77 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:73
ObjectMetadata reformat_object_metadata(millijson::Base *raw)
Definition utils_public.hpp:44
Validation options.
Definition utils_public.hpp:93
chihaya::Options delayed_array_options
Definition utils_public.hpp:233
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> bigwig_file_strict_check
Definition utils_public.hpp:183
bool parallel_reads
Definition utils_public.hpp:97
std::unordered_map< std::string, std::unordered_set< std::string > > custom_satisfies_interface
Definition utils_public.hpp:146
std::unordered_map< std::string, std::function< size_t(const std::filesystem::path &, const ObjectMetadata &m, Options &)> > custom_height
Definition utils_public.hpp:131
hsize_t hdf5_buffer_size
Definition utils_public.hpp:102
std::function< bool(const std::filesystem::path &, const ObjectMetadata &, Options &options)> data_frame_factor_any_duplicated
Definition utils_public.hpp:190
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> image_file_strict_check
Definition utils_public.hpp:240
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> bam_file_strict_check
Definition utils_public.hpp:154
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> gmt_file_strict_check
Definition utils_public.hpp:221
std::unordered_map< std::string, std::function< std::vector< size_t >(const std::filesystem::path &, const ObjectMetadata &, Options &)> > custom_dimensions
Definition utils_public.hpp:124
std::unordered_map< std::string, std::unordered_set< std::string > > custom_derived_from
Definition utils_public.hpp:139
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &, bool)> gff_file_strict_check
Definition utils_public.hpp:214
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> bcf_file_strict_check
Definition utils_public.hpp:161
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> bigbed_file_strict_check
Definition utils_public.hpp:176
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &, bool)> fastq_file_strict_check
Definition utils_public.hpp:206
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> custom_global_validate
Definition utils_public.hpp:116
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> rds_file_strict_check
Definition utils_public.hpp:228
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &, bool)> fasta_file_strict_check
Definition utils_public.hpp:198
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &, bool)> bed_file_strict_check
Definition utils_public.hpp:169
std::unordered_map< std::string, std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &)> > custom_validate
Definition utils_public.hpp:110