NCBI C++ ToolKit
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members

Search Toolkit Book for CNWAligner

#include <algo/align/nw/nw_aligner.hpp>

+ Inheritance diagram for CNWAligner:
+ Collaboration diagram for CNWAligner:

Classes

class  CBacktraceMatrix4
 
struct  SAlignInOut
 
struct  SProgressInfo
 

Public Types

enum  EGapPreference { eEarlier, eLater }
 
enum  ETranscriptSymbol {
  eTS_None = 0, eTS_Delete = 'D', eTS_Insert = 'I', eTS_Match = 'M',
  eTS_Replace = 'R', eTS_Intron = 'Z', eTS_SlackDelete, eTS_SlackInsert
}
 
typedef int TScore
 
typedef bool(* FProgressCallback) (SProgressInfo *)
 
typedef vector< ETranscriptSymbolTTranscript
 
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1, eAllocFillZero, eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef CAtomicCounter TCounter
 Counter type is CAtomiCounter. More...
 
typedef TCounter::TValue TCount
 Alias for value type of counter. More...
 

Public Member Functions

 CNWAligner (void)
 
 CNWAligner (const char *seq1, size_t len1, const char *seq2, size_t len2, const SNCBIPackedScoreMatrix *scoremat=0)
 
 CNWAligner (const string &seq1, const string &seq2, const SNCBIPackedScoreMatrix *scoremat=0)
 
virtual ~CNWAligner (void)
 
virtual TScore Run (void)
 
CRef< objects::CSeq_align > Run (objects::CScope &scope, const objects::CSeq_loc &loc1, const objects::CSeq_loc &loc2, bool trim_end_gaps=true)
 
CRef< objects::CSeq_align > Run (objects::CScope &scope, const objects::CSeq_id &id1, const objects::CSeq_id &id2, bool trim_end_gaps=true)
 
virtual void SetSequences (const char *seq1, size_t len1, const char *seq2, size_t len2, bool verify=true)
 
void SetSequences (const string &seq1, const string &seq2, bool verify=true)
 
void SetScoreMatrix (const SNCBIPackedScoreMatrix *scoremat)
 
const SNCBIFullScoreMatrixGetScoreMatrix (void) const
 
void SetWm (TScore value)
 
void SetWms (TScore value)
 
void SetWg (TScore value)
 
void SetWs (TScore value)
 
void SetEndSpaceFree (bool Left1, bool Right1, bool Left2, bool Right2)
 
void SetSmithWaterman (bool SW)
 
void SetGapPreference (EGapPreference p)
 Control preference for where to place a gap if there is a choice; default is eLater, placing the gap as late as possible. More...
 
void SetPattern (const vector< size_t > &pattern)
 
void SetSpaceLimit (const size_t &maxmem)
 
void SetProgressCallback (FProgressCallback prg_callback, void *data)
 
TScore GetWm (void) const
 
TScore GetWms (void) const
 
TScore GetWg (void) const
 
TScore GetWs (void) const
 
const char * GetSeq1 (void) const
 
size_t GetSeqLen1 (void) const
 
const char * GetSeq2 (void) const
 
size_t GetSeqLen2 (void) const
 
void GetEndSpaceFree (bool *L1, bool *R1, bool *L2, bool *R2) const
 
bool IsSmithWaterman () const
 
EGapPreference GetGapPreference () const
 
TScore GetScore (void) const
 
size_t GetSpaceLimit (void) const
 
TTranscript GetTranscript (bool reversed=true) const
 
void SetTranscript (const TTranscript &transcript)
 
string GetTranscriptString (void) const
 
void SetPositivesAsMatches (bool positives_as_matches=true)
 
bool GetPositivesAsMatches (void) const
 
size_t GetLeftSeg (size_t *q0, size_t *q1, size_t *s0, size_t *s1, size_t min_size) const
 
size_t GetRightSeg (size_t *q0, size_t *q1, size_t *s0, size_t *s1, size_t min_size) const
 
size_t GetLongestSeg (size_t *q0, size_t *q1, size_t *s0, size_t *s1) const
 
virtual size_t GetElemSize (void) const
 
virtual TScore ScoreFromTranscript (const TTranscript &transcript, size_t start1=kMax_UInt, size_t start2=kMax_UInt) const
 
void EnableMultipleThreads (bool enable=true)
 
size_t MakePattern (const size_t hit_size=100, const size_t core_size=28)
 
CRef< objects::CDense_seg > GetDense_seg (TSeqPos query_start, objects::ENa_strand query_strand, TSeqPos subj_start, objects::ENa_strand subj_strand, bool trim_end_gaps=false) const
 
CRef< objects::CDense_seg > GetDense_seg (TSeqPos query_start, objects::ENa_strand query_strand, const objects::CSeq_id &query_id, TSeqPos subj_start, objects::ENa_strand subj_strand, const objects::CSeq_id &subj_id, bool trim_end_gaps=false) const
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 

Static Public Member Functions

static TScore GetDefaultWm (void)
 
static TScore GetDefaultWms (void)
 
static TScore GetDefaultWg (void)
 
static TScore GetDefaultWs (void)
 
static size_t GetDefaultSpaceLimit (void)
 
- Static Public Member Functions inherited from CObject
static NCBI_NORETURN void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_NORETURN void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 

Protected Member Functions

size_t x_CheckSequence (const char *seq, size_t len) const
 
virtual bool x_CheckMemoryLimit (void)
 
unsigned char x_CalcFingerPrint64 (const char *beg, const char *end, size_t &err_index)
 
const char * x_FindFingerPrint64 (const char *beg, const char *end, unsigned char fingerprint, size_t size, size_t &err_index)
 
virtual TScore x_Run (void)
 
virtual TScore x_Align (SAlignInOut *data)
 
void x_DoBackTrace (const CBacktraceMatrix4 &backtrace, SAlignInOut *data)
 
virtual ETranscriptSymbol x_GetDiagTS (size_t i1, size_t i2) const
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Protected Attributes

TScore m_Wm
 
TScore m_Wms
 
TScore m_Wg
 
TScore m_Ws
 
bool m_esf_L1
 
bool m_esf_R1
 
bool m_esf_L2
 
bool m_esf_R2
 
bool m_SmithWaterman
 
EGapPreference m_GapPreference
 
const char * m_abc
 
SNCBIFullScoreMatrix m_ScoreMatrix
 
bool m_ScoreMatrixInvalid
 
FProgressCallback m_prg_callback
 
SProgressInfo m_prg_info
 
bool m_terminate
 
vector< char > m_Seq1Vec
 
const char * m_Seq1
 
size_t m_SeqLen1
 
vector< char > m_Seq2Vec
 
const char * m_Seq2
 
size_t m_SeqLen2
 
TTranscript m_Transcript
 
bool m_PositivesAsMatches
 
TScore m_score
 
vector< size_t > m_guides
 
bool m_mt
 
size_t m_maxthreads
 
size_t m_MaxMem
 

Private Member Functions

void x_SWDoBackTrace (const CBacktraceMatrix4 &backtrace, SAlignInOut *data)
 

Friends

class CNWAlignerThread_Align
 

Additional Inherited Members

- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 

Detailed Description

Definition at line 69 of file nw_aligner.hpp.

Member Typedef Documentation

typedef bool(* CNWAligner::FProgressCallback) (SProgressInfo *)

Definition at line 155 of file nw_aligner.hpp.

Definition at line 72 of file nw_aligner.hpp.

Definition at line 199 of file nw_aligner.hpp.

Constructor & Destructor Documentation

CNWAligner::CNWAligner ( void  )

Definition at line 56 of file nw_aligner.cpp.

References SetScoreMatrix().

CNWAligner::CNWAligner ( const char *  seq1,
size_t  len1,
const char *  seq2,
size_t  len2,
const SNCBIPackedScoreMatrix scoremat = 0 
)

Definition at line 82 of file nw_aligner.cpp.

References SetScoreMatrix(), and SetSequences().

CNWAligner::CNWAligner ( const string seq1,
const string seq2,
const SNCBIPackedScoreMatrix scoremat = 0 
)

Definition at line 112 of file nw_aligner.cpp.

References SetScoreMatrix(), and SetSequences().

virtual CNWAligner::~CNWAligner ( void  )
inlinevirtual

Definition at line 88 of file nw_aligner.hpp.

Member Function Documentation

void CNWAligner::EnableMultipleThreads ( bool  enable = true)

Definition at line 1135 of file nw_aligner.cpp.

References GetCpuCount(), m_maxthreads, and m_mt.

static size_t CNWAligner::GetDefaultSpaceLimit ( void  )
inlinestatic

Definition at line 184 of file nw_aligner.hpp.

Referenced by CSplignArgUtil::SetupArgDescriptions().

static TScore CNWAligner::GetDefaultWg ( void  )
inlinestatic

Definition at line 161 of file nw_aligner.hpp.

Referenced by CAppNWA::Init().

static TScore CNWAligner::GetDefaultWm ( void  )
inlinestatic

Definition at line 159 of file nw_aligner.hpp.

Referenced by CAppNWA::Init().

static TScore CNWAligner::GetDefaultWms ( void  )
inlinestatic

Definition at line 160 of file nw_aligner.hpp.

Referenced by CAppNWA::Init().

static TScore CNWAligner::GetDefaultWs ( void  )
inlinestatic

Definition at line 162 of file nw_aligner.hpp.

Referenced by CAppNWA::Init().

CRef<objects::CDense_seg> CNWAligner::GetDense_seg ( TSeqPos  query_start,
objects::ENa_strand  query_strand,
TSeqPos  subj_start,
objects::ENa_strand  subj_strand,
bool  trim_end_gaps = false 
) const
CRef<objects::CDense_seg> CNWAligner::GetDense_seg ( TSeqPos  query_start,
objects::ENa_strand  query_strand,
const objects::CSeq_id &  query_id,
TSeqPos  subj_start,
objects::ENa_strand  subj_strand,
const objects::CSeq_id &  subj_id,
bool  trim_end_gaps = false 
) const
virtual size_t CNWAligner::GetElemSize ( void  ) const
inlinevirtual

Reimplemented in CSplicedAligner32, and CSplicedAligner16.

Definition at line 229 of file nw_aligner.hpp.

Referenced by CBandAligner::x_CheckMemoryLimit(), and x_CheckMemoryLimit().

void CNWAligner::GetEndSpaceFree ( bool L1,
bool R1,
bool L2,
bool R2 
) const

Definition at line 890 of file nw_aligner.cpp.

References m_esf_L1, m_esf_L2, m_esf_R1, and m_esf_R2.

Referenced by CNWFormatter::MakeSegments().

CNWAligner::EGapPreference CNWAligner::GetGapPreference ( ) const

Definition at line 903 of file nw_aligner.cpp.

References m_GapPreference.

size_t CNWAligner::GetLeftSeg ( size_t *  q0,
size_t *  q1,
size_t *  s0,
size_t *  s1,
size_t  min_size 
) const
size_t CNWAligner::GetLongestSeg ( size_t *  q0,
size_t *  q1,
size_t *  s0,
size_t *  s1 
) const
bool CNWAligner::GetPositivesAsMatches ( void  ) const
inline

Definition at line 214 of file nw_aligner.hpp.

size_t CNWAligner::GetRightSeg ( size_t *  q0,
size_t *  q1,
size_t *  s0,
size_t *  s1,
size_t  min_size 
) const
CNWAligner::TScore CNWAligner::GetScore ( void  ) const

Definition at line 1086 of file nw_aligner.cpp.

References g_msg_NoAlignment, m_score, m_Transcript, and NCBI_THROW.

Referenced by CNWFormatter::AsSeqAlign().

const SNCBIFullScoreMatrix& CNWAligner::GetScoreMatrix ( void  ) const
inline

Definition at line 117 of file nw_aligner.hpp.

const char* CNWAligner::GetSeq1 ( void  ) const
inline
const char* CNWAligner::GetSeq2 ( void  ) const
inline
size_t CNWAligner::GetSeqLen1 ( void  ) const
inline

Definition at line 170 of file nw_aligner.hpp.

size_t CNWAligner::GetSeqLen2 ( void  ) const
inline
size_t CNWAligner::GetSpaceLimit ( void  ) const
inline

Definition at line 183 of file nw_aligner.hpp.

CNWAligner::TTranscript CNWAligner::GetTranscript ( bool  reversed = true) const
string CNWAligner::GetTranscriptString ( void  ) const
TScore CNWAligner::GetWg ( void  ) const
inline

Definition at line 166 of file nw_aligner.hpp.

Referenced by CMultiAligner::x_RealignBlocks().

TScore CNWAligner::GetWm ( void  ) const
inline

Definition at line 164 of file nw_aligner.hpp.

Referenced by CNWFormatter::SSegment::Update().

TScore CNWAligner::GetWms ( void  ) const
inline

Definition at line 165 of file nw_aligner.hpp.

TScore CNWAligner::GetWs ( void  ) const
inline

Definition at line 167 of file nw_aligner.hpp.

Referenced by CMultiAligner::x_RealignBlocks().

bool CNWAligner::IsSmithWaterman ( ) const
size_t CNWAligner::MakePattern ( const size_t  hit_size = 100,
const size_t  core_size = 28 
)
CNWAligner::TScore CNWAligner::Run ( void  )
virtual
CRef<objects::CSeq_align> CNWAligner::Run ( objects::CScope &  scope,
const objects::CSeq_loc &  loc1,
const objects::CSeq_loc &  loc2,
bool  trim_end_gaps = true 
)
CRef<objects::CSeq_align> CNWAligner::Run ( objects::CScope &  scope,
const objects::CSeq_id &  id1,
const objects::CSeq_id &  id2,
bool  trim_end_gaps = true 
)
CNWAligner::TScore CNWAligner::ScoreFromTranscript ( const TTranscript transcript,
size_t  start1 = kMax_UInt,
size_t  start2 = kMax_UInt 
) const
virtual
void CNWAligner::SetEndSpaceFree ( bool  Left1,
bool  Right1,
bool  Left2,
bool  Right2 
)
void CNWAligner::SetGapPreference ( EGapPreference  p)

Control preference for where to place a gap if there is a choice; default is eLater, placing the gap as late as possible.

Definition at line 210 of file nw_aligner.cpp.

References m_GapPreference.

void CNWAligner::SetPattern ( const vector< size_t > &  pattern)
void CNWAligner::SetPositivesAsMatches ( bool  positives_as_matches = true)
inline

Definition at line 211 of file nw_aligner.hpp.

void CNWAligner::SetProgressCallback ( FProgressCallback  prg_callback,
void *  data 
)
void CNWAligner::SetScoreMatrix ( const SNCBIPackedScoreMatrix scoremat)
void CNWAligner::SetSequences ( const char *  seq1,
size_t  len1,
const char *  seq2,
size_t  len2,
bool  verify = true 
)
virtual
void CNWAligner::SetSequences ( const string seq1,
const string seq2,
bool  verify = true 
)

Definition at line 184 of file nw_aligner.cpp.

References SetSequences(), and verify.

void CNWAligner::SetSmithWaterman ( bool  SW)

Definition at line 201 of file nw_aligner.cpp.

References m_esf_L1, m_esf_L2, m_esf_R1, m_esf_R2, and m_SmithWaterman.

void CNWAligner::SetSpaceLimit ( const size_t &  maxmem)
inline
void CNWAligner::SetTranscript ( const TTranscript transcript)

Definition at line 923 of file nw_aligner.cpp.

References m_score, m_Transcript, and ScoreFromTranscript().

void CNWAligner::SetWg ( TScore  value)
inline
void CNWAligner::SetWm ( TScore  value)
void CNWAligner::SetWms ( TScore  value)
void CNWAligner::SetWs ( TScore  value)
inline
CNWAligner::TScore CNWAligner::x_Align ( SAlignInOut data)
protectedvirtual
unsigned char CNWAligner::x_CalcFingerPrint64 ( const char *  beg,
const char *  end,
size_t &  err_index 
)
protected

Definition at line 1395 of file nw_aligner.cpp.

References fp.

Referenced by MakePattern(), and x_FindFingerPrint64().

bool CNWAligner::x_CheckMemoryLimit ( void  )
protectedvirtual
size_t CNWAligner::x_CheckSequence ( const char *  seq,
size_t  len 
) const
protected

Definition at line 1064 of file nw_aligner.cpp.

References len, m_abc, tolower(), and toupper().

Referenced by SetSequences().

void CNWAligner::x_DoBackTrace ( const CBacktraceMatrix4 backtrace,
SAlignInOut data 
)
protected
const char * CNWAligner::x_FindFingerPrint64 ( const char *  beg,
const char *  end,
unsigned char  fingerprint,
size_t  size,
size_t &  err_index 
)
protected

Definition at line 1418 of file nw_aligner.cpp.

References fp, and x_CalcFingerPrint64().

Referenced by MakePattern().

CNWAligner::ETranscriptSymbol CNWAligner::x_GetDiagTS ( size_t  i1,
size_t  i2 
) const
protectedvirtual
CNWAligner::TScore CNWAligner::x_Run ( void  )
protectedvirtual
void CNWAligner::x_SWDoBackTrace ( const CBacktraceMatrix4 backtrace,
SAlignInOut data 
)
private

Friends And Related Function Documentation

friend class CNWAlignerThread_Align
friend

Definition at line 400 of file nw_aligner.hpp.

Referenced by x_Run().

Member Data Documentation

const char* CNWAligner::m_abc
protected

Definition at line 280 of file nw_aligner.hpp.

Referenced by SetScoreMatrix(), and x_CheckSequence().

bool CNWAligner::m_esf_L1
protected
bool CNWAligner::m_esf_L2
protected
bool CNWAligner::m_esf_R1
protected
bool CNWAligner::m_esf_R2
protected
EGapPreference CNWAligner::m_GapPreference
protected

Definition at line 277 of file nw_aligner.hpp.

Referenced by GetGapPreference(), SetGapPreference(), and x_Align().

vector<size_t> CNWAligner::m_guides
protected
size_t CNWAligner::m_MaxMem
protected

Definition at line 324 of file nw_aligner.hpp.

Referenced by CBandAligner::x_CheckMemoryLimit(), and x_CheckMemoryLimit().

size_t CNWAligner::m_maxthreads
protected

Definition at line 321 of file nw_aligner.hpp.

Referenced by EnableMultipleThreads(), CMMAligner::x_DoSubmatrix(), and x_Run().

bool CNWAligner::m_mt
protected

Definition at line 320 of file nw_aligner.hpp.

Referenced by EnableMultipleThreads(), CMMAligner::x_DoSubmatrix(), and x_Run().

bool CNWAligner::m_PositivesAsMatches
protected

Definition at line 315 of file nw_aligner.hpp.

Referenced by x_GetDiagTS().

FProgressCallback CNWAligner::m_prg_callback
protected
SProgressInfo CNWAligner::m_prg_info
mutableprotected
TScore CNWAligner::m_score
protected
SNCBIFullScoreMatrix CNWAligner::m_ScoreMatrix
protected
bool CNWAligner::m_ScoreMatrixInvalid
protected

Definition at line 282 of file nw_aligner.hpp.

Referenced by Run(), SetScoreMatrix(), SetWm(), and SetWms().

const char* CNWAligner::m_Seq1
protected
vector<char> CNWAligner::m_Seq1Vec
protected

Definition at line 294 of file nw_aligner.hpp.

Referenced by SetSequences().

const char* CNWAligner::m_Seq2
protected
vector<char> CNWAligner::m_Seq2Vec
protected

Definition at line 297 of file nw_aligner.hpp.

Referenced by SetSequences().

size_t CNWAligner::m_SeqLen1
protected
size_t CNWAligner::m_SeqLen2
protected
bool CNWAligner::m_SmithWaterman
protected

Definition at line 275 of file nw_aligner.hpp.

Referenced by IsSmithWaterman(), Run(), SetSmithWaterman(), x_Align(), and x_SWDoBackTrace().

bool CNWAligner::m_terminate
mutableprotected
TTranscript CNWAligner::m_Transcript
protected
TScore CNWAligner::m_Wg
protected
TScore CNWAligner::m_Wm
protected
TScore CNWAligner::m_Wms
protected
TScore CNWAligner::m_Ws
protected

The documentation for this class was generated from the following files:
Modified on Fri Apr 20 12:42:49 2018 by modify_doxy.py rev. 546573