#include <dbindex.hpp>
Inheritance diagram for CDbIndex:
Definition at line 221 of file dbindex.hpp.
Public Types | |
typedef CSequenceIStream::TStreamPos | TSeqNum |
Type used to enumerate sequences in the index. | |
typedef Uint4 | TWord |
Type representing main memory unit of the index structure. | |
typedef SOffsetValue | TOffsetValue |
typedef CSubjectMap | TSubjectMap |
Public Member Functions | |
CConstRef< CSearchResults > | Search (const BLAST_SequenceBlk *query, const BlastSeqLoc *locs, const SSearchOptions &search_options) |
Search the index. | |
virtual | ~CDbIndex () |
Index object destructor. | |
TSeqNum | StartSeq () const |
Get the OID of the first sequence in the index. | |
TSeqNum | StartChunk () const |
Get the number of the first chunk of the first sequence in the index. | |
TSeqNum | StopSeq () const |
Get the OID of the last sequence in the index. | |
TSeqNum | StopChunk () const |
Get the number of the last chunk of the last sequence in the index. | |
virtual TSeqPos | GetSeqLen (TSeqNum oid) const |
Get the length of the subject sequence. | |
virtual const Uint1 * | GetSeqData (TSeqNum oid) const |
Get the sequence data of the subject sequence. | |
virtual void | Remap () |
If possible reduce the index footpring by unmapping the portion that does not contain sequence data. | |
TSeqNum | getStartOId () const |
TSeqNum | getStopOId () const |
TSeqNum | getSIdByOId (TSeqNum oid) const |
TSeqNum | getOIdBySId (TSeqNum sid) const |
unsigned long | getHKeyWidth () const |
unsigned long | getStride () const |
unsigned long | getWSHint () const |
unsigned long | getMaxChunkSize () const |
unsigned long | getChunkOverlap () const |
bool | isLegacy () const |
TWord | getSubjectLength (TSeqNum sid) const |
TSeqNum | getCId (TSeqNum sid, TSeqNum rcid) const |
TSeqNum | getCId (TSeqNum sid) const |
pair< TSeqNum, TSeqNum > | getSRCId (TSeqNum cid) const |
TSeqNum | getSIdByCId (TSeqNum cid) const |
TWord | getChunkLength (TSeqNum cid) const |
TWord | getChunkLength (TSeqNum sid, TSeqNum rcid) const |
TSeqNum | getCIdByLRCId (TSeqNum lid, TSeqNum rcid) const |
TSeqNum | getSIdByLRCId (TSeqNum lid, TSeqNum rcid) const |
pair< TSeqNum, TSeqPos > | getRCIdOffByLIdOff (TSeqNum lid, TSeqPos loff) const |
pair< TSeqNum, TSeqPos > | getCIdOffByLIdOff (TSeqNum lid, TSeqPos loff) const |
TSeqPos | getSOff (TSeqNum sid, TSeqNum rcid, TSeqPos coff) const |
pair< TSeqNum, TSeqPos > | getSIdOffByCIdOff (TSeqNum cid, TSeqPos coff) const |
pair< TSeqNum, TSeqPos > | getSIdOffByLIdOff (TSeqNum lid, TSeqPos loff) const |
TSeqNum | getNumSubjects () const |
TSeqNum | getNumChunks () const |
TSeqNum | getNumChunks (TSeqNum sid) const |
const Uint1 * | getSeqData (TSeqNum sid) const |
TSeqNum | getLId (const TOffsetValue &v) const |
TSeqPos | getLOff (const TOffsetValue &v) const |
const string | getBioseqIdBySId (TSeqNum sid) const |
const vector< string > & | getIdMap () const |
Static Public Member Functions | |
static SOptions | DefaultSOptions () |
Creates an SOptions instance initialized with default values. | |
static void | MakeIndex (const std::string &fname, const std::string &oname, TSeqNum start, TSeqNum start_chunk, TSeqNum &stop, TSeqNum &stop_chunk, const SOptions &options) |
Create an index object. | |
static void | MakeIndex (const std::string &fname, const std::string &oname, TSeqNum start, TSeqNum &stop, TSeqNum &stop_chunk, const SOptions &options) |
Create an index object. | |
static void | MakeIndex (const std::string &fname, const std::string &oname, TSeqNum start, TSeqNum &stop, const SOptions &options) |
Create an index object. | |
static void | MakeIndex (CSequenceIStream &input, const std::string &oname, TSeqNum start, TSeqNum start_chunk, TSeqNum &stop, TSeqNum &stop_chunk, const SOptions &options) |
Create an index object. | |
static void | MakeIndex (CSequenceIStream &input, const std::string &oname, TSeqNum start, TSeqNum &stop, TSeqNum &stop_chunk, const SOptions &options) |
Create an index object. | |
static void | MakeIndex (CSequenceIStream &input, const std::string &oname, TSeqNum start, TSeqNum &stop, const SOptions &options) |
Create an index object. | |
static CRef< CDbIndex > | Load (const std::string &fname, bool nomap=false) |
Load index. | |
Static Public Attributes | |
static const unsigned long | CR = 4 |
Letters per byte in the sequence store. | |
static const unsigned long | STRIDE = 5 |
Only process every STRIDEth nmer. | |
static const unsigned long | MIN_OFFSET = 64 |
Offsets below this are reserved for special purposes. | |
static const unsigned long | CODE_BITS = 3 |
How many bits are used for special codes for first/last nmers. | |
static const unsigned char | VERSION = (unsigned char)5 |
Index version that this library handles. | |
Protected Attributes | |
TSeqNum | start_ |
OID of the first sequence in the index. | |
TSeqNum | start_chunk_ |
Number of the first chunk of the first sequence. | |
TSeqNum | stop_ |
OID of the last sequence in the inex. | |
TSeqNum | stop_chunk_ |
Number of the last chunk of the last sequence. | |
SIndexHeader | header_ |
The index header structure. | |
TSubjectMap * | subject_map_ |
The subject map object. | |
vector< string > | idmap_ |
Mapping from source ids to bioseq ids. | |
Private Member Functions | |
virtual CConstRef< CSearchResults > | DoSearch (const BLAST_SequenceBlk *, const BlastSeqLoc *, const SSearchOptions &) |
Actual implementation of seed searching. | |
Static Private Member Functions | |
static CRef< CDbIndex > | LoadIndex (CNcbiIstream &is) |
Load index from an open stream. | |
template<bool LEGACY> | |
static CRef< CDbIndex > | LoadIndex (const std::string &fname, bool nomap=false) |
Load index from a named file. | |
Classes | |
class | CSearchResults |
This class represents a set of seeds obtained by searching all subjects represented by the index. More... | |
struct | SOffsetValue |
struct | SOptions |
Simple record type used to specify index creation parameters. More... | |
struct | SSearchOptions |
Simple record type used to specify index search parameters. More... |
|
Definition at line 652 of file dbindex.hpp. |
|
Type used to enumerate sequences in the index.
Definition at line 271 of file dbindex.hpp. |
|
Reimplemented in CDbIndex_Impl< LEGACY >. Definition at line 654 of file dbindex.hpp. |
|
Type representing main memory unit of the index structure.
Definition at line 274 of file dbindex.hpp. |
|
Index object destructor.
Definition at line 557 of file dbindex.hpp. |
|
Creates an SOptions instance initialized with default values.
Definition at line 144 of file dbindex.cpp. References DBSEQ_CHUNK_OVERLAP, MAX_DBSEQ_LEN, REPORT_NORMAL, and STRIDE. Referenced by CMkIndexApplication::Run(). |
|
Actual implementation of seed searching. Must be implemented by child classes.
Definition at line 638 of file dbindex.hpp. References null. |
|
Definition at line 722 of file dbindex.hpp. |
|
Definition at line 686 of file dbindex.hpp. |
|
Definition at line 1187 of file dbindex.hpp. References CSubjectMap::getChunkLength(), and subject_map_. |
|
Definition at line 676 of file dbindex.hpp. |
|
Definition at line 682 of file dbindex.hpp. |
|
Definition at line 1180 of file dbindex.hpp. References CSubjectMap::getCId(), and subject_map_. |
|
Definition at line 1191 of file dbindex.hpp. References CSubjectMap::getCIdByLRCId(), and subject_map_. |
|
Definition at line 693 of file dbindex.hpp. |
|
Definition at line 671 of file dbindex.hpp. |
|
Definition at line 728 of file dbindex.hpp. |
|
Definition at line 1214 of file dbindex.hpp. References CSubjectMap::getLId(), and subject_map_. |
|
Definition at line 1218 of file dbindex.hpp. References CSubjectMap::getLOff(), and subject_map_. |
|
Definition at line 675 of file dbindex.hpp. |
|
Definition at line 1208 of file dbindex.hpp. References CSubjectMap::getNumChunks(), and subject_map_. |
|
Definition at line 1205 of file dbindex.hpp. References CSubjectMap::getNumChunks(), and subject_map_. |
|
Definition at line 1202 of file dbindex.hpp. References CSubjectMap::getNumSubjects(), and subject_map_. |
|
Definition at line 665 of file dbindex.hpp. References ASSERT. |
|
Definition at line 1195 of file dbindex.hpp. References CSubjectMap::getRCIdOffByLIdOff(), and subject_map_. |
|
Definition at line 1211 of file dbindex.hpp. References CSubjectMap::getSeqData(), and subject_map_. |
|
Get the sequence data of the subject sequence.
Definition at line 601 of file dbindex.hpp. References NCBI_THROW. |
|
Get the length of the subject sequence.
Definition at line 587 of file dbindex.hpp. References NCBI_THROW. |
|
Definition at line 684 of file dbindex.hpp. |
|
Definition at line 689 of file dbindex.hpp. |
|
Definition at line 659 of file dbindex.hpp. References ASSERT. |
|
Definition at line 701 of file dbindex.hpp. |
|
Definition at line 707 of file dbindex.hpp. |
|
Definition at line 1198 of file dbindex.hpp. References CSubjectMap::getSOff(), and subject_map_. |
|
Definition at line 1184 of file dbindex.hpp. References CSubjectMap::getSRCId(), and subject_map_. |
|
Definition at line 656 of file dbindex.hpp. |
|
Definition at line 657 of file dbindex.hpp. |
|
Definition at line 672 of file dbindex.hpp. |
|
Definition at line 1176 of file dbindex.hpp. References CSubjectMap::getSubjectLength(), and subject_map_. |
|
Definition at line 673 of file dbindex.hpp. |
|
Definition at line 678 of file dbindex.hpp. |
|
Load index.
Definition at line 176 of file dbindex.cpp. References GetIndexVersion(), NCBI_THROW, and VERSION. Referenced by CIndexedDb::PreSearch(), CSRSearchApplication::Run(), and CIndexedDb::SetNumThreads(). |
|
Load index from a named file. Usually this is used to memmap() the file data into the index structure.
Definition at line 553 of file dbindex_sp.hpp. References ERR_POST, CMemoryFile::GetPtr(), MapFile(), NCBI_THROW, null, and CRef< C, Locker >::Reset(). |
|
Load index from an open stream.
|
|
Create an index object.
This function is the same as CDbIndex::MakeIndex( input, start, stop, stop_chunk, options ) except that it does not need Definition at line 1800 of file dbindex_factory.cpp. References input(), and MakeIndex(). |
|
Create an index object. This function is the same as CDbIndex::MakeIndex( input, start, start_chunk, stop, stop_chunk, options ) with start_chunk set to 0. Definition at line 514 of file dbindex.hpp. References input(). |
|
Create an index object. Creates an instance of CDbIndex using a given stream as input.
Definition at line 1789 of file dbindex_factory.cpp. References input(). |
|
Create an index object.
This function is the same as CDbIndex::MakeIndex( fname, start, stop, stop_chunk, options ) except that it does not need Definition at line 1780 of file dbindex_factory.cpp. References MakeIndex(). |
|
Create an index object. This function is the same as CDbIndex::MakeIndex( fname, start, start_chunk, stop, stop_chunk, options ) with start_chunk set to 0. Definition at line 462 of file dbindex.hpp. |
|
Create an index object.
Creates an instance of CDbIndex using the named resource as input. The name of the resource is given by the
Definition at line 1766 of file dbindex_factory.cpp. References input(). Referenced by MakeIndex(), and CMkIndexApplication::Run(). |
|
If possible reduce the index footpring by unmapping the portion that does not contain sequence data.
Reimplemented in CDbIndex_Impl< LEGACY >. Definition at line 612 of file dbindex.hpp. |
|
Search the index.
Definition at line 1396 of file dbindex_search.cpp. References header_, SIndexHeader::legacy_, query, and CDbIndex::SSearchOptions::two_hits. |
|
Get the number of the first chunk of the first sequence in the index.
Definition at line 568 of file dbindex.hpp. |
|
Get the OID of the first sequence in the index.
Definition at line 562 of file dbindex.hpp. Referenced by CSearch_Base< LEGACY, NHITS, derived_t >::operator()(). |
|
Get the number of the last chunk of the last sequence in the index.
Definition at line 579 of file dbindex.hpp. |
|
Get the OID of the last sequence in the index.
Definition at line 573 of file dbindex.hpp. Referenced by CSearch_Base< LEGACY, NHITS, derived_t >::operator()(). |
|
How many bits are used for special codes for first/last nmers. See comment to MIN_OFFSET. Definition at line 247 of file dbindex.hpp. |
|
Letters per byte in the sequence store. Sequence data is stored in the index packed 4 bases per byte. Definition at line 228 of file dbindex.hpp. Referenced by CSearch_Base< LEGACY, NHITS, derived_t >::ExtendLeft(), CSearch_Base< LEGACY, NHITS, derived_t >::ExtendRight(), CSubjectMap::getRCIdOffByLIdOff(), and CSubjectMap::MapSubjOff(). |
|
The index header structure.
Definition at line 737 of file dbindex.hpp. Referenced by CDbIndex_Impl< LEGACY >::CDbIndex_Impl(), and Search(). |
|
Mapping from source ids to bioseq ids.
Definition at line 739 of file dbindex.hpp. Referenced by CDbIndex_Impl< LEGACY >::CDbIndex_Impl(). |
|
Offsets below this are reserved for special purposes. Bits 0-2 of such an offset represent the distance from the start of the Nmer to the next invalid base to the left of the Nmer. Bits 3-5 represent the distance from the end of the Nmer to the next invalid base to the right of the Nmer. Definition at line 242 of file dbindex.hpp. |
|
OID of the first sequence in the index.
Definition at line 732 of file dbindex.hpp. Referenced by CDbIndex_Impl< LEGACY >::CDbIndex_Impl(), CDbIndex::CSearchResults::CheckResults(), CDbIndex::CSearchResults::GetResults(), and CDbIndex_Impl< LEGACY >::Remap(). |
|
Number of the first chunk of the first sequence.
Definition at line 733 of file dbindex.hpp. Referenced by CDbIndex_Impl< LEGACY >::CDbIndex_Impl(). |
|
OID of the last sequence in the inex.
Definition at line 734 of file dbindex.hpp. Referenced by CDbIndex_Impl< LEGACY >::CDbIndex_Impl(), and CDbIndex_Impl< LEGACY >::Remap(). |
|
Number of the last chunk of the last sequence.
Definition at line 735 of file dbindex.hpp. Referenced by CDbIndex_Impl< LEGACY >::CDbIndex_Impl(). |
|
Only process every STRIDEth nmer. STRIDE value of 5 allows for search of contiguous seeds of length >= 16. Definition at line 234 of file dbindex.hpp. Referenced by DefaultSOptions(). |
|
|
Index version that this library handles.
Definition at line 250 of file dbindex.hpp. Referenced by Load(), and CDbIndex_Factory::SaveHeader(). |