Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:

- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # ratchet:Swatinem/rust-cache@v2.9.1

- run: cargo clippy -- -D warnings
- run: cargo clippy --all-targets -- -D warnings

msrv:
name: MSRV check
Expand Down
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rust-analyzer.check.command": "clippy",
"[rust]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "rust-lang.rust-analyzer"
}
}
14 changes: 7 additions & 7 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ The primary goal is a faithful port — matching the original STAR behavior as c
Rust 2024 edition. Standard Cargo commands:

```bash
cargo build # Debug build
cargo build --release # Release build
cargo test # Run all tests
cargo test <name> # Run a single test by name
cargo clippy # Lint
cargo fmt # Format code
cargo build # Debug build
cargo build --release # Release build
cargo test # Run all tests
cargo test <name> # Run a single test by name
cargo clippy --all-targets # Lint
cargo fmt # Format code
```

Always run `cargo clippy`, `cargo fmt --check`, and `cargo test` before considering a phase complete.
Always run `cargo clippy --all-targets`, `cargo fmt --check`, and `cargo test` before considering a phase complete.

## Current Status

Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
Rust 2024 edition. Standard Cargo commands:

```bash
cargo build # debug build
cargo build --release # release build
cargo test # run all tests
cargo clippy # lint (zero warnings expected)
cargo fmt --check # formatting check
cargo build # debug build
cargo build --release # release build
cargo test # run all tests
cargo clippy --all-targets # lint (zero warnings expected)
cargo fmt --check # formatting check
```

CI runs on Linux (x86_64, x86-64-v3, aarch64), macOS (aarch64), and Windows (x86_64). PRs must pass all CI checks before merging.
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ See [ROADMAP.md](ROADMAP.md) for detailed implementation tracking.
Requires Rust 2024 edition (rustc 1.85+).

```bash
cargo build --release # Release build
cargo test # Run tests
cargo clippy # Lint
cargo fmt # Format
cargo build --release # Release build
cargo test # Run tests
cargo clippy --all-targets # Lint
cargo fmt # Format
```

## Development
Expand Down
10 changes: 5 additions & 5 deletions docs/src/content/docs/about/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Contributions are welcome. The repository is on GitHub at [Psy-Fer/rustar-aligne
Rust 2024 edition. Standard Cargo commands:

```bash
cargo build # debug build
cargo build --release # release build
cargo test # run all tests
cargo clippy # lint (zero warnings expected)
cargo fmt --check # formatting check
cargo build # debug build
cargo build --release # release build
cargo test # run all tests
cargo clippy --all-targets # lint (zero warnings expected)
cargo fmt --check # formatting check
```

CI runs on Linux (x86_64, x86-64-v3, aarch64), macOS (aarch64), and Windows (x86_64). PRs must pass all CI checks before merging.
Expand Down
6 changes: 3 additions & 3 deletions docs/src/content/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ target/release/rustar-aligner --version
### Verify the build

```bash
cargo test # full test suite (~396 tests)
cargo clippy # lint (zero warnings expected)
cargo fmt --check # formatting check
cargo test # full test suite (~396 tests)
cargo clippy --all-targets # lint (zero warnings expected)
cargo fmt --check # formatting check
```

### Debug builds
Expand Down
4 changes: 1 addition & 3 deletions src/align/score.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1281,9 +1281,7 @@ mod tests {
seq[6] = 2; // G
seq[7] = 3; // T
// Fill intron body
for i in 8..28 {
seq[i] = 1; // C
}
seq[8..28].fill(1); // C
// AG acceptor for jR=1 position (donor at pos 6, del=24, acceptor at 28,29)
seq[28] = 0; // A
seq[29] = 2; // G
Expand Down
2 changes: 1 addition & 1 deletion src/align/stitch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3044,7 +3044,7 @@ mod tests {

#[test]
fn test_wa_entry_sorting() {
let mut entries = vec![
let mut entries = [
WindowAlignment {
seed_idx: 0,
read_pos: 10,
Expand Down
11 changes: 9 additions & 2 deletions src/chimeric/detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1344,8 +1344,15 @@ mod tests {
let read_len = 100usize;
let t1 = make_clipped_transcript(0, 50, false, read_len, 0, 0);
let read_seq = make_read_seq(read_len);
let result =
detect_chimeric_old(&[t1.clone()], &t1, &read_seq, "r", &params, &index).unwrap();
let result = detect_chimeric_old(
std::slice::from_ref(&t1),
&t1,
&read_seq,
"r",
&params,
&index,
)
.unwrap();
assert!(result.is_empty());
}

Expand Down
1 change: 0 additions & 1 deletion src/chimeric/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,6 @@ mod tests {

#[test]
fn test_within_bam_donor_not_supplementary() {
use noodles::sam::alignment::record::Flags;
let donor = ChimericSegment {
chr_idx: 0,
genome_start: 100,
Expand Down
2 changes: 1 addition & 1 deletion src/index/packed_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ mod tests {
fn round_trip_cross_byte_boundary() {
let mut arr = PackedArray::new(33, 100); // Human genome SA width

let test_values = vec![
let test_values = [
0x1FFFFFFFF, // All 33 bits set
0x100000000, // Bit 32 set (strand bit)
0x0FFFFFFFF, // Bits 0-31 set (max forward position)
Expand Down
16 changes: 8 additions & 8 deletions src/io/sam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ mod tests {
Some("read1".to_string())
);
assert_eq!(record.reference_sequence_id(), Some(0));
assert_eq!(record.alignment_start().map(|p| usize::from(p)), Some(11)); // 1-based
assert_eq!(record.alignment_start().map(usize::from), Some(11)); // 1-based
// hit_index=1, so NOT secondary
assert!(!record.flags().is_secondary());
}
Expand Down Expand Up @@ -1754,7 +1754,7 @@ mod tests {
assert_eq!(rec.mate_reference_sequence_id(), Some(0));

// PNEXT = mate's per-chr position (genome_start=4, chr_start=0 → pos=5)
assert_eq!(rec.mate_alignment_start().map(|p| usize::from(p)), Some(5));
assert_eq!(rec.mate_alignment_start().map(usize::from), Some(5));

// Check TLEN
assert_eq!(rec.template_length(), 250);
Expand Down Expand Up @@ -2792,7 +2792,7 @@ mod tests {

assert!(rec1.flags().is_mate_reverse_complemented());
assert!(!rec1.flags().is_reverse_complemented());
assert_eq!(rec1.mate_alignment_start().map(|p| usize::from(p)), Some(5)); // genome_start=4, chr_start=0 → 5
assert_eq!(rec1.mate_alignment_start().map(usize::from), Some(5)); // genome_start=4, chr_start=0 → 5

// Mate2 record: mate is forward → 0x20 NOT set, PNEXT=1
let rec2 = build_paired_mate_record(
Expand All @@ -2815,7 +2815,7 @@ mod tests {

assert!(!rec2.flags().is_mate_reverse_complemented());
assert!(rec2.flags().is_reverse_complemented());
assert_eq!(rec2.mate_alignment_start().map(|p| usize::from(p)), Some(1)); // genome_start=0, chr_start=0 → 1
assert_eq!(rec2.mate_alignment_start().map(usize::from), Some(1)); // genome_start=0, chr_start=0 → 1
}

#[test]
Expand Down Expand Up @@ -3499,26 +3499,26 @@ mod tests {
let mapped = &records[0];
assert_eq!(mapped.reference_sequence_id(), Some(0));
assert_eq!(
mapped.alignment_start().map(|p| usize::from(p)),
mapped.alignment_start().map(usize::from),
Some(expected_pos)
);
// RNEXT and PNEXT should point to own position (STAR convention)
assert_eq!(mapped.mate_reference_sequence_id(), Some(0));
assert_eq!(
mapped.mate_alignment_start().map(|p| usize::from(p)),
mapped.mate_alignment_start().map(usize::from),
Some(expected_pos)
);

// Unmapped mate: co-located at mapped mate's position
let unmapped = &records[1];
assert_eq!(unmapped.reference_sequence_id(), Some(0));
assert_eq!(
unmapped.alignment_start().map(|p| usize::from(p)),
unmapped.alignment_start().map(usize::from),
Some(expected_pos)
);
assert_eq!(unmapped.mate_reference_sequence_id(), Some(0));
assert_eq!(
unmapped.mate_alignment_start().map(|p| usize::from(p)),
unmapped.mate_alignment_start().map(usize::from),
Some(expected_pos)
);
// MAPQ = 0 for unmapped
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(non_snake_case)]

pub mod error;
pub mod params;

Expand Down
1 change: 1 addition & 0 deletions src/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,7 @@ mod tests {
assert!(err.to_string().contains("RG"));
}

#[test]
fn run_rng_seed_override() {
let p = parse(&["--readFilesIn", "r.fq", "--runRNGseed", "42"]);
assert_eq!(p.run_rng_seed, 42);
Expand Down
20 changes: 6 additions & 14 deletions src/quant/transcriptome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1999,7 +1999,7 @@ mod tests {
assert_eq!(results.len(), 1);
let r = &results[0];
assert_eq!(r.chr_idx, 0); // transcript index
assert_eq!(r.is_reverse, false);
assert!(!r.is_reverse);
assert_eq!(r.exons.len(), 1);
// t-space offset = 0 (ex_len_cum) + (110 - 100) = 10
assert_eq!(r.exons[0].genome_start, 10);
Expand Down Expand Up @@ -2086,7 +2086,7 @@ mod tests {
assert_eq!(results.len(), 1);
let r = &results[0];
// is_reverse flipped (transcript strand == 2, align was false → result true)
assert_eq!(r.is_reverse, true);
assert!(r.is_reverse);
// t-space position after flip:
// pre-flip: genome_start=20, length=40 → new_g = 100 - (20 + 40) = 40
// read_start=0, read_len=40 → new_r = 40 - (0 + 40) = 0
Expand Down Expand Up @@ -2259,13 +2259,9 @@ mod tests {
// read whose soft-clipped bases match the adjacent genome.
let mut seq = vec![4u8; 1000];
// Place pattern "AAAA" at genome [100, 104) — clip region
for i in 100..104 {
seq[i] = 0; // A
}
seq[100..104].fill(0); // A
// Aligned region [104, 144) — fill with zeros (A) so read bases match
for i in 104..144 {
seq[i] = 0;
}
seq[104..144].fill(0);
let genome = Genome {
sequence: seq,
n_genome: 1000,
Expand Down Expand Up @@ -2314,13 +2310,9 @@ mod tests {
// With very tight out_filter_mismatch_nmax, the alignment is rejected.
let mut seq = vec![4u8; 1000];
// Clip region [100, 104): all zeros (A)
for i in 100..104 {
seq[i] = 0;
}
seq[100..104].fill(0);
// Aligned region [104, 144): all zeros
for i in 104..144 {
seq[i] = 0;
}
seq[104..144].fill(0);
let genome = Genome {
sequence: seq,
n_genome: 1000,
Expand Down
Loading
Loading