Repository navigation
Conversation
…e missing SEQ Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pairtools parse2 --add-columns seq(andpairtools parse --add-columns seq) fails onpysam >= 0.23.2— outputting<class 'NotImplementedType'>on Linux/GCC 14 Python 3.12 (#281) or crashing withSIGBUSon macOS arm64 +pysam 0.24.1— and also breaks--add-columns mismatchesand--drop-seq.Root cause:
makeAlignedSegmentPairtoolizedinpairtools/lib/parse_pysam.pyxconstructedAlignedSegmentPairtoolizedvia__new__without callingAlignedSegment.__init__, leavingAlignedSegment.cache(_AlignedSegment_Cache, added inpysam >= 0.23.2) asPy_Noneinstead of an initialized cache object. Accessing cached sequence/quality properties (query_sequence,seq,query_qualities,query_alignment_sequence) or mutating them (--drop-seq) then dereferencedPy_Noneas_AlignedSegment_Cache.In addition,
parse_pysam_entryinpairtools/lib/parse.pyread the deprecatedsam.seqalias without guardingNonefor records whoseSEQfield is*(l_qseq == 0), which serialized missing sequences as literal"None"instead of"*".Who hits this:
pairtools parse2andpairtools parseusers extracting read sequences (--add-columns seq), mismatches (--add-columns mismatches), or stripping sequences (--drop-seq) onpysam >= 0.23.2(#281).Changes
pairtools/lib/parse_pysam.pyx:AlignedSegmentPairtoolized(header)inmakeAlignedSegmentPairtoolizedsoAlignedSegment.__init__initializes its delegate and_AlignedSegment_Cache, then copysrcviabam_copy1(dest._delegate, src)with aNULLcheck raisingMemoryError.pairtools/lib/parse.py:parse_pysam_entry, usesam.query_sequenceand emit"*"whenNone.tests/test_parse.py&tests/test_parse2.py:AlignmentFilePairtoolizedcached properties (query_sequence,seq,query_alignment_sequence,query_qualities),pairtools parseandpairtools parse2with--add-columns seqon both SAM and BAM inputs (matching--flip/--no-flipsettings, reverse-strand reference-orientation sequences), omittedSEQ == "*"on unmapped and supplementary walk alignments, allEXTRA_COLUMNSincludingmismatcheswithMDtags, and--keep-sam --drop-seq.Verification
pytest tests/:40 passed, 0 failed(up from36 passedon677b9085; all 4 new tests fail on677b9085).flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics):0errors.93.62 MiBpeak, ~3.94M records/ssingle-threaded) with cleanbam1_townership across SAM, BAM, and reference-free CRAM.pysam 0.24.1libcalignedsegment.pyx/htslibownership, 102 CLI runs, throughput/RSS, and the full test/lint suites before opening this PR.Fixes #281
🤖 Generated with Claude Code
https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N