Repository navigation
Conversation
RefSeqFromChromSeq.getBases read lastBuff after warming via getBase, but getBase never updated lastKey/lastBuff when the contig had no chromSeq file. Result: bases from the previous contig's buffer, or an NPE when no buffer had been loaded yet. Only use lastBuff when lastKey matches the requested buffer, otherwise fall back to per-base getBase which returns 'N'. getBase now sets lastKey/lastBuff on a fresh read, removing the double-call warm-up. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gmagnu
marked this pull request as ready for review
October 6, 2026 21:36
…-missing-contig # Conflicts: # model/src/test/java/org/gorpipe/model/gor/iterators/UTestRefSeqFromChromSeq.java
Move buffer loading into getBuffer, which returns null for a contig without sequence or a failed read and only sets lastKey/lastBuff on success. getBases now walks the range buffer by buffer and fills a buffer that can not be loaded with 'N' in one step. Before, a failed read (e.g. a wrapped network error) was retried and logged once per position, and a missing contig rebuilt the file path per position. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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
RefSeqFromChromSeq(behindrefbases,refbases_with_build,VARNORM,VERIFYVARIANT) keepslastKey/lastBufffor the last buffer read.getBaseswarmed the buffer throughgetBaseand then readlastBuffunconditionally. When the requested contig has no chromSeq file,getBasereturns'N'without loading a buffer, so:getBasesreturned bases from that contig's buffer — wrong data, no error;NullPointerExceptiononlastBuff.The outcome depended on row order.
Fix
getBuffer(LUFO cache or file viareadBuffer). It returnsnullwhen the contig has no sequence in the build or the read fails, and only setslastKey/lastBuffwhen it returns a buffer, solastBuffalways belongs tolastKey.getBaseandgetBasesboth usegetBuffer.getBaseswalks the range buffer by buffer: one load per buffer, and a buffer that can not be loaded reads as'N'for its whole part.IOExceptionwrapped in aRuntimeException) is attempted and logged once per buffer, not once per position;getBaseloop.Behaviour unchanged otherwise: positions past the chromosome end and below 1 read as
'N', a directIOExceptionstill raisesGorResourceException.Tests
New tests in
UTestRefSeqFromChromSeq:testGetRefbasesMissingContigAfterOtherContig— fails on main:expected:<[NNN]> but was:<[CAG]>(bases from chr1).testGetRefbasesMissingContigFirst— fails on main:NullPointerExceptiononlastBuff.testGetRefbasesFailedReadIsTriedOncePerBuffer— mockedRacFilewhosereadthrows; asserts one read attempt per buffer touched. Failed on the previous revision of this PR (TooManyActualInvocations).testGetRefbasesMissingContigAcrossBuffers— missing contig over a range spanning two buffer boundaries reads as all'N'.Also ran, all passing: full
:model:test(1554 tests),UTestGenomicFunctions(34),UTestVarNormWithBuild(15),UTestVerifyVariant(8).Merged main after #149 (ENGKNOW-3981); both fixes compose in
getBase/getBases.Jira: ENGKNOW-3978
🤖 Generated with Claude Code