diff --git a/src/derive/command/encoding.rs b/src/derive/command/encoding.rs index a85d30c..5b3ee52 100644 --- a/src/derive/command/encoding.rs +++ b/src/derive/command/encoding.rs @@ -1,15 +1,12 @@ //! Functionality relating to the `ngs derive encoding` subcommand itself. +use anyhow::{Context, Ok}; +use clap::Args; +use noodles::bam; +use num_format::{Locale, ToFormattedString}; use std::collections::HashSet; use std::io::BufReader; use std::path::PathBuf; - -use anyhow::Context; -use anyhow::Ok; -use clap::Args; -use noodles::bam; -use num_format::Locale; -use num_format::ToFormattedString; use tracing::info; use crate::derive::encoding::compute; diff --git a/src/derive/command/endedness.rs b/src/derive/command/endedness.rs index a35b390..5a457e0 100644 --- a/src/derive/command/endedness.rs +++ b/src/derive/command/endedness.rs @@ -1,16 +1,12 @@ //! Functionality relating to the `ngs derive endedness` subcommand itself. -use std::collections::HashMap; -use std::collections::HashSet; -use std::path::PathBuf; -use std::sync::Arc; - use anyhow::Context; use clap::Args; -use num_format::Locale; -use num_format::ToFormattedString; -use tracing::info; -use tracing::trace; +use num_format::{Locale, ToFormattedString}; +use std::collections::{HashMap, HashSet}; +use std::path::PathBuf; +use std::sync::Arc; +use tracing::{info, trace}; use crate::derive::endedness::compute; use crate::derive::endedness::compute::OrderingFlagsCounts; diff --git a/src/derive/command/instrument.rs b/src/derive/command/instrument.rs index 26c102f..93690ba 100644 --- a/src/derive/command/instrument.rs +++ b/src/derive/command/instrument.rs @@ -2,8 +2,7 @@ use anyhow::bail; use clap::Args; -use num_format::Locale; -use num_format::ToFormattedString; +use num_format::{Locale, ToFormattedString}; use std::collections::HashSet; use std::path::PathBuf; use tracing::info; diff --git a/src/derive/command/junction_annotation.rs b/src/derive/command/junction_annotation.rs index c265867..def6281 100644 --- a/src/derive/command/junction_annotation.rs +++ b/src/derive/command/junction_annotation.rs @@ -1,15 +1,12 @@ //! Functionality relating to the `ngs derive junction-annotation` subcommand itself. -use std::collections::HashMap; -use std::path::PathBuf; - use anyhow::Context; use clap::Args; use noodles::sam::record::MappingQuality; -use num_format::Locale; -use num_format::ToFormattedString; -use tracing::debug; -use tracing::info; +use num_format::{Locale, ToFormattedString}; +use std::collections::HashMap; +use std::path::PathBuf; +use tracing::{debug, info}; use crate::derive::junction_annotation::compute; use crate::derive::junction_annotation::results::JunctionAnnotationResults; diff --git a/src/derive/command/readlen.rs b/src/derive/command/readlen.rs index e6b0c51..f5c2246 100644 --- a/src/derive/command/readlen.rs +++ b/src/derive/command/readlen.rs @@ -1,12 +1,10 @@ //! Functionality relating to the `ngs derive readlen` subcommand itself. -use std::collections::HashMap; -use std::path::PathBuf; - use anyhow::Context; use clap::Args; -use num_format::Locale; -use num_format::ToFormattedString; +use num_format::{Locale, ToFormattedString}; +use std::collections::HashMap; +use std::path::PathBuf; use tracing::info; use crate::derive::readlen::compute; diff --git a/src/derive/command/strandedness.rs b/src/derive/command/strandedness.rs index bc10479..5ce71d7 100644 --- a/src/derive/command/strandedness.rs +++ b/src/derive/command/strandedness.rs @@ -1,23 +1,17 @@ //! Functionality relating to the `ngs derive strandedness` subcommand itself. -use std::collections::HashMap; -use std::collections::HashSet; -use std::fs::File; -use std::path::PathBuf; - -use anyhow::bail; -use anyhow::Context; +use anyhow::{bail, Context}; use clap::Args; -use noodles::bam; -use noodles::gff; use noodles::sam::record::MappingQuality; +use noodles::{bam, gff}; use rust_lapper::{Interval, Lapper}; -use tracing::debug; -use tracing::info; +use std::collections::{HashMap, HashSet}; +use std::fs::File; +use std::path::PathBuf; +use tracing::{debug, info}; -use crate::derive::strandedness::compute; use crate::derive::strandedness::compute::ParsedBAMFile; -use crate::derive::strandedness::results; +use crate::derive::strandedness::{compute, results}; use crate::utils::formats; use crate::utils::read_groups::validate_read_group_info; diff --git a/src/derive/endedness/compute.rs b/src/derive/endedness/compute.rs index d70633c..388b6a2 100644 --- a/src/derive/endedness/compute.rs +++ b/src/derive/endedness/compute.rs @@ -1,7 +1,6 @@ //! Module holding the logic for computing the endedness of a BAM. -use std::collections::HashMap; -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; use std::ops::{Add, AddAssign}; use std::sync::Arc; use tracing::warn; diff --git a/src/derive/instrument/compute.rs b/src/derive/instrument/compute.rs index 59ce1ed..8af7b9e 100644 --- a/src/derive/instrument/compute.rs +++ b/src/derive/instrument/compute.rs @@ -1,14 +1,11 @@ //! Combines the flowcell and instrument checks into a single workflow. -use std::collections::HashMap; -use std::collections::HashSet; - use regex::Regex; use serde::Serialize; +use std::collections::{HashMap, HashSet}; use tracing::debug; -use super::flowcells; -use super::instruments; +use crate::derive::instrument::{flowcells, instruments}; /// Generalized struct for holding instrument detection results. #[derive(Debug, Default, Serialize)] diff --git a/src/derive/instrument/flowcells.rs b/src/derive/instrument/flowcells.rs index 4bb2389..b339cfa 100644 --- a/src/derive/instrument/flowcells.rs +++ b/src/derive/instrument/flowcells.rs @@ -1,7 +1,6 @@ //! Knowledge about which flowcells map to which machine types. -use std::collections::HashMap; -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; /// Encapsulates the knowledge we currently have on which flowcell patterns map /// to which machine types as a [`HashMap`]. diff --git a/src/derive/instrument/instruments.rs b/src/derive/instrument/instruments.rs index e10b114..a1df971 100644 --- a/src/derive/instrument/instruments.rs +++ b/src/derive/instrument/instruments.rs @@ -1,7 +1,6 @@ //! Knowledge about which instrument ids map to which machine types. -use std::collections::HashMap; -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; /// Encapsulates the knowledge we currently have on which instrument name patterns map /// to which machine types as a [`HashMap`]. diff --git a/src/derive/junction_annotation/compute.rs b/src/derive/junction_annotation/compute.rs index 428daac..3c6b5ee 100644 --- a/src/derive/junction_annotation/compute.rs +++ b/src/derive/junction_annotation/compute.rs @@ -1,14 +1,12 @@ //! Module holding the logic for annotating junctions. -use anyhow::bail; -use anyhow::Ok; +use anyhow::{bail, Ok}; use noodles::core::Position; use noodles::sam::alignment::Record; use noodles::sam::record::cigar::op::Kind; use noodles::sam::record::MappingQuality; use noodles::sam::Header; -use std::collections::HashMap; -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; use crate::derive::junction_annotation::results; use crate::utils::alignment::filter_by_mapq; diff --git a/src/derive/junction_annotation/results.rs b/src/derive/junction_annotation/results.rs index edd1dd3..9e363cc 100644 --- a/src/derive/junction_annotation/results.rs +++ b/src/derive/junction_annotation/results.rs @@ -2,8 +2,7 @@ use noodles::core::Position; use serde::ser::SerializeStruct; -use serde::Serialize; -use serde::Serializer; +use serde::{Serialize, Serializer}; use std::collections::HashMap; /// A junction is a tuple of (start, end) coordinates. diff --git a/src/derive/strandedness/compute.rs b/src/derive/strandedness/compute.rs index 6fffda5..7133adc 100644 --- a/src/derive/strandedness/compute.rs +++ b/src/derive/strandedness/compute.rs @@ -1,7 +1,8 @@ //! Module holding the logic for computing the strandedness. +use noodles::core::Region; use noodles::sam::record::MappingQuality; -use noodles::{bam, core::Region, gff, sam}; +use noodles::{bam, gff, sam}; use rand::Rng; use rust_lapper::Lapper; use std::collections::{HashMap, HashSet}; @@ -9,8 +10,9 @@ use std::ops::{Add, AddAssign}; use std::sync::Arc; use crate::derive::strandedness::results; +use crate::utils::alignment::filter_by_mapq; +use crate::utils::display::RecordCounter; use crate::utils::read_groups; -use crate::utils::{alignment::filter_by_mapq, display::RecordCounter}; const STRANDED_THRESHOLD: f64 = 80.0; const UNSTRANDED_THRESHOLD: f64 = 40.0;