NCBI C++ ToolKit
dbindex_sp.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: dbindex_sp.hpp 61298 2014-01-09 15:49:08Z morgulis $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Aleksandr Morgulis
27  *
28  * File Description:
29  * Specialized index implementations.
30  *
31  */
32 
33 #ifndef C_DB_INDEX_SP_HPP
34 #define C_DB_INDEX_SP_HPP
35 
36 #include <corelib/ncbifile.hpp>
38 
40 BEGIN_SCOPE( blastdbindex )
41 
42 #define INLINE NCBI_INLINE
43 
44 /** Forwarding declarations for convenience. */
47 
48 //-------------------------------------------------------------------------
49 /** Read a word from the input stream.
50  @param word_t word type (must be an integer type)
51  @param is [I/O] input stream
52  @param data [O] storage for the value obtained from the stream
53 */
54 template< typename word_t >
56 {
57  word_t result;
58  is.read( (char *)(&result), sizeof( word_t ) );
59  data = result;
60 }
61 
62 //-------------------------------------------------------------------------
63 /** Read the index header information from the given input stream.
64  @param map [I] pointer to the start of the mapped index data
65  @return the index header structure filled with the values read from map
66 */
67 template< bool LEGACY >
69 
70 //-------------------------------------------------------------------------
71 /** Get the stride value associated with the index.
72 
73  @param header the index header structure
74 
75  @return the stride value
76  */
77 template< bool LEGACY >
78 unsigned long GetIndexStride( const SIndexHeader & header );
79 
80 //-------------------------------------------------------------------------
81 /** Get the ws_hint value associated with the index.
82 
83  @param header the index header structure
84 
85  @return the ws_hint value
86  */
87 template< bool LEGACY >
88 unsigned long GetIndexWSHint( const SIndexHeader & header );
89 
90 /** Iterator specific functionality of offset list manager class. */
91 template< typename iterator_t >
92 class COffsetData;
93 
94 /** Iterator for 0-terminated pre-ordered offset lists.
95  */
97 {
98  /** Type of offset data class supported by this iterator. */
101 
102  public:
103 
105 
106  void Reset(
107  const TOffsetData & offset_data, TWord key, unsigned long ws );
108 
109  void Reset();
110 
111  /** Object constructor.
112  @param offset_data [I] offset data connected to the this object
113  @param key [I] nmer value identifying the offset list
114  @param ws [I] target word size
115  */
117  const TOffsetData & offset_data, TWord key, unsigned long ws )
118  { Reset( offset_data, key, ws ); }
119 
120  /** Advance the iterator.
121  @return false if the end of the list is reached; true otherwise
122  */
123  bool Next();
124 
125  /** Check if more data is available in the iterator.
126  @return true if more data is available; false otherwise
127  */
128  bool More();
129 
130  /** Iterator dereference.
131  @return the value pointed to by the interator
132  */
133  TWord Offset() const { return offset_; }
134 
135  bool Advance();
136 
138  {
140  return r;
141  };
142 
143  bool end() const { return end_; }
144 
145  private:
146 
148  const TWord * start_;
149  const TWord * curr_; /**< Current position in the offset list. */
151  TWord offset_; /**< Current cached offset value. */
152  unsigned long more_; /**< Flag indicating that more values are available. */
153  unsigned long init_more_;
154  unsigned long mod_; /**< Determines which offsets to skip. */
155  bool boundary_; /**< Flag indicating the current offset is actually
156  a extra information for boundary cases. */
157 
158  unsigned long min_offset_; /**< Minimum offset used by the index. */
159  bool end_;
160 };
161 
162 //-------------------------------------------------------------------------
163 /** Type of objects maintaining the offset list data for all Nmers and
164  the corresponding hash table.
165 */
166 template< typename iterator_t >
168 {
170 
171  typedef COffsetData_Base TBase; /**< Base class alias. */
172  typedef CVectorWrap< TWord > TOffsets; /**< Type used to store offset lists. */
173 
174  public:
175 
176  /** Type used to iterate over an offset list. */
177  typedef iterator_t TIterator;
178 
179  /** Construct the object from the data in the given input stream.
180  @param is [I/O] the input stream containing the object
181  data
182  @param hkey_width [I] hash key width
183  @param min_offset [I] minimum offset used by the index
184  */
186  CNcbiIstream & is, unsigned long hkey_width,
187  unsigned long stride, unsigned long ws_hint );
188 
189  /** Constructs the object by mapping to the memory segment.
190  @param map [I/O] points to the memory segment
191  @param hkey_width [I] hash key width
192  @param stride [I] stride of the index
193  @param ws_hint [I] ws_hint value of the index
194  */
195  COffsetData(
196  TWord ** map, unsigned long hkey_width,
197  unsigned long stride, unsigned long ws_hint );
198 
199  private:
200 
201  TOffsets offsets_; /**< Concatenated offset list data. */
202  TWord * data_start_; /**< Start of the offset data. */
203 };
204 
205 //-------------------------------------------------------------------------
206 INLINE
208  const TOffsetData & offset_data, TWord key, unsigned long ws )
209 {
210  special_ = 0;
211  boundary_ = false;
212  min_offset_ = offset_data.getMinOffset();
213  end_ = false;
214 
215  {
216  unsigned long h = offset_data.hkey_width() - 1;
217  unsigned long s = offset_data.getStride();
218  unsigned long w = offset_data.getWSHint();
219 
220  init_more_ = more_ = (w - h)/s;
221  mod_ = (ws - h)/s;
222  }
223 
224  cache_ = offset_data.hash_table_[key];
225 
226  if( cache_ != 0 ) {
227  start_ = curr_ = offset_data.data_start_ + cache_ - 1;
228  }
229  else{
230  curr_ = 0;
231  init_more_ = more_ = 0;
232  end_ = true;
233  }
234 }
235 
236 //-------------------------------------------------------------------------
237 INLINE
239 {
240  special_ = 0;
241  boundary_ = false;
242  end_ = false;
243  more_ = init_more_;
244 
245  if( cache_ != 0 ) curr_ = start_;
246  else {
247  curr_ = 0;
248  more_ = 0;
249  end_ = true;
250  }
251 }
252 
253 //-------------------------------------------------------------------------
254 INLINE
256 {
257  if( curr_ == 0 ) return false;
258 
259  if( (offset_ = *++curr_) == 0 ) {
260  more_ = 0;
261  end_ = true;
262  return false;
263  }
264  else {
265  if( offset_ < min_offset_ ) {
266  boundary_ = true;
267  special_ = offset_;
268  return true;
269  }
270  else if( boundary_ ) {
271  boundary_ = false;
272  return true;
273  }
274  else if( offset_%more_ == 0 ) {
275  return true;
276  }
277  else {
278  more_ = (more_ <= mod_) ? 0 : more_ - 1;
279  --curr_;
280  special_ = 0;
281  end_ = true;
282  return false;
283  }
284  }
285 }
286 
287 //-------------------------------------------------------------------------
288 INLINE
290 {
291  if( Next() ) {
292  if( boundary_ ) Next();
293  return true;
294  }
295 
296  return false;
297 }
298 
299 //-------------------------------------------------------------------------
300 INLINE
302 { return more_ != 0; }
303 
304 //-------------------------------------------------------------------------
305 template< typename iterator_t >
307  TWord ** map, unsigned long hkey_width,
308  unsigned long stride, unsigned long ws_hint )
309  : TBase( map, hkey_width, stride, ws_hint )
310 {
311  if( *map ) {
312  offsets_.SetPtr(
313  *map, (typename TOffsets::size_type)(this->total_) );
314  data_start_ = *map;
315  *map += this->total_;
316  }
317 }
318 
319 //-------------------------------------------------------------------------
320 /** Some computed type definitions.
321  */
322 template< bool LEGACY >
324 {
327 };
328 
329 /** Implementation of the BLAST database index
330 */
331 template< bool LEGACY >
332 class CDbIndex_Impl : public CDbIndex
333 {
334  /** Offset data and subject map types computer. */
336 
337  public:
338 
339  /**@name Some convenience alias declarations. */
340  /**@{*/
344  /**@}*/
345 
346  /** Size of the index file header for index format version >= 2. */
347  static const unsigned long HEADER_SIZE = 16 + 7*sizeof( TWord );
348 
349  /** Create an index object from mapped memory segment.
350  @param map [I/O] points to the memory segment
351  @param header [I] index header information
352  @param idmap [I] mapping from ordinal source ids to bioseq ids
353  @param data [I] index data read from the file in
354  the case mmap() is not selected.
355  */
356  CDbIndex_Impl(
357  CMemoryFile * map,
358  const SIndexHeader & header,
359  const vector< string > & idmap,
360  TWord * data = 0 );
361 
362  /** Object destructor. */
364  {
365  delete subject_map_;
366  delete offset_data_;
367  if( mapfile_ != 0 ) { mapfile_->Unmap(); delete mapfile_; }
368  else if ( map_start_ != 0 ) delete[] map_start_;
369  }
370 
371  /** Get the hash key width of the index.
372  @return the hash key width of the index in base pairs
373  */
374  unsigned long hkey_width() const
375  { return offset_data_->hkey_width(); }
376 
377  /** Create an offset list iterator corresponding to the given
378  Nmer value.
379  @param nmer [I] the Nmer value
380  @param mod [I] determines the stride size
381  @return the iterator over the offset list corresponding to nmer
382  */
383  const TOffsetIterator OffsetIterator( TWord nmer, unsigned long mod ) const
384  { return TOffsetIterator( *offset_data_, nmer, mod ); }
385 
386  /** Get the total number of sequence chunks in the index.
387  @sa CSubjectMap::NumChunks()
388  */
389  TSeqNum NumChunks() const { return subject_map_->NumChunks(); }
390 
391  /** Get the total number of logical sequences in the index.
392  @sa CSubjectMap::NumSubjects()
393  */
395 
396  /** Get the subject map instance from the index object.
397 
398  @return The subject map instance.
399  */
400  const TSubjectMap & GetSubjectMap() const
401  { return *subject_map_; }
402 
403  /** Get the start of compressed raw sequence data.
404  @sa CSubjectMap::GetSeqStoreBase()
405  */
406  const Uint1 * GetSeqStoreBase() const
407  { return subject_map_->GetSeqStoreBase(); }
408 
409  /** Get the length of the subject sequence.
410 
411  @param oid Ordinal id of the subject sequence.
412 
413  @return Length of the sequence in bases.
414  */
415  virtual TSeqPos GetSeqLen( TSeqNum oid ) const
416  {
417  return subject_map_->GetSeqLen( oid - this->start_ );
418  }
419 
420  /** Get the sequence data of the subject sequence.
421 
422  @param oid Ordinal id of the subject sequence.
423 
424  @return Pointer to the sequence data.
425  */
426  virtual const Uint1 * GetSeqData( TSeqNum oid ) const
427  {
428  return subject_map_->GetSeqData( oid - this->start_ );
429  }
430 
431  /** Get the index format version.
432 
433  @return The index format version.
434  */
435  virtual unsigned long Version() const { return version_; }
436 
437  /** If possible reduce the index footpring by unmapping
438  the portion that does not contain sequence data.
439  */
440  virtual void Remap();
441 
442  private:
443 
444  /** The search procedure for this specialized index implementation.
445  @param query [I] the query sequence encoded as BLASTNA
446  @param locs [I] set of query locations to search
447  @param search_options [I] search options
448  @return the set of matches of query to sequences present in the
449  index
450  */
452  const BLAST_SequenceBlk * query,
453  const BlastSeqLoc * locs,
454  const SSearchOptions & search_options );
455 
456  CMemoryFile * mapfile_; /**< Memory mapped file. */
457  TWord * map_; /**< Start of memory mapped file data. */
458  TWord * map_start_; /**< Start of the index data, when not mapped. */
459  TOffsetData * offset_data_; /**< Offset lists. */
460  size_t subject_map_offset_; /**< Offset of the subject map in the index file. */
461  unsigned long version_; /**< Index format version. */
462  unsigned long stride_; /**< Stride value used during index creation. */
463 };
464 
465 //-------------------------------------------------------------------------
466 template< bool LEGACY >
468  CMemoryFile * map, const SIndexHeader & header,
469  const vector< string > & idmap, TWord * data )
470  : mapfile_( map ), map_start_( 0 ), version_( VERSION ),
471  stride_( GetIndexStride< LEGACY >( header ) )
472 {
473  header_ = header;
474 
475  start_ = header.start_;
476  stop_ = header.stop_;
477  start_chunk_ = header.start_chunk_;
478  stop_chunk_ = header.stop_chunk_;
479 
480  idmap_ = idmap;
481 
482  if( mapfile_ != 0 ) {
483  map_ = (TWord *)(((char *)(mapfile_->GetPtr())) + HEADER_SIZE);
484  offset_data_ = new TOffsetData(
485  &map_, header.hkey_width_,
486  stride_, GetIndexWSHint< LEGACY >( header ) );
487  Uint1 * map_start = (Uint1 *)(mapfile_->GetPtr());
488  subject_map_offset_ = (Uint1 *)map_ - map_start;
489  subject_map_ = new TSubjectMap( &map_, header );
490  }
491  else if( data != 0 ) {
492  map_start_ = data;
493  Uint1 * map_start = (Uint1 *)data;
494  map_ = (TWord *)((char *)data + HEADER_SIZE);
495  offset_data_ = new TOffsetData(
496  &map_, header.hkey_width_,
497  stride_, GetIndexWSHint< LEGACY >( header ) );
498  subject_map_offset_ = (Uint1 *)map_ - map_start;
499  subject_map_ = new TSubjectMap( &map_, header );
500  }
501 }
502 
503 //-------------------------------------------------------------------------
504 template< bool LEGACY >
506 {
507  if( mapfile_ != 0 ) {
508  delete subject_map_; subject_map_ = 0;
509  delete offset_data_; offset_data_ = 0;
510  mapfile_->Unmap();
511  map_ = (TWord *)(mapfile_->Map( subject_map_offset_ ));
512  subject_map_ = new TSubjectMap( &map_, start_, stop_, stride_ );
513  }
514 }
515 
516 //-------------------------------------------------------------------------
517 template< bool LEGACY >
520  const BLAST_SequenceBlk * query,
521  const BlastSeqLoc * locs,
522  const SSearchOptions & search_options )
523 {
525 }
526 
527 //-------------------------------------------------------------------------
528 CMemoryFile * MapFile( const std::string & fname );
529 
530 template< bool LEGACY >
532  const std::string & fname, bool nomap )
533 {
534  vector< string > idmap;
535  string idmap_fname = fname + ".map";
536  CNcbiIfstream idmap_stream( idmap_fname.c_str() );
537 
538  while( idmap_stream ) {
539  string line;
540  idmap_stream >> line;
541  idmap.push_back( line );
542  }
543 
544  CRef< CDbIndex > result( null );
545  CMemoryFile * map = 0;
546  SIndexHeader header;
547  TWord * data = 0;
548 
549  if( nomap ) {
550  Int8 l = CFile( fname ).GetLength();
551  CNcbiIfstream s( fname.c_str() );
552 
553  try {
554  data = new TWord[1 + l/sizeof( TWord )];
555  }
556  catch( ... ) {
557  ERR_POST( "not enough memory for index" );
558  NCBI_THROW(
559  CDbIndex_Exception, eIO,
560  "not enough memory for index" );
561  }
562 
563  s.read( (char *)data, l );
564  header = ReadIndexHeader< LEGACY >( data );
565  }
566  else {
567  map = MapFile( fname );
568  if( map != 0 ) {
569  header = ReadIndexHeader< LEGACY >( map->GetPtr() );
570  }
571  }
572 
573  result.Reset( new CDbIndex_Impl< LEGACY >( map, header, idmap, data ) );
574  return result;
575 }
576 
577 END_SCOPE( blastdbindex )
579 
580 #endif
581 
CConstRef –.
Definition: ncbiobj.hpp:1266
Types of exception the indexing library can throw.
Definition: dbindex.hpp:409
Implementation of the BLAST database index.
Definition: dbindex_sp.hpp:333
const Uint1 * GetSeqStoreBase() const
Get the start of compressed raw sequence data.
Definition: dbindex_sp.hpp:406
size_t subject_map_offset_
Offset of the subject map in the index file.
Definition: dbindex_sp.hpp:460
unsigned long version_
Index format version.
Definition: dbindex_sp.hpp:461
virtual CConstRef< CSearchResults > DoSearch(const BLAST_SequenceBlk *query, const BlastSeqLoc *locs, const SSearchOptions &search_options)
The search procedure for this specialized index implementation.
Definition: dbindex_sp.hpp:519
TOffsetData * offset_data_
Offset lists.
Definition: dbindex_sp.hpp:459
static const unsigned long HEADER_SIZE
Size of the index file header for index format version >= 2.
Definition: dbindex_sp.hpp:347
TTraits::TOffsetData TOffsetData
Definition: dbindex_sp.hpp:341
CMemoryFile * mapfile_
Memory mapped file.
Definition: dbindex_sp.hpp:456
TWord * map_
Start of memory mapped file data.
Definition: dbindex_sp.hpp:457
TOffsetData::TIterator TOffsetIterator
Definition: dbindex_sp.hpp:343
TWord * map_start_
Start of the index data, when not mapped.
Definition: dbindex_sp.hpp:458
const TOffsetIterator OffsetIterator(TWord nmer, unsigned long mod) const
Create an offset list iterator corresponding to the given Nmer value.
Definition: dbindex_sp.hpp:383
TTraits::TSubjectMap TSubjectMap
Definition: dbindex_sp.hpp:342
virtual TSeqPos GetSeqLen(TSeqNum oid) const
Get the length of the subject sequence.
Definition: dbindex_sp.hpp:415
TSeqNum NumChunks() const
Get the total number of sequence chunks in the index.
Definition: dbindex_sp.hpp:389
const TSubjectMap & GetSubjectMap() const
Get the subject map instance from the index object.
Definition: dbindex_sp.hpp:400
CDbIndex_Traits< LEGACY > TTraits
Offset data and subject map types computer.
Definition: dbindex_sp.hpp:335
virtual void Remap()
If possible reduce the index footpring by unmapping the portion that does not contain sequence data.
Definition: dbindex_sp.hpp:505
~CDbIndex_Impl()
Object destructor.
Definition: dbindex_sp.hpp:363
CDbIndex_Impl(CMemoryFile *map, const SIndexHeader &header, const vector< string > &idmap, TWord *data=0)
Create an index object from mapped memory segment.
Definition: dbindex_sp.hpp:467
TSeqNum NumSubjects() const
Get the total number of logical sequences in the index.
Definition: dbindex_sp.hpp:394
unsigned long stride_
Stride value used during index creation.
Definition: dbindex_sp.hpp:462
virtual unsigned long Version() const
Get the index format version.
Definition: dbindex_sp.hpp:435
virtual const Uint1 * GetSeqData(TSeqNum oid) const
Get the sequence data of the subject sequence.
Definition: dbindex_sp.hpp:426
unsigned long hkey_width() const
Get the hash key width of the index.
Definition: dbindex_sp.hpp:374
Base class providing high level interface to index objects.
Definition: dbindex.hpp:435
static CRef< CDbIndex > LoadIndex(CNcbiIstream &is)
Load index from an open stream.
TSeqNum start_
OID of the first sequence in the index.
Definition: dbindex.hpp:945
TSeqNum stop_chunk_
Number of the last chunk of the last sequence.
Definition: dbindex.hpp:948
Uint4 TWord
Type representing main memory unit of the index structure.
Definition: dbindex.hpp:487
SIndexHeader header_
The index header structure.
Definition: dbindex.hpp:950
TSeqNum start_chunk_
Number of the first chunk of the first sequence.
Definition: dbindex.hpp:946
TSubjectMap * subject_map_
The subject map object.
Definition: dbindex.hpp:951
vector< string > idmap_
Mapping from source ids to bioseq ids.
Definition: dbindex.hpp:952
TSeqNum stop_
OID of the last sequence in the inex.
Definition: dbindex.hpp:947
CSequenceIStream::TStreamPos TSeqNum
Type used to enumerate sequences in the index.
Definition: dbindex.hpp:484
CFile –.
Definition: ncbifile.hpp:1604
CMemoryFile –.
Definition: ncbifile.hpp:2860
Class representing index hash table and offset list database.
Definition: dbindex.hpp:958
THashTable hash_table_
The hash table (mapping from Nmer values to the lists of offsets.
Definition: dbindex.hpp:1020
TWord total_
Auxiliary data member used for importing the offset list data.
Definition: dbindex.hpp:1013
unsigned long getMinOffset() const
Accessor for minimum offset value.
Definition: dbindex.hpp:994
unsigned long hkey_width() const
Get the width of the hash key in base pairs.
Definition: dbindex.hpp:988
unsigned long getWSHint() const
Accessor for ws_hint value.
Definition: dbindex.hpp:1006
unsigned long getStride() const
Accessor for stride value.
Definition: dbindex.hpp:1000
Iterator specific functionality of offset list manager class.
Definition: dbindex_sp.hpp:168
TWord * data_start_
Start of the offset data.
Definition: dbindex_sp.hpp:202
TOffsets offsets_
Concatenated offset list data.
Definition: dbindex_sp.hpp:201
COffsetData_Base TBase
Base class alias.
Definition: dbindex_sp.hpp:171
CVectorWrap< TWord > TOffsets
Type used to store offset lists.
Definition: dbindex_sp.hpp:172
iterator_t TIterator
Type used to iterate over an offset list.
Definition: dbindex_sp.hpp:177
COffsetData(CNcbiIstream &is, unsigned long hkey_width, unsigned long stride, unsigned long ws_hint)
Construct the object from the data in the given input stream.
Iterator for 0-terminated pre-ordered offset lists.
Definition: dbindex_sp.hpp:97
const TWord * curr_
Current position in the offset list.
Definition: dbindex_sp.hpp:149
TOffsetValue getOffsetValue() const
Definition: dbindex_sp.hpp:137
bool More()
Check if more data is available in the iterator.
Definition: dbindex_sp.hpp:301
bool boundary_
Flag indicating the current offset is actually a extra information for boundary cases.
Definition: dbindex_sp.hpp:155
COffsetData_Base::TOffsetValue TOffsetValue
Definition: dbindex_sp.hpp:100
unsigned long more_
Flag indicating that more values are available.
Definition: dbindex_sp.hpp:152
bool Next()
Advance the iterator.
Definition: dbindex_sp.hpp:255
unsigned long mod_
Determines which offsets to skip.
Definition: dbindex_sp.hpp:154
COffsetData< CPreOrderedOffsetIterator > TOffsetData
Type of offset data class supported by this iterator.
Definition: dbindex_sp.hpp:99
TWord offset_
Current cached offset value.
Definition: dbindex_sp.hpp:151
unsigned long min_offset_
Minimum offset used by the index.
Definition: dbindex_sp.hpp:158
CPreOrderedOffsetIterator(const TOffsetData &offset_data, TWord key, unsigned long ws)
Object constructor.
Definition: dbindex_sp.hpp:116
TWord Offset() const
Iterator dereference.
Definition: dbindex_sp.hpp:133
Type representing subject map data.
Definition: dbindex.hpp:1028
const Uint1 * GetSeqStoreBase() const
Return the start of the raw storage for compressed subject sequence data.
Definition: dbindex.hpp:1091
TSeqNum NumSubjects() const
Get the total number of logical sequences in the map.
Definition: dbindex.hpp:1221
TSeqNum NumChunks() const
Get the total number of sequence chunks in the map.
Definition: dbindex.hpp:1102
TSeqPos GetSeqLen(TSeqNum oid) const
Get the length of the subject sequence.
Definition: dbindex.hpp:1230
const Uint1 * GetSeqData(TSeqNum oid) const
Get the sequence data of the subject sequence.
Definition: dbindex.hpp:1239
TVector::size_type size_type
Definition: dbindex.hpp:325
void SetPtr(T *base, size_type sz)
Make the object hold an external sequence.
Definition: dbindex.hpp:347
Definition: map.hpp:338
void ReadWord(CNcbiIstream &is, word_t &data)
Read a word from the input stream.
Definition: dbindex_sp.hpp:55
#define INLINE
Definition: dbindex_sp.hpp:42
unsigned long GetIndexStride(const SIndexHeader &header)
Get the stride value associated with the index.
const SIndexHeader ReadIndexHeader(void *map)
Read the index header information from the given input stream.
CDbIndex::TSeqNum TSeqNum
Forwarding declarations for convenience.
Definition: dbindex_sp.hpp:45
CDbIndex::TWord TWord
Definition: dbindex_sp.hpp:46
CMemoryFile * MapFile(const std::string &fname)
Memory map a file and return a pointer to the mapped area.
unsigned long GetIndexWSHint(const SIndexHeader &header)
Get the ws_hint value associated with the index.
#define true
Definition: bool.h:35
char data[12]
Definition: iconv.c:80
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
string
Definition: cgiapp.hpp:687
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
Definition: ncbidiag.hpp:186
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
Int8 GetLength(void) const
Get size of file.
Definition: ncbifile.cpp:3204
bool Unmap(void)
Unmap file if mapped.
Definition: ncbifile.cpp:6138
void * GetPtr(void) const
Get pointer to beginning of data.
Definition: ncbifile.hpp:4281
uint8_t Uint1
1-byte (8-bit) unsigned integer
Definition: ncbitype.h:99
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
int64_t Int8
8-byte (64-bit) signed integer
Definition: ncbitype.h:104
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
Definition: ncbistre.hpp:146
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
Definition: ncbistre.hpp:439
#define VERSION
Definition: config.h:13
unsigned int word_t
Definition: bmconst.h:39
const struct ncbi::grid::netcache::search::fields::KEY key
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
Int mod(Int i, Int j)
Definition: njn_integer.hpp:67
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
Structure to hold a sequence.
Definition: blast_def.h:242
Used to hold a set of positions, mostly used for filtering.
Definition: blast_def.h:204
Simple record type used to specify index search parameters.
Definition: dbindex.hpp:639
Some computed type definitions.
Definition: dbindex_sp.hpp:324
CSubjectMap TSubjectMap
Definition: dbindex_sp.hpp:326
COffsetData< CPreOrderedOffsetIterator > TOffsetData
Definition: dbindex_sp.hpp:325
Structure into which an index header is loaded.
Definition: dbindex.hpp:290
CSequenceIStream::TStreamPos stop_chunk_
Number of the last chunk of the last sequence in the index.
Definition: dbindex.hpp:303
CSequenceIStream::TStreamPos start_chunk_
Number of the first chunk of the first sequence in the index.
Definition: dbindex.hpp:301
unsigned long hkey_width_
Size in bp of the Nmer used as a hash key.
Definition: dbindex.hpp:293
CSequenceIStream::TStreamPos stop_
OID of the last sequence in the index.
Definition: dbindex.hpp:302
CSequenceIStream::TStreamPos start_
OID of the first sequence in the index.
Definition: dbindex.hpp:300
static string query
else result
Definition: token2.c:20
Modified on Mon May 20 05:02:59 2024 by modify_doxy.py rev. 669887