[go: nahoru, domu]

Skip to content

Commit

Permalink
Merge pull request #22 from TravisWheelerLab/addSeqCount
Browse files Browse the repository at this point in the history
add getNumSequences function
  • Loading branch information
Sawwave committed Nov 22, 2023
2 parents bdf75b9 + a8e1ae8 commit b7cb72e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/AwFmIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,4 +560,19 @@ bool awFmReturnCodeIsFailure(const enum AwFmReturnCode rc);
*/
bool awFmReturnCodeIsSuccess(const enum AwFmReturnCode rc);


/*
* Function: awFmGetNumSequences
* --------------------
* Returns the number of sequences used to generate the awfmIndex.
* When this index is built from a fasta, this will be equal to the number
* of sequences in that fasta. When built from a text string, this will be one.
* Inputs:
* index: AwFmIndex to query.
*
* Returns:
* Number of sequences contained inside the index.
*/
uint32_t awFmGetNumSequences(const struct AwFmIndex *_RESTRICT_ const index);

#endif /* end of include guard: AW_FM_INDEX_STRUCTS_H */
10 changes: 10 additions & 0 deletions src/AwFmIndexStruct.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,13 @@ inline bool awFmReturnCodeIsFailure(const enum AwFmReturnCode rc){
inline bool awFmReturnCodeIsSuccess(const enum AwFmReturnCode rc){
return !awFmReturnCodeIsFailure(rc);
}


uint32_t awFmGetNumSequences(const struct AwFmIndex *_RESTRICT_ const index){
if(index->fastaVector){
return index->fastaVector->metadata.count;
}
else{
return 1;
}
}

0 comments on commit b7cb72e

Please sign in to comment.