33 const std::string type_name =
"fasta_file";
34 const auto& famap = internal_json::extract_typed_object_from_metadata(metadata.
other, type_name);
36 const std::string version_name =
"version";
37 const std::string& vstring = internal_json::extract_string_from_typed_object(famap, version_name, type_name);
38 auto version = ritsuko::parse_version_string(vstring.c_str(), vstring.size(),
true);
39 if (version.major != 1) {
40 throw std::runtime_error(
"unsupported version string '" + vstring +
"'");
43 internal_files::check_sequence_type(famap, type_name.c_str());
46 bool indexed = internal_files::is_indexed(famap);
47 auto fpath = path /
"file.fasta.";
54 internal_files::check_gzip_signature(fpath);
55 auto reader = internal_other::open_reader<byteme::GzipFileReader>(fpath, 10);
56 byteme::PerByte<> pb(&reader);
57 if (!pb.valid() || pb.get() !=
'>') {
58 throw std::runtime_error(
"FASTA file does not start with '>'");
62 auto fixpath = path /
"file.fasta.fai";
63 if (!std::filesystem::exists(fixpath)) {
64 throw std::runtime_error(
"missing FASTA index file");
69 if (!std::filesystem::exists(ixpath)) {
70 throw std::runtime_error(
"missing BGZF index file");
void validate(const std::filesystem::path &path, const ObjectMetadata &metadata, Options &options)
Definition fasta_file.hpp:32
std::function< void(const std::filesystem::path &, const ObjectMetadata &, Options &, bool)> fasta_file_strict_check
Definition utils_public.hpp:199