Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odgi viz: longer path names by default; odgi positions: emit all positions #573

Merged
merged 2 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/subcommand/position_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ int main_position(int argc, char** argv) {
args::ValueFlag<uint64_t> _search_radius(position_opts, "DISTANCE", "Limit coordinate conversion breadth-first search up to DISTANCE bp from each given position (default: 10000).", {'d',"search-radius"});
args::ValueFlag<uint64_t> _walking_dist(position_opts, "N", "Maximum walking distance in nucleotides for one orientation when finding the best target (reference) range for each query path (default: 10000). Note: If we walked 9999 base pairs and **w, --jaccard-context** is **10000**, we will also include the next node, even if we overflow the actual limit.",
{'w', "jaccard-context"});
args::Flag all_positions_of_ref_path(position_opts, "all-positions", "Emit all positions for all nodes in the specified ref-paths.", {"all-positions"});
args::Group threading_opts(parser, "[ Threading ]");
args::ValueFlag<uint64_t> threads(threading_opts, "N", "Number of threads to use for parallel operations.", {'t', "threads"});
args::Group processing_info_opts(parser, "[ Processing Information ]");
Expand Down Expand Up @@ -141,6 +142,24 @@ int main_position(int argc, char** argv) {
target_graph.for_each_path_handle([&](const path_handle_t& path) { ref_paths.push_back(path); });
}

if (ref_paths.size() > 0 && args::get(all_positions_of_ref_path)){
std::cout << "path\tnode_id\tposition" << std::endl;
for (auto &path_handle : ref_paths) {
uint64_t walked = 0;
const auto path_end = target_graph.path_end(path_handle);
auto path_name = target_graph.get_path_name(path_handle);
for (step_handle_t cur_step = target_graph.path_begin(path_handle);
cur_step != path_end;
cur_step = target_graph.get_next_step(cur_step)) {
const handle_t cur_handle = target_graph.get_handle_of_step(cur_step);
std::cout << path_name << "\t"
<< target_graph.get_id(cur_handle) << "\t"
<< walked << std::endl;
walked += target_graph.get_length(cur_handle);
}
}
}

std::unordered_map<std::string, std::tuple<std::string, uint64_t, uint64_t>> path_start_end_pos_map;
std::string gff_in_file;
if (gff_input) {
Expand Down
4 changes: 2 additions & 2 deletions src/subcommand/viz_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace odgi {
args::Flag color_path_names_background(path_names_viz_opts, "bool", "Color path names background with the same color as paths.",{'C', "color-path-names-background"});
args::ValueFlag<size_t> _max_num_of_characters(path_names_viz_opts, "N", "Maximum number of characters to display for each path name (max 128"
" characters). The default value is *the length of the longest path"
" name* (up to 32 characters).",{'c', "max-num-of-characters"});
" name* (up to 128 characters).",{'c', "max-num-of-characters"});

/// Binned mode
args::Group bin_opts(parser, "[ Binned Mode Options ]");
Expand Down Expand Up @@ -395,7 +395,7 @@ namespace odgi {
}
}

const size_t max_num_of_characters = args::get(_max_num_of_characters) > 1 ? min(args::get(_max_num_of_characters), (size_t) PATH_NAMES_MAX_NUM_OF_CHARACTERS) : 32;
const size_t max_num_of_characters = args::get(_max_num_of_characters) > 1 ? min(args::get(_max_num_of_characters), (size_t) PATH_NAMES_MAX_NUM_OF_CHARACTERS) : PATH_NAMES_MAX_NUM_OF_CHARACTERS;

uint64_t path_count = graph.get_path_count();
const uint64_t pix_per_path = args::get(path_height) ? args::get(path_height) : 10;
Expand Down