Skip to content

add-variants: fix .tbi/.csi crashing the enricher (v2.8.2) + MGBOA license - #43

Merged
lucapinello merged 1 commit into
masterfrom
fix/add-variants-tbi-and-mgboa
Sep 24, 2026
Merged

lucapinello merged 1 commit into
masterfrom
fix/add-variants-tbi-and-mgboa

Conversation

@lucapinello

Copy link
Copy Markdown
Contributor

Summary

Two things, bundled because the version bump is shared:

1. Bug fix — add-variants crashes on tabix/bcftools index sidecars

The VCF-directory listing filtered .tbi with a mutate-while-iterating loop:

listChrs = os.listdir(dirVCFFiles)
for file in listChrs:
    if file.endswith('.tbi'): listChrs.remove(file)   # skips elements!

Removing from a list during iteration skips elements, so some .tbi files survive and are passed to the enricher, which gzip.open()s + readline()s each input → decompressing a binary .tbi as text raises UnicodeDecodeError: 'utf-8' codec can't decode byte 0x9d. Replaced with a single comprehension excluding .tbi and .csi:

listChrs = [f for f in os.listdir(dirVCFFiles) if not (f.endswith('.tbi') or f.endswith('.csi'))]

Surfaced building a genotyped 1000G index whose VCF folder was tabix-indexed. The stray index workers were harmless (they died before writing) but produced confusing tracebacks and were a latent collision risk.

Verified (independent review):

  • Reproduced the survivor + the enricher crash.
  • The other listChrs (genome dir, indexGenome) uses continue, not remove — no twin bug.
  • Nothing downstream needs the index entries (len(listChrs) worker count + the for elem in listChrs enrichment loop want real VCFs only).
  • The enricher hard-requires gzip input, so dropping index sidecars is necessary and non-regressing (a .csi/.tbi reaching it would crash the same way).

2. Version + license

  • VERSION 2.8.1 → 2.8.2 (crispritz.py + conda/meta.yaml) + CHANGELOG entry.
  • LICENSE: AGPL-3.0 (dual) → MGB Open Access License 1.0 (MGBOA 1.0), matching CRISPRme+ and CRISPRme (non-commercial academic use; commercial use requires a commercial license).

Note: the stale conda/crispritz.py and docker_image/crispritz.py copies (not installed by conda/build.sh or the root Dockerfile, which both use root crispritz.py) are left untouched.

🤖 Generated with Claude Code

…; MGBOA license

FIX (add-variants): the VCF-directory listing filtered .tbi with
  for file in listChrs:
      if file.endswith('.tbi'): listChrs.remove(file)
which mutates the list while iterating over it and therefore SKIPS elements, so
some .tbi index files survived and were passed to the enricher. The enricher
gzip.open()s + readline()s each input, so decompressing a binary .tbi as text
raised 'UnicodeDecodeError: utf-8 codec cant decode byte 0x9d'. Replace with a
single comprehension that excludes both .tbi and .csi index sidecars, so only
real VCFs reach the enricher. Verified: the other listChrs (genome dir, indexGenome)
uses continue not remove, so it has no twin bug; nothing downstream needs the
index entries; the enricher requires gzip input so dropping index sidecars is
both necessary and non-regressing.

VERSION: 2.8.1 -> 2.8.2 (crispritz.py + conda/meta.yaml) + CHANGELOG entry.

LICENSE: AGPL-3.0 (dual) -> MGB Open Access License 1.0 (MGBOA 1.0), matching
CRISPRme+ and CRISPRme (non-commercial academic use; commercial use requires a
commercial license).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lucapinello
lucapinello merged commit c114cae into master Sep 24, 2026
10 checks passed
@lucapinello
lucapinello deleted the fix/add-variants-tbi-and-mgboa branch September 24, 2026 12:09
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.

1 participant