Skip to content

Commit

Permalink
Revert "add function for resolving a single bwt position to global po…
Browse files Browse the repository at this point in the history
…sition"
  • Loading branch information
Sawwave authored Feb 27, 2024
1 parent 8eed250 commit aa661fb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 58 deletions.
24 changes: 0 additions & 24 deletions src/AwFmIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
* --------------------
Expand Down
34 changes: 0 additions & 34 deletions src/AwFmSearch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit aa661fb

Please sign in to comment.