diff --git a/examples/intersect.rs b/examples/intersect.rs index 90f0885..2dc7950 100644 --- a/examples/intersect.rs +++ b/examples/intersect.rs @@ -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<()> { @@ -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::>() + .join(",") + )?; + stdout.flush()?; + continue; + } writeln!( &mut stdout, diff --git a/src/intersections.rs b/src/intersections.rs index 0e60d48..2c6dd74 100644 --- a/src/intersections.rs +++ b/src/intersections.rs @@ -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); } }