Skip to content

Commit

Permalink
correction: read counts [#1]
Browse files Browse the repository at this point in the history
  • Loading branch information
esteinig committed Mar 15, 2022
1 parent fd95c82 commit aa55281
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ float_eq = "0.6.1"
rust-lapper = "1.0.0"
noodles = { version = "0.20.0", features = ["fasta"] }
crossterm = "0.23.0"
itertools = "0.10.3"

[[bin]]
name = "vircov"
path = "src/main.rs"
9 changes: 4 additions & 5 deletions src/paf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::PathBuf;
use thiserror::Error;
use itertools::Itertools;

/*
========================
Expand Down Expand Up @@ -143,12 +144,10 @@ impl PafFile {


// Get the number of unique reads in the alignments
let mut reads = targets.iter().map(|interval| interval.val.to_owned()).collect::<Vec<String>>();
reads.dedup_by(|a, b| a == b);
let reads: Vec<String> = targets.iter().map(|interval| interval.val.to_owned()).collect::<Vec<String>>();
let unique_reads = reads.into_iter().unique().collect::<Vec<String>>();

println!("{:?}", reads);

println!("{}\t{}\t{}\t{}\t{}\t{}\t{:.4}\t{}", &target_name, target_cov_n, reads.len(), targets.len(), target_cov_bp, target_seq_len_display, target_seq_cov, tags);
println!("{}\t{}\t{}\t{}\t{}\t{}\t{:.4}\t{}", &target_name, target_cov_n, unique_reads.len(), targets.len(), target_cov_bp, target_seq_len_display, target_seq_cov, tags);
}

Ok(())
Expand Down

0 comments on commit aa55281

Please sign in to comment.