Skip to content

Commit

Permalink
more work towards #56, skip count for start less than current position
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed Dec 12, 2024
1 parent f12fd2f commit 8a12cd6
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions gtars/src/uniwig/counting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1328,34 +1328,31 @@ pub fn variable_shifted_bam_to_bw( records: &mut Box<Query<noodles::bgzf::reader
adjusted_start_site = shifted_pos - smoothsize;


count += 1;

if adjusted_start_site < 0 {
adjusted_start_site = 0;

Check warning on line 1332 in gtars/src/uniwig/counting.rs

View check run for this annotation

Codecov / codecov/patch

gtars/src/uniwig/counting.rs#L1332

Added line #L1332 was not covered by tests
}

let new_end_site = adjusted_start_site + 1 + smoothsize * 2;
println!("adjusted start site for new coord: {}", adjusted_start_site);
println!("new endsite for new coord: {}", new_end_site);

if new_end_site < current_end_site {
collected_end_sites.insert(0, current_end_site); // put the current end site back into the queue
current_end_site = new_end_site;
} else
{
//println!("adjusted start site for new coord: {}", adjusted_start_site);
//println!("new endsite for new coord: {}", new_end_site);

if new_end_site < current_end_site || coordinate_position > adjusted_start_site{
continue;

Check warning on line 1340 in gtars/src/uniwig/counting.rs

View check run for this annotation

Codecov / codecov/patch

gtars/src/uniwig/counting.rs#L1340

Added line #L1340 was not covered by tests
} else{
collected_end_sites.push(new_end_site);
}

println!("here is all endsites: {:?}", collected_end_sites);
count += 1;
//println!("here is all endsites: {:?}", collected_end_sites);

if adjusted_start_site == prev_coordinate_value {
continue;

Check warning on line 1349 in gtars/src/uniwig/counting.rs

View check run for this annotation

Codecov / codecov/patch

gtars/src/uniwig/counting.rs#L1349

Added line #L1349 was not covered by tests
}

while coordinate_position < adjusted_start_site {
println!("coordinate_position< adjusted_start_site: {} < {} . here is current endsite: {} ", coordinate_position, adjusted_start_site, current_end_site);
//println!("coordinate_position< adjusted_start_site: {} < {} . here is current endsite: {} ", coordinate_position, adjusted_start_site, current_end_site);
while current_end_site == coordinate_position {
println!("current_end_site == coordinate_position {} = {} adjusted start site: {}", current_end_site, coordinate_position, adjusted_start_site);
//println!("current_end_site == coordinate_position {} = {} adjusted start site: {}", current_end_site, coordinate_position, adjusted_start_site);
count = count - 1;

//prev_end_site = current_end_site;
Expand All @@ -1368,7 +1365,7 @@ pub fn variable_shifted_bam_to_bw( records: &mut Box<Query<noodles::bgzf::reader
current_end_site = 0;

Check warning on line 1365 in gtars/src/uniwig/counting.rs

View check run for this annotation

Codecov / codecov/patch

gtars/src/uniwig/counting.rs#L1365

Added line #L1365 was not covered by tests
} else {
current_end_site = collected_end_sites.remove(0);
println!("new endsite deom deque: {}", current_end_site);
//println!("new endsite deom deque: {}", current_end_site);
}
}

Expand Down Expand Up @@ -1530,8 +1527,8 @@ pub fn get_shifted_pos(flags: &Flags, start_site:i32, end_site:i32) -> i32 {
}

Check warning on line 1527 in gtars/src/uniwig/counting.rs

View check run for this annotation

Codecov / codecov/patch

gtars/src/uniwig/counting.rs#L1522-L1527

Added lines #L1522 - L1527 were not covered by tests
}

println!("Here is read.reference_start {} and read.reference_end {}", start_site, end_site);
println!("here is shifted_pos -> {shifted_pos}");
//println!("Here is read.reference_start {} and read.reference_end {}", start_site, end_site);
//println!("here is shifted_pos -> {shifted_pos}");

shifted_pos
}

0 comments on commit 8a12cd6

Please sign in to comment.