Skip to content

Commit

Permalink
typos and tweak in odgi flip
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGuarracino committed Oct 21, 2022
1 parent 0b21b35 commit 98c139e
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions src/subcommand/flip_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,43 +79,43 @@ int main_flip(int argc, char **argv) {

graph.set_number_of_threads(num_threads);

// path loading
auto load_paths = [&](const std::string& path_names_file) {
std::ifstream path_names_in(path_names_file);
uint64_t num_of_paths_in_file = 0;
std::vector<bool> path_already_seen;
path_already_seen.resize(graph.get_path_count(), false);
std::string line;
std::vector<path_handle_t> paths;
while (std::getline(path_names_in, line)) {
if (!line.empty()) {
if (graph.has_path(line)) {
const path_handle_t path = graph.get_path_handle(line);
const uint64_t path_rank = as_integer(path) - 1;
if (!path_already_seen[path_rank]) {
path_already_seen[path_rank] = true;
paths.push_back(path);
} else {
std::cerr << "[odgi::untangle] error: in the path list there are duplicated path names."
<< std::endl;
exit(1);
std::vector<path_handle_t> no_flips;
if (_no_flips) {
// path loading
auto load_paths = [&](const std::string& path_names_file) {
std::ifstream path_names_in(path_names_file);
uint64_t num_of_paths_in_file = 0;
std::vector<bool> path_already_seen;
path_already_seen.resize(graph.get_path_count(), false);
std::string line;
std::vector<path_handle_t> paths;
while (std::getline(path_names_in, line)) {
if (!line.empty()) {
if (graph.has_path(line)) {
const path_handle_t path = graph.get_path_handle(line);
const uint64_t path_rank = as_integer(path) - 1;
if (!path_already_seen[path_rank]) {
path_already_seen[path_rank] = true;
paths.push_back(path);
} else {
std::cerr << "[odgi::flip] error: in the path list there are duplicated path names."
<< std::endl;
exit(1);
}
}
++num_of_paths_in_file;
}
++num_of_paths_in_file;
}
}
path_names_in.close();
std::cerr << "[odgi::untangle] found " << paths.size() << "/" << num_of_paths_in_file
<< " paths to consider." << std::endl;
if (paths.empty()) {
std::cerr << "[odgi::untangle] error: no path to consider." << std::endl;
exit(1);
}
return paths;
};
path_names_in.close();
std::cerr << "[odgi::flip] found " << paths.size() << "/" << num_of_paths_in_file
<< " paths to consider." << std::endl;
if (paths.empty()) {
std::cerr << "[odgi::flip] error: no path to consider." << std::endl;
exit(1);
}
return paths;
};

std::vector<path_handle_t> no_flips;
if (_no_flips) {
no_flips = load_paths(args::get(_no_flips));
}

Expand Down

0 comments on commit 98c139e

Please sign in to comment.