NCBI C++ ToolKit
scope_impl.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef OBJMGR_IMPL_SCOPE_IMPL__HPP
2 #define OBJMGR_IMPL_SCOPE_IMPL__HPP
3 
4 /* $Id: scope_impl.hpp 101834 2024-02-20 19:05:51Z vasilche $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Authors:
30 * Andrei Gourianov
31 * Aleksey Grichenko
32 * Michael Kimelman
33 * Denis Vakatov
34 * Eugene Vasilchenko
35 *
36 * File Description:
37 * Scope is top-level object available to a client.
38 * Its purpose is to define a scope of visibility and reference
39 * resolution and provide access to the bio sequence data
40 *
41 */
42 
43 #include <corelib/ncbiobj.hpp>
44 #include <corelib/ncbimtx.hpp>
45 
47 #include <objmgr/impl/priority.hpp>
48 
50 
52 #include <util/mutex_pool.hpp>
54 
55 
56 #include <objects/seq/Seq_inst.hpp> // for enum EMol
57 
58 #include <set>
59 #include <map>
60 
63 
64 
65 // fwd decl
66 // objects
67 class CSeq_entry;
68 class CSeq_annot;
69 class CSeq_data;
70 class CSeq_id;
71 class CSeq_loc;
72 class CBioseq;
73 class CSeq_submit;
74 
75 // objmgr
76 class CScope;
77 class CHeapScope;
78 class CObjectManager;
79 class CDataSource;
80 class CSeq_entry_Info;
81 class CSeq_annot_Info;
82 class CBioseq_Info;
83 class CBioseq_set_Info;
84 class CSeq_id_Handle;
85 class CSeqMap;
86 class CSynonymsSet;
87 class CTSE_Handle;
88 class CBioseq_Handle;
89 class CSeq_annot_Handle;
90 class CSeq_entry_Handle;
91 class CBioseq_set_Handle;
92 class CBioseq_EditHandle;
97 class CHandleRangeMap;
99 class CTSE_ScopeInfo;
100 class CTSE_Info;
101 class CTSE_Info_Object;
102 struct SAnnotTypeSelector;
103 struct SAnnotSelector;
104 class CPriorityTree;
105 class CPriorityNode;
108 class CBioseq_ScopeInfo;
109 
110 
111 /////////////////////////////////////////////////////////////////////////////
112 // CScope_Impl
113 /////////////////////////////////////////////////////////////////////////////
114 
115 
117 {
118  typedef int TBlobStateFlags;
119 
121  : m_BlobState(0)
122  {
123  }
124 
127 };
128 
129 
131 {
132 public:
134 
135  // History of requests
139  typedef vector< pair<CTSE_Handle, CSeq_id_Handle> > TTSE_LockMatchSet;
140  typedef int TPriority;
143  typedef vector<CSeq_id_Handle> TIds;
144  typedef vector<TIds> TBulkIds;
145  typedef vector<CSeq_entry_Handle> TTSE_Handles;
146 
147  CObjectManager& GetObjectManager(void);
148 
149  //////////////////////////////////////////////////////////////////
150  // Adding top level objects: DataLoader, Seq-entry, Bioseq, Seq-annot
151  typedef int TMissing;
152  typedef int TExist;
153 
154  // Add default data loaders from object manager
155  void AddDefaults(TPriority priority);
156  // Add data loader by name.
157  // The loader (or its factory) must be known to Object Manager.
158  void AddDataLoader(const string& loader_name,
159  TPriority priority);
160  // Add the scope's datasources as a single group with the given priority
161  void AddScope(CScope_Impl& scope, TPriority priority);
162 
163  // Add seq_entry, default priority is higher than for defaults or loaders
164  CSeq_entry_Handle AddSeq_entry(CSeq_entry& entry,
165  TPriority pri,
166  TExist action);
167  CSeq_entry_Handle AddSharedSeq_entry(const CSeq_entry& entry,
168  TPriority pri,
169  TExist action);
170  // Add bioseq, return bioseq handle. Try to use unresolved seq-id
171  // from the bioseq, fail if all ids are already resolved to
172  // other sequences.
173  CBioseq_Handle AddBioseq(CBioseq& bioseq,
174  TPriority pri,
175  TExist action);
176  CBioseq_Handle AddSharedBioseq(const CBioseq& bioseq,
177  TPriority pri,
178  TExist action);
179 
180  // Add Seq-annot.
181  CSeq_annot_Handle AddSeq_annot(CSeq_annot& annot,
182  TPriority pri,
183  TExist action);
184  CSeq_annot_Handle AddSharedSeq_annot(const CSeq_annot& annot,
185  TPriority pri,
186  TExist action);
187 
188  // Add Seq-annot.
189  CSeq_entry_Handle AddSeq_submit(CSeq_submit& submit,
190  TPriority pri);
191 
192  //////////////////////////////////////////////////////////////////
193  // Modification of existing object tree
194  CTSE_Handle GetEditHandle(const CTSE_Handle& src_tse);
195  CBioseq_EditHandle GetEditHandle(const CBioseq_Handle& seq);
196  CSeq_entry_EditHandle GetEditHandle(const CSeq_entry_Handle& entry);
197  CSeq_annot_EditHandle GetEditHandle(const CSeq_annot_Handle& annot);
198  CBioseq_set_EditHandle GetEditHandle(const CBioseq_set_Handle& seqset);
199 
200  // Add new sub-entry to the existing tree if it is in this scope
201  CSeq_entry_EditHandle AttachEntry(const CBioseq_set_EditHandle& seqset,
202  CSeq_entry& entry,
203  int index = -1);
204  CSeq_entry_EditHandle AttachEntry(const CBioseq_set_EditHandle& seqset,
205  CRef<CSeq_entry_Info> entry,
206  int index = -1);
207  /*
208  CSeq_entry_EditHandle CopyEntry(const CBioseq_set_EditHandle& seqset,
209  const CSeq_entry_Handle& entry,
210  int index = -1);
211  // Argument entry will be moved to new place.
212  CSeq_entry_EditHandle TakeEntry(const CBioseq_set_EditHandle& seqset,
213  const CSeq_entry_EditHandle& entry,
214  int index = -1);
215  */
216  // Argument entry must be removed.
217  CSeq_entry_EditHandle AttachEntry(const CBioseq_set_EditHandle& seqset,
218  const CSeq_entry_EditHandle& entry,
219  int index = -1);
220 
221  // Add annotations to a seq-entry (seq or set)
222  CSeq_annot_EditHandle AttachAnnot(const CSeq_entry_EditHandle& entry,
223  CSeq_annot& annot);
224  CSeq_annot_EditHandle AttachAnnot(const CSeq_entry_EditHandle& entry,
225  CRef<CSeq_annot_Info> annot);
226  /*
227  CSeq_annot_EditHandle CopyAnnot(const CSeq_entry_EditHandle& entry,
228  const CSeq_annot_Handle& annot);
229  // Argument annot will be moved to new place.
230  CSeq_annot_EditHandle TakeAnnot(const CSeq_entry_EditHandle& entry,
231  const CSeq_annot_EditHandle& annot);
232  */
233  // Argument annot must be removed.
234  CSeq_annot_EditHandle AttachAnnot(const CSeq_entry_EditHandle& entry,
235  const CSeq_annot_EditHandle& annot);
236 
237  // Remove methods.
238  void RemoveEntry(const CSeq_entry_EditHandle& entry);
239  void RemoveBioseq(const CBioseq_EditHandle& seq);
240  void RemoveBioseq_set(const CBioseq_set_EditHandle& seqset);
241  void RemoveAnnot(const CSeq_annot_EditHandle& annot);
242 
243  void RemoveTopLevelBioseq(const CBioseq_Handle& seq);
244  void RemoveTopLevelBioseq_set(const CBioseq_set_Handle& seqset);
245  void RemoveTopLevelAnnot(const CSeq_annot_Handle& annot);
246 
247  // Modify Seq-entry.
248  void SelectNone(const CSeq_entry_EditHandle& entry);
249  CBioseq_EditHandle SelectSeq(const CSeq_entry_EditHandle& entry,
250  CBioseq& seq);
251  CBioseq_EditHandle SelectSeq(const CSeq_entry_EditHandle& entry,
252  CRef<CBioseq_Info> seq);
253 
254  /*
255  CBioseq_EditHandle CopySeq(const CSeq_entry_EditHandle& entry,
256  const CBioseq_Handle& seq);
257  // Argument seq will be moved to new place.
258  CBioseq_EditHandle TakeSeq(const CSeq_entry_EditHandle& entry,
259  const CBioseq_EditHandle& seq);
260  */
261  // Argument seq must be removed.
262  CBioseq_EditHandle SelectSeq(const CSeq_entry_EditHandle& entry,
263  const CBioseq_EditHandle& seq);
264 
265  CBioseq_set_EditHandle SelectSet(const CSeq_entry_EditHandle& entry,
266  CBioseq_set& seqset);
267  CBioseq_set_EditHandle SelectSet(const CSeq_entry_EditHandle& entry,
268  CRef<CBioseq_set_Info> seqset);
269 
270  /*
271  CBioseq_set_EditHandle CopySet(const CSeq_entry_EditHandle& entry,
272  const CBioseq_set_Handle& seqset);
273  // Argument seqset will be moved to new place.
274  CBioseq_set_EditHandle TakeSet(const CSeq_entry_EditHandle& entry,
275  const CBioseq_set_EditHandle& seqset);
276  */
277  // Argument seqset must be removed.
278  CBioseq_set_EditHandle SelectSet(const CSeq_entry_EditHandle& entry,
279  const CBioseq_set_EditHandle& seqset);
280 
281  // Get bioseq handle, limit id resolving
282  // get_flag can have values from CScope::EGetBioseqFlag
283  // and CScope_Impl::EGetBioseqFlag2
285  fUserFlagMask = 0xff,
286  fNoLockFlag = 0x100
287  };
288  CBioseq_Handle GetBioseqHandle(const CSeq_id_Handle& id, int get_flag);
289 
290  bool IsSameBioseq(const CSeq_id_Handle& id1,
291  const CSeq_id_Handle& id2,
292  int get_flag);
293 
294  CBioseq_Handle GetBioseqHandleFromTSE(const CSeq_id_Handle& id,
295  const CTSE_Handle& tse);
296 
297  // Get bioseq handle by seqloc
298  CBioseq_Handle GetBioseqHandle(const CSeq_loc& loc, int get_flag);
299 
300  // History cleanup methods
301  void ResetScope(void); // reset scope in initial state (no data)
302  void ResetHistory(int action); // CScope::EActionIfLocked
303  void ResetDataAndHistory(void);
304  void RemoveFromHistory(const CTSE_Handle& tse, int action);
305  void RemoveFromHistory(const CSeq_id_Handle& seq_id);
306 
307  // Revoke data sources from the scope. Throw exception if the
308  // operation fails (e.g. data source is in use or not found).
309  void RemoveDataLoader(const string& loader_name,
310  int action); // CScope::EActionIfLocked
311  // Remove TSE previously added using AddTopLevelSeqEntry() or
312  // AddBioseq().
313  void RemoveTopLevelSeqEntry(const CTSE_Handle& entry);
314 
315  CSeq_entry_Handle GetSeq_entryHandle(CDataLoader* loader,
316  const CBlobIdKey& blob_id,
317  TMissing action);
318 
319  // Deprecated interface
320  CBioseq_Handle GetBioseqHandle(const CBioseq& bioseq,
321  TMissing action);
322  CBioseq_set_Handle GetBioseq_setHandle(const CBioseq_set& seqset,
323  TMissing action);
324  CSeq_entry_Handle GetSeq_entryHandle(const CSeq_entry& entry,
325  TMissing action);
326  CSeq_annot_Handle GetSeq_annotHandle(const CSeq_annot& annot,
327  TMissing action);
328  CSeq_entry_Handle GetSeq_entryHandle(const CTSE_Handle& tse);
329  CSeq_feat_Handle GetSeq_featHandle(const CSeq_feat& feat,
330  TMissing action);
331 
332  CScope& GetScope(void);
333 
334  typedef int TGetFlags;
335 
336  bool Exists(const CSeq_id_Handle& id);
337  // Get "native" bioseq ids without filtering and matching.
338  TIds GetIds(const CSeq_id_Handle& idh, TGetFlags flags = 0);
340  TGi GetGi(const CSeq_id_Handle& idh, TGetFlags flags);
341  string GetLabel(const CSeq_id_Handle& idh, TGetFlags flags);
343 
344  /// Bulk retrieval methods
345 
346  // Get a set of bioseq handles
347  typedef vector<CBioseq_Handle> TBioseqHandles;
348  TBioseqHandles GetBioseqHandles(const TIds& ids);
349 
350  typedef vector<CTSE_Handle> TCDD_Entries;
351  TCDD_Entries GetCDDAnnots(const TIds& idhs);
352  TCDD_Entries GetCDDAnnots(const TBioseqHandles& bhs);
353 
354  // Get a set of all ids of requested sequences
355  void GetBulkIds(TBulkIds& ret, const TIds& idhs, TGetFlags flags);
356 
357  // Get a set of accession/version pairs
358  void GetAccVers(TIds& ret, const TIds& idhs, TGetFlags flags);
359 
360  // Get a set of gis
361  typedef vector<TGi> TGIs;
362  void GetGis(TGIs& ret, const TIds& idhs, TGetFlags flags);
363 
364  // Get a set of label strings
365  typedef vector<string> TLabels;
366  void GetLabels(TLabels& ret, const TIds& idhs, TGetFlags flags);
367 
368  // Get a set of taxids
369  typedef vector<TTaxId> TTaxIds;
370  void GetTaxIds(TTaxIds& ret, const TIds& idhs, TGetFlags flags);
371 
372  // Get bioseq synonyms, resolving to the bioseq in this scope.
373  CConstRef<CSynonymsSet> GetSynonyms(const CSeq_id_Handle& id,
374  int get_flag);
375  CConstRef<CSynonymsSet> GetSynonyms(const CBioseq_Handle& bh);
376 
377  void GetAllTSEs(TTSE_Handles& tses, int kind);
378 
379  IScopeTransaction_Impl* CreateTransaction();
380  void SetActiveTransaction(IScopeTransaction_Impl*);
381  IScopeTransaction_Impl& GetTransaction();
382 
383  bool IsTransactionActive() const;
384 
385  TSeqPos GetSequenceLength(const CSeq_id_Handle& id, TGetFlags flags);
387  int GetSequenceState(const CSeq_id_Handle& id, TGetFlags flags);
388  int GetSequenceHash(const CSeq_id_Handle& id, TGetFlags flags);
389 
390  // Get a set of bioseq lengths
391  typedef vector<TSeqPos> TSequenceLengths;
392  void GetSequenceLengths(TSequenceLengths& ret,
393  const TIds& idhs, TGetFlags flags);
394  // Get a set of bioseq types
395  typedef vector<CSeq_inst::TMol> TSequenceTypes;
396  void GetSequenceTypes(TSequenceTypes& ret,
397  const TIds& idhs, TGetFlags flags);
398  // Get a set of bioseq states
399  typedef vector<int> TSequenceStates;
400  void GetSequenceStates(TSequenceStates& ret,
401  const TIds& idhs, TGetFlags flags);
402  // Get a set of sequence hashes
403  typedef vector<int> TSequenceHashes;
404  void GetSequenceHashes(TSequenceHashes& ret,
405  const TIds& idhs, TGetFlags flags);
406 
407 private:
408  // constructor/destructor visible from CScope
409  CScope_Impl(CObjectManager& objmgr);
410  virtual ~CScope_Impl(void);
411 
412  // to prevent copying
415 
416  // Return the highest priority loader or null
417  CDataSource* GetFirstLoaderSource(void);
418 
419  void GetTSESetWithAnnots(const CSeq_id_Handle& idh,
420  TTSE_LockMatchSet& tse_set);
421  void GetTSESetWithAnnots(const CBioseq_Handle& bh,
422  TTSE_LockMatchSet& tse_set);
423  void GetTSESetWithAnnots(const CSeq_id_Handle& idh,
424  TTSE_LockMatchSet& tse_set,
425  const SAnnotSelector& sel);
426  void GetTSESetWithAnnots(const CBioseq_Handle& bh,
427  TTSE_LockMatchSet& tse_set,
428  const SAnnotSelector& sel);
429 
430  void x_AttachToOM(CObjectManager& objmgr);
431  void x_DetachFromOM(void);
432 
433  // clean some cache entries when new data source is added
434  void x_ReportNewDataConflict(const CSeq_id_Handle* conflict_id = 0);
435  void x_ClearCacheOnNewDS(void);
436  void x_ClearCacheOnEdit(const CTSE_ScopeInfo& replaced_tse);
437 
438  // both seq_ids and annot_ids must be sorted
439  void x_ClearCacheOnNewData(const TIds& seq_ids, const TIds& annot_ids);
440  void x_ClearCacheOnNewData(const CTSE_Info& new_tse);
441  void x_ClearCacheOnNewData(const CTSE_Info& new_tse,
442  const CSeq_id_Handle& new_id);
443  void x_ClearCacheOnNewData(const CTSE_Info& new_tse,
444  const CSeq_entry_Info& new_entry);
445 public:
446  void x_ClearCacheOnRemoveData(const CTSE_Info* old_tse = 0);
447  void x_ClearAnnotCache(void);
448  void x_ClearCacheOnNewAnnot(const CTSE_Info& new_tse);
449 private:
450  void x_ClearCacheOnRemoveSeqId(const CSeq_id_Handle& id,
451  CBioseq_ScopeInfo& seq);
452  void x_ClearCacheOnRemoveAnnot(const CTSE_Info& old_tse);
453 
455  GetEditDataSource(CDataSource_ScopeInfo& ds,
456  const CTSE_ScopeInfo* replaced_tse = 0);
457 
458  CSeq_entry_EditHandle x_AttachEntry(const CBioseq_set_EditHandle& seqset,
459  CRef<CSeq_entry_Info> entry,
460  int index);
461  void x_AttachEntry(const CBioseq_set_EditHandle& seqset,
462  const CSeq_entry_EditHandle& entry,
463  int index);
464  CSeq_annot_EditHandle x_AttachAnnot(const CSeq_entry_EditHandle& entry,
465  CRef<CSeq_annot_Info> annot);
466  void x_AttachAnnot(const CSeq_entry_EditHandle& entry,
467  const CSeq_annot_EditHandle& annot);
468 
469  CBioseq_EditHandle x_SelectSeq(const CSeq_entry_EditHandle& entry,
470  CRef<CBioseq_Info> bioseq);
471  CBioseq_set_EditHandle x_SelectSet(const CSeq_entry_EditHandle& entry,
472  CRef<CBioseq_set_Info> seqset);
473  void x_SelectSeq(const CSeq_entry_EditHandle& entry,
474  const CBioseq_EditHandle& bioseq);
475  void x_SelectSet(const CSeq_entry_EditHandle& entry,
476  const CBioseq_set_EditHandle& seqset);
477 
478  // Find the best possible resolution for the Seq-id
479  void x_ResolveSeq_id(TSeq_idMapValue& id,
480  int get_flag,
482  // Iterate over priorities, find all possible data sources
483  SSeqMatch_Scope x_FindBioseqInfo(const CPriorityTree& tree,
484  const CSeq_id_Handle& idh,
485  int get_flag);
486  SSeqMatch_Scope x_FindBioseqInfo(const CPriorityNode& node,
487  const CSeq_id_Handle& idh,
488  int get_flag);
489  SSeqMatch_Scope x_FindBioseqInfo(CDataSource_ScopeInfo& ds_info,
490  const CSeq_id_Handle& idh,
491  int get_flag);
492 
493  CBioseq_Handle x_GetBioseqHandleFromTSE(const CSeq_id_Handle& id,
494  const CTSE_Handle& tse);
495  void x_UpdateHandleSeq_id(CBioseq_Handle& bh);
496 
497  // guarded
498  CBioseq_Handle GetBioseqHandle(const CBioseq_Info& seq,
499  const CTSE_Handle& tse);
500  // unguarded
501  CBioseq_Handle x_GetBioseqHandle(const CBioseq_Info& seq,
502  const CTSE_Handle& tse);
503 
504  CRef<CSeq_entry> x_MakeDummyTSE(CBioseq& seq) const;
505  CRef<CSeq_entry> x_MakeDummyTSE(CBioseq_set& seqset) const;
506  CRef<CSeq_entry> x_MakeDummyTSE(CSeq_annot& annot) const;
507  CRef<CSeq_entry> x_MakeDummyTSE(CSeq_submit& submit) const;
508  bool x_IsDummyTSE(const CTSE_Info& tse,
509  const CBioseq_Info& seq) const;
510  bool x_IsDummyTSE(const CTSE_Info& tse,
511  const CBioseq_set_Info& seqset) const;
512  bool x_IsDummyTSE(const CTSE_Info& tse,
513  const CSeq_annot_Info& annot) const;
514 
515  void x_GetBioseqHandlesSorted(const TIds& ids,
516  size_t from,
517  size_t count,
518  TBioseqHandles& ret);
519 
520 public:
521  typedef pair<CConstRef<CSeq_entry_Info>, TTSE_Lock> TSeq_entry_Lock;
522  typedef pair<CConstRef<CSeq_annot_Info>, TTSE_Lock> TSeq_annot_Lock;
523  typedef pair<CConstRef<CBioseq_set_Info>, TTSE_Lock> TBioseq_set_Lock;
525 
526  TTSE_Lock x_GetTSE_Lock(const CSeq_entry& tse,
527  int action);
528  TSeq_entry_Lock x_GetSeq_entry_Lock(const CSeq_entry& entry,
529  int action);
530  TSeq_annot_Lock x_GetSeq_annot_Lock(const CSeq_annot& annot,
531  int action);
532  TBioseq_set_Lock x_GetBioseq_set_Lock(const CBioseq_set& seqset,
533  int action);
534  TBioseq_Lock x_GetBioseq_Lock(const CBioseq& bioseq,
535  int action);
536 
537  TTSE_Lock x_GetTSE_Lock(const CTSE_Lock& lock, CDataSource_ScopeInfo& ds);
538  TTSE_Lock x_GetTSE_Lock(const CTSE_ScopeInfo& tse);
539 
540  CRef<CDataSource_ScopeInfo> x_GetDSInfo(CDataSource& ds);
542  TPriority priority);
543  CRef<CDataSource_ScopeInfo> GetEditDS(TPriority priority);
544  CRef<CDataSource_ScopeInfo> GetConstDS(TPriority priority);
546  AddDSBefore(CRef<CDataSource> ds,
548  const CTSE_ScopeInfo* replaced_tse = 0);
549 
551  {
552  return m_KeepExternalAnnotsForEdit;
553  }
554  void SetKeepExternalAnnotsForEdit(bool keep = true);
555 
556 private:
557  // Get bioseq handles for sequences from the given TSE using the filter
558  typedef vector<CBioseq_Handle> TBioseq_HandleSet;
559  typedef int TBioseqLevelFlag;
560  void x_PopulateBioseq_HandleSet(const CSeq_entry_Handle& tse,
561  TBioseq_HandleSet& handles,
562  CSeq_inst::EMol filter,
563  TBioseqLevelFlag level);
564 
566  void x_AddSynonym(const CSeq_id_Handle& idh,
567  CSynonymsSet& syn_set, CBioseq_ScopeInfo& info);
568 
569  TSeq_idMapValue& x_GetSeq_id_Info(const CSeq_id_Handle& id);
571  TSeq_idMapValue* x_FindSeq_id_Info(const CSeq_id_Handle& id);
572 
573  CRef<CBioseq_ScopeInfo> x_InitBioseq_Info(TSeq_idMapValue& info,
574  int get_flag,
576  bool x_InitBioseq_Info(TSeq_idMapValue& info,
577  CBioseq_ScopeInfo& bioseq_info);
578  CRef<CBioseq_ScopeInfo> x_GetBioseq_Info(const CSeq_id_Handle& id,
579  int get_flag,
581  CRef<CBioseq_ScopeInfo> x_FindBioseq_Info(const CSeq_id_Handle& id,
582  int get_flag,
584 
587 
589  x_GetAnnotRef_Info(const SAnnotSelector* sel,
592 
593  void x_GetTSESetWithAnnots(TTSE_LockMatchSet& lock,
594  CBioseq_ScopeInfo& binfo,
595  const SAnnotSelector* sel = 0);
596  void x_GetTSESetWithAnnots(TTSE_LockMatchSet& lock,
597  TTSE_MatchSet* save_match,
598  CBioseq_ScopeInfo& binfo,
599  const SAnnotSelector* sel = 0);
600  void x_GetTSESetWithAnnots(TTSE_LockMatchSet& lock,
602  const SAnnotSelector* sel = 0);
603  void x_GetTSESetWithAnnots(TTSE_LockMatchSet& lock,
604  TTSE_MatchSet* save_match,
606  const SAnnotSelector* sel = 0);
607 
608  void x_AddTSESetWithAnnots(TTSE_LockMatchSet& lock,
609  TTSE_MatchSet* save_match,
610  const TTSE_LockMatchSet_DS& add,
611  CDataSource_ScopeInfo& ds_info,
612  CDataLoader::TProcessedNAs* filter_nas = 0);
613  void x_GetTSESetWithOrphanAnnots(TTSE_LockMatchSet& lock,
614  TTSE_MatchSet* save_match,
615  const TSeq_idSet& ids,
616  CBioseq_ScopeInfo* binfo,
617  const SAnnotSelector* sel);
618  void x_GetTSESetWithBioseqAnnots(TTSE_LockMatchSet& lock,
619  TTSE_MatchSet* save_match,
620  CBioseq_ScopeInfo& binfo,
621  const SAnnotSelector* sel);
622  void x_GetTSESetWithBioseqAnnots(TTSE_LockMatchSet& lock,
623  CBioseq_ScopeInfo& binfo,
624  const SAnnotSelector* sel);
625 
626  void x_UpdateProcessedNAs(const SAnnotSelector*& sel,
627  unique_ptr<SAnnotSelector>& sel_copy,
628  CDataLoader::TProcessedNAs& filter_nas,
629  CDataLoader::TProcessedNAs& processed_nas);
630 
631  void x_LockMatchSet(TTSE_LockMatchSet& lock,
632  const TTSE_MatchSet& match);
633 
634 private:
636 
638  CPriorityTree m_setDataSrc; // Data sources ordered by priority
639 
641 
643 
648 
650 
653 
655 
657  atomic<int> m_AnnotChangeCounter;
659 
660  friend class CScope;
661  friend class CHeapScope;
662  friend class CObjectManager;
663  friend class CSeqVector;
664  friend class CDataSource;
665  friend class CBioseq_CI;
666  friend class CAnnot_Collector;
667  friend class CBioseq_Handle;
668  friend class CBioseq_set_Handle;
669  friend class CSeq_entry_Handle;
670  friend class CBioseq_EditHandle;
672  friend class CSeq_entry_EditHandle;
673  friend class CSeq_annot_EditHandle;
674  friend class CTSE_CI;
675  friend class CSeq_annot_CI;
676  friend class CSeqMap_CI;
678  friend class CDataSource_ScopeInfo;
679  friend class CTSE_ScopeInfo;
681 
682  friend class CBioseq_ScopeInfo;
683 };
684 
685 
686 inline
688 {
689  return *m_ObjMgr;
690 }
691 
692 
695 
696 #endif//OBJMGR_IMPL_SCOPE_IMPL__HPP
pair< string, int > GetAccVer(const CAlignModel &a, CScope &scope)
Definition: chainer.cpp:6323
CBioseq_CI –.
Definition: bioseq_ci.hpp:69
CBioseq_EditHandle –.
CBioseq_Handle –.
vector< pair< TTSE_ScopeInfo, CSeq_id_Handle > > TTSE_MatchSet
Definition: scope_info.hpp:524
CBioseq_set_EditHandle –.
CBioseq_set_Handle –.
CConstRef –.
Definition: ncbiobj.hpp:1266
vector< pair< TTSE_Lock, CSeq_id_Handle > > TTSE_LockMatchSet
CFastMutex –.
Definition: ncbimtx.hpp:667
CObjectManager –.
CObject –.
Definition: ncbiobj.hpp:180
CRWLock –.
Definition: ncbimtx.hpp:953
CFastMutex TSeq_idMapLock
Definition: scope_impl.hpp:647
CDataSource::TTSE_LockMatchSet TTSE_LockMatchSet_DS
Definition: scope_impl.hpp:586
TConfLock::TWriteLockGuard TConfWriteLockGuard
Definition: scope_impl.hpp:646
CBioseq_ScopeInfo::TTSE_MatchSet TTSE_MatchSet
Definition: scope_impl.hpp:585
CPriorityTree m_setDataSrc
Definition: scope_impl.hpp:638
int TBioseqLevelFlag
Definition: scope_impl.hpp:559
CRef< CObjectManager > m_ObjMgr
Definition: scope_impl.hpp:637
map< CRef< CDataSource >, CRef< CDataSource_ScopeInfo > > TDSMap
Definition: scope_impl.hpp:142
vector< TTaxId > TTaxIds
Definition: scope_impl.hpp:369
vector< CBioseq_Handle > TBioseqHandles
Bulk retrieval methods.
Definition: scope_impl.hpp:347
TSeq_idMapValue & x_GetSeq_id_Info(const CBioseq_Handle &bh)
TConfLock m_ConfLock
Definition: scope_impl.hpp:649
CTSE_ScopeUserLock TTSE_Lock
Definition: scope_impl.hpp:133
vector< CTSE_Handle > TCDD_Entries
Definition: scope_impl.hpp:350
IScopeTransaction_Impl * m_Transaction
Definition: scope_impl.hpp:654
TSeq_idMap::value_type TSeq_idMapValue
Definition: scope_impl.hpp:137
bool GetKeepExternalAnnotsForEdit() const
Definition: scope_impl.hpp:550
vector< TIds > TBulkIds
Definition: scope_impl.hpp:144
set< CSeq_id_Handle > TSeq_idSet
Definition: scope_impl.hpp:138
bool m_KeepExternalAnnotsForEdit
Definition: scope_impl.hpp:658
vector< TSeqPos > TSequenceLengths
Definition: scope_impl.hpp:391
pair< CConstRef< CSeq_entry_Info >, TTSE_Lock > TSeq_entry_Lock
Definition: scope_impl.hpp:521
vector< TGi > TGIs
Definition: scope_impl.hpp:361
vector< pair< CTSE_Handle, CSeq_id_Handle > > TTSE_LockMatchSet
Definition: scope_impl.hpp:139
CScope_Impl(const CScope_Impl &)
vector< CBioseq_Handle > TBioseq_HandleSet
Definition: scope_impl.hpp:558
CDataSource_ScopeInfo::TBioseq_Lock TBioseq_Lock
Definition: scope_impl.hpp:524
CInitMutexPool m_MutexPool
Definition: scope_impl.hpp:642
vector< int > TSequenceStates
Definition: scope_impl.hpp:399
map< CSeq_id_Handle, SSeq_id_ScopeInfo > TSeq_idMap
Definition: scope_impl.hpp:136
atomic< int > m_AnnotChangeCounter
Definition: scope_impl.hpp:657
map< CConstRef< CObject >, CRef< CObject > > TEditInfoMap
Definition: scope_impl.hpp:141
vector< CSeq_entry_Handle > TTSE_Handles
Definition: scope_impl.hpp:145
atomic< int > m_BioseqChangeCounter
Definition: scope_impl.hpp:656
TDSMap m_DSMap
Definition: scope_impl.hpp:640
vector< CSeq_inst::TMol > TSequenceTypes
Definition: scope_impl.hpp:395
TConfLock::TReadLockGuard TConfReadLockGuard
Definition: scope_impl.hpp:645
TSeq_idMapLock m_Seq_idMapLock
Definition: scope_impl.hpp:652
vector< int > TSequenceHashes
Definition: scope_impl.hpp:403
vector< CSeq_id_Handle > TIds
Definition: scope_impl.hpp:143
CObjectManager & GetObjectManager(void)
Definition: scope_impl.hpp:687
TSeq_idMap m_Seq_idMap
Definition: scope_impl.hpp:651
CRWLock TConfLock
Definition: scope_impl.hpp:644
vector< string > TLabels
Definition: scope_impl.hpp:365
pair< CConstRef< CSeq_annot_Info >, TTSE_Lock > TSeq_annot_Lock
Definition: scope_impl.hpp:522
pair< CConstRef< CBioseq_set_Info >, TTSE_Lock > TBioseq_set_Lock
Definition: scope_impl.hpp:523
CScope_Impl & operator=(const CScope_Impl &)
CScope * m_HeapScope
Definition: scope_impl.hpp:635
CScope –.
Definition: scope.hpp:92
Iterator over CSeqMap.
Definition: seq_map_ci.hpp:252
CSeqMap –.
Definition: seq_map.hpp:93
CSeqVector –.
Definition: seq_vector.hpp:65
CSeq_annot_CI –.
CSeq_annot_Handle –.
CSeq_entry_Handle –.
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
CSeq_feat_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
Definition: set.hpp:45
static uch flags
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
SStrictId_Tax::TId TTaxId
Taxon id type.
Definition: ncbimisc.hpp:1048
string GetLabel(const CSeq_id &id)
bool IsSameBioseq(const CSeq_id &id1, const CSeq_id &id2, CScope *scope, CScope::EGetBioseqFlag get_flag=CScope::eGetBioseq_All)
Determines if two CSeq_ids represent the same CBioseq.
TTaxId GetTaxId(const CBioseq_Handle &handle)
return the tax-id associated with a given sequence.
Definition: sequence.cpp:274
#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
#define NCBI_XOBJMGR_EXPORT
Definition: ncbi_export.h:1307
EMol
molecule class in living organism
Definition: Seq_inst_.hpp:108
static MDB_envinfo info
Definition: mdb_load.c:37
double value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:228
Multi-threading – mutexes; rw-locks; semaphore.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
Definition: pcre2_match.c:594
#define count
static bool GetIds(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
Uint4 GetSequenceType(const CBioseq_Handle &bsh)
Return a (corrected) set of flags identifying the sequence type.
Definition: sequtils.cpp:42
SAnnotSelector –.
TBlobStateFlags m_BlobState
Definition: scope_impl.hpp:126
CTSE_ScopeUserLock m_TSE_Lock
Definition: scope_impl.hpp:125
CScope & GetScope()
Modified on Fri Sep 20 14:58:02 2024 by modify_doxy.py rev. 669887