Skip to content

Commit

Permalink
style: prettify imports
Browse files Browse the repository at this point in the history
  • Loading branch information
a-frantz committed Feb 12, 2024
1 parent 42d09dc commit 55b3bc7
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 62 deletions.
11 changes: 4 additions & 7 deletions src/derive/command/encoding.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
14 changes: 5 additions & 9 deletions src/derive/command/endedness.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/derive/command/instrument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 4 additions & 7 deletions src/derive/command/junction_annotation.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
8 changes: 3 additions & 5 deletions src/derive/command/readlen.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
20 changes: 7 additions & 13 deletions src/derive/command/strandedness.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
3 changes: 1 addition & 2 deletions src/derive/endedness/compute.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
7 changes: 2 additions & 5 deletions src/derive/instrument/compute.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
3 changes: 1 addition & 2 deletions src/derive/instrument/flowcells.rs
Original file line number Diff line number Diff line change
@@ -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`].
Expand Down
3 changes: 1 addition & 2 deletions src/derive/instrument/instruments.rs
Original file line number Diff line number Diff line change
@@ -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`].
Expand Down
6 changes: 2 additions & 4 deletions src/derive/junction_annotation/compute.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/derive/junction_annotation/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions src/derive/strandedness/compute.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
//! 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};
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;
Expand Down

0 comments on commit 55b3bc7

Please sign in to comment.