Skip to content

refactor: bundle process_chromosome_batch() parameters into config structs #85

@edmundmiller

Description

@edmundmiller

Context

process_chromosome_batch() in src/rna/dupradar/counting.rs currently takes 19 positional parameters. This was flagged during review of #84 — the addition of skip_dup_check brought it from 18 to 19.

Problem

  • Hard to read and maintain — callers must get the positional order exactly right
  • Easy to accidentally swap parameters of the same type (e.g. multiple &str, bool, usize args)
  • Each new feature tends to add another parameter, compounding the problem

Suggested approach

Bundle related parameters into config structs, e.g.:

struct BatchConfig<'a> {
    bam_path: &'a str,
    gtf_path: &'a str,
    stranded: Strandedness,
    paired: bool,
    skip_dup_check: bool,
    // ...
}

struct BatchResources<'a> {
    index: &'a SpatialIndex,
    interner: &'a GeneIdInterner,
    qualimap_index: Option<&'a QualimapIndex>,
    gene_to_biotype: &'a [u16],
    // ...
}

This would make call sites self-documenting and make future parameter additions non-breaking.

Priority

Low — the current code works fine, this is a maintainability improvement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions