Skip to content

Commit

Permalink
Update contigs.
Browse files Browse the repository at this point in the history
  • Loading branch information
hhandika committed Feb 5, 2024
1 parent 0938b57 commit 222b134
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/handler/contig/summarize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,35 @@ impl<'a> ContigSummaryHandler<'a> {
}

fn summarize_contigs(&self) -> Vec<ContigSummary> {
if self.files.is_empty() {
panic!("No contig files found")
}

if files.len() == 1 {
return vec![self.process_contigs(&self.files[0])];
}

let (sender, receiver) = channel();

self.files.par_iter().for_each_with(sender, |s, p| {
let mut summary = ContigSummary::new();
summary.summarize(p, self.input_fmt);
let summary = self.process_contigs(p);
s.send(summary).expect("Failed sending data");
});

receiver.iter().collect()
}

fn process_contigs(&self, input: &Path) -> ContigSummary {
let mut summary = ContigSummary::new();
summary.summarize(input, self.input_fmt);
summary
}

fn print_input_info(&self) {
log::info!("{}", "Output".yellow());
log::info!("{:18}: {}", "Dir", self.output.display());
}

fn print_input_info(&self) {
log::info!("{}", "Output".yellow());
log::info!("{:18}: {}", "Dir", self.output.display());
Expand Down

0 comments on commit 222b134

Please sign in to comment.