Skip to content

Fix add_sample_from_csv crash on unmatched transcript/gene ids (2.0.7) - #44

Merged
YalanBi merged 2 commits into
masterfrom
fix/csv-import-missing-gene-info
Aug 4, 2026
Merged

Fix add_sample_from_csv crash on unmatched transcript/gene ids (2.0.7)#44
YalanBi merged 2 commits into
masterfrom
fix/csv-import-missing-gene-info

Conversation

@YalanBi

@YalanBi YalanBi commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #25: add_sample_from_csv crashed with a confusing AttributeError when importing PacBio isoseq-collapse/Pigeon-style files that have no gene lines.

  • The original TypeError on infer_genes is already fixed on master (side effect of Trouble while working with .csi indexes #28's fix in 2.0.3).
  • The AttributeError was deeper than it looked: gene_id/chr column construction used a list comprehension inside try/except KeyError -- one unmatched id silently broke the column for every row, not just that one, crashing far downstream with an unrelated-looking error.

Fix: per-row .get() lookups with explicit filtering, so an unmatched id only drops that row. The warning is now also actionable, pointing at infer_genes=True when gene info can't be resolved -- confirmed as the actual fix against the reporter's scenario.

Bumps version to 2.0.7.

Test plan

  • Full pytest suite passes (19 passed), including the new regression test
  • Verified the new test reproduces the original crash against the pre-fix code
  • Verified via a fresh independent clone of the pushed branch
  • flake8/black clean
  • python -m build + twine check dist/* pass at 2.0.7
  • CI green across the full matrix

YalanBi added 2 commits August 5, 2026 00:28
…e id

The gene_id/chr column construction used a list comprehension inside
try/except KeyError -- if even one transcript_id or gene_id from the
coverage csv wasn't found in the transcripts file, the whole
comprehension raised and the column silently never got created for
*any* row, crashing later with a confusing AttributeError far from
the real cause (e.g. 'Series' object has no attribute 'chr').

Switch to per-row .get() lookups with explicit filtering, so one
unmatched id only drops that row. Also make the warning actionable:
point at infer_genes=True when gene info can't be resolved, which is
the actual fix for files with no gene lines (e.g. PacBio
isoseq-collapse/Pigeon output). Closes #25.
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@YalanBi YalanBi self-assigned this Aug 4, 2026
@YalanBi YalanBi added the bug Something isn't working label Aug 4, 2026
@YalanBi
YalanBi merged commit 8a4b122 into master Aug 4, 2026
19 checks passed
@YalanBi
YalanBi deleted the fix/csv-import-missing-gene-info branch August 4, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IsoTools2 integration with Iso-Seq data

1 participant