: m_AllTaxidCount(0),
150 Uint4data_start = (4 +
156 if(idx_file_len < (data_start +
sizeof(
CSeqDBTaxId))) {
170 const unsignedTAX_DB_MAGIC_NUMBER = 0x8739;
175 ERR_POST(
"Error: Tax database file has wrong magic number.");
184 inttaxid_array_size =
int((idx_file_len - data_start)/
sizeof(
CSeqDBTaxId));
190<<
") entries but file has room for ("<< taxid_array_size
221 if(
t.IsMissingTaxInfo())
return false;
224 Int4high_index =
t.GetTaxidCount() - 1;
226 const char* Data =
t.GetDataPtr();
231 if((tax_id < low_taxid) || (tax_id > high_taxid))
234 Int4new_index = (low_index+high_index)/2;
235 Int4old_index = new_index;
240 if(tax_id < curr_taxid) {
241high_index = new_index;
242}
else if(tax_id > curr_taxid){
243low_index = new_index;
248new_index = (low_index+high_index)/2;
249 if(new_index == old_index) {
250 if(tax_id > curr_taxid) {
255old_index = new_index;
258 if(tax_id == Index[new_index].
GetTaxId()) {
259 info.taxid = tax_id;
261 Uint4begin_data(Index[new_index].GetOffset());
264 if(new_index == high_index) {
266end_data =
Uint4(
t.GetDataFileSize());
268 if(end_data < begin_data) {
270 ERR_POST(
"Error: Offset error at end of taxdb file.");
274end_data = (Index[new_index+1].
GetOffset());
277 const char* start_ptr = &Data[begin_data];
288 if(rc1 && rc2 && rc3 &&
buffer.Size()) {
Uint4 m_Offset
The offset of the start of the taxonomy data.
Int4 GetOffset() const
Return the offset field (in host order)
TTaxId GetTaxId() const
Return the taxonomic identifier field (in host order)
Uint4 m_Taxid
The taxonomic identifier.
CSeqDBTaxId(const CSeqDBTaxId &)
This structure should not be copy constructed.
CSeqDBTaxId()
Constructor.
static bool GetTaxNames(TTaxId tax_id, SSeqDBTaxInfo &info)
Get the taxonomy names for a given tax id.
void GetString(string &s) const
Return the data by assigning it to a string.
const char * GetDataPtr()
bool m_MissingDB
Indicator if tax db files are missing.
unique_ptr< CMemoryFile > m_IndexFileMap
Memory map of the index file.
const Int4 GetTaxidCount()
const CSeqDBTaxId * GetIndexPtr()
unique_ptr< CMemoryFile > m_DataFileMap
string m_IndexFN
The filename of the taxonomic db index file.
string m_DataFN
The filename of the taxnomoic db data file.
Int4 m_AllTaxidCount
Total number of taxids in the database.
SStrictId_Tax::TId TTaxId
Taxon id type.
#define TAX_ID_FROM(T, value)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
Int8 GetLength(void) const
Get size of file.
TTaxId GetTaxId(const CBioseq_Handle &handle)
return the tax-id associated with a given sequence.
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
unsigned int
A callback function used to compare two keys in a database.
string SeqDB_ResolveDbPath(const string &filename)
Resolve a file path using SeqDB's path algorithms.
bool SeqDB_SplitString(CSeqDB_Substring &buffer, CSeqDB_Substring &front, char delim)
Parse a prefix from a substring.
T SeqDB_GetStdOrd(const T *stdord_obj)
Read a network order integer value.
Defines database volume access classes.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4