(bio_handle.GetScope().GetObjectManager())
83 s_ScopeTls.SetValue(s, TlsValCleanup<TScopeRef>, 0);
100 autoTaxId =
GetTaxId(fExtOrgLookup);
117list<CRef<CSeqdesc> > seqdesclist = bio_handle.
GetDescr().
Get();
118 for(
autoseqdesc : seqdesclist) {
119 if(seqdesc->IsTitle()) {
135 if(!
m_TaxId&& fExtOrgLookup) {
174 if(biosrc.IsSetTaxname()) {
175taxonomy = biosrc.GetTaxname();
176 const COrg_ref&org = biosrc.GetOrg();
199 if(taxonomy.empty())
209m_CreateConsensus(
false),
210m_isDataReadSync(
false)
225 LOG_POST(
Error<<
"CAlnVecMultiDataSource::~CAlnVecMultiDataSource(): " 226<<
"failed to delete job: "<< e.
GetMsg());
241 returnm_ConsRowIndex;
247vector< CConstRef<CSeq_align> > aligns;
249 if(annot.GetData().IsAlign() ) {
251aligns.emplace_back(*it);
254 Init(aligns, sync, select_anchor);
260vector< CConstRef<CSeq_align> > aligns;
266aligns.emplace_back(&*it);
268 Init(aligns, sync, select_anchor);
273 boolsync,
boolselect_anchor)
325 ERR_POST(
"CAlnVecMultiDataSource::OnAppJobNotification() - unknown Job ID "<< job_id);
352progressSoFar->GetText(), progressSoFar->GetNormDone());
374 if(!
row->IsConsensus())
412 string text= prg->GetText();
432 if(
m_AlnVec->GetDenseg().IsSetWidths()) {
442}
catch(exception& e) {
553 booltry_reverse_dir)
const 555 return m_AlnVec->GetAlnPosFromSeqPos(for_row, aln_pos,
562 booltry_reverse_dir)
const 584 if(seq_start > seq_stop) {
585 swap(seq_start, seq_stop);
590 TSeqPosfrom =
max(seq_start, it->GetFrom());
595 if(aln_from > aln_to) {
596 swap(aln_from, aln_to);
614 TSeqPosaln_from =
max(aln_start, it->GetFrom());
677fill_n(base_count, numBases, 0);
680 for(
size_t i= 0;
i< rows.size(); ++
i) {
681 if(col >= rows[
i].
size())
758fill_n(base_count, numBases, 0);
761 for(
size_t i= 0;
i< rows.size(); ++
i) {
766 if(0 <= pos && pos < numBases)
774 boolisNucleotide =
m_AlnVec->GetBioseqHandle(0).IsNucleotide();
776 const intnumBases = isNucleotide ? 4 : 26;
777 const autonum_rows =
m_AlnVec->GetNumRows();
778 const autonum_segs =
m_AlnVec->GetNumSegs();
784 intgap_seg_thresh = num_rows - num_rows / 2;
786 for(
autoj = 0; j < num_segs; ++j) {
789 autoseg_len =
m_AlnVec->GetLen(j, 0);
790 for(
auto i= 0;
i< num_rows; ++
i) {
791 if(
m_AlnVec->GetStart(
i, j, 0) == -1) {
800 if(gap_count > gap_seg_thresh) {
801consens[j].resize(seg_len);
802 for(
size_t i= 0;
i< seg_len; ++
i)
803consens[j][
i] =
m_AlnVec->GetGapChar(0);
811((num_rows - gap_count) * 7 + 5) / 10;
815consens[j].resize(seg_len);
818vector<string> segs(num_rows);
819 m_AlnVec->RetrieveSegmentSequences(j, segs);
825 for(
auto i= 0;
i< seg_len; ++
i) {
841 for(
intk = 0; k < numBases; ++k) {
851 if(rev_map.count(rev_map.begin()->first) == 1 &&
852rev_map.begin()->first >= base_thresh) {
853consens[j][
i] = isNucleotide ?
854 m_AlnVec->ToIupac(rev_map.begin()->second) :
855(rev_map.begin()->second +
'A');
861 unsigned charc = 0x00;
863TRevMap::iterator curr = rev_map.begin();
864TRevMap::iterator
prev= rev_map.begin();
866curr != rev_map.end() &&
867(freq < base_thresh ||
prev->first == curr->first);
875 unsigned charcur_char = curr->second +
'A';
880 case 'N':
case 'D':
881c = (cur_char ==
'N'|| cur_char ==
'D') ?
'B':
'X';
883 case 'Q':
case 'E':
884c = (cur_char ==
'Q'|| cur_char ==
'E') ?
'Z':
'X';
886 case 'I':
case 'L':
887c = (cur_char ==
'I'|| cur_char ==
'L') ?
'J':
'X';
899consens[j][
i] = isNucleotide ?
'N':
'X';
902consens[j][
i] = isNucleotide ?
m_AlnVec->ToIupac(c) : c;
934unique_ptr<vector<string>> consens(
newvector<string>);
935consens->resize(
m_AlnVec->GetNumSegs());
938 CSeq_idconsensus_id(
"lcl|consensus");
941*bioseq, consensus_id, consens.get());
946 m_AlnVec->GetScope().AddTopLevelSeqEntry(*entry);
959 CScope& scope = **scope_ptr;
970 ERR_POST(
"Exception when calling scope.ResetDataAndHistory()");
981 autoseq_len = new_seq.size();
982seq.resize(seq_len * 3);
984 for(
size_t i= 0;
i< seq_len; ++
i) {
986seq[n_i] = seq[n_i + 1] = seq[n_i + 2] = new_seq[
i];
990 #ifdef _SHOW_CONSENSUS_IN_PANORAMA_ 993 'A',
'C',
'D',
'E',
'F',
994 'G',
'H',
'I',
'K',
'L',
995 'M',
'N',
'O',
'P',
'Q',
996 'R',
'S',
'T',
'U',
'V',
997 'W',
'Y',
'X',
' ',
'-' 1001 'A',
'C',
'G',
'T',
'N',
' ',
'-' 1005 #define ADD_BASE_TO_GRAPH(b) \ 1006 { if (graphs[b].size() == 0) graphs[b].resize(ref_len, 0); graphs[b][curr_pos] += 1; } 1019 charambiguous_residue =
' ';
1020 if(align_type == IAlnExplorer::EAlignType::fDNA)
1021ambiguous_residue =
'N';
1023ambiguous_residue =
'X';
1032 if(translate_sequence)
1035 boolref_is_consensus = anchor != -1 && anchor == consensus_idx;
1037 #ifdef _SHOW_CONSENSUS_IN_PANORAMA_ 1038 const set<char>* non_ambiguous_set =
nullptr;
1039 if(consensus_idx >= 0) {
1041non_ambiguous_set = &ss_NonAmbiguousAA;
1043non_ambiguous_set = &ss_NonAmbiguousDNA;
1049 if(
row== consensus_idx)
1052unique_ptr<IAlnSegmentIterator> p_it
1075 if(curr_aln_start < aln_range.
GetFrom()) {
1076pos = aln_range.
GetFrom() - curr_aln_start;
1078off = curr_aln_start - aln_range.
GetFrom();
1080 size_tcurr_pos = off;
1084 if(translate_sequence)
1088 while(pos < seg_len && curr_pos < ref_len) {
1090 charbase = aln_seq[pos];
1093}
else if(anchor >=0 && curr_pos < ref_len) {
1094 #ifdef _SHOW_CONSENSUS_IN_PANORAMA_ 1096 if(non_ambiguous_set && non_ambiguous_set->count(ref_str[curr_pos]) == 0)
1100 if(base != ref_str[curr_pos] && base != ambiguous_residue) {
1101 if(ref_str[curr_pos] != ambiguous_residue || ref_is_consensus) {
static CRef< CScope > m_Scope
static void s_GetTaxonomyInfoFromService(int tax_id, string &taxonomy)
USING_SCOPE(ncbi::objects)
static void s_TranslateAndExpand(string &seq, int gen_code)
static objects::CScope & s_GetPristineScope(const objects::CBioseq_Handle &bio_handle)
static void s_GetTaxonomyInfoFromBiosrc(const objects::CBioSource &biosrc, std::string &taxonomy)
void CollectNucleotideFrequences(const vector< string > &rows, int col, int base_count[], int numBases)
ON_EVENT(CAppJobNotification, CAppJobNotification::eStateChanged, &CAlnVecMultiDataSource::OnAppJobNotification) ON_EVENT(CAppJobNotification
void CollectProteinFrequences(const vector< string > &rows, int col, int base_count[], int numBases)
void TlsValCleanup(T *oldVal, void *)
#define ADD_BASE_TO_GRAPH(b)
static CStaticTls< TScopeRef > s_ScopeTls
CAlnVecMultiDataSource - implementation of IAlnMultiDataSource for CAlnVec-based alignments.
virtual const IAlignRowHandle * GetRowHandle(TNumrow row) const
virtual void x_OnJobProgress(CAppJobNotification ¬n)
virtual bool IsPositiveStrand(TNumrow row) const
virtual TSeqPos GetSeqStop(TNumrow row) const
virtual void GetAlnFromSeq(TNumrow row, const TRangeColl &seq_coll, TRangeColl &aln_coll) const
virtual TNumrow GetNumRows(void) const
number of rows in alignment
virtual void CreateConsensus()
virtual TSignedSeqPos GetAlnPosFromSeqPos(TNumrow row, TSeqPos seq_pos, TSearchDirection dir=IAlnExplorer::eNone, bool try_reverse_dir=true) const
virtual void GetSeqFromAln(TNumrow row, const TRangeColl &aln_coll, TRangeColl &seq_coll) const
virtual void Init(const objects::CSeq_annot &annot, bool sync=false, bool select_anchor=false)
virtual bool SetAnchor(TNumrow anchor)
virtual TSeqPos GetSeqStart(TNumrow row) const
virtual void SetGapChar(TResidue gap_char)
vector< CAlnVecRowHandle * > THandleVector
virtual void x_DeleteJob()
virtual TSignedSeqPos GetSeqPosFromAlnPos(TNumrow for_row, TSeqPos aln_pos, TSearchDirection dir=IAlnExplorer::eNone, bool try_reverse_dir=true) const
virtual TSeqPos GetBaseWidth(TNumrow row) const
virtual bool IsNegativeStrand(TNumrow row) const
virtual IAlnSegmentIterator * CreateSegmentIterator(TNumrow row, const IAlnExplorer::TSignedRange &range, IAlnSegmentIterator::EFlags flags) const
CAlnVecMultiDataSource(objects::CScope &scope)
virtual string & GetAlnSeqString(TNumrow row, string &buffer, const IAlnExplorer::TSignedRange &aln_range) const
virtual TSeqPos GetAlnStart(void) const
virtual bool IsSetAnchor(void) const
Anchoring methods.
virtual IAlnExplorer::EAlignType GetAlignType() const
virtual void x_CreateHandles()
void OnAppJobNotification(CEvent *evt)
virtual TSeqPos GetAlnStop(void) const
virtual bool UnsetAnchor(void)
CRef< objects::CScope > m_Scope
virtual const objects::CSeq_id & GetSeqId(TNumrow row) const
CRef< objects::CAlnVec > m_AlnVec
virtual bool x_IsJobRunning()
virtual void x_ClearHandles()
~CAlnVecMultiDataSource()
virtual bool CanGetId(TNumrow row) const
virtual void x_Assign(objects::CAlnVec &aln_vec)
virtual bool CanCreateConsensus()
virtual const objects::CBioseq_Handle & GetBioseqHandle(TNumrow row) const
CRef< CBuildAlnVecJob > m_Job
virtual bool IsEmpty() const
virtual TNumrow GetAnchor(void) const
static void s_CleanScope()
virtual bool CanChangeAnchor(void) const
virtual int GetGenCode(IAlnExplorer::TNumrow row) const
CAlnVecRowHandle is inherited from IAlignRowHandle and represents a row of CAlnVec-based alignment.
static void TranslateNAToAA(const string &na, string &aa, int gen_code=kDefaultGenCode)
CAppJobNotification Notification send by CAppJobEventTranslator.
CRef< objects::CAlnVec > m_AlnVec
CUpdate - notification send by CUIDataSource to the listener.
virtual void NotifyListener(CUpdate &update)
CEvent - generic event implementation TODO TODO - Attachments.
void GetLabel(string *label) const
TThisType & CombineWith(const TRange &r)
string GetTaxname(int tax_id)
static CTaxonCache & GetInstance()
string GetCommon(int tax_id)
string GetLabel(int tax_id)
string GetBlastName(int tax_id)
IAlignRowHandle provides an abstract way to access alignment row data.
virtual bool CanGetBioseqHandle() const =0
virtual const string & GetOrgLabel(bool fExtOrgLookup=false) const
virtual int GetGenCode() const =0
virtual const objects::CBioseq_Handle & GetBioseqHandle() const =0
virtual void GetTaxonomy(string &taxonomy, bool fExtOrgLookup=false) const
virtual int GetTaxId(bool fExtOrgLookup=false) const
virtual IAlnSegmentIterator * CreateSegmentIterator(const IAlnExplorer::TSignedRange &range, IAlnSegmentIterator::EFlags flags) const =0
virtual const string & GetText() const =0
ESearchDirection
Position search options.
@ eRight
Towards higher aln coord (always to the right)
@ eLeft
Towards lower aln coord (always to the left)
virtual IAlnExplorer::EAlignType GetAlignType() const =0
virtual int GetConsensusRow() const =0
returns index of the Consensus row or -1 if it doesn't exist
void CollectAlignStats(const TSignedSeqRange &range, TStatGraphs &graphs, bool translate_sequence=false) const
IAlnExplorer::TResidue TResidue
virtual IAlnSegmentIterator * CreateSegmentIterator(TNumrow row, const IAlnExplorer::TSignedRange &range, IAlnSegmentIterator::EFlags flags) const =0
IAlnExplorer::TNumrow TNumrow
virtual TNumrow GetNumRows(void) const =0
number of rows in alignment
virtual bool IsSetAnchor(void) const =0
Anchoring methods.
virtual TNumrow GetAnchor(void) const =0
virtual string & GetAlnSeqString(TNumrow row, string &buffer, const IAlnExplorer::TSignedRange &aln_range) const =0
Alignment segment iterator interface.
@ eAllSegments
Iterate all segments.
Alignment segment interface.
virtual const TSignedRange & GetRange(void) const =0
Get the selected row range.
@ fAligned
Aligned segment.
@ fIndel
Either anchor or the selected row is not present in the segment.
@ fGap
Both anchor row and the selected row are not included in the segment (some other row is present and t...
virtual TSegTypeFlags GetType(void) const =0
Get current segment type.
virtual const TSignedRange & GetAlnRange(void) const =0
Get alignment range for the segment.
virtual int GetGenCode(IAlnExplorer::TNumrow row) const =0
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
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.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
static objects::SAnnotSelector GetAnnotSelector(TAnnotFlags flags=0)
request an annotation selector for a given type
static bool IsVDBAccession(const string &acc)
Check if string starts with ("SRA", "SRR", "DRR", "ERR")
CConstIRef< IAppJobError > GetError() const
returns non-null pointer only if job Failed
void RunSync(IAppJob &job, TJobID &jobId, CEventHandler &listener)
Runs jon synchronously sending job notifications synchronously Returns when job is finished.
static CAppJobDispatcher & GetInstance()
CRef< CObject > GetResult() const
returns non-null pointer only if Completed or Running and has temporary results available
bool DeleteJob(TJobID job_id)
when a Job is deleted the listener is not notified
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
#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
const CBioSource * GetBioSource(const CBioseq &bioseq)
Retrieve the BioSource object for a given bioseq handle.
TTaxId GetTaxId(const CBioseq_Handle &handle)
return the tax-id associated with a given sequence.
void ResetDataAndHistory(void)
Clear all information in the scope except added data loaders.
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
const TDescr & GetDescr(void) const
bool CanGetDescr(void) const
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty â pointing to an object and has a non-null value.
position_type GetLength(void) const
CRange< TSeqPos > TSeqRange
typedefs for sequence ranges
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
const TOrg & GetOrg(void) const
Get the Org member data.
TFrom GetFrom(void) const
Get the From member data.
bool CanGetCommon(void) const
Check if it is safe to call GetCommon method.
const TCommon & GetCommon(void) const
Get the Common member data.
TSeq & SetSeq(void)
Select the variant.
bool CanGet(void) const
Check if it is safe to call Get method.
const TInst & GetInst(void) const
Get the Inst member data.
list< CRef< CSeq_align > > TAlign
const Tdata & Get(void) const
Get the member data.
TMol GetMol(void) const
Get the Mol member data.
static void text(MDB_val *v)
constexpr bool empty(list< Ts... >) noexcept
double value_type
The numeric datatype used by the parser.
const struct ncbi::grid::netcache::search::fields::SIZE size
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
#define row(bind, expected)
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