NCBI C++ ToolKit
Public Types | Public Member Functions | Private Attributes | List of all members
CBamIndex Class Reference

Search Toolkit Book for CBamIndex

#include <sra/readers/bam/bamindex.hpp>

+ Inheritance diagram for CBamIndex:
+ Collaboration diagram for CBamIndex:

Public Types

typedef vector< SBamIndexRefIndexTRefs
 
- Public Types inherited from SBamIndexDefs
enum  ESearchMode { eSearchByOverlap , eSearchByStart }
 
enum  EIndexLevel : uint8_t { kMinLevel = 0 , kLevel0 = kMinLevel , kLevel1 = kLevel0+1 , kMaxLevel = kBAI_depth }
 
typedef uint32_t TBin
 
typedef uint8_t TIndexLevel
 
typedef uint8_t TShift
 

Public Member Functions

 CBamIndex ()
 
 CBamIndex (const string &index_file_name)
 
 ~CBamIndex ()
 
const stringGetFileName () const
 
void Read (const string &index_file_name)
 
void Read (const char *buffer_ptr, size_t buffer_size)
 
void Read (CNcbiIstream &in)
 
const TRefsGetRefs () const
 
size_t GetRefCount () const
 
const SBamIndexRefIndexGetRef (size_t ref_index) const
 
void SetLengthFromHeader (const CBamHeader &header)
 
CBGZFRange GetTotalFileRange (size_t ref_index) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (const CBamHeader &header, const string &ref_name, const string &seq_id, const string &annot_name, TIndexLevel min_index_level, TIndexLevel max_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (const CBamHeader &header, const string &ref_name, const string &seq_id, const string &annot_name, EIndexLevel min_index_level, EIndexLevel max_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (const CBamHeader &header, const string &ref_name, const string &seq_id, const string &annot_name, TIndexLevel min_index_level=0) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (const CBamHeader &header, const string &ref_name, const string &seq_id, const string &annot_name, EIndexLevel min_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (const CBamHeader &header, const string &ref_name, const CSeq_id &seq_id, const string &annot_name, TIndexLevel min_index_level, TIndexLevel max_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (const CBamHeader &header, const string &ref_name, const CSeq_id &seq_id, const string &annot_name, EIndexLevel min_index_level, EIndexLevel max_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (const CBamHeader &header, const string &ref_name, const CSeq_id &seq_id, const string &annot_name, TIndexLevel min_index_level=0) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (const CBamHeader &header, const string &ref_name, const CSeq_id &seq_id, const string &annot_name, EIndexLevel min_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const string &seq_id, const string &annot_name, TIndexLevel min_index_level, TIndexLevel max_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const string &seq_id, const string &annot_name, EIndexLevel min_index_level, EIndexLevel max_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const string &seq_id, const string &annot_name, TIndexLevel min_index_level=0) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const string &seq_id, const string &annot_name, EIndexLevel min_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const CSeq_id &seq_id, const string &annot_name, TIndexLevel min_index_level, TIndexLevel max_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const CSeq_id &seq_id, const string &annot_name, EIndexLevel min_index_level, EIndexLevel max_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const CSeq_id &seq_id, const string &annot_name, TIndexLevel min_index_level=0) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const CSeq_id &seq_id, const string &annot_name, EIndexLevel min_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const string &seq_id, const string &annot_name, TSeqPos ref_length, TIndexLevel min_index_level, TIndexLevel max_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const string &seq_id, const string &annot_name, TSeqPos ref_length, EIndexLevel min_index_level, EIndexLevel max_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const string &seq_id, const string &annot_name, TSeqPos ref_length, TIndexLevel min_index_level=0) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const string &seq_id, const string &annot_name, TSeqPos ref_length, EIndexLevel min_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const CSeq_id &seq_id, const string &annot_name, TSeqPos ref_length, TIndexLevel min_index_level, TIndexLevel max_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const CSeq_id &seq_id, const string &annot_name, TSeqPos ref_length, EIndexLevel min_index_level, EIndexLevel max_index_level) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const CSeq_id &seq_id, const string &annot_name, TSeqPos ref_length, TIndexLevel min_index_level=0) const
 
CRef< CSeq_annotMakeEstimatedCoverageAnnot (size_t ref_index, const CSeq_id &seq_id, const string &annot_name, TSeqPos ref_length, EIndexLevel min_index_level) const
 
vector< uint64_tCollectEstimatedCoverage (size_t ref_index, TIndexLevel min_index_level, TIndexLevel max_index_level) const
 
vector< uint64_tCollectEstimatedCoverage (size_t ref_index, EIndexLevel min_index_level, EIndexLevel max_index_level) const
 
vector< uint64_tCollectEstimatedCoverage (size_t ref_index, TIndexLevel index_level) const
 
vector< uint64_tCollectEstimatedCoverage (size_t ref_index, EIndexLevel index_level) const
 
vector< uint64_tCollectEstimatedCoverage (size_t ref_index) const
 
vector< uint64_tEstimateDataSizeByAlnStartPos (size_t ref_index) const
 
pair< Uint8, double > GetReadStatistics () const
 
- Public Member Functions inherited from SBamIndexParams
constexpr TShift GetMinLevelBinShift () const
 
constexpr TIndexLevel GetMaxIndexLevel () const
 
constexpr TIndexLevel ToIndexLevel (EIndexLevel level) const
 
constexpr TShift GetLevelBinShift (TIndexLevel level) const
 
constexpr TShift GetLevelBinShift (EIndexLevel level) const
 
constexpr TSeqPos GetBinSize (TIndexLevel level) const
 
constexpr TSeqPos GetBinSize (EIndexLevel level) const
 
constexpr TShift GetMinBinShift () const
 
constexpr TSeqPos GetMinBinSize () const
 
constexpr TSeqPos GetMaxBinSize () const
 
constexpr TSeqPos GetPageSize () const
 
constexpr TShift GetPageShift () const
 
constexpr TBin GetBinNumberBaseReversed (int reversed_level) const
 
constexpr TBin GetBinNumberBase (int level) const
 
constexpr TBin GetBinNumberBase (EIndexLevel level) const
 
constexpr TBin GetMinBinNumberBase () const
 
constexpr TBin GetFirstOverflowBin (TIndexLevel level=0) const
 
constexpr TBin GetFirstBin (TIndexLevel level) const
 
constexpr TBin GetLastBin (TIndexLevel level) const
 
constexpr TBin GetPseudoBin () const
 
bool IsOverflowBin (TBin bin, TIndexLevel level=0) const
 
bool IsOverflowPos (TSeqPos pos) const
 
TBin GetBinNumberOffset (TSeqPos pos, TIndexLevel level) const
 
TBin GetBinNumberOffset (TSeqPos pos, EIndexLevel level) const
 
TBin GetBinNumber (TSeqPos pos, TIndexLevel level) const
 
TBin GetBinNumber (TSeqPos pos, EIndexLevel level) const
 
pair< TBin, TBinGetBinRange (COpenRange< TSeqPos > ref_range, TIndexLevel index_level) const
 
TBin GetUpperBinNumber (TBin bin) const
 
TIndexLevel Bin2IndexLevel (TBin bin) const
 
TIndexLevel GetRangeIndexLevel (CRange< TSeqPos > range) const
 
bool RangeIsOnMinBinIndexLevel (CRange< TSeqPos > range) const
 
COpenRange< TSeqPosGetSeqRange (TBin bin) const
 

Private Attributes

string m_FileName
 
TRefs m_Refs
 
Uint8 m_UnmappedCount
 
Uint8 m_TotalReadBytes
 
double m_TotalReadSeconds
 

Additional Inherited Members

- Public Attributes inherited from SBamIndexParams
bool is_CSI
 
TShift min_shift
 
TIndexLevel depth
 
- Static Public Attributes inherited from SBamIndexDefs
static const TBin kMaxBinNumber = 0
 
static const TIndexLevel kMinBinIndexLevel = 0
 
static const TShift kLevelStepBinShift = 3
 
static const TShift kBAI_min_shift = 14
 
static const TIndexLevel kBAI_depth = 5
 

Detailed Description

Definition at line 446 of file bamindex.hpp.

Member Typedef Documentation

◆ TRefs

Definition at line 463 of file bamindex.hpp.

Constructor & Destructor Documentation

◆ CBamIndex() [1/2]

CBamIndex::CBamIndex ( )

Definition at line 1168 of file bamindex.cpp.

◆ CBamIndex() [2/2]

CBamIndex::CBamIndex ( const string index_file_name)
explicit

Definition at line 1176 of file bamindex.cpp.

References Read().

◆ ~CBamIndex()

CBamIndex::~CBamIndex ( )

Definition at line 1185 of file bamindex.cpp.

Member Function Documentation

◆ CollectEstimatedCoverage() [1/5]

vector<uint64_t> CBamIndex::CollectEstimatedCoverage ( size_t  ref_index) const
inline

◆ CollectEstimatedCoverage() [2/5]

vector<uint64_t> CBamIndex::CollectEstimatedCoverage ( size_t  ref_index,
EIndexLevel  index_level 
) const
inline

Definition at line 731 of file bamindex.hpp.

References CollectEstimatedCoverage(), and SBamIndexParams::ToIndexLevel().

◆ CollectEstimatedCoverage() [3/5]

vector<uint64_t> CBamIndex::CollectEstimatedCoverage ( size_t  ref_index,
EIndexLevel  min_index_level,
EIndexLevel  max_index_level 
) const
inline

Definition at line 714 of file bamindex.hpp.

References CollectEstimatedCoverage(), and SBamIndexParams::ToIndexLevel().

◆ CollectEstimatedCoverage() [4/5]

vector<uint64_t> CBamIndex::CollectEstimatedCoverage ( size_t  ref_index,
TIndexLevel  index_level 
) const
inline

Definition at line 725 of file bamindex.hpp.

References CollectEstimatedCoverage().

◆ CollectEstimatedCoverage() [5/5]

vector< uint64_t > CBamIndex::CollectEstimatedCoverage ( size_t  ref_index,
TIndexLevel  min_index_level,
TIndexLevel  max_index_level 
) const

◆ EstimateDataSizeByAlnStartPos()

vector<uint64_t> CBamIndex::EstimateDataSizeByAlnStartPos ( size_t  ref_index) const
inline

Definition at line 746 of file bamindex.hpp.

References SBamIndexRefIndex::EstimateDataSizeByAlnStartPos(), and GetRef().

◆ GetFileName()

const string& CBamIndex::GetFileName ( void  ) const
inline

Definition at line 454 of file bamindex.hpp.

References m_FileName.

Referenced by CBamRawDb::GetIndexName().

◆ GetReadStatistics()

pair<Uint8, double> CBamIndex::GetReadStatistics ( ) const
inline

Definition at line 751 of file bamindex.hpp.

References m_TotalReadBytes, and m_TotalReadSeconds.

Referenced by CBamRawDb::GetEstimatedSecondsPerByte(), and CBamRawDb::Open().

◆ GetRef()

const SBamIndexRefIndex & CBamIndex::GetRef ( size_t  ref_index) const

◆ GetRefCount()

size_t CBamIndex::GetRefCount ( ) const
inline

Definition at line 468 of file bamindex.hpp.

References m_Refs.

Referenced by GetRef(), and SetLengthFromHeader().

◆ GetRefs()

const TRefs& CBamIndex::GetRefs ( void  ) const
inline

Definition at line 464 of file bamindex.hpp.

References m_Refs.

◆ GetTotalFileRange()

CBGZFRange CBamIndex::GetTotalFileRange ( size_t  ref_index) const

Definition at line 1386 of file bamindex.cpp.

References b, and GetRef().

◆ MakeEstimatedCoverageAnnot() [1/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( const CBamHeader header,
const string ref_name,
const CSeq_id seq_id,
const string annot_name,
EIndexLevel  min_index_level 
) const
inline

Definition at line 546 of file bamindex.hpp.

References MakeEstimatedCoverageAnnot(), and SBamIndexParams::ToIndexLevel().

◆ MakeEstimatedCoverageAnnot() [2/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( const CBamHeader header,
const string ref_name,
const CSeq_id seq_id,
const string annot_name,
EIndexLevel  min_index_level,
EIndexLevel  max_index_level 
) const
inline

Definition at line 524 of file bamindex.hpp.

References MakeEstimatedCoverageAnnot(), and SBamIndexParams::ToIndexLevel().

◆ MakeEstimatedCoverageAnnot() [3/24]

CRef< CSeq_annot > CBamIndex::MakeEstimatedCoverageAnnot ( const CBamHeader header,
const string ref_name,
const CSeq_id seq_id,
const string annot_name,
TIndexLevel  min_index_level,
TIndexLevel  max_index_level 
) const

◆ MakeEstimatedCoverageAnnot() [4/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( const CBamHeader header,
const string ref_name,
const CSeq_id seq_id,
const string annot_name,
TIndexLevel  min_index_level = 0 
) const
inline

◆ MakeEstimatedCoverageAnnot() [5/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( const CBamHeader header,
const string ref_name,
const string seq_id,
const string annot_name,
EIndexLevel  min_index_level 
) const
inline

Definition at line 507 of file bamindex.hpp.

References MakeEstimatedCoverageAnnot(), and SBamIndexParams::ToIndexLevel().

◆ MakeEstimatedCoverageAnnot() [6/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( const CBamHeader header,
const string ref_name,
const string seq_id,
const string annot_name,
EIndexLevel  min_index_level,
EIndexLevel  max_index_level 
) const
inline

Definition at line 485 of file bamindex.hpp.

References MakeEstimatedCoverageAnnot(), and SBamIndexParams::ToIndexLevel().

◆ MakeEstimatedCoverageAnnot() [7/24]

CRef< CSeq_annot > CBamIndex::MakeEstimatedCoverageAnnot ( const CBamHeader header,
const string ref_name,
const string seq_id,
const string annot_name,
TIndexLevel  min_index_level,
TIndexLevel  max_index_level 
) const

◆ MakeEstimatedCoverageAnnot() [8/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( const CBamHeader header,
const string ref_name,
const string seq_id,
const string annot_name,
TIndexLevel  min_index_level = 0 
) const
inline

◆ MakeEstimatedCoverageAnnot() [9/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const CSeq_id seq_id,
const string annot_name,
EIndexLevel  min_index_level 
) const
inline

Definition at line 619 of file bamindex.hpp.

References MakeEstimatedCoverageAnnot(), and SBamIndexParams::ToIndexLevel().

◆ MakeEstimatedCoverageAnnot() [10/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const CSeq_id seq_id,
const string annot_name,
EIndexLevel  min_index_level,
EIndexLevel  max_index_level 
) const
inline

Definition at line 599 of file bamindex.hpp.

References MakeEstimatedCoverageAnnot(), and SBamIndexParams::ToIndexLevel().

◆ MakeEstimatedCoverageAnnot() [11/24]

CRef< CSeq_annot > CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const CSeq_id seq_id,
const string annot_name,
TIndexLevel  min_index_level,
TIndexLevel  max_index_level 
) const

Definition at line 1471 of file bamindex.cpp.

References kInvalidSeqPos, and MakeEstimatedCoverageAnnot().

◆ MakeEstimatedCoverageAnnot() [12/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const CSeq_id seq_id,
const string annot_name,
TIndexLevel  min_index_level = 0 
) const
inline

◆ MakeEstimatedCoverageAnnot() [13/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const CSeq_id seq_id,
const string annot_name,
TSeqPos  ref_length,
EIndexLevel  min_index_level 
) const
inline

Definition at line 697 of file bamindex.hpp.

References MakeEstimatedCoverageAnnot(), and SBamIndexParams::ToIndexLevel().

◆ MakeEstimatedCoverageAnnot() [14/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const CSeq_id seq_id,
const string annot_name,
TSeqPos  ref_length,
EIndexLevel  min_index_level,
EIndexLevel  max_index_level 
) const
inline

Definition at line 675 of file bamindex.hpp.

References MakeEstimatedCoverageAnnot(), and SBamIndexParams::ToIndexLevel().

◆ MakeEstimatedCoverageAnnot() [15/24]

CRef< CSeq_annot > CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const CSeq_id seq_id,
const string annot_name,
TSeqPos  ref_length,
TIndexLevel  min_index_level,
TIndexLevel  max_index_level 
) const

◆ MakeEstimatedCoverageAnnot() [16/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const CSeq_id seq_id,
const string annot_name,
TSeqPos  ref_length,
TIndexLevel  min_index_level = 0 
) const
inline

◆ MakeEstimatedCoverageAnnot() [17/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const string seq_id,
const string annot_name,
EIndexLevel  min_index_level 
) const
inline

Definition at line 584 of file bamindex.hpp.

References MakeEstimatedCoverageAnnot(), and SBamIndexParams::ToIndexLevel().

◆ MakeEstimatedCoverageAnnot() [18/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const string seq_id,
const string annot_name,
EIndexLevel  min_index_level,
EIndexLevel  max_index_level 
) const
inline

Definition at line 564 of file bamindex.hpp.

References MakeEstimatedCoverageAnnot(), and SBamIndexParams::ToIndexLevel().

◆ MakeEstimatedCoverageAnnot() [19/24]

CRef< CSeq_annot > CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const string seq_id,
const string annot_name,
TIndexLevel  min_index_level,
TIndexLevel  max_index_level 
) const

Definition at line 1460 of file bamindex.cpp.

References kInvalidSeqPos, and MakeEstimatedCoverageAnnot().

◆ MakeEstimatedCoverageAnnot() [20/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const string seq_id,
const string annot_name,
TIndexLevel  min_index_level = 0 
) const
inline

◆ MakeEstimatedCoverageAnnot() [21/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const string seq_id,
const string annot_name,
TSeqPos  ref_length,
EIndexLevel  min_index_level 
) const
inline

Definition at line 658 of file bamindex.hpp.

References MakeEstimatedCoverageAnnot(), and SBamIndexParams::ToIndexLevel().

◆ MakeEstimatedCoverageAnnot() [22/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const string seq_id,
const string annot_name,
TSeqPos  ref_length,
EIndexLevel  min_index_level,
EIndexLevel  max_index_level 
) const
inline

Definition at line 636 of file bamindex.hpp.

References MakeEstimatedCoverageAnnot(), and SBamIndexParams::ToIndexLevel().

◆ MakeEstimatedCoverageAnnot() [23/24]

CRef< CSeq_annot > CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const string seq_id,
const string annot_name,
TSeqPos  ref_length,
TIndexLevel  min_index_level,
TIndexLevel  max_index_level 
) const

Definition at line 1447 of file bamindex.cpp.

References MakeEstimatedCoverageAnnot().

◆ MakeEstimatedCoverageAnnot() [24/24]

CRef<CSeq_annot> CBamIndex::MakeEstimatedCoverageAnnot ( size_t  ref_index,
const string seq_id,
const string annot_name,
TSeqPos  ref_length,
TIndexLevel  min_index_level = 0 
) const
inline

◆ Read() [1/3]

void CBamIndex::Read ( CNcbiIstream in)

◆ Read() [2/3]

void CBamIndex::Read ( const char *  buffer_ptr,
size_t  buffer_size 
)

◆ Read() [3/3]

void CBamIndex::Read ( const string index_file_name)

◆ SetLengthFromHeader()

void CBamIndex::SetLengthFromHeader ( const CBamHeader header)

Member Data Documentation

◆ m_FileName

string CBamIndex::m_FileName
private

Definition at line 757 of file bamindex.hpp.

Referenced by GetFileName(), and Read().

◆ m_Refs

TRefs CBamIndex::m_Refs
private

Definition at line 758 of file bamindex.hpp.

Referenced by GetRef(), GetRefCount(), GetRefs(), Read(), and SetLengthFromHeader().

◆ m_TotalReadBytes

Uint8 CBamIndex::m_TotalReadBytes
private

Definition at line 760 of file bamindex.hpp.

Referenced by GetReadStatistics(), and Read().

◆ m_TotalReadSeconds

double CBamIndex::m_TotalReadSeconds
private

Definition at line 761 of file bamindex.hpp.

Referenced by GetReadStatistics(), and Read().

◆ m_UnmappedCount

Uint8 CBamIndex::m_UnmappedCount
private

Definition at line 759 of file bamindex.hpp.

Referenced by Read().


The documentation for this class was generated from the following files:
Modified on Wed May 01 14:18:14 2024 by modify_doxy.py rev. 669887