From aa661fb703955acaaeafa6fef6091f8d1b34d85f Mon Sep 17 00:00:00 2001 From: Tim Anderson Date: Mon, 26 Feb 2024 18:04:46 -0700 Subject: [PATCH] Revert "add function for resolving a single bwt position to global position" --- src/AwFmIndex.h | 24 ------------------------ src/AwFmSearch.c | 34 ---------------------------------- 2 files changed, 58 deletions(-) diff --git a/src/AwFmIndex.h b/src/AwFmIndex.h index 170080c..f8a1856 100644 --- a/src/AwFmIndex.h +++ b/src/AwFmIndex.h @@ -518,30 +518,6 @@ uint64_t *awFmFindDatabaseHitPositions(const struct AwFmIndex *_RESTRICT_ const const struct AwFmSearchRange *_RESTRICT_ const searchRange, enum AwFmReturnCode *_RESTRICT_ fileAccessResult); -/* - * Function: awFmFindDatabaseHitPositionSingle - * -------------------- - * Backtraces a single BWT position to find its position in the sequence. - * If the Suffix Array is stored on disk, this will occur a single disk read. - * If your goal is to query many BWT positions, use awFmFindDatabaseHitPositions instead. - * - * - * - * Inputs: - * index: Pointer to the valid AwFmIndex struct. - * bwtPosition: Position in the bwt to query - * fileAssessResult: Returns the result of this action as an out-variable. - * possible return values are: - * AwFmFileReadOkay on success - * AwFmFileReadFail on failure to read from the position array (if left - * on file and not in memory) - * - * Returns: - * Position in the original sequence that corresponds to the bwt position - */ -uint64_t awFmFindDatabaseHitPositionSingle(const struct AwFmIndex *_RESTRICT_ const index, - const uint64_t bwtPosition, enum AwFmReturnCode *_RESTRICT_ fileAccessResult); - /* * Function: awFmGetLocalSequencePositionFromIndexPosition * -------------------- diff --git a/src/AwFmSearch.c b/src/AwFmSearch.c index 8eb235f..9ad2f2b 100644 --- a/src/AwFmSearch.c +++ b/src/AwFmSearch.c @@ -217,40 +217,6 @@ uint64_t *awFmFindDatabaseHitPositions(const struct AwFmIndex *_RESTRICT_ const } -uint64_t awFmFindDatabaseHitPositionSingle(const struct AwFmIndex *_RESTRICT_ const index, - const uint64_t bwtPosition, enum AwFmReturnCode *_RESTRICT_ fileAccessResult){ - - uint64_t databaseSequenceOffset = 0; - uint64_t backtracePosition = bwtPosition; - - if(index->config.alphabetType != AwFmAlphabetAmino) { - while(!awFmBwtPositionIsSampled(index, backtracePosition)) { - backtracePosition = awFmNucleotideBacktraceBwtPosition(index, backtracePosition); - databaseSequenceOffset++; - } - } - else { - while(!awFmBwtPositionIsSampled(index, backtracePosition)) { - backtracePosition = awFmAminoBacktraceBwtPosition(index, backtracePosition); - databaseSequenceOffset++; - } - } - - *fileAccessResult = awFmReadPositionsFromSuffixArray(index, &backtracePosition, 1); - - // make sure that reading from the suffix array actually succeeded - if(*fileAccessResult == AwFmFileReadFail) { - return 0; - } - - backtracePosition += databaseSequenceOffset; - backtracePosition %= index->bwtLength; // mod by the length so that the sentinel wraps to zero. - *fileAccessResult = AwFmFileReadOkay; - return backtracePosition; - -} - - enum AwFmReturnCode awFmGetLocalSequencePositionFromIndexPosition(const struct AwFmIndex *_RESTRICT_ const index, size_t globalPosition, size_t *sequenceNumber, size_t *localSequencePosition) { if(__builtin_expect(!index->fastaVector, false)) {