Skip to content

Commit 1514169

Browse files
ewelsclaude
andcommitted
chore: apply cargo fmt
Fixes formatting drift inherited from main. No semantic changes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4b5cc8b commit 1514169

3 files changed

Lines changed: 72 additions & 26 deletions

File tree

src/align/stitch.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,7 +2407,6 @@ pub(crate) fn stitch_seeds_with_jdb_debug(
24072407
Ok(transcripts)
24082408
}
24092409

2410-
24112410
/// Shared core: preprocessing + recursive stitcher, returns working transcripts + context.
24122411
#[allow(clippy::too_many_arguments)]
24132412
fn stitch_seeds_core(
@@ -2750,8 +2749,6 @@ fn stitch_seeds_core(
27502749
))
27512750
}
27522751

2753-
2754-
27552752
#[cfg(test)]
27562753
mod tests {
27572754
use super::*;

src/lib.rs

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ fn align_reads(params: &Parameters) -> anyhow::Result<()> {
144144
let quant_ctx: Option<std::sync::Arc<crate::quant::QuantContext>> =
145145
if params.quant_gene_counts() {
146146
let gtf_path = params.sjdb_gtf_file.as_ref().unwrap();
147-
info!("quantMode GeneCounts: building gene annotation from {}", gtf_path.display());
147+
info!(
148+
"quantMode GeneCounts: building gene annotation from {}",
149+
gtf_path.display()
150+
);
148151
let ctx = crate::quant::QuantContext::build(gtf_path, &index.genome)?;
149152
Some(std::sync::Arc::new(ctx))
150153
} else {
@@ -223,8 +226,22 @@ fn run_single_pass(
223226

224227
// Route to single-end or paired-end mode
225228
match params.read_files_in.len() {
226-
1 => align_reads_single_end(params, index, &mut writer, &stats, &sj_stats, quant.as_ref()),
227-
2 => align_reads_paired_end(params, index, &mut writer, &stats, &sj_stats, quant.as_ref()),
229+
1 => align_reads_single_end(
230+
params,
231+
index,
232+
&mut writer,
233+
&stats,
234+
&sj_stats,
235+
quant.as_ref(),
236+
),
237+
2 => align_reads_paired_end(
238+
params,
239+
index,
240+
&mut writer,
241+
&stats,
242+
&sj_stats,
243+
quant.as_ref(),
244+
),
228245
n => anyhow::bail!("Invalid number of read files: {} (expected 1 or 2)", n),
229246
}?;
230247
}
@@ -241,8 +258,22 @@ fn run_single_pass(
241258

242259
// Route to single-end or paired-end mode (same functions as SAM, generic!)
243260
match params.read_files_in.len() {
244-
1 => align_reads_single_end(params, index, &mut writer, &stats, &sj_stats, quant.as_ref()),
245-
2 => align_reads_paired_end(params, index, &mut writer, &stats, &sj_stats, quant.as_ref()),
261+
1 => align_reads_single_end(
262+
params,
263+
index,
264+
&mut writer,
265+
&stats,
266+
&sj_stats,
267+
quant.as_ref(),
268+
),
269+
2 => align_reads_paired_end(
270+
params,
271+
index,
272+
&mut writer,
273+
&stats,
274+
&sj_stats,
275+
quant.as_ref(),
276+
),
246277
n => anyhow::bail!("Invalid number of read files: {} (expected 1 or 2)", n),
247278
}?;
248279

@@ -345,8 +376,22 @@ fn run_pass1(
345376

346377
// Align reads (single-end or paired-end); no quant counting in pass 1
347378
match params.read_files_in.len() {
348-
1 => align_reads_single_end(&params_pass1, index, &mut null_writer, &stats, &sj_stats, None)?,
349-
2 => align_reads_paired_end(&params_pass1, index, &mut null_writer, &stats, &sj_stats, None)?,
379+
1 => align_reads_single_end(
380+
&params_pass1,
381+
index,
382+
&mut null_writer,
383+
&stats,
384+
&sj_stats,
385+
None,
386+
)?,
387+
2 => align_reads_paired_end(
388+
&params_pass1,
389+
index,
390+
&mut null_writer,
391+
&stats,
392+
&sj_stats,
393+
None,
394+
)?,
350395
n => anyhow::bail!("Invalid number of read files: {} (expected 1 or 2)", n),
351396
}
352397

@@ -572,7 +617,8 @@ fn align_reads_single_end<W: AlignmentWriter>(
572617

573618
// Gene-level quantification (lock-free atomic counts)
574619
if let Some(ref q) = quant {
575-
q.counts.count_se_read(&transcripts, n_for_mapq, &q.gene_ann);
620+
q.counts
621+
.count_se_read(&transcripts, n_for_mapq, &q.gene_ann);
576622
}
577623

578624
// Record junction statistics

src/quant/mod.rs

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,8 @@ impl GeneCounts {
234234
}
235235

236236
/// Write `ReadsPerGene.out.tab` in STAR's format.
237-
pub fn write_output(
238-
&self,
239-
path: &Path,
240-
gene_ann: &GeneAnnotation,
241-
) -> Result<(), Error> {
242-
let mut file = std::fs::File::create(path)
243-
.map_err(|e| Error::io(e, path))?;
237+
pub fn write_output(&self, path: &Path, gene_ann: &GeneAnnotation) -> Result<(), Error> {
238+
let mut file = std::fs::File::create(path).map_err(|e| Error::io(e, path))?;
244239

245240
macro_rules! wl {
246241
($($arg:tt)*) => {
@@ -350,10 +345,7 @@ impl QuantContext {
350345
let exons = crate::junction::gtf::parse_gtf(gtf_path)?;
351346
let gene_ann = GeneAnnotation::from_gtf_exons(&exons, genome);
352347
let n = gene_ann.n_genes();
353-
log::info!(
354-
"quantMode GeneCounts: {} genes loaded from GTF",
355-
n
356-
);
348+
log::info!("quantMode GeneCounts: {} genes loaded from GTF", n);
357349
let counts = GeneCounts::new(n);
358350
Ok(QuantContext { gene_ann, counts })
359351
}
@@ -381,7 +373,13 @@ mod tests {
381373
}
382374
}
383375

384-
fn make_gtf_exon(seqname: &str, start: u64, end: u64, strand: char, gene_id: &str) -> GtfRecord {
376+
fn make_gtf_exon(
377+
seqname: &str,
378+
start: u64,
379+
end: u64,
380+
strand: char,
381+
gene_id: &str,
382+
) -> GtfRecord {
385383
let mut attrs = std::collections::HashMap::new();
386384
attrs.insert("gene_id".to_string(), gene_id.to_string());
387385
attrs.insert("transcript_id".to_string(), "T1".to_string());
@@ -401,7 +399,12 @@ mod tests {
401399
genome_start: gs,
402400
genome_end: ge,
403401
is_reverse,
404-
exons: vec![Exon { genome_start: gs, genome_end: ge, read_start: 0, read_end: (ge - gs) as usize }],
402+
exons: vec![Exon {
403+
genome_start: gs,
404+
genome_end: ge,
405+
read_start: 0,
406+
read_end: (ge - gs) as usize,
407+
}],
405408
cigar: vec![],
406409
score: 100,
407410
n_mismatch: 0,
@@ -417,7 +420,7 @@ mod tests {
417420
fn test_gene_annotation_basic() {
418421
let genome = make_genome();
419422
let exons = vec![
420-
make_gtf_exon("chr1", 101, 200, '+', "G1"), // 0-based: [100, 200)
423+
make_gtf_exon("chr1", 101, 200, '+', "G1"), // 0-based: [100, 200)
421424
make_gtf_exon("chr1", 301, 400, '+', "G1"),
422425
make_gtf_exon("chr1", 501, 600, '-', "G2"),
423426
];
@@ -426,7 +429,7 @@ mod tests {
426429
assert_eq!(ann.gene_ids[0], "G1");
427430
assert_eq!(ann.gene_ids[1], "G2");
428431
assert!(!ann.gene_is_reverse[0]); // G1 is +
429-
assert!(ann.gene_is_reverse[1]); // G2 is -
432+
assert!(ann.gene_is_reverse[1]); // G2 is -
430433
assert_eq!(ann.chr_exons[0].len(), 3);
431434
}
432435

0 commit comments

Comments
 (0)