: m_Alignment(
NULL),
64: m_ScoreColls(
NULL),
65m_EnBgProcessing(
true),
93m_Listener = listener;
105 _ASSERT(grad_n > 1 && grad_n <= 0xFFFF);
174 ERR_POST(
"CScoringCache::OnAJNotification() - unknown Job ID "<< job_id);
251 ERR_POST(
"CScoreCache::x_TransferResults() - invalid results!");
295 floatnorm_done = prg->GetNormDone();
327: m_ScoreColls(
NULL),
491vector<size_t> row_size(row_n);
493 boolis_mixed =
false;
499 else if(!is_mixed && base_width !=
GetAlignment()->GetBaseWidth(
r)) {
504 if(translate && !is_mixed && base_width == 1) {
509 size_tseq_len =
m_vRows[
r].size();
514seq_len = new_seq.size();
522 for(
size_t i= 0;
i< seq_len; ++
i) {
524 _ASSERT(n_i + 2 < new_seq.size());
525 if(n_i > new_seq.size() - 2)
527new_seq[n_i] = new_seq[n_i + 1] = new_seq[n_i + 2] =
m_vRows[
r][
i];
531seq_len = seq_len * 3;
533 else if(translate && base_width == 1) {
536seq_len = new_seq.size();
549 int&
state,
intgencode)
const 551 constobjects::CTrans_table& tbl =
552objects::CGen_code_table::GetTransTable(gencode);
554 size_tna_remainder = na.size() % 3;
555 size_tna_size = na.size() - na_remainder;
558aa.resize(na_size / 3 + (na_remainder ? 1 : 0));
561 if( na.empty() )
return;
564 for(
size_tna_i = 0; na_i < na_size; ) {
565 for(
size_t i= 0;
i< 3; ++
i, ++na_i) {
566 state= tbl.NextCodonState(
state, na[na_i]);
568aa[aa_i++] = tbl.GetCodonResidue(
state);
618 if(aligned_row == anchor)
633 if(anchor_width == 3) {
636}
else if(aligned_width == 3) {
643ranges.emplace_back(curr_aln_r.
GetFrom(), curr_aln_r.
GetTo());
647 bool negative= prot_from > prot_to;
649 swap(prot_from, prot_to);
654ranges.emplace_back(curr_aln_r.
GetFrom() - f_off, curr_aln_r.
GetTo() + t_off);
672itC->SetFrom(aln_start);
675 string column(row_n,
'\0');
682vector<TSeqRange> ranges;
684 if(mixed && aln_mgr->
GetAnchor() >= 0)
687ranges.emplace_back(aln_start, aln_stop);
690 boolneed_translation =
false;
692need_translation =
true;
700 automax_len =
abs((
int)aln_stop - (
int)aln_start) + 1;
703 static const intkMaxMemoryForBuffers = 16 * 1024 * 1024;
704 if(row_n * max_len * col_width <= kMaxMemoryForBuffers) {
707 kPageSize= max<int>(300, kMaxMemoryForBuffers/(row_n * col_width));
712 ITERATE(vector<TSeqRange>, r_iter, ranges) {
714 autorange = *r_iter;
717 TSeqPosstart = range.GetFrom();
720 if(pre_pos < start) {
725(*m_ScoreColls)[
r].push_back(0, start - pre_pos);
733 m_NormDone= float(pos - start) / (stop - start);
738 while(p <= pos_stop) {
742 charcons = (cons_row > -1) ?
column[cons_row] : 0;
747sc = ((
int) (sc * grad_n)) / grad_n;
748(*m_ScoreColls)[
r].push_back(sc, col_width);
770 typedefTScoreColl::const_pos_iterator TPosIt;
778TPosIt itC_end = score_row.
end_pos();
785 TScorethis_score = it_sc->GetAttr();
786 if(this_score < old_min) old_min = this_score;
787 if(this_score > old_max) old_max = this_score;
793TPosIt win_begin = itC;
794TPosIt win_end = itC_end;
800 TScorewin_score = win_sum / (win_end - win_begin);
802 if(win_score < new_min) {
805 if(win_score > new_max) {
813 for( ++itC; itC != itC_end; ++itC ) {
817win_sum -= *win_begin;
820 if(win_end < itC_end) {
825win_score = win_sum/(win_end - win_begin);
827 if(win_score < new_min) new_min = win_score;
828 if(win_score > new_max) new_max = win_score;
838 TScorenorm_slope = (old_max - old_min) / (new_max - new_min);
841(it_sc->GetAttr() - new_min) * norm_slope + old_min,
842it_sc->GetLength() );
844score_row.
swap(norm_score_row);
static void s_SetRangesForMixedAlignments(const IScoringAlignment *aln_mgr, vector< TSeqRange > &ranges)
ON_EVENT(CAppJobNotification, CAppJobNotification::eStateChanged, &CScoreCache::OnAJNotification) ON_EVENT(CAppJobNotification
CAppJobNotification Notification send by CAppJobEventTranslator.
CAppJobProgress Default implementation for IAppJobProgress - the class encapsulates a text message an...
CEvent - generic event implementation TODO TODO - Attachments.
class CRgbaColor provides a simple abstraction for managing colors.
virtual void OnScoringFinished()=0
virtual void OnScoringProgress(float progress, const string &msg)=0
void x_OnJobCanceled(CAppJobNotification ¬n)
CScoreCache()
CScoreCache.
CRef< CScoringJob > m_Job
void x_OnJobFailed(CAppJobNotification ¬n)
TScoreCollVector * m_ScoreColls
vector< TScoreColl > TScoreCollVector
void SetScoringMethod(IScoringMethod *method)
void x_OnJobCompleted(CAppJobNotification ¬n)
IAlnExplorer::TNumrow TNumrow
bool x_IsJobRunning()
returns true if CScoreCache launched the job and it has not finished yet (it may have finished,...
bool x_TransferResults(CObject *result)
void OnAJNotification(CEvent *evt)
bool HasScores() const
returns "true" if CalculateScores() did produce results
void x_DeleteJob()
stop the job and destriy it
const TScoreColl & GetScores(TNumrow row) const
void CalculateScores(const TSeqRange &range=TSeqRange::GetEmpty())
Recalculate scores using current method; resets scores if no method is selected.
const CRgbaColor & GetColorForNoScore(IScoringMethod::EColorType type) const
void x_OnJobProgress(CAppJobNotification ¬n)
void EnableBackgoundProcessing(bool en)
IListener * m_Listener
score storage
void SetGradNumber(int grad_n)
Sets the number of score gradations.
TScoreCollVector * m_ScoreColls
IScoringMethod::TScore TScore
IAlnExplorer::TNumrow TNumrow
void x_UpdateBuffer(TSeqPos start, TSeqPos stop, int &state, bool translate=false)
Fetches sequence from CAlnVec.
char x_BufferGetSeq(TSeqPos pos, TNumrow row) const
Sequence buffer management routins.
virtual EJobState Run()
Function that does all the useful work, called by the Engine.
virtual CRef< CObject > GetResult()
Returns the Job Result.
string m_Descr
buffer row length
const IScoringAlignment * GetAlignment() const
void x_WindowAvgScores(size_t window_size)
void x_AllocBuffer(TSeqPos row_len)
CRef< CAppJobError > m_Error
virtual string GetDescr() const
Returns a human readable description of the Job (optional)
CRef< CScoringJobResult > m_Result
normalized [0, 1.0] progress
vector< string > m_vRows
Sequence buffer data members.
virtual CConstIRef< IAppJobProgress > GetProgress()
return progress object, the function shall be synchronized internally.
TScoreCollVector * m_ScoreColls
void x_CalculateSequenceScores(IRowScoringMethod &method)
void TranslateNAToAA(const string &na, string &aa, int &state, int gencode=1) const
IScoringMethod::TScoreVector TScoreVector
void x_CalculateAlignmentScores(IColumnScoringMethod &method)
vector< TScoreColl > TScoreCollVector
TScoreCollVector * GetResults()
transfers ownership
virtual CConstIRef< IAppJobError > GetError()
Returns IAppJobError object describing internal error that caused the Job to fail.
TSeqPos m_RowLength
Aln position corresponding to the first column of the buffer.
CScoringJob(CScoringParams ¶ms)
CScoringJob.
CScoringParams m_Params
score storage
void x_BufferGetColumn(TSeqPos pos, string &column) const
Alignment segment iterator interface.
@ eSkipGaps
Skip gap segments (show only aligned ranges)
Alignment segment interface.
virtual const TSignedRange & GetAlnRange(void) const =0
Get alignment range for the segment.
IColumnScoringMethod - column-based method.
virtual void UpdateSettings(const IScoringAlignment &aln)
Set alignment specifi settings.
virtual void CalculateScores(char cons, const string &column, IScoringMethod::TScore &col_score, IScoringMethod::TScoreVector &scores)=0
virtual bool CanCalculateScores(const IScoringAlignment &aln)=0
Do we have what it takes to calculate scores? e.g. a master row selected?
virtual bool NeedsTranslation() const
IRowScoringMethod - row-based method.
virtual void CalculateScores(IAlnExplorer::TNumrow row, const IScoringAlignment &aln, IScoringMethod::TScoreColl &scores)=0
virtual TSeqPos GetAlnStart() const =0
virtual bool IsMixedAlign() const
New interfaces to handle alignemnt with mixed type (protein-to-genomic) To make them backward compati...
virtual TSeqPos GetBaseWidth(IAlnExplorer::TNumrow) const =0
virtual TSeqPos GetAlnStop() const =0
virtual string & GetAlnSeqString(IAlnExplorer::TNumrow row, string &buffer, const IAlnExplorer::TSignedRange &aln_range) const =0
virtual IAlnExplorer::TNumrow GetNumRows() const =0
virtual IAlnExplorer::TNumrow GetAnchor() const =0
virtual IAlnSegmentIterator * CreateSegmentIterator(IAlnExplorer::TNumrow, const IAlnExplorer::TSignedRange &, IAlnSegmentIterator::EFlags) const =0
virtual TSignedSeqPos GetSeqPosFromAlnPos(IAlnExplorer::TNumrow for_row, TSeqPos aln_pos, IAlnExplorer::ESearchDirection dir=IAlnExplorer::eNone, bool try_reverse_dir=true) const =0
IScoringMethod represents an abstract algorithm for calculating alignment scores and assigning colors...
IWindowScoringMethod - Method that can be windowed, i.e.
virtual size_t GetWindowSize() const =0
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const char * column
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
int TSignedSeqPos
Type for signed sequence position.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
CConstIRef< IAppJobError > GetError() const
returns non-null pointer only if job Failed
const_pos_iterator begin_pos() const
static CAppJobDispatcher & GetInstance()
CRef< CObject > GetResult() const
returns non-null pointer only if Completed or Running and has temporary results available
const_pos_iterator end_pos() const
virtual bool IsCanceled() const override
position_type GetLength(void) const
void swap(CAttrRangeCollection &c)
bool DeleteJob(TJobID job_id)
when a Job is deleted the listener is not notified
EJobState
Job states (describe FSM)
TJobID StartJob(IAppJob &job, const string &engine_name, IEngineParams *params=NULL)
Starts a Job on the specified engine in "passive mode" - no notifications or progress reports will be...
CConstIRef< IAppJobProgress > GetProgress() const
returns non-null pointer only if notification type is eProgress
void push_back(const attr_type &attr)
#define END_EVENT_MAP()
Ends definition of Command Map.
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
TJobState GetState() const
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
position_type GetLength(void) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
unsigned int
A callback function used to compare two keys in a database.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
Process information in the NCBI Registry, including working with configuration files.
The NCBI C++/STL use hints.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static const TSeqPos kPageSize
#define row(bind, expected)
CConstIRef< IScoringAlignment > m_Alignment
CIRef< IScoringMethod > m_Method
TSeqRange m_VisibleRange
Visible range in the alignment coordinates if range is not empty scoring is applied to this range onl...
CScoringParams()
CScoringParams.
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