Skip to content

Commit

Permalink
ensure that target end <= target len
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGuarracino committed May 20, 2024
1 parent 7a8bfc1 commit c813386
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ fn load_index(paf_file: &str) -> io::Result<Impg> {
fn perform_query(impg: &Impg, target_name: &str, target_range: (i32, i32), transitive: bool) -> Vec<AdjustedInterval> {
let (target_start, target_end) = target_range;
let target_id = impg.seq_index.get_id(target_name).expect("Target name not found in index");
let target_length = impg.seq_index.get_len_from_id(target_id).expect("Target length not found in index");
if target_end > target_length as i32 {
panic!("Target range end ({}) exceeds the target sequence length ({})", target_end, target_length);
}
if transitive {
impg.query_transitive(target_id, target_start, target_end)
} else {
Expand Down

0 comments on commit c813386

Please sign in to comment.