Skip to content

fix: clearer errors when no reads are assigned to genes (rebased #132 + #176) - #217

Open
rhassaine wants to merge 4 commits into
seqeralabs:mainfrom
rhassaine:fix/gene-assignment-errors
Open

rhassaine wants to merge 4 commits into
seqeralabs:mainfrom
rhassaine:fix/gene-assignment-errors

Conversation

@rhassaine

Copy link
Copy Markdown
Contributor

Benjamin's #132 and Nico's #176 rebased onto current main (post-noodles) as one PR, since both change the same "no reads assigned to any gene" error in counting.rs and would conflict with each other as two PRs. Each author's commits are kept as they were:

The resulting order is: shared names → assignment failure; empty annotation → annotation error; otherwise → name mismatch.

Rebase notes: Nico's Cargo.lock commit is dropped (main already has newer versions), and his lint commit is already on main, so it was empty. Conflicts were only where main had changed nearby code: the GTF-order chromosome list in counting.rs, the exon tables in gtf.rs, and tests appended at the end of integration_test.rs.

#176's new integration tests fail on main's code (3/4; the fourth is the disjoint-names control) and pass here. #132's 4 GTF tests pass. Full suite, fmt and clippy are green locally.

Supersedes #132 and #176.

🤖 Generated with Claude Code

BenjaminDEMAILLE and others added 4 commits December 3, 2026 15:47
A malformed or truncated GTF that yields zero genes used to log a WARN and
carry on, so the run died later in count_reads with a "Chromosome name
mismatch" error, an empty "GTF chromosomes (first 5):" list and a
chromosome_mapping suggestion with nothing in it. The real cause (bad
annotation file) was buried in an easy-to-miss warning above.

parse_gtf now tracks why nothing was extracted and returns a fatal,
actionable error naming the most likely cause: no annotation lines, lines
with fewer than the 9 mandatory columns, no exon features (listing the
feature types actually present, which flags GFF3 input), or exon features
without gene_id attributes.

count_reads keeps a guard for library callers: an empty annotation index now
reports an empty-annotation error instead of the chromosome-mismatch
diagnosis, which cannot apply when there is nothing to match against.

Closes seqeralabs#126

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…mosome names

When mapped reads exist but none lands in a gene, `count_reads` reports
"Chromosome name mismatch" without comparing names. These tests fail where
the BAM and GTF share a name (directly, or through chromosome_prefix) and
keep the mismatch message for disjoint names. All three expect a non-zero
exit: whether to abort on this input is a separate question.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… overlap

When mapped reads exist but none is assigned to a gene, check whether any
alignment chromosome (after chromosome_prefix / chromosome_mapping) is a
GTF chromosome. If one is, report that no reads could be assigned to any
gene instead of "Chromosome name mismatch" and its chromosome_mapping
advice. The run still fails in both cases; only the diagnostic changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Avoid claiming no physical overlap when strandedness rejects overlapping reads. Preserve error exits and chromosome-name diagnostics. Add a wrong-strand overlap regression with a successful unstranded control.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants