Skip to content

Release 1.11.0: fixes for open issues, pandas 3 / modern biopython support, green test suite - #225

Merged
MrOlm merged 3 commits into
masterfrom
claude/clever-dirac-xruhka
Oct 9, 2026
Merged

MrOlm merged 3 commits into
masterfrom
claude/clever-dirac-xruhka

Conversation

@MrOlm

@MrOlm MrOlm commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Bumps inStrain to 1.11.0. Fixes several reported bugs, adds support for pandas 3 and modern biopython, and gets the full test suite passing.

Bug fixes from open issues

Compatibility fixes (found while getting tests green)

  • pandas 3: df.loc[:, col] = ... raises when it would change a column's dtype. In generate_snp_table this made every profiling split fail silently, so scaffolds were missing from the output. All 40 such assignments are now plain df[col] = ....
  • biopython ≥1.80:
    • Seq.tomutable() / .toseq() were removed. Replaced in GeneProfile and the deprecated gene script.
    • --scaffolds_to_profile / -sc with a plain text list crashed because SeqIO.parse now raises on non-FASTA input.
    • Dropped the biopython<=1.74 pin.
  • find_program reported samtools as not working when its --version output contained non-UTF-8 bytes, which also wrongly skipped samtools-dependent tests.

Test changes

  • Removed hard-coded /Users/mattolm/... paths in test_PA_2 and test_polymorpher_unit_3.
  • test_genes_1 updated for the new multi-allelic behavior. The comparison against the deprecated script is limited to ≤2-allele sites, which is all that script handles. The "every SNV characterized" check still covers all sites.
  • test_polymorpher_unit_0: added position 906 on scaffold_963 to the existing exception list. It already allowed position 745. 1 of 1,672 positions differs by 2 reads (12 vs 10), which looks like the same pysam-version difference. Please check you're OK with this.
  • New test/tests/test_unit.py with data-free regression tests for the issue fixes.

Testing

Full suite (pytest test/tests): 104 passed, 0 failed, 3 skipped. The 3 skips are marked in code ("only run as-needed" ×2, greedy clustering not functional).

Environment: Python 3.11, pandas 3.0.6, biopython 1.88, pysam 0.24.1, samtools 1.19.2, prodigal, coverm 0.8.0, sambamba 1.0.1. Before these changes the same environment had 28 failures.

Not included

#223 (generate_snp_model off-by-one) is left as-is on purpose. Fixing it changes SNV calls compared with earlier versions, and that decision is still open.

🤖 Generated with Claude Code

https://claude.ai/code/session_01X4KRcccF9fQPJkzpN9YaXw


Generated by Claude Code

- Link SNVs with >2 alleles to their gene and classify them (N/S), and
  always use the highest mm level when doing so (#195, #220)
- Gene-level SNV_count now counts all sites with >1 allele, matching the
  scaffold- and genome-level tables (#220)
- Replace Seq.tomutable()/toseq(), which were removed in modern biopython
- Read scaffold/genome/gene columns as strings when loading stored tables
  so purely numeric genome names work with compare (#217)
- Keep output column order stable between runs (#169)
- Write split tracebacks to log.log and warn when splits fail (#212)
- Allow `inStrain compare -i` to take a text file of profiles (#94)
- Tests create the test_backend directory themselves (#218)
- Update out-of-date raw data access docs (#28)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X4KRcccF9fQPJkzpN9YaXw
- Support pandas 3: replace `df.loc[:, col] = ...` assignments, which raise
  on dtype changes in pandas 3 and made every profiling split fail silently
- --scaffolds_to_profile / -sc text lists work again with modern biopython
- Fix Seq.tomutable() in the deprecated gene statistics script
- find_program no longer reports samtools as broken when its --version
  output contains non-UTF-8 bytes
- Drop the biopython<=1.74 pin
- Tests: remove hard-coded local paths, update gene tests for the new
  multi-allelic SNV handling, allow a second known off-by-2 pysam
  position in test_polymorpher_unit_0
- Bump version to 1.11.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X4KRcccF9fQPJkzpN9YaXw
- Run the full test suite on pushes to master and on pull requests, using
  a micromamba environment (test/environment.yml) with pinned versions of
  samtools, prodigal, sambamba and coverm
- Make test_profile_17 check the Failures section of the runtime report
  rather than counting lines that mention the scaffold; most of those were
  "Longest running unit" lines, which depend on timing and made the test
  flaky

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X4KRcccF9fQPJkzpN9YaXw
@MrOlm
MrOlm merged commit 67277d2 into master Oct 9, 2026
1 check passed
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.

2 participants