30inline uint64_t
validate_genes(
const std::string& prefix,
const std::vector<std::string>& types) {
32 uint64_t num_genes = 0;
33 for (
auto t : types) {
34 auto candidate = internal::check_genes(prefix + t +
".tsv.gz");
36 num_genes = candidate;
38 }
else if (candidate != num_genes) {
39 throw std::runtime_error(
"inconsistent number of genes between types (" + std::to_string(num_genes) +
" for " + types.front() +
", " + std::to_string(candidate) +
" for " + t +
")");
44 throw std::runtime_error(
"at least one gene name type should be present");
60 std::vector<std::string> types;
62 std::filesystem::path path(prefix);
63 auto dir = path.parent_path();
64 auto raw_prefix = path.filename().string();
66 for (
const auto& entry : std::filesystem::directory_iterator(dir)) {
67 std::string name = entry.path().filename().string();
68 if (name.rfind(raw_prefix, 0) != 0) {
71 if (name.size() < 6) {
74 size_t ext_loc = name.size() - 7;
75 if (name.rfind(
".tsv.gz", ext_loc) != ext_loc) {
78 types.push_back(name.substr(raw_prefix.size(), ext_loc - raw_prefix.size()));