Thomas 1 year ago
parent
commit
f89f9705d6
2 changed files with 12 additions and 18 deletions
  1. 6 10
      src/lib.rs
  2. 6 8
      src/progs/cramino.rs

+ 6 - 10
src/lib.rs

@@ -1,17 +1,15 @@
 pub mod progs;
 // pub mod runners;
-pub mod utils;
 pub mod runn;
+pub mod utils;
 
 #[cfg(test)]
 mod tests {
-    use std::time;
 
-    use crate::{runn::{BasicProgress, Inc}, utils::Run};
+    use crate::utils::Run;
     use anyhow::anyhow;
     use env_logger::Env;
     use log::info;
-    use tokio::sync::mpsc::Sender;
 
     use self::{progs::cramino::Cramino, runn::TaskManager};
 
@@ -46,15 +44,14 @@ mod tests {
 
         let mut cramino = Cramino::default()
             .with_threads(150)
-            .with_result_path(
-                "/data/longreads_basic_pipe/CAMARA/diag/CAMARA_diag_hs1_cramino.txt",
-                )
-            .with_bam("/data/longreads_basic_pipe/CAMARA/diag/CAMARA_diag_hs1.bam").unwrap();
+            .with_result_path("/data/longreads_basic_pipe/CAMARA/diag/CAMARA_diag_hs1_cramino.txt")
+            .with_bam("/data/longreads_basic_pipe/CAMARA/diag/CAMARA_diag_hs1.bam")
+            .unwrap();
 
         let _ = task_manager
             .spawn(|sender| async move {
                 cramino.run()?;
-                if let Err(_) = sender.send(cramino) {
+                if sender.send(cramino).is_err() {
                     return Err(anyhow!("the receiver dropped"));
                 }
                 Ok(())
@@ -75,6 +72,5 @@ mod tests {
         if let Some(r) = task_manager.try_recv().await {
             println!("{r:?}");
         }
-
     }
 }

+ 6 - 8
src/progs/cramino.rs

@@ -130,14 +130,12 @@ impl RunBin for Cramino {
                     "Checksum" => cramino_res.checksum = parts[1].to_string(),
                     _ => {}
                 }
-            } else {
-                if parts.len() == 2 {
-                    let chromosome = parts[0].to_string();
-                    let count = parts[1].parse().unwrap_or(0.0);
-                    cramino_res
-                        .normalized_read_count_per_chromosome
-                        .insert(chromosome, count);
-                }
+            } else if parts.len() == 2 {
+                let chromosome = parts[0].to_string();
+                let count = parts[1].parse().unwrap_or(0.0);
+                cramino_res
+                    .normalized_read_count_per_chromosome
+                    .insert(chromosome, count);
             }
         }