Skip to content

Commit

Permalink
work on intersect with new report
Browse files Browse the repository at this point in the history
  • Loading branch information
brentp committed Dec 19, 2023
1 parent 03f04af commit e3cac5e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
29 changes: 27 additions & 2 deletions examples/intersect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ struct Args {
help = "fai or genome file that dictates chromosome order"
)]
fai: PathBuf,

#[clap(long, short, help = "count the number of intersections")]
count: bool,

#[clap(long, short = 'b', help = "count the bases of overlaps")]
count_base: bool,
}

fn main() -> io::Result<()> {
Expand Down Expand Up @@ -81,8 +87,27 @@ fn main() -> io::Result<()> {
&args.a_requirements,
&args.b_requirements,
);
eprintln!("{:?}", report);
eprintln!("a reqs: {:?}", args.a_requirements);
//eprintln!("{:?} {:?}", report.len(), report);
//eprintln!("a reqs: {:?}", args.a_requirements);

if args.count {
writeln!(
&mut stdout,
"{}\t{}\t{}\t{}",
intersection.base_interval.chrom(),
intersection.base_interval.start(),
intersection.base_interval.stop(),
// count reports by id.
// TODO: currently just collects the ids.
report
.iter()
.map(|r| r.id.to_string())
.collect::<Vec<_>>()
.join(",")
)?;
stdout.flush()?;
continue;
}

writeln!(
&mut stdout,
Expand Down
5 changes: 0 additions & 5 deletions src/intersections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,6 @@ impl Intersections {
b_requirements,
b_mode,
) {
eprintln!(
"total_bases_overlap: {} a length: {}",
total_bases_overlap,
self.base_interval.stop() - self.base_interval.start()
);
self.push_overlap_fragments(&mut result, overlaps, a_part, b_part, b_idx);
}
}
Expand Down

0 comments on commit e3cac5e

Please sign in to comment.