Conversation
|
|
||
| #[allow(clippy::too_many_arguments)] | ||
| pub fn derive_subgraph( | ||
| pub fn derive_chunks( |
There was a problem hiding this comment.
Most of the changes to this method are just generalizing from one subgraph/chunk to many
| conn, | ||
| PATH_START_NODE_ID, | ||
| -1, | ||
| 0, |
There was a problem hiding this comment.
Using -1 was the wrong choice, it prevents edges from the start node from showing up when the graph is loaded. I have a to-do to look through the code and see where else this is being done
src/graph_operators.rs
Outdated
| new_sample_name: &str, | ||
| region_name: &str, | ||
| backbone: Option<&str>, | ||
| breakpoints: &str, |
There was a problem hiding this comment.
is there a reason this is a string vs. a vec here?
There was a problem hiding this comment.
No, and vec is better. I moved the parsing into main.rs
8cebcd2 to
dbda662
Compare
Chris7
left a comment
There was a problem hiding this comment.
Just a few comments. I think the range functions are pretty similar but have different behaviors around the edges, which seems like it might make sense to unify them. For errors, I think we need to start using the errors defined more vs. panics (you can see the stuff like FastaError and what I just did in #150). It lets us test the code more effectively, sets us up better for library code, and lets various callers handle the errors in the way that makes sense.
src/graph_operators.rs
Outdated
| end: path_length, | ||
| }); | ||
|
|
||
| chunk_ranges |
There was a problem hiding this comment.
is this supposed to be sorted in some way? or a check that the breakpoints are within the length of the path?
There was a problem hiding this comment.
it seems like this and the above are pretty similar, should these be merged to one function?
There was a problem hiding this comment.
I reworked a bunch of it and moved the range calculation into main.rs, it was mostly straightforward and I think it's better to have it there
src/graph_operators.rs
Outdated
| if (start_coordinate < 0 || start_coordinate > current_path_length) | ||
| || (end_coordinate < 0 || end_coordinate > current_path_length) | ||
| { | ||
| panic!( |
There was a problem hiding this comment.
since you are using result here, can you define error functions for these? It makes it so we can test the code better and handle errors better by delegating the message/etc. to whatever invoked the function.
There was a problem hiding this comment.
Good point, done. I have a to-do to do that wherever else it's needed
dbda662 to
50f4f50
Compare
Example usage: