|
|
@@ -9,9 +9,9 @@ use log::info;
|
|
|
use rayon::prelude::*;
|
|
|
use rust_htslib::bam::{Format, Header, Read, Record, Writer};
|
|
|
use std::{
|
|
|
- collections::{HashMap, HashSet},
|
|
|
+ collections::HashSet,
|
|
|
fs::{self, File},
|
|
|
- io::{self, BufReader, BufWriter, Write}, sync::Arc,
|
|
|
+ io::{self, BufReader, BufWriter, Write},
|
|
|
};
|
|
|
|
|
|
pub mod bam;
|
|
|
@@ -93,7 +93,6 @@ pub fn scan_save(
|
|
|
})
|
|
|
.collect();
|
|
|
|
|
|
- info!("🆗");
|
|
|
let bam = rust_htslib::bam::IndexedReader::from_path(bam_path).unwrap();
|
|
|
let header = bam.header().to_owned();
|
|
|
let mut grouped_records = Vec::new();
|
|
|
@@ -134,12 +133,11 @@ pub fn scan_save(
|
|
|
|
|
|
for outlier_record in outliers_records {
|
|
|
let hm_positions: DashMap<String, Vec<String>> = DashMap::new();
|
|
|
- // let bam_clone = Arc::clone(&mut bam);
|
|
|
|
|
|
outlier_record.par_iter().for_each(|r| {
|
|
|
let r = r.clone();
|
|
|
if let Ok(positions) = get_all_positions(&r, bam_path) {
|
|
|
- // if let Ok(positions) = get_all_positions(&r, &header, &mut bam) {
|
|
|
+ // if let Ok(positions) = get_all_positions(&r, &header, &mut bam) {
|
|
|
let qname = String::from_utf8_lossy(r.qname()).to_string();
|
|
|
for pos in positions {
|
|
|
hm_positions
|
|
|
@@ -173,7 +171,6 @@ pub fn scan_save(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- info!("n groups {}", grouped_records.len());
|
|
|
let mut dedup = HashSet::new();
|
|
|
let mut n_records = 0;
|
|
|
let grouped_records: Vec<Vec<Record>> = grouped_records
|
|
|
@@ -201,7 +198,7 @@ pub fn scan_save(
|
|
|
|
|
|
if !grouped_records.is_empty() {
|
|
|
info!(
|
|
|
- "{} reads to assemble in {} groups",
|
|
|
+ "{contig}:{start}-{end}, {} reads to assemble in {} groups",
|
|
|
n_records,
|
|
|
grouped_records.len()
|
|
|
);
|