NCBI C++ ToolKit
tse_info.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: tse_info.cpp 98264 2022-10-19 19:18:38Z vasilche $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Author: Aleksey Grichenko, Eugene Vasilchenko
27 *
28 * File Description:
29 * TSE info -- entry for data source seq-id to TSE map
30 *
31 */
32 
33 
34 #include <ncbi_pch.hpp>
36 #include <objmgr/impl/tse_info.hpp>
48 
51 
53 #include <objmgr/error_codes.hpp>
54 
55 #include <algorithm>
56 
57 
58 #define NCBI_USE_ERRCODE_X ObjMgr_TSEinfo
59 
61 
63 
65 
66 
68 {
69 }
70 
71 
73 {
75  delete *it;
76  *it = 0;
77  }
78 }
79 
80 
82 {
83  if ( index >= m_AnnotSet.size() ) {
84  m_AnnotSet.resize(index+1);
85  }
86  TRangeMap*& slot = m_AnnotSet[index];
87  if ( !slot ) {
88  slot = new TRangeMap;
89  }
90  return *slot;
91 }
92 
93 
95 {
96  while ( !m_AnnotSet.empty() ) {
97  TRangeMap*& slot = m_AnnotSet.back();
98  if ( slot ) {
99  if ( !slot->empty() ) {
100  return false;
101  }
102  delete slot;
103  slot = 0;
104  }
105  m_AnnotSet.pop_back();
106  }
107  return true;
108 }
109 
110 
112 {
113  _ASSERT(objs.m_AnnotSet.empty());
114  _ASSERT(objs.m_SNPSet.empty());
115 }
116 
117 
118 ////////////////////////////////////////////////////////////////////
119 //
120 // CTSE_Info::
121 //
122 // General information and indexes for top level seq-entries
123 //
124 
125 
127  : m_InternalBioObjNumber(0),
128  m_MasterSeqSegmentsLoaded(false)
129 {
130  x_Initialize();
131 
132  x_TSEAttach(*this);
133 }
134 
135 
137  TBlobVersion blob_version)
138  : m_InternalBioObjNumber(0),
139  m_MasterSeqSegmentsLoaded(false)
140 {
141  x_Initialize();
142 
143  m_BlobId = blob_id;
144  m_BlobVersion = blob_version;
145 
146  x_TSEAttach(*this);
147 }
148 
149 
151  TBlobState blob_state,
152  const TBlobId& blob_id,
153  TBlobVersion blob_version)
154  : m_InternalBioObjNumber(0),
155  m_MasterSeqSegmentsLoaded(false)
156 {
157  x_Initialize();
158 
159  m_BlobId = blob_id;
160  m_BlobVersion = blob_version;
161  m_BlobState = blob_state;
162 
163  SetSeq_entry(entry);
165 
166  x_TSEAttach(*this);
167 }
168 
169 
171  TBlobState blob_state)
172  : m_InternalBioObjNumber(0),
173  m_MasterSeqSegmentsLoaded(false)
174 {
175  x_Initialize();
176 
177  m_BlobState = blob_state;
178 
179  SetSeq_entry(entry);
181 
182  x_TSEAttach(*this);
183 }
184 
185 
187  : m_BaseTSE(new SBaseTSE(tse)),
188  m_InternalBioObjNumber(0),
189  m_MasterSeqSegmentsLoaded(false)
190 {
191  x_Initialize();
192 
193  m_BlobState = tse->m_BlobState;
195  m_Name = tse->m_Name;
196  m_UsedMemory = tse->m_UsedMemory;
198 
199  // update Seq-inst object with split data
201  x_SetObject(*tse, &m_BaseTSE->m_ObjectCopyMap);
202  x_TSEAttach(*this);
203 
204  m_Split = tse->m_Split;
205  if (m_Split) {
207  if( !lsnr )
208  lsnr.Reset(new CTSE_Default_Assigner);
209  m_Split->x_TSEAttach(*this, lsnr);
211  }
212  if (tse->HasDataSource()) {
213  CDataLoader* ld = tse->GetDataSource().GetDataLoader();
214  if ( ld ) {
215  m_EditSaver = ld->GetEditSaver();
216  m_BlobId = tse->m_BlobId;
217  //CBlobIdKey(new CBlobIdString(tse->m_BlobId.ToString()));
218  }
219  }
220 }
221 
222 
224 {
225  _ASSERT(m_LockCounter.Get() == 0);
226  _ASSERT(m_DataSource == 0);
227  if( m_Split )
228  m_Split->x_TSEDetach(*this);
229 }
230 
231 
233 {
234  // m_BaseTSE.reset(new SBaseTSE(tse));
235  m_BlobState = tse->m_BlobState;
237  m_Name = tse->m_Name;
238  m_UsedMemory = tse->m_UsedMemory;
239 
240  if (tse->m_Contents)
241  x_SetObject(*tse,NULL);//tse->m_BaseTSE->m_ObjectCopyMap);
242  //x_TSEAttach(*this);
243 
244  m_Split = tse->m_Split;
245  if (m_Split) {
246  CRef<ITSE_Assigner> listener = m_Split->GetAssigner(*tse);
247  if( !listener )
248  listener.Reset(new CTSE_Default_Assigner);
249  m_Split->x_TSEAttach(*this, listener);
250  }
251  return *this;
252 }
253 
254 
256  CRef<CSeq_entry> entry)
257 // CRef<ITSE_Assigner> listener)
258 {
259  m_BlobState = tse->m_BlobState;
261  m_Name = tse->m_Name;
262  m_UsedMemory = tse->m_UsedMemory;
263 
264  if (entry)
265  SetSeq_entry(*entry);
266 
267  m_Split = tse->m_Split;
268  if (m_Split) {
269  CRef<ITSE_Assigner> listener = m_Split->GetAssigner(*tse);
270  if( !listener )
271  listener.Reset(new CTSE_Default_Assigner);
272  m_Split->x_TSEAttach(*this, listener);
273  /*
274  if( !listener ) {
275  listener = m_Split->GetAssigner(*tse);
276  if( !listener ) {
277  listener.Reset(new CTSE_Default_Assigner);
278  }
279  }
280  m_Split->x_TSEAttach(*this, listener);
281  */
282  }
283 
284  //x_TSEAttach(*this);
285  return *this;
286 }
287 
288 
290 {
291  m_DataSource = 0;
292  m_BlobVersion = -1;
295  m_UsedMemory = 0;
298  m_AnnotIdsFlags = 0;
299 }
300 
301 
303 {
305  m_Bioseqs.clear();
308  m_Split.Reset();
313  m_BaseTSE.reset();
314  m_EditSaver.Reset();
317 
318  m_Object.Reset();
320  m_Contents.Reset();
321 }
322 
323 
325 {
326  _ASSERT(version >= 0);
330 }
331 
332 
334 {
335  m_Name = name;
336 }
337 
338 
340 {
341  m_UsedMemory = size;
342 }
343 
344 
346 {
347  m_UsedMemory += size;
348 }
349 
350 
352 {
353  if ( m_Which != CSeq_entry::e_not_set ) {
354  if ( m_LoadState == eNotLoaded ) {
355  Reset();
356  m_Object.Reset();
357  m_Split.Reset();
361  m_AnnotIdsFlags = 0;
362  }
363  else if ( HasSplitInfo() &&
364  GetSplitInfo().x_HasDelayedMainChunk() &&
365  GetSplitInfo().GetChunk(CTSE_Chunk_Info::kDelayedMain_ChunkId).NotLoaded()) {
366  // special reset for incomplete main chunk load
367  if ( m_Contents ) {
369  m_Contents.Reset();
370  }
372  m_Object.Reset();
376  m_AnnotIdsFlags = 0;
377  }
378  }
379 
380  entry.Parentize();
381 
382  m_SetObjectInfo = set_info;
383  if ( HasDataSource() ) {
384  {{
386  (GetDataSource().m_DSMainLock);
387  x_SetObject(entry);
388  }}
390  }
391  else {
392  x_SetObject(entry);
393  }
394  if ( set_info ) {
395  if ( !set_info->m_Seq_annot_InfoMap.empty() ) {
396  NCBI_THROW(CObjMgrException, eAddDataError,
397  "Unknown SNP annots");
398  }
399  m_SetObjectInfo = null;
400  }
401 }
402 
403 
405 {
406  // x_RegisterRemovedIds(bioseq,info);
407  CBioObjectId uniq_id;
408  _ASSERT(info->GetBioObjectId().GetType() == CBioObjectId::eUnSet);
409  ITERATE ( CBioseq_Info::TId, it, info->GetId() ) {
410  if ( it->IsGi() ) {
411  uniq_id = CBioObjectId(*it);
412  break;
413  }
414  }
415  if ( !info->GetId().empty() ) {
417  }
418  if (uniq_id.GetType() == CBioObjectId::eUnSet) {
419  if (!info->GetId().empty())
420  uniq_id = CBioObjectId(*info->GetId().begin());
421  else
422  uniq_id = x_RegisterBioObject(*info);
423  }
424  return uniq_id;
425 }
427 {
428  CBioObjectId uniq_id;
429  _ASSERT(info->GetBioObjectId().GetType() == CBioObjectId::eUnSet);
430  if (info->m_Bioseq_set_Id > 0)
431  uniq_id = CBioObjectId(CBioObjectId::eSetId, info->m_Bioseq_set_Id);
432  else
433  uniq_id = x_RegisterBioObject(*info);
434  return uniq_id;
435 }
436 
438 {
439  CBioObjectId uniq_id = info.GetBioObjectId();
440  if (uniq_id.GetType() == CBioObjectId::eUniqNumber) {
441  if (m_BioObjects.find(uniq_id) != m_BioObjects.end())
442  return uniq_id;
443  }
444 
447  m_BioObjects[uniq_id] = &info;
448  return uniq_id;
449 }
450 
452 {
453  const CBioObjectId& uid = info.GetBioObjectId();
454  if (uid.GetType() == CBioObjectId::eUniqNumber) {
456  if (i != m_BioObjects.end()) {
457  // i->second->x_SetBioObjectId(CBioObjectId());
459  }
460  }
461 }
462 
464 {
465  switch (uniq_id.GetType()) {
467  {
469  if (i != m_BioObjects.end())
470  return i->second;
471  }
472  return NULL;
474  {
475  x_GetRecords(uniq_id.GetSeqId(), true);
478  if ( it != m_Bioseqs.end() ) {
479  return it->second;
480  }
481  }
482  return NULL;
484  {
486  m_Bioseq_sets.find(uniq_id.GetSetId());
487  if ( it != m_Bioseq_sets.end() ) {
488  return it->second;
489  }
490  }
491  return NULL;
492  default:
493  _ASSERT(0);
494  }
495  return NULL;
496 }
497 
498 /*
499 void CTSE_Info::x_RegisterRemovedIds(const CConstRef<CBioseq>& bioseq,
500  CBioseq_Info* info)
501 {
502  if (m_SetObjectInfo) {
503  CTSE_SetObjectInfo::TBioseq_InfoMap::iterator iter =
504  m_SetObjectInfo->m_Bioseq_InfoMap.find(bioseq);
505  if ( iter != m_SetObjectInfo->m_Bioseq_InfoMap.end() ) {
506  vector<CSeq_id_Handle>& ids = iter->second.m_Removed_ids;
507  for( vector<CSeq_id_Handle>::const_iterator idit = ids.begin();
508  idit != ids.end(); ++idit) {
509  _ASSERT( m_Removed_Bioseqs.find(*idit) == m_Removed_Bioseqs.end());
510  m_Removed_Bioseqs.insert(TBioseqs::value_type(*idit, info));
511  }
512  }
513  }
514 }
515 */
518 {
520  if ( m_SetObjectInfo ) {
523  if ( iter != m_SetObjectInfo->m_Seq_annot_InfoMap.end() ) {
524  ret = iter->second.m_SNP_annot_Info;
526  }
527  }
528  return ret;
529 }
530 
531 
532 bool CTSE_Info::HasAnnot(const CAnnotName& name) const
533 {
535  return m_NamedAnnotObjs.find(name) != m_NamedAnnotObjs.end();
536 }
537 
538 
539 bool CTSE_Info::HasNamedAnnot(const string& name) const
540 {
541  return HasAnnot(CAnnotName(name));
542 }
543 
544 
546 {
547  return HasAnnot(CAnnotName());
548 }
549 
550 
552 {
553  return GetCompleteSeq_entry();
554 }
555 
556 
558 {
559  return GetSeq_entryCore();
560 }
561 
562 
564 {
566 
567  m_DataSource = &ds;
569  if ( m_Split ) {
570  m_Split->x_DSAttach(ds);
571  }
572  ITERATE ( TBioseqs, it, m_Bioseqs ) {
573  ds.x_IndexSeqTSE(it->first, this);
574  }
575  ds.x_IndexAnnotTSEs(this);
576 }
577 
578 
580 {
581  _ASSERT(m_DataSource == &ds);
582 
583  ITERATE ( TBioseqs, it, m_Bioseqs ) {
584  ds.x_UnindexSeqTSE(it->first, this);
585  }
586  ds.x_UnindexAnnotTSEs(this);
587  if ( m_Split ) {
588  m_Split->x_DSDetach(ds);
589  }
591  m_DataSource = 0;
592 }
593 
594 
596 {
597  ds.x_Map(obj, this);
598  TParent::x_DSMapObject(obj, ds);
599 }
600 
601 
603 {
604  ds.x_Unmap(obj, this);
605  TParent::x_DSUnmapObject(obj, ds);
606 }
607 
608 
609 inline
611 {
612  if ( HasDataSource() ) {
613  GetDataSource().x_IndexSeqTSE(id, this);
614  }
615 }
616 
617 
618 inline
620 {
621  if ( HasDataSource() ) {
622  GetDataSource().x_UnindexSeqTSE(id, this);
623  }
624 }
625 
626 
628  const CSeq_id_Handle& id)
629 {
630  if ( !id.IsGi() ) {
632  if ( id.HaveMatchingHandles() ) {
634  }
635  }
636  bool new_id = false;
638  if ( iter == m_IdAnnotInfoMap.end() || iter->first != id ) {
639  iter = m_IdAnnotInfoMap
641  new_id = true;
642  bool orphan = !ContainsMatchingBioseq(id);
643  iter->second.m_Orphan = orphan;
644  if ( HasDataSource() ) {
645  GetDataSource().x_IndexAnnotTSE(id, this, orphan);
646  }
647  }
648  _VERIFY(iter->second.m_Names.insert(name).second);
649  return new_id;
650 }
651 
652 
654  const CSeq_id_Handle& id)
655 {
657  if ( iter == m_IdAnnotInfoMap.end() || iter->first != id ) {
658  return;
659  }
660  _VERIFY(iter->second.m_Names.erase(name) == 1);
661  if ( iter->second.m_Names.empty() ) {
662  bool orphan = iter->second.m_Orphan;
663  m_IdAnnotInfoMap.erase(iter);
664  if ( HasDataSource() ) {
665  GetDataSource().x_UnindexAnnotTSE(id, this, orphan);
666  }
667  }
668 }
669 
670 
672 {
674  if ( m_Split ) {
676  }
677  }
679 }
680 
681 
682 namespace {
683  static inline void x_SortUnique(CTSE_Info::TSeqIds& ids)
684  {
685  sort(ids.begin(), ids.end());
686  ids.erase(unique(ids.begin(), ids.end()), ids.end());
687  }
688 }
689 
690 
692 {
693 
694  {{
696  ITERATE ( TBioseqs, it, m_Bioseqs ) {
697  ids.push_back(it->first);
698  }
699  }}
700  if ( m_Split ) {
701  m_Split->GetBioseqsIds(ids);
702  // after adding split bioseq Seq-ids the result may contain
703  // duplicates and need to be sorted
704  x_SortUnique(ids);
705  }
706 }
707 
708 
710 {
712  {{
715  ITERATE ( TAnnotObjs, it2, it->second ) {
716  ids.push_back(it2->first);
717  }
718  }
719  }}
720  x_SortUnique(ids);
721 }
722 
723 
725 {
726  {{
728  if ( m_Bioseqs.find(id) != m_Bioseqs.end() ) {
729  return true;
730  }
731  }}
732  if ( m_Split ) {
733  return m_Split->ContainsBioseq(id);
734  }
735  return false;
736 }
737 
738 
741 {
742  if ( ContainsBioseq(id) ) {
743  return id;
744  }
745  else if ( id.HaveMatchingHandles() ) {
747  id.GetMatchingHandles(ids, eAllowWeakMatch);
748  ITERATE ( CSeq_id_Handle::TMatches, match_it, ids ) {
749  if ( *match_it != id ) {
750  if ( ContainsBioseq(*match_it) ) {
751  return *match_it;
752  }
753  }
754  }
755  }
756  return null;
757 }
758 
759 
761 {
763  x_GetRecords(id, true);
764  {{
767  if ( it != m_Bioseqs.end() ) {
768  ret = it->second;
769  }
770  }}
771  return ret;
772 }
773 
774 
777 {
778  return GetSeqMatch(id).m_Bioseq;
779 }
780 
781 
784 {
785  for ( CConstRef<CSeq_entry_Info> entry(this); entry->IsSet(); ) {
786  const CBioseq_set_Info& seqset = entry->GetSet();
788  if ( !first ) {
789  break;
790  }
791  if ( seqset.GetClass() == CBioseq_set::eClass_segset ) {
792  if ( first->IsSeq() ) {
793  return ConstRef(&first->GetSeq());
794  }
795  break;
796  }
797  entry = first;
798  }
799  return null;
800 }
801 
802 
804 {
805  if ( !m_MasterSeqSegmentsLoaded ) {
807  if ( !m_MasterSeqSegmentsLoaded ) {
809  if ( master_seq ) {
810  try {
811  m_MasterSeqSegments = new CMasterSeqSegments(*master_seq);
812  }
813  catch ( CException& exc ) {
814  ERR_POST("Segment set cannot be initialized: "<<exc);
815  }
816  }
818  }
819  }
820  return m_MasterSeqSegments;
821 }
822 
823 
825 {
826  SSeqMatch_TSE ret;
827  ret.m_Bioseq = FindBioseq(id);
828  if ( ret.m_Bioseq ) {
829  ret.m_Seq_id = id;
830  }
831  else if ( id.HaveMatchingHandles() ) {
833  id.GetMatchingHandles(ids, eAllowWeakMatch);
834  ITERATE ( CSeq_id_Handle::TMatches, match_it, ids ) {
835  if ( *match_it != id ) {
836  ret.m_Bioseq = FindBioseq(*match_it);
837  if ( ret.m_Bioseq ) {
838  ret.m_Seq_id = *match_it;
839  break;
840  }
841  }
842  }
843  }
844  return ret;
845 }
846 
847 
848 void CTSE_Info::x_GetRecords(const CSeq_id_Handle& id, bool bioseq) const
849 {
850  if ( m_Split ) {
851  m_Split->x_GetRecords(id, bioseq);
852  }
853 }
854 
855 
856 void CTSE_Info::x_LoadChunk(TChunkId chunk_id) const
857 {
858  m_Split->x_LoadChunk(chunk_id);
859 }
860 
861 
862 void CTSE_Info::x_LoadChunks(const TChunkIds& chunk_ids) const
863 {
864  if ( !chunk_ids.empty() ) {
865  m_Split->x_LoadChunks(chunk_ids);
866  }
867 }
868 
869 
872 {
873  _ASSERT(info);
874  {{
876  pair<TBioseqs::iterator, bool> ins =
878  if ( !ins.second ) {
879  // No duplicate bioseqs in the same TSE
880  NCBI_THROW_FMT(CObjMgrException, eAddDataError,
881  "duplicate Bioseq id " << id << " present in" <<
882  "\n seq1: " << ins.first->second->IdString() <<
883  "\n seq2: " << info->IdString());
884  }
885  }}
886  // register this TSE in data source as containing the sequence
887  x_IndexSeqTSE(id);
888 }
889 
890 
892 {
893  _ASSERT(info);
894  {{
896  ITERATE ( CBioseq_Info::TId, it, info->GetId() ) {
897  pair<TBioseqs::iterator, bool> ins =
899  if ( !ins.second ) {
900  // No duplicate bioseqs in the same TSE
901  NCBI_THROW(CObjMgrException, eAddDataError,
902  "duplicate Bioseq id "+it->AsString()+" present in"+
903  "\n seq1: " + ins.first->second->IdString()+
904  "\n seq2: " + info->IdString());
905  }
906  }
907  if ( m_BioseqUpdater ) {
909  }
910  }}
911  // register this TSE in data source as containing the sequence
912  if ( HasDataSource() ) {
913  GetDataSource().x_IndexSeqTSE(info->GetId(), this);
914  }
915 }
916 
917 
920 {
921  {{
924  if ( iter == m_Bioseqs.end() || iter->first != id ) {
925  return;
926  }
927  _ASSERT(iter->second == info);
928  m_Bioseqs.erase(iter);
929 
930  if (m_Split) {
931  iter = m_Removed_Bioseqs.find(id);
932  if (iter == m_Removed_Bioseqs.end())
934  }
935 
936  }}
937  x_UnindexSeqTSE(id);
938 }
939 
940 
943 {
944  pair<TBioseq_sets::iterator, bool> ins =
946  if ( ins.second ) {
947  // everything is fine
948  }
949  else {
950  // No duplicate bioseqs in the same TSE
951  NCBI_THROW(CObjMgrException, eAddDataError,
952  " duplicate Bioseq_set id '"+NStr::IntToString(key));
953  }
954 }
955 
956 
959 {
961  if ( iter != m_Bioseq_sets.end() && iter->first == key ) {
962  _ASSERT(iter->second == info);
963  m_Bioseq_sets.erase(iter);
964  if (m_Split) {
966  if (iter == m_Removed_Bioseq_sets.end())
968  }
969  }
970 }
971 
972 
974 {
975  if ( HasDataSource() ) {
977  }
978 }
979 
980 
982 {
983  if ( HasDataSource() ) {
985  }
986 }
987 
988 
990  EFeatIdType id_type) const
991 {
992  if ( m_Split ) {
994  }
996 }
997 
998 
1000  EFeatIdType id_type) const
1001 {
1002  if ( m_Split ) {
1003  m_Split.GetNCObject().x_UpdateFeatIdIndex(subtype, id_type);
1004  }
1005  UpdateAnnotIndex();
1006 }
1007 
1008 
1010 {
1011  x_GetRecords(id, false);
1012  const_cast<CTSE_Info*>(this)->UpdateAnnotIndex();
1013 }
1014 
1015 
1017 {
1018  const_cast<CTSE_Info*>(this)->UpdateAnnotIndex();
1019 }
1020 
1021 
1023 {
1024  const_cast<CTSE_Info*>(this)->
1025  UpdateAnnotIndex(const_cast<CTSE_Info_Object&>(object));
1026 }
1027 
1028 
1030 {
1031  UpdateAnnotIndex(*this);
1032 }
1033 
1034 
1036 {
1037  _ASSERT(&object.GetTSE_Info() == this);
1038  if ( object.x_DirtyAnnotIndex() ) {
1040  if (HasDataSource())
1041  guard.Guard(GetDataSource());
1043  //CStopWatch sw(CStopWatch::eStart);
1044  object.x_UpdateAnnotIndex(*this);
1045  _ASSERT(!object.x_DirtyAnnotIndex());
1046  //LOG_POST(Info<<"Updated annot index in "<<sw.Elapsed());
1047  }
1048 }
1049 
1050 /*
1051 void CTSE_Info::UpdateAnnotIndex(CTSE_Chunk_Info& chunk)
1052 {
1053  CDataSource::TAnnotLockWriteGuard guard(GetDataSource());
1054  TAnnotLockWriteGuard guard2(GetAnnotLock());
1055  chunk.x_UpdateAnnotIndex(*this);
1056 }
1057 */
1058 
1060 {
1061  _ASSERT(this == &tse);
1062  if ( m_Split ) {
1064  }
1066 }
1067 
1068 
1070 {
1072  if ( iter == m_NamedAnnotObjs.end() || iter->first != name ) {
1074  iter = m_NamedAnnotObjs.insert(iter, value_type(name, TAnnotObjs()));
1075  }
1076  return iter->second;
1077 }
1078 
1079 
1081 {
1082  m_NamedAnnotObjs.erase(name);
1083 }
1084 
1085 
1086 const CTSE_Info::TAnnotObjs*
1088 {
1090  if ( iter == m_NamedAnnotObjs.end() || iter->first != name ) {
1091  return 0;
1092  }
1093  return &iter->second;
1094 }
1095 
1096 
1097 const CTSE_Info::TAnnotObjs*
1099 {
1101  if ( iter == m_NamedAnnotObjs.end() || iter->first.IsNamed() ) {
1102  return 0;
1103  }
1104  return &iter->second;
1105 }
1106 
1107 
1108 pair<SIdAnnotObjs*, bool>
1110  const CAnnotName& name,
1111  const CSeq_id_Handle& id)
1112 {
1113  // repeat for more generic types of selector
1114  bool new_id = false;
1115  TAnnotObjs::iterator it = objs.find(id);
1116  if ( it == objs.end() ) {
1117  // new id
1118  it = objs.insert(TAnnotObjs::value_type(id, SIdAnnotObjs())).first;
1119  new_id = x_IndexAnnotTSE(name, id);
1120  }
1121  _ASSERT(it != objs.end() && it->first == id);
1122  return make_pair(&it->second, new_id);
1123 }
1124 
1125 
1126 pair<SIdAnnotObjs*, bool>
1128  const CSeq_id_Handle& id)
1129 {
1130  return x_SetIdObjects(x_SetAnnotObjs(name), name, id);
1131 }
1132 
1133 
1135  const CSeq_id_Handle& idh) const
1136 {
1137  TAnnotObjs::const_iterator it = objs.find(idh);
1138  if ( it == objs.end() ) {
1139  return 0;
1140  }
1141  return &it->second;
1142 }
1143 
1144 
1146  const CSeq_id_Handle& idh) const
1147 {
1148  const TAnnotObjs* objs = x_GetAnnotObjs(name);
1149  if ( !objs ) {
1150  return 0;
1151  }
1152  return x_GetIdObjects(*objs, idh);
1153 }
1154 
1155 
1156 const SIdAnnotObjs*
1158 {
1159  const TAnnotObjs* objs = x_GetUnnamedAnnotObjs();
1160  if ( !objs ) {
1161  return 0;
1162  }
1163  return x_GetIdObjects(*objs, idh);
1164 }
1165 
1166 
1168 {
1169  // tse annot index should be locked by TAnnotLockReadGuard
1171  if ( x_GetIdObjects(it->second, idh) ) {
1172  return true;
1173  }
1174  }
1175  return false;
1176 }
1177 
1178 
1179 inline
1181  const SAnnotObject_Key& key,
1182  const SAnnotObject_Index& index)
1183 {
1184  //_ASSERT(index.m_AnnotObject_Info == key.m_AnnotObject_Info);
1185  rangeMap.insert(TRangeMap::value_type(key.m_Range, index));
1186 }
1187 
1188 
1189 inline
1191  const CAnnotObject_Info& info,
1192  const SAnnotObject_Key& key)
1193 {
1194  for ( TRangeMap::iterator it = rangeMap.find(key.m_Range);
1195  it && it->first == key.m_Range; ++it ) {
1196  if ( it->second.m_AnnotObject_Info == &info ) {
1197  rangeMap.erase(it);
1198  return rangeMap.empty();
1199  }
1200  }
1201  _ASSERT(0);
1202  return rangeMap.empty();
1203 }
1204 
1205 
1207  const SAnnotObject_Key& key,
1208  const SAnnotObject_Index& index)
1209 {
1210  if ( index.m_AnnotObject_Info->IsLocs() ) {
1211  // Locs may contain multiple indexes
1213  index.m_AnnotObject_Info->GetLocsTypes(idx_set);
1214  ITERATE(CAnnotObject_Info::TTypeIndexSet, idx_rg, idx_set) {
1215  for (size_t idx = idx_rg->first; idx < idx_rg->second; ++idx) {
1216  x_MapAnnotObject(objs.x_GetRangeMap(idx), key, index);
1217  }
1218  }
1219  }
1220  else {
1223  for (size_t idx = idx_rg.first; idx < idx_rg.second; ++idx) {
1224  x_MapAnnotObject(objs.x_GetRangeMap(idx), key, index);
1225  }
1226  }
1227 }
1228 
1229 
1231  const CAnnotObject_Info& info,
1232  const SAnnotObject_Key& key)
1233 {
1236  for (size_t idx = idx_rg.first; idx < idx_rg.second; ++idx) {
1237  _ASSERT(idx < objs.x_GetRangeMapCount());
1238  if ( x_UnmapAnnotObject(objs.x_GetRangeMap(idx), info, key) ) {
1239  if ( objs.x_CleanRangeMaps() ) {
1240  return objs.m_SNPSet.empty();
1241  }
1242  }
1243  }
1244  return false;
1245 }
1246 
1247 
1249  const CAnnotName& name,
1250  const SAnnotObject_Key& key,
1251  const SAnnotObject_Index& index)
1252 {
1253  auto id_objs = x_SetIdObjects(objs, name, key.m_Handle);
1254  x_MapAnnotObject(*id_objs.first, key, index);
1255  return id_objs.second;
1256 }
1257 
1258 
1260  const CAnnotName& name,
1261  const CAnnotObject_Info& info,
1262  const SAnnotObject_Key& key)
1263 {
1264  TAnnotObjs::iterator it = objs.find(key.m_Handle);
1265  if ( it != objs.end() && x_UnmapAnnotObject(it->second, info, key) ) {
1266  x_UnindexAnnotTSE(name, key.m_Handle);
1267  objs.erase(it);
1268  return objs.empty();
1269  }
1270  return false;
1271 }
1272 
1273 
1275  const CSeq_id_Handle& key,
1276  const CSeq_annot_SNP_Info& snp_info)
1277 {
1278  auto objs = x_SetIdObjects(name, key);
1279  objs.first->m_SNPSet.push_back(ConstRef(&snp_info));
1280  return objs.second;
1281 }
1282 
1283 
1285  const CSeq_id_Handle& key,
1286  const CSeq_annot_SNP_Info& snp_info)
1287 {
1288  SIdAnnotObjs& objs = *x_SetIdObjects(name, key).first;
1289  TSNPSet::iterator iter = find(objs.m_SNPSet.begin(),
1290  objs.m_SNPSet.end(),
1291  ConstRef(&snp_info));
1292  if ( iter != objs.m_SNPSet.end() ) {
1293  objs.m_SNPSet.erase(iter);
1294  }
1295 }
1296 
1297 
1299  const SAnnotObject_Key& key,
1300  const SAnnotObject_Index& index)
1301 {
1302  return x_MapAnnotObject(x_SetAnnotObjs(name), name, key, index);
1303 }
1304 
1305 
1307  const CAnnotObject_Info& info,
1308  const SAnnotObject_Key& key)
1309 {
1310  TAnnotObjs& index = x_SetAnnotObjs(name);
1311 
1312  x_UnmapAnnotObject(index, name, info, key);
1313 
1314  if ( index.empty() ) {
1315  x_RemoveAnnotObjs(name);
1316  }
1317 }
1318 
1319 
1321 {
1322  if ( !infos.IsIndexed() ) {
1323  return;
1324  }
1325  const CAnnotName& name = infos.GetName();
1326  TAnnotObjs& index = x_SetAnnotObjs(name);
1327 
1329  if ( it->HasSingleKey() ) {
1330  x_UnmapAnnotObject(index, name, *it, it->GetKey());
1331  }
1332  else {
1333  for ( size_t i = it->GetKeysBegin(); i < it->GetKeysEnd(); ++i ) {
1334  x_UnmapAnnotObject(index, name, *it, infos.GetKey(i));
1335  }
1336  }
1337  }
1338 
1339  if ( index.empty() ) {
1340  x_RemoveAnnotObjs(name);
1341  }
1342 }
1343 
1344 
1346 {
1348  if (m_Split) {
1349  iter = m_Removed_Bioseq_sets.find(id);
1350  if ( iter != m_Removed_Bioseq_sets.end() )
1351  return *iter->second;
1352  }
1353 
1354  iter = m_Bioseq_sets.find(id);
1355  if ( iter == m_Bioseq_sets.end() ) {
1356  NCBI_THROW(CObjMgrException, eRegisterError,
1357  "cannot find Bioseq-set by local id");
1358  }
1359  return *iter->second;
1360 }
1361 
1362 
1364 {
1366  TBioseqs::iterator iter;
1367  if (m_Split) {
1368  iter = m_Removed_Bioseqs.find(id);
1369  if ( iter != m_Removed_Bioseqs.end() )
1370  return *iter->second;
1371  }
1372 
1373  iter = m_Bioseqs.find(id);
1374  if ( iter == m_Bioseqs.end() ) {
1375  NCBI_THROW(CObjMgrException, eRegisterError,
1376  "cannot find Bioseq by Seq-id "+id.AsString());
1377  }
1378  return *iter->second;
1379 }
1380 
1381 
1382 bool CTSE_Info::HasSplitInfo(void) const
1383 {
1384  return m_Split;
1385 }
1386 
1387 
1389 {
1390  _ASSERT(HasSplitInfo());
1391  return *m_Split;
1392 }
1393 
1394 
1396 {
1397  if ( !m_Split ) {
1401  m_Split->x_TSEAttach(*this, listener);
1402  }
1403  return *m_Split;
1404 }
1405 
1406 
1408 {
1410 }
1411 
1412 
1414 {
1415  if ( m_Split ) {
1417  }
1418 }
1419 
1420 
1422  const SFeatIdIndex& index,
1423  TFeatIdInt id,
1424  EFeatIdType id_type,
1425  const CSeq_annot_Info* src_annot) const
1426 {
1427  if ( !index.m_Chunks.empty() ) {
1428  x_LoadChunks(index.m_Chunks);
1429  UpdateAnnotIndex();
1430  }
1431  if ( !index.m_IndexInt ) {
1432  return;
1433  }
1434  const CSeq_entry_Info* xref_tse = 0;
1435  if ( src_annot ) {
1436  xref_tse = &src_annot->GetXrefTSE();
1437  if ( xref_tse == this ) {
1438  xref_tse = 0;
1439  }
1440  }
1441  const SFeatIdIndex::TIndexInt& index2 = *index.m_IndexInt;
1442  for ( SFeatIdIndex::TIndexInt::const_iterator iter2 = index2.find(id);
1443  iter2 != index2.end() && iter2->first == id; ++iter2 ) {
1444  const SFeatIdInfo& info = iter2->second;
1445  if ( info.m_Type == id_type ) {
1446  if ( info.m_IsChunk ) {
1447  x_LoadChunk(info.m_ChunkId);
1448  UpdateAnnotIndex();
1449  }
1450  else {
1451  if ( xref_tse && xref_tse != &info.m_Info->GetSeq_annot_Info().GetXrefTSE() ) {
1452  continue;
1453  }
1454  objects.push_back(info.m_Info);
1455  }
1456  }
1457  }
1458 }
1459 
1460 
1462 {
1464  return iter != m_FeatIdIndex.end();
1465 }
1466 
1467 
1469  CSeqFeatData::ESubtype subtype,
1470  TFeatIdInt id,
1471  EFeatIdType id_type,
1472  const CSeq_annot_Info* src_annot) const
1473 {
1475  if ( iter == m_FeatIdIndex.end() ) {
1476  return;
1477  }
1478  x_AddFeaturesById(objects, iter->second, id, id_type, src_annot);
1479 }
1480 
1481 
1483  TFeatIdInt id,
1484  EFeatIdType id_type,
1485  const CSeq_annot_Info* src_annot) const
1486 {
1487  //LOG_POST_X(1, this << ": ""x_AddAllFeaturesWithId: " << id);
1488  ITERATE ( TFeatIdIndex, iter, m_FeatIdIndex ) {
1489  x_AddFeaturesById(objects, iter->second, id, id_type, src_annot);
1490  }
1491 }
1492 
1493 
1495  const SFeatIdIndex& index,
1496  const TFeatIdStr& id,
1497  EFeatIdType id_type,
1498  const CSeq_annot_Info* src_annot) const
1499 {
1500  if ( !index.m_Chunks.empty() ) {
1501  x_LoadChunks(index.m_Chunks);
1502  UpdateAnnotIndex();
1503  }
1504  if ( !index.m_IndexStr ) {
1505  return;
1506  }
1507  const CSeq_entry_Info* xref_tse = 0;
1508  if ( src_annot ) {
1509  xref_tse = &src_annot->GetXrefTSE();
1510  if ( xref_tse == this ) {
1511  xref_tse = 0;
1512  }
1513  }
1514  const SFeatIdIndex::TIndexStr& index2 = *index.m_IndexStr;
1515  for ( SFeatIdIndex::TIndexStr::const_iterator iter2 = index2.find(id);
1516  iter2 != index2.end() && iter2->first == id; ++iter2 ) {
1517  const SFeatIdInfo& info = iter2->second;
1518  if ( info.m_Type == id_type ) {
1519  if ( info.m_IsChunk ) {
1520  x_LoadChunk(info.m_ChunkId);
1521  UpdateAnnotIndex();
1522  }
1523  else {
1524  if ( xref_tse && xref_tse != &info.m_Info->GetSeq_annot_Info().GetXrefTSE() ) {
1525  continue;
1526  }
1527  objects.push_back(info.m_Info);
1528  }
1529  }
1530  }
1531 }
1532 
1533 
1535  CSeqFeatData::ESubtype subtype,
1536  const TFeatIdStr& id,
1537  EFeatIdType id_type,
1538  const CSeq_annot_Info* src_annot) const
1539 {
1541  if ( iter == m_FeatIdIndex.end() ) {
1542  return;
1543  }
1544  x_AddFeaturesById(objects, iter->second, id, id_type, src_annot);
1545 }
1546 
1547 
1549  const TFeatIdStr& id,
1550  EFeatIdType id_type,
1551  const CSeq_annot_Info* src_annot) const
1552 {
1553  //LOG_POST_X(1, this << ": ""x_AddAllFeaturesWithId: " << id);
1554  ITERATE ( TFeatIdIndex, iter, m_FeatIdIndex ) {
1555  x_AddFeaturesById(objects, iter->second, id, id_type, src_annot);
1556  }
1557 }
1558 
1559 
1562 {
1563  //LOG_POST_X(2, this << ": ""x_MapFeatById: " << type);
1564  SFeatIdIndex& index = m_FeatIdIndex[type];
1565  if ( !index.m_IndexInt ) {
1566  index.m_IndexInt.reset(new SFeatIdIndex::TIndexInt);
1567  }
1568  return *index.m_IndexInt;
1569 }
1570 
1571 
1574 {
1575  //LOG_POST_X(2, this << ": ""x_MapFeatById: " << type);
1576  SFeatIdIndex& index = m_FeatIdIndex[type];
1577  if ( !index.m_IndexStr ) {
1578  index.m_IndexStr.reset(new SFeatIdIndex::TIndexStr);
1579  }
1580  return *index.m_IndexStr;
1581 }
1582 
1583 
1586  EFeatIdType id_type)
1587 {
1588  //LOG_POST_X(2, this << ": ""x_MapFeatById: " << id << " " << id_type<<" "<<&info);
1589  SFeatIdIndex::TIndexInt& index =
1590  x_GetFeatIdIndexInt(info.GetFeatSubtype());
1592  index.insert(value);
1593 }
1594 
1595 
1598  EFeatIdType id_type)
1599 {
1600  //LOG_POST_X(3, this << ": ""x_UnmapFeatById: " << id << " " << id_type<<" "<<&info);
1601  SFeatIdIndex::TIndexInt& index =
1602  x_GetFeatIdIndexInt(info.GetFeatSubtype());
1603  for ( SFeatIdIndex::TIndexInt::iterator iter = index.lower_bound(id);
1604  iter != index.end() && iter->first == id; ++iter ) {
1605  if ( iter->second.m_Info == &info && iter->second.m_Type == id_type ) {
1606  index.erase(iter);
1607  return;
1608  }
1609  }
1610  _ASSERT("x_UnmapFeatById: not found" && 0);
1611 }
1612 
1613 
1616  EFeatIdType id_type)
1617 {
1618  //LOG_POST_X(2, this << ": ""x_MapFeatById: " << id << " " << id_type<<" "<<&info);
1619  SFeatIdIndex::TIndexStr& index =
1620  x_GetFeatIdIndexStr(info.GetFeatSubtype());
1622  index.insert(value);
1623 }
1624 
1625 
1628  EFeatIdType id_type)
1629 {
1630  //LOG_POST_X(3, this << ": ""x_UnmapFeatById: " << id << " " << id_type<<" "<<&info);
1631  SFeatIdIndex::TIndexStr& index =
1632  x_GetFeatIdIndexStr(info.GetFeatSubtype());
1633  for ( SFeatIdIndex::TIndexStr::iterator iter = index.lower_bound(id);
1634  iter != index.end() && iter->first == id; ++iter ) {
1635  if ( iter->second.m_Info == &info && iter->second.m_Type == id_type ) {
1636  index.erase(iter);
1637  return;
1638  }
1639  }
1640  _ASSERT("x_UnmapFeatById: not found" && 0);
1641 }
1642 
1643 
1646  EFeatIdType id_type)
1647 {
1648  if ( id.IsId() ) {
1649  x_MapFeatById(id.GetId(), info, id_type);
1650  }
1651  else {
1652  x_MapFeatById(id.GetStr(), info, id_type);
1653  }
1654 }
1655 
1656 
1659  EFeatIdType id_type)
1660 {
1661  if ( id.IsId() ) {
1662  x_UnmapFeatById(id.GetId(), info, id_type);
1663  }
1664  else {
1665  x_UnmapFeatById(id.GetStr(), info, id_type);
1666  }
1667 }
1668 
1669 
1670 void CTSE_Info::x_MapFeatByLocus(const string& locus, bool tag,
1672 {
1674 }
1675 
1676 
1677 void CTSE_Info::x_UnmapFeatByLocus(const string& locus, bool tag,
1679 {
1680  for ( TLocusIndex::iterator it =
1682  it != m_LocusIndex.end() &&
1683  it->first.first == locus &&
1684  it->first.second == tag;
1685  ++it ) {
1686  if ( it->second == &info ) {
1687  m_LocusIndex.erase(it);
1688  return;
1689  }
1690  }
1691 }
1692 
1693 
1695  CSeqFeatData::ESubtype subtype,
1696  TChunkId chunk_id,
1697  EFeatIdType id_type)
1698 {
1699  SFeatIdIndex::TIndexInt& index = x_GetFeatIdIndexInt(subtype);
1700  SFeatIdIndex::TIndexInt::value_type value(id, SFeatIdInfo(id_type, chunk_id));
1701  index.insert(value);
1702 }
1703 
1704 
1707  TChunkId chunk_id,
1708  EFeatIdType id_type)
1709 {
1712  for ( size_t index = range.first; index < range.second; ++index ) {
1713  CSeqFeatData::ESubtype subtype =
1715  x_MapChunkByFeatId(id, subtype, chunk_id, id_type);
1716  }
1717 }
1718 
1719 
1721  const SAnnotTypeSelector& type,
1722  TChunkId chunk_id,
1723  EFeatIdType id_type)
1724 {
1725  if ( type.GetFeatSubtype() != CSeqFeatData::eSubtype_any ) {
1726  x_MapChunkByFeatId(id, type.GetFeatSubtype(), chunk_id, id_type);
1727  }
1728  else {
1729  x_MapChunkByFeatId(id, type.GetFeatType(), chunk_id, id_type);
1730  }
1731 }
1732 
1733 
1735  CSeqFeatData::ESubtype subtype,
1736  TChunkId chunk_id,
1737  EFeatIdType id_type)
1738 {
1739  SFeatIdIndex::TIndexStr& index = x_GetFeatIdIndexStr(subtype);
1740  SFeatIdIndex::TIndexStr::value_type value(id, SFeatIdInfo(id_type, chunk_id));
1741  index.insert(value);
1742 }
1743 
1744 
1747  TChunkId chunk_id,
1748  EFeatIdType id_type)
1749 {
1752  for ( size_t index = range.first; index < range.second; ++index ) {
1753  CSeqFeatData::ESubtype subtype =
1755  x_MapChunkByFeatId(id, subtype, chunk_id, id_type);
1756  }
1757 }
1758 
1759 
1761  const SAnnotTypeSelector& type,
1762  TChunkId chunk_id,
1763  EFeatIdType id_type)
1764 {
1765  if ( type.GetFeatSubtype() != CSeqFeatData::eSubtype_any ) {
1766  x_MapChunkByFeatId(id, type.GetFeatSubtype(), chunk_id, id_type);
1767  }
1768  else {
1769  x_MapChunkByFeatId(id, type.GetFeatType(), chunk_id, id_type);
1770  }
1771 }
1772 
1773 
1775  CSeqFeatData::ESubtype subtype,
1776  TChunkId chunk_id,
1777  EFeatIdType id_type)
1778 {
1779  if ( id.IsId() ) {
1780  x_MapChunkByFeatId(id.GetId(), subtype, chunk_id, id_type);
1781  }
1782  else {
1783  x_MapChunkByFeatId(id.GetStr(), subtype, chunk_id, id_type);
1784  }
1785 }
1786 
1787 
1790  TChunkId chunk_id,
1791  EFeatIdType id_type)
1792 {
1793  if ( id.IsId() ) {
1794  x_MapChunkByFeatId(id.GetId(), type, chunk_id, id_type);
1795  }
1796  else {
1797  x_MapChunkByFeatId(id.GetStr(), type, chunk_id, id_type);
1798  }
1799 }
1800 
1801 
1803  const SAnnotTypeSelector& type,
1804  TChunkId chunk_id,
1805  EFeatIdType id_type)
1806 {
1807  if ( id.IsId() ) {
1808  x_MapChunkByFeatId(id.GetId(), type, chunk_id, id_type);
1809  }
1810  else {
1811  x_MapChunkByFeatId(id.GetStr(), type, chunk_id, id_type);
1812  }
1813 }
1814 
1815 
1817  TChunkId chunk_id)
1818 {
1819  m_FeatIdIndex[subtype].m_Chunks.push_back(chunk_id);
1820 }
1821 
1822 
1824  TChunkId chunk_id)
1825 {
1828  for ( size_t index = range.first; index < range.second; ++index ) {
1829  CSeqFeatData::ESubtype subtype =
1831  x_MapChunkByFeatType(subtype, chunk_id);
1832  }
1833 }
1834 
1835 
1837  TChunkId chunk_id)
1838 {
1839  if ( type.GetFeatSubtype() != CSeqFeatData::eSubtype_any ) {
1840  x_MapChunkByFeatType(type.GetFeatSubtype(), chunk_id);
1841  }
1842  else {
1843  x_MapChunkByFeatType(type.GetFeatType(), chunk_id);
1844  }
1845 }
1846 
1847 
1850  TFeatIdInt id,
1851  EFeatIdType id_type,
1852  const CSeq_annot_Info* src_annot) const
1853 {
1855  UpdateFeatIdIndex(subtype, id_type);
1856  if ( subtype == CSeqFeatData::eSubtype_any ) {
1857  x_AddAllFeaturesById(objects, id, id_type, src_annot);
1858  }
1859  else {
1860  x_AddFeaturesById(objects, subtype, id, id_type, src_annot);
1861  }
1862  return objects;
1863 }
1864 
1865 
1868  TFeatIdInt id,
1869  EFeatIdType id_type,
1870  const CSeq_annot_Info* src_annot) const
1871 {
1873  UpdateFeatIdIndex(type, id_type);
1874  if ( type == CSeqFeatData::e_not_set ) {
1875  x_AddAllFeaturesById(objects, id, id_type, src_annot);
1876  }
1877  else {
1880  for ( size_t index = range.first; index < range.second; ++index ) {
1881  CSeqFeatData::ESubtype subtype =
1883  x_AddFeaturesById(objects, subtype, id, id_type, src_annot);
1884  }
1885  }
1886  return objects;
1887 }
1888 
1889 
1892  const TFeatIdStr& id,
1893  EFeatIdType id_type,
1894  const CSeq_annot_Info* src_annot) const
1895 {
1897  UpdateFeatIdIndex(subtype, id_type);
1898  if ( subtype == CSeqFeatData::eSubtype_any ) {
1899  x_AddAllFeaturesById(objects, id, id_type, src_annot);
1900  }
1901  else {
1902  x_AddFeaturesById(objects, subtype, id, id_type, src_annot);
1903  }
1904  return objects;
1905 }
1906 
1907 
1910  const TFeatIdStr& id,
1911  EFeatIdType id_type,
1912  const CSeq_annot_Info* src_annot) const
1913 {
1915  UpdateFeatIdIndex(type, id_type);
1916  if ( type == CSeqFeatData::e_not_set ) {
1917  x_AddAllFeaturesById(objects, id, id_type, src_annot);
1918  }
1919  else {
1922  for ( size_t index = range.first; index < range.second; ++index ) {
1923  CSeqFeatData::ESubtype subtype =
1925  x_AddFeaturesById(objects, subtype, id, id_type, src_annot);
1926  }
1927  }
1928  return objects;
1929 }
1930 
1931 
1934  const TFeatId& id,
1935  EFeatIdType id_type,
1936  const CSeq_annot_Info* src_annot) const
1937 {
1939  if ( id.IsId() ) {
1940  x_GetFeaturesById(subtype, id.GetId(), id_type, src_annot).swap(objects);
1941  }
1942  else {
1943  x_GetFeaturesById(subtype, id.GetStr(), id_type, src_annot).swap(objects);
1944  }
1945  return objects;
1946 }
1947 
1948 
1951  const TFeatId& id,
1952  EFeatIdType id_type,
1953  const CSeq_annot_Info* src_annot) const
1954 {
1956  if ( id.IsId() ) {
1957  x_GetFeaturesById(type, id.GetId(), id_type, src_annot).swap(objects);
1958  }
1959  else {
1960  x_GetFeaturesById(type, id.GetStr(), id_type, src_annot).swap(objects);
1961  }
1962  return objects;
1963 }
1964 
1965 
1967  bool tag,
1968  const CSeq_annot_Info* src_annot) const
1969 {
1970  UpdateAnnotIndex();
1972  const CSeq_entry_Info* xref_tse = 0;
1973  if ( src_annot ) {
1974  xref_tse = &src_annot->GetXrefTSE();
1975  if ( xref_tse == this ) {
1976  xref_tse = 0;
1977  }
1978  }
1979  for ( TLocusIndex::const_iterator it =
1981  it != m_LocusIndex.end() &&
1982  it->first.first == locus &&
1983  it->first.second == tag;
1984  ++it ) {
1985  if ( xref_tse && xref_tse != &it->second->GetSeq_annot_Info().GetXrefTSE() ) {
1986  continue;
1987  }
1988  objects.push_back(it->second);
1989  }
1990  return objects;
1991 }
1992 
1993 
1996  TSeqPos loc_pos,
1997  const CSeq_feat& feat) const
1998 {
1999  TSeq_feat_Lock ret;
2000  CSeqFeatData::ESubtype subtype = feat.GetData().GetSubtype();
2001  size_t index = CAnnotType_Index::GetSubtypeIndex(subtype);
2002  TRange range(loc_pos, loc_pos);
2004  const SIdAnnotObjs* objs = x_GetIdObjects(it_n->second, loc_id);
2005  if ( !objs ) {
2006  continue;
2007  }
2008  if ( index < objs->x_GetRangeMapCount() &&
2009  !objs->x_RangeMapIsEmpty(index) ) {
2010  const TRangeMap& rmap = objs->x_GetRangeMap(index);
2011  for ( TRangeMap::const_iterator it(rmap.begin(range)); it; ++it ) {
2012  const CAnnotObject_Info& annot_info =
2013  *it->second.m_AnnotObject_Info;
2014  if ( !annot_info.IsRegular() ) {
2015  continue;
2016  }
2017  const CSeq_feat* found_feat = annot_info.GetFeatFast();
2018  if ( found_feat == &feat ) {
2019  ret.first.first = &annot_info.GetSeq_annot_Info();
2020  ret.second = annot_info.GetAnnotIndex();
2021  return ret;
2022  }
2023  }
2024  }
2025  /*
2026  if ( subtype == CSeqFeatData::eSubtype_variation &&
2027  !objs->m_SNPSet.empty() ) {
2028 
2029  }
2030  */
2031  }
2032  return ret;
2033 }
2034 
2035 
2037 {
2039  m_BioseqUpdater = updater;
2040  set<CBioseq_Info*> seen;
2042  if ( seen.insert(it->second).second ) {
2043  m_BioseqUpdater->Update(*it->second);
2044  }
2045  }
2046 }
2047 
2048 
2049 string CTSE_Info::GetDescription(void) const
2050 {
2051  string ret;
2052  if ( m_BlobId ) {
2053  ret = GetBlobId().ToString();
2054  }
2055  else {
2056  ret = NStr::PtrToString(this);
2057  }
2058  if ( GetName().IsNamed() ) {
2059  ret += '/';
2060  ret += GetName().GetName();
2061  }
2062  return ret;
2063 }
2064 
2065 
2067 {
2068  return m_TopLevelObjectType;
2069 }
2070 
2071 
2073 {
2075 }
2076 
2077 
2079 {
2081  m_TopLevelObjectPtr = ptr;
2082 }
2083 
2084 
2086 {
2088 }
2089 
2090 
2092 {
2093  if ( !IsTopLevelSeq_submit() ) {
2094  NCBI_THROW(CObjMgrException, eInvalidHandle,
2095  "CTSE_Handle::GetTopLevelSeq_submit: "
2096  "Top level object is not Seq-submit");
2097  }
2098  CSeq_submit* submit = dynamic_cast<CSeq_submit*>(m_TopLevelObjectPtr.GetNCPointerOrNull());
2099  if ( !submit ) {
2100  NCBI_THROW(CObjMgrException, eInvalidHandle,
2101  "CTSE_Handle::GetTopLevelSeq_submit: "
2102  "Top level object is not Seq-submit");
2103  }
2104  return *submit;
2105 }
2106 
2107 
2109 {
2111  if ( IsSet() ) {
2112  const TSet& set = GetSet();
2113  // update entry/annot lists
2114  if ( set.IsSetSeq_set() && !set.GetSeq_set().empty() ) {
2115  submit.SetData().SetEntrys() = set.GetBioseq_setCore()->GetSeq_set();
2116  }
2117  else if ( set.IsSetAnnot() && !set.GetAnnot().empty() ) {
2118  submit.SetData().SetAnnots() = set.GetBioseq_setCore()->GetAnnot();
2119  }
2120  else {
2121  switch ( submit.GetData().Which() ) {
2123  submit.SetData().SetEntrys().clear();
2124  break;
2126  submit.SetData().SetAnnots().clear();
2127  break;
2128  default:
2129  break;
2130  }
2131  }
2132  }
2133  return submit;
2134 }
2135 
2136 
2138 {
2139  return x_GetTopLevelSeq_submit().GetSub();
2140 }
2141 
2142 
2144 {
2145  return x_GetTopLevelSeq_submit().SetSub();
2146 }
2147 
2148 
2150 {
2152 }
2153 
2154 
2156 {
2157  SetTopLevelObject(type, 0);
2158 }
2159 
2160 
2162 {
2163 }
2164 
2165 
2167 {
2168 }
2169 
2170 
2171 
User-defined methods of the data storage class.
const string & GetName(void) const
Definition: annot_name.hpp:62
void GetLocsTypes(TTypeIndexSet &idx_set) const
const CSeq_annot_Info & GetSeq_annot_Info(void) const
bool IsRegular(void) const
vector< TIndexRange > TTypeIndexSet
const CSeq_feat * GetFeatFast(void) const
bool IsLocs(void) const
TIndex GetAnnotIndex(void) const
static CSeqFeatData::ESubtype GetSubtypeForIndex(size_t index)
pair< size_t, size_t > TIndexRange
static TIndexRange GetFeatTypeRange(CSeqFeatData::E_Choice type)
static TIndexRange GetTypeIndex(const CAnnotObject_Info &info)
static size_t GetSubtypeIndex(CSeqFeatData::ESubtype subtype)
TIntId GetSetId() const
const CSeq_id_Handle & GetSeqId() const
EType GetType() const
virtual void Update(CBioseq_Info &seq)=0
vector< CSeq_id_Handle > TId
Definition: bioseq_info.hpp:91
TClass GetClass(void) const
CConstRef< CSeq_entry_Info > GetFirstEntry(void) const
void Guard(CDataSource &ds)
void x_ResetDirtyAnnotIndex(CTSE_Info &tse)
void x_IndexAnnotTSEs(CTSE_Info *tse_info)
void x_UnindexAnnotTSEs(CTSE_Info *tse_info)
CDataLoader * GetDataLoader(void) const
void x_SetDirtyAnnotIndex(CTSE_Info &tse)
void x_UnindexSeqTSE(const CSeq_id_Handle &ids, CTSE_Info *tse_info)
void x_UnindexAnnotTSE(const CSeq_id_Handle &idh, CTSE_Info *tse_info, bool orphan)
void x_Unmap(const CObject *obj, const CTSE_Info_Object *info)
void x_Map(const CObject *obj, const CTSE_Info_Object *info)
void x_IndexAnnotTSE(const CSeq_id_Handle &idh, CTSE_Info *tse_info, bool orphan)
void x_IndexSeqTSE(const CSeq_id_Handle &idh, CTSE_Info *tse_info)
Base class for all object manager exceptions.
ESubtype GetSubtype(void) const
const CSeq_entry_Info & GetXrefTSE(void) const
void x_DoUpdate(TNeedUpdateFlags flags)
void x_Update(TNeedUpdateFlags flags) const
CConstRef< TObject > GetSeq_entryCore(void) const
vector< CSeq_id_Handle > TSeqIds
void x_SetObject(TObject &obj)
void Reset(void)
virtual void x_DSDetachContents(CDataSource &ds)
void x_DSMapObject(CConstRef< TObject > obj, CDataSource &ds)
CRef< TObject > m_Object
virtual void x_DSAttachContents(CDataSource &ds)
CRef< CBioseq_Base_Info > m_Contents
void x_DetachContents(void)
bool IsSet(void) const
void x_UpdateAnnotIndexContents(CTSE_Info &tse)
const TSet & GetSet(void) const
E_Choice m_Which
void x_DSUnmapObject(CConstRef< TObject > obj, CDataSource &ds)
const CSeq_entry_Info & GetXrefTSE() const
CConstRef< TObject > GetCompleteSeq_entry(void) const
Definition: Seq_entry.hpp:56
void Parentize(void)
Definition: Seq_entry.cpp:71
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
Base class for all serializable objects.
Definition: serialbase.hpp:150
CSubmit_block –.
ETopLevelObjectType
Type of top level object added to scope.
Definition: tse_handle.hpp:127
@ eTopLevel_Seq_submit
Definition: tse_handle.hpp:132
void x_TSEAttach(CTSE_Info &tse)
bool x_DirtyAnnotIndex(void) const
vector< TChunkId > TChunkIds
TBioseq_sets m_Bioseq_sets
Definition: tse_info.hpp:730
TBlobVersion GetBlobVersion(void) const
Definition: tse_info.hpp:877
TBioObjects m_BioObjects
Definition: tse_info.hpp:776
void UpdateAnnotIndex(void) const
Definition: tse_info.cpp:1016
TNamedAnnotObjs m_NamedAnnotObjs
Definition: tse_info.hpp:743
CRef< CSeq_annot_SNP_Info > x_GetSNP_Info(const CConstRef< CSeq_annot > &annot)
Definition: tse_info.cpp:517
void x_MapChunkByFeatType(CSeqFeatData::ESubtype subtype, TChunkId chunk_id)
Definition: tse_info.cpp:1816
void SetTopLevelObject(ETopLevelObjectType type, CSerialObject *ptr)
Definition: tse_info.cpp:2078
CRef< CTSE_Split_Info > m_Split
Definition: tse_info.hpp:737
void x_MapFeatByLocus(const string &locus, bool tag, CAnnotObject_Info &info)
Definition: tse_info.cpp:1670
CAtomicCounter_WithAutoInit m_LockCounter
Definition: tse_info.hpp:719
virtual void x_ResetDirtyAnnotIndexNoParent(void)
Definition: tse_info.cpp:981
CSeq_id_Handle m_RequestedId
Definition: tse_info.hpp:749
bool HasNamedAnnot(const string &name) const
Definition: tse_info.cpp:539
CAnnotName m_Name
Definition: tse_info.hpp:695
CConstRef< CSeq_entry > GetTSECore(void) const
Definition: tse_info.cpp:557
CConstRef< CBioseq_Info > FindBioseq(const CSeq_id_Handle &id) const
Definition: tse_info.cpp:760
virtual void x_SetDirtyAnnotIndexNoParent(void)
Definition: tse_info.cpp:973
SFeatIdIndex::TIndexInt & x_GetFeatIdIndexInt(CSeqFeatData::ESubtype type)
Definition: tse_info.cpp:1561
CDataSource & GetDataSource(void) const
Definition: tse_info.hpp:805
void x_MapFeatById(TFeatIdInt id, CAnnotObject_Info &info, EFeatIdType type)
Definition: tse_info.cpp:1584
const TAnnotObjs * x_GetAnnotObjs(const CAnnotName &name) const
Definition: tse_info.cpp:1087
int TFeatIdInt
Definition: tse_info.hpp:335
TBioseqs m_Removed_Bioseqs
Definition: tse_info.hpp:733
bool IsTopLevelSeq_submit() const
Definition: tse_info.cpp:2085
void x_LoadChunk(TChunkId chunk_id) const
Definition: tse_info.cpp:856
void x_DSUnmapObject(CConstRef< TObject > obj, CDataSource &ds)
Definition: tse_info.cpp:602
void x_Initialize(void)
Definition: tse_info.cpp:289
void x_Reset(void)
Definition: tse_info.cpp:302
CConstRef< CMasterSeqSegments > GetMasterSeqSegments(void) const
Definition: tse_info.cpp:803
TBlobVersion m_BlobVersion
Definition: tse_info.hpp:685
void x_UnmapSNP_Table(const CAnnotName &name, const CSeq_id_Handle &key, const CSeq_annot_SNP_Info &snp_info)
Definition: tse_info.cpp:1284
bool HasUnnamedAnnot(void) const
Definition: tse_info.cpp:545
void AddUsedMemory(size_t size)
Definition: tse_info.cpp:345
int TBlobVersion
Definition: tse_info.hpp:212
CConstRef< CBioseq_Info > FindMatchingBioseq(const CSeq_id_Handle &id) const
Definition: tse_info.cpp:776
virtual ~CTSE_Info(void)
Definition: tse_info.cpp:223
void SetTopLevelObjectType(ETopLevelObjectType type)
Definition: tse_info.cpp:2155
@ fAnnotIds_NonGi
Definition: tse_info.hpp:752
@ fAnnotIds_Matching
Definition: tse_info.hpp:753
TAnnotObjects x_GetFeaturesById(CSeqFeatData::E_Choice type, TFeatIdInt id, EFeatIdType id_type, const CSeq_annot_Info *src_annot=0) const
Definition: tse_info.cpp:1867
TLocusIndex m_LocusIndex
Definition: tse_info.hpp:746
vector< CAnnotObject_Info * > TAnnotObjects
Definition: tse_info.hpp:426
CRef< CSerialObject > m_TopLevelObjectPtr
Definition: tse_info.hpp:692
SSeqMatch_TSE GetSeqMatch(const CSeq_id_Handle &id) const
Definition: tse_info.cpp:824
void x_RemoveAnnotObjs(const CAnnotName &name)
Definition: tse_info.cpp:1080
CSeq_id_Handle ContainsMatchingBioseq(const CSeq_id_Handle &id) const
Definition: tse_info.cpp:740
void x_LoadDelayedMainChunk(void) const
Definition: tse_info.cpp:1413
void UpdateFeatIdIndex(CSeqFeatData::E_Choice type, EFeatIdType id_type) const
Definition: tse_info.cpp:989
string TFeatIdStr
Definition: tse_info.hpp:336
bool x_HasFeaturesWithId(CSeqFeatData::ESubtype subtype) const
Definition: tse_info.cpp:1461
CSubmit_block & SetTopLevelSubmit_block() const
Definition: tse_info.cpp:2143
void x_DSMapObject(CConstRef< TObject > obj, CDataSource &ds)
Definition: tse_info.cpp:595
void x_UnmapFeatByLocus(const string &locus, bool tag, CAnnotObject_Info &info)
Definition: tse_info.cpp:1677
virtual void GetAnnotIds(TSeqIds &ids) const
Definition: tse_info.cpp:709
unique_ptr< SBaseTSE > m_BaseTSE
Definition: tse_info.hpp:771
CSeq_submit & x_GetTopLevelSeq_submit() const
Definition: tse_info.cpp:2091
void SetName(const CAnnotName &name)
Definition: tse_info.cpp:333
TBlobId m_BlobId
Definition: tse_info.hpp:684
virtual string GetDescription(void) const
Definition: tse_info.cpp:2049
void x_MapChunkByFeatId(TFeatIdInt id, CSeqFeatData::ESubtype subtype, TChunkId chunk_id, EFeatIdType type)
Definition: tse_info.cpp:1694
void x_GetRecords(const CSeq_id_Handle &id, bool bioseq) const
Definition: tse_info.cpp:848
TBlobState m_BlobState
Definition: tse_info.hpp:688
TAnnotLock m_AnnotLock
Definition: tse_info.hpp:748
CBioseq_Handle::TBioseqStateFlags TBlobState
Definition: tse_info.hpp:211
CRef< CBioseqUpdater > m_BioseqUpdater
Definition: tse_info.hpp:781
void SetUsedMemory(size_t size)
Definition: tse_info.cpp:339
void x_UnmapFeatById(TFeatIdInt id, CAnnotObject_Info &info, EFeatIdType type)
Definition: tse_info.cpp:1596
CRef< CTSE_SetObjectInfo > m_SetObjectInfo
Definition: tse_info.hpp:740
void x_UpdateAnnotIndexContents(CTSE_Info &tse)
Definition: tse_info.cpp:1059
CBioseq_set_Info & x_GetBioseq_set(int id)
Definition: tse_info.cpp:1345
TBioseqs m_Bioseqs
Definition: tse_info.hpp:731
const TBlobId & GetBlobId(void) const
Definition: tse_info.hpp:907
bool m_MasterSeqSegmentsLoaded
Definition: tse_info.hpp:778
CBioObjectId x_RegisterBioObject(CTSE_Info_Object &info)
Definition: tse_info.cpp:437
ETopLevelObjectType m_TopLevelObjectType
Definition: tse_info.hpp:691
void x_UnmapAnnotObjects(const SAnnotObjectsIndex &infos)
Definition: tse_info.cpp:1320
TSeq_feat_Lock x_FindSeq_feat(const CSeq_id_Handle &loc_id, TSeqPos loc_pos, const CSeq_feat &feat) const
Definition: tse_info.cpp:1995
friend class CTSE_Split_Info
Definition: tse_info.hpp:506
void SetBioseqUpdater(CRef< CBioseqUpdater > updater)
Definition: tse_info.cpp:2036
virtual void GetBioseqsIds(TSeqIds &ids) const
Definition: tse_info.cpp:691
void x_DoUpdate(TNeedUpdateFlags flags)
Definition: tse_info.cpp:671
void x_AddAllFeaturesById(TAnnotObjects &objects, TFeatIdInt id, EFeatIdType id_type, const CSeq_annot_Info *src_annot=0) const
Definition: tse_info.cpp:1482
bool ContainsBioseq(const CSeq_id_Handle &id) const
Definition: tse_info.cpp:724
TAnnotLock & GetAnnotLock(void) const
Definition: tse_info.hpp:914
void x_DSDetachContents(CDataSource &ds)
Definition: tse_info.cpp:579
bool x_HasIdObjects(const CSeq_id_Handle &id) const
Definition: tse_info.cpp:1167
void x_IndexSeqTSE(const CSeq_id_Handle &id)
Definition: tse_info.cpp:610
SFeatIdIndex::TIndexStr & x_GetFeatIdIndexStr(CSeqFeatData::ESubtype type)
Definition: tse_info.cpp:1573
const CSerialObject * GetTopLevelObjectPtr() const
Definition: tse_info.cpp:2072
void x_UnindexSeqTSE(const CSeq_id_Handle &id)
Definition: tse_info.cpp:619
atomic< ELoadState > m_LoadState
Definition: tse_info.hpp:712
bool HasDataSource(void) const
Definition: tse_info.hpp:798
TBioseq_sets m_Removed_Bioseq_sets
Definition: tse_info.hpp:732
CBioObjectId x_IndexBioseq(CBioseq_Info *)
Definition: tse_info.cpp:404
ETopLevelObjectType GetTopLevelObjectType() const
Definition: tse_info.cpp:2066
const SIdAnnotObjs * x_GetIdObjects(const TAnnotObjs &objs, const CSeq_id_Handle &idh) const
Definition: tse_info.cpp:1134
TFeatIdIndex m_FeatIdIndex
Definition: tse_info.hpp:745
int m_InternalBioObjNumber
Definition: tse_info.hpp:774
vector< CSeq_id_Handle > TSeqIds
Definition: tse_info.hpp:351
const CAnnotName & GetName(void) const
Definition: tse_info.hpp:893
ECacheState m_CacheState
Definition: tse_info.hpp:713
void x_DSAttachContents(CDataSource &ds)
Definition: tse_info.cpp:563
TIdAnnotInfoMap m_IdAnnotInfoMap
Definition: tse_info.hpp:744
const TAnnotObjs * x_GetUnnamedAnnotObjs(void) const
Definition: tse_info.cpp:1098
void x_ResetBioseqId(const CSeq_id_Handle &id, CBioseq_Info *info)
Definition: tse_info.cpp:918
const SIdAnnotObjs * x_GetUnnamedIdObjects(const CSeq_id_Handle &id) const
Definition: tse_info.cpp:1157
CFastMutex m_BioseqsMutex
Definition: tse_info.hpp:734
void x_SetBioseq_setId(int key, CBioseq_set_Info *info)
Definition: tse_info.cpp:941
CRef< IEditSaver > m_EditSaver
Definition: tse_info.hpp:773
CConstRef< CSeq_entry > GetCompleteTSE(void) const
Definition: tse_info.cpp:551
void x_AddFeaturesById(TAnnotObjects &objects, const SFeatIdIndex &index, TFeatIdInt id, EFeatIdType id_type, const CSeq_annot_Info *src_annot=0) const
Definition: tse_info.cpp:1421
CDataSource * m_DataSource
Definition: tse_info.hpp:678
bool HasAnnot(const CAnnotName &name) const
Definition: tse_info.cpp:532
bool x_MapSNP_Table(const CAnnotName &name, const CSeq_id_Handle &key, const CSeq_annot_SNP_Info &snp_info)
Definition: tse_info.cpp:1274
void x_UnregisterBioObject(CTSE_Info_Object &info)
Definition: tse_info.cpp:451
CTSE_Split_Info & GetSplitInfo(void)
Definition: tse_info.cpp:1395
size_t m_UsedMemory
Definition: tse_info.hpp:698
const CSubmit_block & GetTopLevelSubmit_block() const
Definition: tse_info.cpp:2137
pair< string, bool > TLocusKey
Definition: tse_info.hpp:348
void x_SetBioseqIds(CBioseq_Info *info)
Definition: tse_info.cpp:891
TAnnotIdsFlags m_AnnotIdsFlags
Definition: tse_info.hpp:758
bool x_NeedsDelayedMainChunk(void) const
Definition: tse_info.cpp:1407
pair< TSeq_annot_Lock, int > TSeq_feat_Lock
Definition: tse_info.hpp:484
const CTSE_Info & GetTSE_Info(void) const
Definition: tse_info.hpp:820
void x_UnindexAnnotTSE(const CAnnotName &name, const CSeq_id_Handle &id)
Definition: tse_info.cpp:653
CConstRef< CMasterSeqSegments > m_MasterSeqSegments
Definition: tse_info.hpp:779
pair< SIdAnnotObjs *, bool > x_SetIdObjects(TAnnotObjs &objs, const CAnnotName &name, const CSeq_id_Handle &id)
Definition: tse_info.cpp:1109
void x_LoadChunks(const TChunkIds &chunk_ids) const
Definition: tse_info.cpp:862
void x_ResetBioseq_setId(int key, CBioseq_set_Info *info)
Definition: tse_info.cpp:957
bool x_IndexAnnotTSE(const CAnnotName &name, const CSeq_id_Handle &id)
Definition: tse_info.cpp:627
CBioseq_Info & x_GetBioseq(const CSeq_id_Handle &id)
Definition: tse_info.cpp:1363
void SetSeq_entry(CSeq_entry &entry, CTSE_SetObjectInfo *set_info=0)
Definition: tse_info.cpp:351
bool HasSplitInfo(void) const
Definition: tse_info.cpp:1382
void x_MapAnnotObject(TRangeMap &rangeMap, const SAnnotObject_Key &key, const SAnnotObject_Index &index)
Definition: tse_info.cpp:1180
CTSE_Info & Assign(const CTSE_Lock &tse)
Definition: tse_info.cpp:232
CConstRef< CBioseq_Info > GetSegSetMaster(void) const
Definition: tse_info.cpp:783
TAnnotObjects x_GetFeaturesByLocus(const string &locus, bool tag, const CSeq_annot_Info *src_annot=0) const
Definition: tse_info.cpp:1966
CTSE_Info(void)
Definition: tse_info.cpp:126
bool x_UnmapAnnotObject(TRangeMap &rangeMap, const CAnnotObject_Info &info, const SAnnotObject_Key &key)
Definition: tse_info.cpp:1190
CBioObjectId x_IndexBioseq_set(CBioseq_set_Info *)
Definition: tse_info.cpp:426
void SetBlobVersion(TBlobVersion version)
Definition: tse_info.cpp:324
const CSeq_submit & GetTopLevelSeq_submit() const
Definition: tse_info.cpp:2108
TAnnotObjs & x_SetAnnotObjs(const CAnnotName &name)
Definition: tse_info.cpp:1069
CTSE_Info_Object * x_FindBioObject(const CBioObjectId &uniq_id) const
Definition: tse_info.cpp:463
map< CSeq_id_Handle, SIdAnnotObjs > TAnnotObjs
Definition: tse_info.hpp:305
void x_SetBioseqId(const CSeq_id_Handle &id, CBioseq_Info *info)
Definition: tse_info.cpp:870
TSeq_annot_InfoMap m_Seq_annot_InfoMap
Definition: tse_info.hpp:163
void x_UpdateCore(void)
void x_LoadChunks(const TChunkIds &chunk_ids) const
void x_TSEAttach(CTSE_Info &tse_info, CRef< ITSE_Assigner > &assigner)
bool ContainsBioseq(const CSeq_id_Handle &id) const
void x_DSDetach(CDataSource &ds)
void x_TSEDetach(CTSE_Info &tse_info)
void x_LoadDelayedMainChunk(void) const
void GetBioseqsIds(TSeqIds &ids) const
void x_UpdateAnnotIndex(void)
void x_LoadChunk(TChunkId chunk_id) const
void x_UpdateFeatIdIndex(CSeqFeatData::E_Choice type, EFeatIdType id_type)
void x_DSAttach(CDataSource &ds)
void x_GetRecords(const CSeq_id_Handle &id, bool bioseq) const
CRef< ITSE_Assigner > GetAssigner(const CTSE_Info &tse)
bool x_NeedsDelayedMainChunk(void) const
void erase(iterator pos)
Definition: map.hpp:167
const_iterator begin() const
Definition: map.hpp:151
const_iterator end() const
Definition: map.hpp:152
const_iterator lower_bound(const key_type &key) const
Definition: map.hpp:154
iterator_bool insert(const value_type &val)
Definition: map.hpp:165
bool empty() const
Definition: map.hpp:149
void clear()
Definition: map.hpp:169
const_iterator find(const key_type &key) const
Definition: map.hpp:153
container_type::const_iterator const_iterator
Definition: map.hpp:191
const_iterator find(const key_type &key) const
Definition: map.hpp:293
void erase(iterator pos)
Definition: map.hpp:307
const_iterator lower_bound(const key_type &key) const
Definition: map.hpp:294
const_iterator end() const
Definition: map.hpp:292
iterator insert(const value_type &val)
Definition: map.hpp:305
Definition: set.hpp:45
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
bool empty() const
Definition: set.hpp:133
static uch flags
#define false
Definition: bool.h:36
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:46
static int type
Definition: getdata.c:31
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
#define NULL
Definition: ncbistd.hpp:225
TValue Get(void) const THROWS_NONE
Get atomic counter value.
Definition: ncbicntr.hpp:168
#define _DEBUG_ARG(arg)
Definition: ncbidbg.hpp:134
#define _VERIFY(expr)
Definition: ncbidbg.hpp:161
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
Definition: ncbidiag.hpp:186
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
Definition: ncbiexpt.hpp:719
void Reset(void)
Reset the handle (remove seq-id reference)
@ eAllowWeakMatch
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
string ToString(void) const
Definition: blob_id.hpp:176
virtual TEditSaver GetEditSaver() const
TObjectType * GetNCPointerOrNull(void) const THROWS_NONE
Get pointer value.
Definition: ncbiobj.hpp:1162
CConstRef< C > ConstRef(const C *object)
Template function for conversion of const object pointer to CConstRef.
Definition: ncbiobj.hpp:2024
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
TObjectType * GetPointerOrNull(void) THROWS_NONE
Get pointer value.
Definition: ncbiobj.hpp:986
TObjectType & GetNCObject(void) const
Get object.
Definition: ncbiobj.hpp:1187
TParent::value_type value_type
Definition: rangemap.hpp:611
iterator insert(const value_type &value)
Definition: rangemap.hpp:629
const_iterator begin(void) const
Definition: rangemap.hpp:451
bool empty(void) const
Definition: rangemap.hpp:428
void erase(iterator iter)
Definition: rangemap.hpp:498
const_iterator find(const key_type &key) const
Definition: rangemap.hpp:484
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
static void PtrToString(string &out_str, const void *ptr)
Convert pointer to string.
Definition: ncbistr.cpp:2771
E_Choice
Choice variants.
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_feat_.hpp:925
@ e_not_set
No variant selected.
@ eClass_segset
segmented sequence + parts
@ e_not_set
No variant selected.
Definition: Seq_entry_.hpp:88
void SetSub(TSub &value)
Assign a value to Sub data member.
E_Choice Which(void) const
Which variant is currently selected.
const TData & GetData(void) const
Get the Data member data.
void SetData(TData &value)
Assign a value to Data data member.
const TSub & GetSub(void) const
Get the Sub member data.
@ eEmptyGuard
Definition: guard.hpp:94
Definition of all error codes used in objmgr libraries (xobjmgr.lib, xobjutil.lib and others).
int i
static MDB_envinfo info
Definition: mdb_load.c:37
static int version
Definition: mdb_load.c:29
range(_Ty, _Ty) -> range< _Ty >
constexpr auto sort(_Init &&init)
double value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:228
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
const char * tag
AutoPtr< TIndexInt > m_IndexInt
Definition: tse_info.hpp:344
AutoPtr< TIndexStr > m_IndexStr
Definition: tse_info.hpp:345
CAnnotObject_Info * m_AnnotObject_Info
bool IsIndexed(void) const
TObjectInfos & GetInfos(void)
const SAnnotObject_Key & GetKey(size_t i) const
const CAnnotName & GetName(void) const
deque< CAnnotObject_Info > TObjectInfos
const TRangeMap & x_GetRangeMap(size_t index) const
Definition: tse_info.hpp:118
TSNPSet m_SNPSet
Definition: tse_info.hpp:128
TAnnotSet m_AnnotSet
Definition: tse_info.hpp:127
vector< TRangeMap * > TAnnotSet
Definition: tse_info.hpp:105
~SIdAnnotObjs(void)
Definition: tse_info.cpp:72
bool x_RangeMapIsEmpty(size_t index) const
Definition: tse_info.hpp:112
CRangeMultimap< SAnnotObject_Index, TSeqPos > TRangeMap
Definition: tse_info.hpp:104
size_t x_GetRangeMapCount(void) const
Definition: tse_info.hpp:108
bool x_CleanRangeMaps(void)
Definition: tse_info.cpp:94
SIdAnnotObjs(void)
Definition: tse_info.cpp:67
CConstRef< CBioseq_Info > m_Bioseq
Definition: tse_info.hpp:138
CSeq_id_Handle m_Seq_id
Definition: tse_info.hpp:137
Definition: type.c:6
#define _ASSERT
NCBI_DEFINE_ERR_SUBCODE_X(3)
Modified on Mon May 13 04:34:44 2024 by modify_doxy.py rev. 669887