STEIMLE Thomas 2 недель назад
Родитель
Сommit
1fcf1c5c22
9 измененных файлов с 32 добавлено и 27 удалено
  1. 1 1
      src/annotation/mod.rs
  2. 1 1
      src/callers/mod.rs
  3. 6 6
      src/commands/mod.rs
  4. 0 1
      src/config.rs
  5. 1 1
      src/helpers.rs
  6. 9 4
      src/io/fasta.rs
  7. 1 1
      src/lib.rs
  8. 1 1
      src/uniqueness/genome_index.rs
  9. 12 11
      src/uniqueness/mod.rs

+ 1 - 1
src/annotation/mod.rs

@@ -1,10 +1,10 @@
 pub mod alpha_genome;
 pub mod cosmic;
+pub mod dbsnp;
 pub mod echtvar;
 pub mod gnomad;
 pub mod ncbi;
 pub mod vep;
-pub mod dbsnp;
 
 use std::{
     collections::{HashMap, HashSet},

+ 1 - 1
src/callers/mod.rs

@@ -153,11 +153,11 @@ pub mod coral;
 pub mod deep_somatic;
 pub mod deep_variant;
 pub mod gatk;
+pub mod longcallD;
 pub mod nanomonsv;
 pub mod savana;
 pub mod severus;
 pub mod straglr;
-pub mod longcallD;
 
 /// Runs all somatic variant callers sequentially for comprehensive multi-caller analysis.
 ///

+ 6 - 6
src/commands/mod.rs

@@ -1082,8 +1082,7 @@ macro_rules! run_many {
 pub fn exec_jobs_locally(
     jobs: Vec<Vec<Box<dyn AnyJob>>>,
     max_par: usize,
-) -> anyhow::Result<Vec<CapturedOutput>>
-{
+) -> anyhow::Result<Vec<CapturedOutput>> {
     let pool = rayon::ThreadPoolBuilder::new()
         .num_threads(max_par)
         .build()
@@ -1113,8 +1112,10 @@ pub fn exec_jobs_locally(
 ///
 /// # Panics
 /// Panics if `max_par` is 0.
-pub fn exec_jobs_slurm(jobs: Vec<Vec<Box<dyn AnyJob>>>, max_par: usize) -> anyhow::Result<Vec<CapturedOutput>>
-{
+pub fn exec_jobs_slurm(
+    jobs: Vec<Vec<Box<dyn AnyJob>>>,
+    max_par: usize,
+) -> anyhow::Result<Vec<CapturedOutput>> {
     let pool = rayon::ThreadPoolBuilder::new()
         .num_threads(max_par)
         .build()
@@ -1188,8 +1189,7 @@ pub fn exec_jobs(
     jobs: Vec<Vec<Box<dyn AnyJob>>>,
     with_slurm: bool,
     max_par: usize,
-) -> anyhow::Result<Vec<CapturedOutput>>
-{
+) -> anyhow::Result<Vec<CapturedOutput>> {
     if with_slurm {
         exec_jobs_slurm(jobs, max_par)
     } else {

+ 0 - 1
src/config.rs

@@ -1268,7 +1268,6 @@ impl Config {
             self.haplotagged_bam_tag_name
         )
     }
-
 }
 
 impl Default for Config {

+ 1 - 1
src/helpers.rs

@@ -1468,7 +1468,7 @@ mod tests {
         while rec < max_rec {
             for n_parts in [1, 2, 3, 4, 7, 10, 60, 100] {
                 let parts = split_ordered_genome_into_n_regions_exact(&genome, n_parts);
-                
+
                 let r = regions_hash.insert(parts.iter().flatten().join(", "));
                 if rec > 0 && r {
                     panic!("Not deterministic !");

+ 9 - 4
src/io/fasta.rs

@@ -165,7 +165,9 @@ pub fn read_single_contig_fasta(path: &Path) -> anyhow::Result<Vec<u8>> {
     let mut seq = Vec::new();
     for line in reader.lines() {
         let line = line?;
-        if line.starts_with('>') { continue; }
+        if line.starts_with('>') {
+            continue;
+        }
         let sanitized = line.bytes().map(|b| match b.to_ascii_uppercase() {
             b'A' | b'C' | b'G' | b'T' => b.to_ascii_uppercase(),
             _ => b'N',
@@ -178,7 +180,7 @@ pub fn read_single_contig_fasta(path: &Path) -> anyhow::Result<Vec<u8>> {
 
 pub struct FaiEntry {
     pub name: String,
-    pub len:  usize,
+    pub len: usize,
 }
 
 pub fn read_fai(path: &Path) -> anyhow::Result<Vec<FaiEntry>> {
@@ -190,8 +192,11 @@ pub fn read_fai(path: &Path) -> anyhow::Result<Vec<FaiEntry>> {
             let l = l?;
             let mut cols = l.split('\t');
             let name = cols.next().context("fai: missing name")?.to_owned();
-            let len  = cols.next().context("fai: missing len")?.parse::<usize>()
-                           .context("fai: bad len")?;
+            let len = cols
+                .next()
+                .context("fai: missing len")?
+                .parse::<usize>()
+                .context("fai: bad len")?;
             Ok(FaiEntry { name, len })
         })
         .collect()

+ 1 - 1
src/lib.rs

@@ -149,8 +149,8 @@ pub mod positions;
 pub mod runners;
 pub mod scan;
 pub mod slurm_helpers;
-pub mod variant;
 pub mod uniqueness;
+pub mod variant;
 
 #[macro_use]
 extern crate lazy_static;

+ 1 - 1
src/uniqueness/genome_index.rs

@@ -1,8 +1,8 @@
 // src/uniqueness/genome_index.rs
 
+use log::{info, warn};
 use std::collections::HashMap;
 use std::path::Path;
-use log::{info, warn};
 
 use anyhow::Context;
 

+ 12 - 11
src/uniqueness/mod.rs

@@ -1,7 +1,7 @@
+use log::{info, warn};
 use std::fs;
 use std::io::{self, BufReader, BufWriter, Read, Write};
 use std::path::{Path, PathBuf};
-use log::{info, warn};
 
 mod cache;
 mod genome_index;
@@ -15,20 +15,22 @@ use suffix::{build_lcp_kasai, build_suffix_array};
 /// Pure computation: genome bytes → min_unique_len vector.
 /// Separated so GenomeIndex can call it without going through build_with_cache.
 fn build_min_unique_len(genome: &[u8]) -> Vec<usize> {
-    let n   = genome.len();
-    let sa  = build_suffix_array(genome);
+    let n = genome.len();
+    let sa = build_suffix_array(genome);
     let lcp = build_lcp_kasai(genome, &sa);
 
     let mut rank = vec![0usize; n];
-    for (i, &s) in sa.iter().enumerate() { rank[s] = i; }
+    for (i, &s) in sa.iter().enumerate() {
+        rank[s] = i;
+    }
 
     let mut mul = vec![usize::MAX; n];
     for p in 0..n {
-        let r     = rank[p];
-        let left  = if r > 0     { lcp[r]     } else { 0 };
+        let r = rank[p];
+        let left = if r > 0 { lcp[r] } else { 0 };
         let right = if r + 1 < n { lcp[r + 1] } else { 0 };
-        let k     = left.max(right) + 1;
-        mul[p]    = if p + k <= n { k } else { usize::MAX };
+        let k = left.max(right) + 1;
+        mul[p] = if p + k <= n { k } else { usize::MAX };
     }
     mul
 }
@@ -66,7 +68,7 @@ impl UniquenessIndex {
         if cache_path.exists() {
             match load_from_cache(&cache_path, genome.len()) {
                 Ok(mul) => return Ok(Self::from_raw(mul)),
-                Err(e)  => warn!("[cache] invalid ({e}), rebuilding..."),
+                Err(e) => warn!("[cache] invalid ({e}), rebuilding..."),
             }
         }
         let mul = build_min_unique_len(genome);
@@ -548,8 +550,7 @@ mod tests {
             }
         }
     }
-        use crate::helpers::test_init;
-
+    use crate::helpers::test_init;
 
     #[test]
     fn uniqueness_genome() -> anyhow::Result<()> {