Skip to content

Commit

Permalink
all i32
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGuarracino committed Jan 26, 2025
1 parent 8261473 commit 02a8069
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
14 changes: 7 additions & 7 deletions src/impg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@ impl Impg {
range_start: i32,
range_end: i32,
masked_regions: Option<&FxHashMap<u32, SortedRanges>>,
max_depth: u16,
min_interval_size: u32,
min_distance_between_ranges: u32,
max_depth: i32,
min_interval_size: i32,
min_distance_between_ranges: i32,
) -> Vec<AdjustedInterval> {
let mut results = Vec::new();
// Add the input range to the results
Expand All @@ -416,7 +416,7 @@ impl Impg {
}
));
// Initialize stack with first query
let mut stack = vec![(target_id, range_start, range_end, 0u16)];
let mut stack = vec![(target_id, range_start, range_end, 0i32)];
// Initialize visited ranges from masked regions if provided
let mut visited_ranges: FxHashMap<u32, SortedRanges> = if let Some(m) = masked_regions {
m.iter()
Expand Down Expand Up @@ -488,14 +488,14 @@ impl Impg {
if idx > 0 {
// Check previous range
let (_, prev_end) = ranges.ranges[idx - 1];
if ((new_min - prev_end).abs() as u32) < min_distance_between_ranges {
if (new_min - prev_end).abs() < min_distance_between_ranges {
should_add = false;
}
}
if should_add && idx < ranges.ranges.len() {
// Check next range
let (next_start, _) = ranges.ranges[idx];
if ((next_start - new_max).abs() as u32) < min_distance_between_ranges {
if (next_start - new_max).abs() < min_distance_between_ranges {
should_add = false;
}
}
Expand All @@ -506,7 +506,7 @@ impl Impg {

// Add non-overlapping portions to stack
for (new_start, new_end) in new_ranges {
if ((new_end - new_start).abs() as u32) >= min_interval_size {
if (new_end - new_start).abs() >= min_interval_size {
stack.push((metadata.query_id, new_start, new_end, current_depth + 1));
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,23 @@ enum Args {

/// Maximum distance between intervals to merge.
#[clap(short = 'd', long, value_parser, default_value_t = 10000)]
merge_distance: usize,
merge_distance: i32,

/// Minimum length for intervals.
#[clap(short = 'l', long, value_parser, default_value_t = 5000)]
min_length: usize,
min_length: i32,

/// Maximum recursion depth for transitive overlaps (0 for no limit).
#[clap(short = 'm', long, value_parser, default_value_t = 1)]
max_depth: u16,
max_depth: i32,

/// Minimum size of intervals to consider for transitive queries
#[clap(long, value_parser, default_value_t = 0)]
min_interval_size: u32,
min_interval_size: i32,

/// Minimum distance between transitive ranges to consider on the same sequence
#[clap(long, value_parser, default_value_t = 0)]
min_distance_between_ranges: u32,
min_distance_between_ranges: i32,
},
/// Query overlaps in the alignment.
Query {
Expand All @@ -87,15 +87,15 @@ enum Args {

/// Maximum recursion depth for transitive overlaps (0 for no limit).
#[clap(short = 'm', long, value_parser, default_value_t = 1)]
max_depth: u16,
max_depth: i32,

/// Minimum size of intervals to consider for transitive queries
#[clap(long, value_parser, default_value_t = 0)]
min_interval_size: u32,
min_interval_size: i32,

/// Minimum distance between transitive ranges to consider on the same sequence
#[clap(long, value_parser, default_value_t = 0)]
min_distance_between_ranges: u32,
min_distance_between_ranges: i32,

/// Output results in PAF format.
#[clap(short = 'P', long, action)]
Expand Down Expand Up @@ -325,9 +325,9 @@ fn perform_query(
target_name: &str,
target_range: (i32, i32),
transitive: bool,
max_depth: u16,
min_interval_size: u32,
min_distance_between_ranges: u32
max_depth: i32,
min_interval_size: i32,
min_distance_between_ranges: i32
) -> 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");
Expand Down
12 changes: 6 additions & 6 deletions src/partition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ pub fn partition_alignments(
impg: &Impg,
window_size: usize,
sequence_prefix: &str,
min_length: usize,
merge_distance: usize,
max_depth: u16,
min_interval_size: u32,
min_distance_between_ranges: u32,
min_length: i32,
merge_distance: i32,
max_depth: i32,
min_interval_size: i32,
min_distance_between_ranges: i32,
debug: bool,
) -> io::Result<()> {
// Get all sequences with the given prefix
Expand Down Expand Up @@ -128,7 +128,7 @@ pub fn partition_alignments(
// Ignore CIGAR strings and target intervals.
debug!(" Merging overlaps closer than {}bp", merge_distance); // bedtools sort | bedtools merge -d merge_distance
//let merge_start = Instant::now();
merge_overlaps(&mut overlaps, merge_distance as i32);
merge_overlaps(&mut overlaps, merge_distance);
//let merge_time = merge_start.elapsed();
debug!(" Collected {} query overlaps after merging", overlaps.len());

Expand Down

0 comments on commit 02a8069

Please sign in to comment.