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

Go to the SVN repository for this file.

1 /* $Id: annot_selector.cpp 99724 2023-05-03 16:12:32Z grichenk $
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 *
30 */
31 
32 #include <ncbi_pch.hpp>
34 #include <objmgr/impl/tse_info.hpp>
38 
39 #include <objmgr/bioseq_handle.hpp>
44 
47 
48 #include <algorithm>
49 
52 
53 ////////////////////////////////////////////////////////////////////
54 //
55 // SAnnotSelector
56 //
57 
59  TFeatType feat,
60  bool feat_product)
61  : SAnnotTypeSelector(annot),
62  m_FeatProduct(feat_product),
63  m_ResolveDepth(kMax_Int),
64  m_OverlapType(eOverlap_Intervals),
65  m_ResolveMethod(eResolve_TSE),
66  m_SortOrder(eSortOrder_Normal),
67  m_LimitObjectType(eLimit_None),
68  m_UnresolvedFlag(eIgnoreUnresolved),
69  m_MaxSize(numeric_limits<size_t>::max()),
70  m_MaxSearchSegments(kMax_UInt),
71  m_MaxSearchTime(FLT_MAX),
72  m_MaxSearchSegmentsAction(eMaxSearchSegmentsThrow),
73  m_NoMapping(false),
74  m_AdaptiveDepthFlags(kAdaptive_None),
75  m_ExactDepth(false),
76  m_ExcludeExternal(false),
77  m_CollectSeq_annots(false),
78  m_CollectTypes(false),
79  m_CollectNames(false),
80  m_CollectCostOfLoading(false),
81  m_IgnoreStrand(false),
82  m_HasWildcardInAnnotsNames(false),
83  m_FilterMask(0),
84  m_FilterBits(0),
85  m_ExcludeIfGeneIsSuppressed(false),
86  m_SNPScaleLimit(CSeq_id::eSNPScaleLimit_Default)
87 {
88  if ( feat != CSeqFeatData::e_not_set ) {
89  SetFeatType(feat);
90  }
91 }
92 
93 
95  bool feat_product)
96  : SAnnotTypeSelector(feat),
97  m_FeatProduct(feat_product),
98  m_ResolveDepth(kMax_Int),
99  m_OverlapType(eOverlap_Intervals),
100  m_ResolveMethod(eResolve_TSE),
101  m_SortOrder(eSortOrder_Normal),
102  m_LimitObjectType(eLimit_None),
103  m_UnresolvedFlag(eIgnoreUnresolved),
104  m_MaxSize(numeric_limits<size_t>::max()),
105  m_MaxSearchSegments(kMax_UInt),
106  m_MaxSearchTime(FLT_MAX),
107  m_MaxSearchSegmentsAction(eMaxSearchSegmentsThrow),
108  m_NoMapping(false),
109  m_AdaptiveDepthFlags(kAdaptive_None),
110  m_ExactDepth(false),
111  m_ExcludeExternal(false),
112  m_CollectSeq_annots(false),
113  m_CollectTypes(false),
114  m_CollectNames(false),
115  m_CollectCostOfLoading(false),
116  m_IgnoreStrand(false),
117  m_HasWildcardInAnnotsNames(false),
118  m_FilterMask(0),
119  m_FilterBits(0),
120  m_ExcludeIfGeneIsSuppressed(false),
121  m_SNPScaleLimit(CSeq_id::eSNPScaleLimit_Default)
122 {
123 }
124 
125 
127  : SAnnotTypeSelector(feat_subtype),
128  m_FeatProduct(false),
129  m_ResolveDepth(kMax_Int),
130  m_OverlapType(eOverlap_Intervals),
131  m_ResolveMethod(eResolve_TSE),
132  m_SortOrder(eSortOrder_Normal),
133  m_LimitObjectType(eLimit_None),
134  m_UnresolvedFlag(eIgnoreUnresolved),
135  m_MaxSize(numeric_limits<size_t>::max()),
136  m_MaxSearchSegments(kMax_UInt),
137  m_MaxSearchTime(FLT_MAX),
138  m_MaxSearchSegmentsAction(eMaxSearchSegmentsThrow),
139  m_NoMapping(false),
140  m_AdaptiveDepthFlags(kAdaptive_None),
141  m_ExactDepth(false),
142  m_ExcludeExternal(false),
143  m_CollectSeq_annots(false),
144  m_CollectTypes(false),
145  m_CollectNames(false),
146  m_CollectCostOfLoading(false),
147  m_IgnoreStrand(false),
148  m_HasWildcardInAnnotsNames(false),
149  m_FilterMask(0),
150  m_FilterBits(0),
151  m_ExcludeIfGeneIsSuppressed(false),
152  m_SNPScaleLimit(CSeq_id::eSNPScaleLimit_Default)
153 {
154 }
155 
156 
158 {
159  *this = sel;
160 }
161 
162 
164 {
165  if ( this != &sel ) {
166  static_cast<SAnnotTypeSelector&>(*this) = sel;
171  m_SortOrder = sel.m_SortOrder;
176  m_LimitTSE = sel.m_LimitTSE;
177  m_MaxSize = sel.m_MaxSize;
182  if ( sel.m_NamedAnnotAccessions ) {
185  }
187  m_NoMapping = sel.m_NoMapping;
202  if ( sel.m_SourceLoc ) {
204  }
205  else {
206  m_SourceLoc.reset();
207  }
211  }
212  return *this;
213 }
214 
215 
217 {
218 }
219 
220 
222 {
225  m_LimitTSE.Reset();
226  return *this;
227 }
228 
229 
232 {
233  if ( !limit )
234  return SetLimitNone();
235 
238  m_LimitTSE = limit;
239  return *this;
240 }
241 
242 
245 {
246  return SetLimitTSE(limit.GetTSE_Handle());
247 }
248 
249 
252 {
253  if ( !limit )
254  return SetLimitNone();
255 
257  m_LimitObject.Reset(&limit.x_GetInfo());
258  m_LimitTSE = limit.GetTSE_Handle();
259  return *this;
260 }
261 
262 
265 {
266  if ( !limit )
267  return SetLimitNone();
268 
270  m_LimitObject.Reset(&limit.x_GetInfo());
271  m_LimitTSE = limit.GetTSE_Handle();
272  return *this;
273 }
274 
275 
277 {
278  _ASSERT( tse );
279  SetResolveTSE();
280  SetLimitTSE(tse);
282  return *this;
283 }
284 
285 
287 {
288  _ASSERT( se );
289  return SetSearchExternal(se.GetTSE_Handle());
290 }
291 
292 
294 {
295  _ASSERT( seq );
296  return SetSearchExternal(seq.GetTSE_Handle());
297 }
298 
299 
300 namespace {
301  bool sx_HasWildcard(const CAnnotName& name, string* acc_ptr = 0)
302  {
303  if ( !name.IsNamed() ) {
304  return false;
305  }
306  const string& s = name.GetName();
307  if ( s.empty() || s.back() != '*' ) {
308  return false;
309  }
310  int zoom_level = 0;
311  return ExtractZoomLevel(s, acc_ptr, &zoom_level) && zoom_level == -1;
312  }
313 
314  template<class TNames, class TName>
315  inline bool sx_Has(const TNames& names, const TName& name)
316  {
317  return find(names.begin(), names.end(), name) != names.end();
318  }
319 
320  template<class TNames, class TName>
321  inline void sx_Add(TNames& names, const TName& name)
322  {
323  if ( !sx_Has(names, name) ) {
324  names.push_back(name);
325  }
326  }
327 
328  template<class TNames, class TName>
329  void sx_Del(TNames& names, const TName& name)
330  {
331  NON_CONST_ITERATE( typename TNames, it, names ) {
332  if ( *it == name ) {
333  names.erase(it);
334  break;
335  }
336  }
337  }
338 }
339 
340 
342 {
343  // check if there is a match to at least one name in 'included' list
344  string arg_acc;
345  int arg_level = 0;
346  if ( IsSetIncludedAnnotsNames() ) {
347  bool has_match = false;
348  string incl_acc;
349  for ( auto& n : m_IncludeAnnotsNames ) {
350  if ( name == n ) {
351  has_match = true;
352  break;
353  }
354  if ( name.IsNamed() && HasWildcardInAnnotsNames() && sx_HasWildcard(n, &incl_acc) ) {
355  // named annot may match by zoom_level wildcard
356  if ( arg_acc.empty() ) {
357  ExtractZoomLevel(name.GetName(), &arg_acc, &arg_level);
358  }
359  if ( incl_acc == arg_acc ) {
360  // same annot name -> matches wildcard
361  has_match = true;
362  break;
363  }
364  }
365  }
366  if ( !has_match ) {
367  // there is no match
368  return false;
369  }
370  }
371 
372  // check if NA zoom level matches
373  if ( name.IsNamed() && IsIncludedAnyNamedAnnotAccession() ) {
374  if ( arg_acc.empty() ) {
375  ExtractZoomLevel(name.GetName(), &arg_acc, &arg_level);
376  }
377 
379  if ( it != m_NamedAnnotAccessions->end() ) {
380  // annot accession is requested
381  int incl_level = it->second;
382  if ( incl_level != -1 && arg_level != incl_level ) {
383  // but with another zoom level
384  return false;
385  }
386  }
387  }
388 
389  // check if there is no match to 'excluded' list
390  if ( true ) {
391  string incl_acc;
392  for ( auto& n : m_ExcludeAnnotsNames ) {
393  if ( name == n ) {
394  // explicitly excluded
395  return false;
396  }
397  if ( name.IsNamed() && HasWildcardInAnnotsNames() && sx_HasWildcard(n, &incl_acc) ) {
398  // named annot may match by zoom_level wildcard
399  if ( arg_acc.empty() ) {
400  ExtractZoomLevel(name.GetName(), &arg_acc, &arg_level);
401  }
402  if ( incl_acc == arg_acc ) {
403  // same annot name -> matches wildcard -> excluded
404  return false;
405  }
406  }
407  }
408  }
409 
410  return true;
411 }
412 
413 
415 {
416  return !IncludedAnnotName(name);
417 }
418 
419 
421 {
423  return false;
424  }
425  for ( auto& n : m_IncludeAnnotsNames ) {
426  if ( !n.IsNamed() ) {
427  return false;
428  }
429  string acc;
430  ExtractZoomLevel(n.GetName(), &acc, 0);
431  if ( m_NamedAnnotAccessions->find(acc) == m_NamedAnnotAccessions->end() ) {
432  // annot name that's not a named annot accession
433  return false;
434  }
435  }
436  return true;
437 }
438 
439 
441 {
442  m_IncludeAnnotsNames.clear();
443  m_ExcludeAnnotsNames.clear();
445  return *this;
446 }
447 
448 namespace {
449  void vector_erase(vector<CAnnotName>& v, const CAnnotName& name)
450  {
451  v.erase(remove(v.begin(), v.end(), name), v.end());
452  }
453 }
454 
455 
457 {
458  vector_erase(m_IncludeAnnotsNames, name);
459  vector_erase(m_ExcludeAnnotsNames, name);
460  return *this;
461 }
462 
463 
465 {
466  return ResetNamedAnnots(CAnnotName(name));
467 }
468 
469 
471 {
472  return ResetNamedAnnots(CAnnotName());
473 }
474 
475 
477 {
478  if ( !HasWildcardInAnnotsNames() && sx_HasWildcard(name) ) {
480  }
481  sx_Add(m_IncludeAnnotsNames, name);
482  sx_Del(m_ExcludeAnnotsNames, name);
483  return *this;
484 }
485 
486 
488 {
489  return AddNamedAnnots(CAnnotName(name));
490 }
491 
492 
494 {
495  return AddNamedAnnots(CAnnotName());
496 }
497 
498 
500 {
501  if ( !HasWildcardInAnnotsNames() && sx_HasWildcard(name) ) {
503  }
504  sx_Add(m_ExcludeAnnotsNames, name);
505  sx_Del(m_IncludeAnnotsNames, name);
506  return *this;
507 }
508 
509 
511 {
512  return ExcludeNamedAnnots(CAnnotName(name));
513 }
514 
515 
517 {
518  return ExcludeNamedAnnots(CAnnotName());
519 }
520 
521 
523 {
526  return *this;
527 }
528 
529 
531 {
532  if ( source.empty() ) {
534  }
535  return AddNamedAnnots(source);
536 }
537 
538 
541 {
542  m_NamedAnnotAccessions.reset();
543  return *this;
544 }
545 
546 
549  int zoom_level)
550 {
551  if ( !m_NamedAnnotAccessions ) {
553  }
554  string acc_part;
555  int zoom_part;
556  if ( ExtractZoomLevel(acc, &acc_part, &zoom_part) ) {
557  if ( zoom_level != 0 && zoom_part != zoom_level ) {
558  NCBI_THROW_FMT(CAnnotException, eOtherError,
559  "SAnnotSelector::IncludeNamedAnnotAccession: "
560  "Incompatible zoom levels: "
561  <<acc<<" vs "<<zoom_level);
562  }
563  zoom_level = zoom_part;
564  }
565  (*m_NamedAnnotAccessions)[acc_part] = zoom_level;
566  return *this;
567 }
568 
569 
572 {
573  if ( m_NamedAnnotAccessions ) {
574  m_NamedAnnotAccessions->erase(acc);
575  if ( m_NamedAnnotAccessions->empty() ) {
576  m_NamedAnnotAccessions.reset();
577  }
578  }
579  return *this;
580 }
581 
582 
584 {
585  // The argument acc may contain version like "accession.123".
586  // In this case we also check if plain accession ("accession"),
587  // or all accesions ("accession.*") are included.
589  // no accessions are included at all
590  return false;
591  }
593  m_NamedAnnotAccessions->lower_bound(acc);
594  if ( it != m_NamedAnnotAccessions->end() && it->first == acc ) {
595  // direct match
596  return true;
597  }
598  SIZE_TYPE acc_size = acc.find('.');
599  if ( acc_size == NPOS ) {
600  // no version -> stop looking
601  return false;
602  }
603  CTempString acc_name(acc.data(), acc_size);
604  // find "accession" or "accession.*" which should be before iterator it
605  while ( it != m_NamedAnnotAccessions->begin() &&
606  NStr::StartsWith((--it)->first, acc_name) ) {
607  const string& tacc = it->first;
608  if ( tacc.size() == acc_size ) {
609  // plain accession ("accession")
610  return true;
611  }
612  if ( tacc.size() == acc_size+2 &&
613  tacc[acc_size] == '.' &&
614  tacc[acc_size+1] == '*' ) {
615  // all accessions ("accession.*")
616  return true;
617  }
618  }
619  // no more matching accessions
620  return false;
621 }
622 
623 
625 {
627  return *this;
628 }
629 
630 
631 NCBI_PARAM_DECL(bool, OBJMGR, ADAPTIVE_DEPTH_BY_NAMED_ACC);
632 NCBI_PARAM_DEF(bool, OBJMGR, ADAPTIVE_DEPTH_BY_NAMED_ACC, true);
633 
634 
635 static
637 
638 
640 {
642  if ( flags & fAdaptive_Default ) {
644  if ( !NCBI_PARAM_TYPE(OBJMGR, ADAPTIVE_DEPTH_BY_NAMED_ACC)::GetDefault() ) {
646  }
648  }
649  return flags;
650 }
651 
652 
654 {
656 }
657 
658 
661 {
664  return *this;
665 }
666 
667 
670 {
672  if ( *it == sel ) {
673  return *this;
674  }
675  }
676  m_AdaptiveTriggers.push_back(sel);
677  return *this;
678 }
679 
680 
683 {
684  if ( !ExcludedTSE(tse) ) {
685  m_ExcludedTSE.push_back(tse);
686  }
687  return *this;
688 }
689 
690 
693 {
694  return ExcludeTSE(tse.GetTSE_Handle());
695 }
696 
697 
700 {
701  m_ExcludedTSE.clear();
702  return *this;
703 }
704 
705 
707 {
708  return find(m_ExcludedTSE.begin(), m_ExcludedTSE.end(), tse)
709  != m_ExcludedTSE.end();
710 }
711 
712 
714 {
715  return ExcludedTSE(tse.GetTSE_Handle());
716 }
717 
718 
720 {
721  m_AnnotTypesBitset.reset();
722 }
723 
724 
726 {
727  if ( m_AnnotTypesBitset.any() ) {
728  return;
729  }
730  if ( default_value ) {
731  m_AnnotTypesBitset.set();
732  }
733  else {
734  m_AnnotTypesBitset.reset();
735  }
736  // Do not try to use flags from an uninitialized selector
738  // Copy current state to the set
741  for (size_t i = range.first; i < range.second; ++i) {
742  m_AnnotTypesBitset.set(i);
743  }
744  }
745 }
746 
747 
749 {
752  }
753  else if ( !IncludedAnnotType(type) ) {
757  for (size_t i = range.first; i < range.second; ++i) {
758  m_AnnotTypesBitset.set(i);
759  }
760  }
761  return *this;
762 }
763 
764 
766 {
768  || IncludedAnnotType(type)) {
772  for (size_t i = range.first; i < range.second; ++i) {
773  m_AnnotTypesBitset.reset(i);
774  }
775  }
776  return *this;
777 }
778 
779 
781 {
784  }
785  else if (!IncludedFeatType(type)) {
790  for (size_t i = range.first; i < range.second; ++i) {
791  m_AnnotTypesBitset.set(i);
792  }
793  }
794  return *this;
795 }
796 
797 
799 {
801  || IncludedFeatType(type)) {
806  for (size_t i = range.first; i < range.second; ++i) {
807  m_AnnotTypesBitset.reset(i);
808  }
809  }
810  return *this;
811 }
812 
813 
815 {
818  }
819  else if ( !IncludedFeatSubtype(subtype) ) {
823  }
824  return *this;
825 }
826 
827 
829 {
831  || IncludedFeatSubtype(subtype)) {
835  }
836  return *this;
837 }
838 
839 
841 {
843  // Remove all non-feature types from the list
844  if ( m_AnnotTypesBitset.any() ) {
847  for (size_t i = 0; i < range.first; ++i) {
848  m_AnnotTypesBitset.reset(i);
849  }
850  for (size_t i = range.second; i < m_AnnotTypesBitset.size(); ++i) {
851  m_AnnotTypesBitset.reset(i);
852  }
853  }
854  else {
856  }
857  }
858  else if ( type != CSeq_annot::C_Data::e_not_set ) {
859  // Force the type
861  }
862  return *this;
863 }
864 
865 
867 {
868  if ( m_AnnotTypesBitset.any() ) {
871  for (size_t i = range.first; i < range.second; ++i) {
872  if ( m_AnnotTypesBitset.test(i) ) {
873  return true;
874  }
875  }
876  return false;
877  }
879  || GetAnnotType() == type;
880 }
881 
882 
884 {
885  if ( m_AnnotTypesBitset.any() ) {
888  for (size_t i = range.first; i < range.second; ++i) {
889  if ( m_AnnotTypesBitset.test(i) ) {
890  return true;
891  }
892  }
893  return false;
894  }
895  // Make sure features are selected
899  GetFeatType() == type));
900 }
901 
902 
904 {
905  if ( m_AnnotTypesBitset.any() ) {
906  return m_AnnotTypesBitset
907  .test(CAnnotType_Index::GetSubtypeIndex(subtype));
908  }
909  // Make sure features are selected
913  subtype == CSeqFeatData::eSubtype_any ||
914  GetFeatSubtype() == subtype ||
917 }
918 
919 
920 bool SAnnotSelector::MatchType(const CAnnotObject_Info& annot_info) const
921 {
922  if (annot_info.GetFeatSubtype() != CSeqFeatData::eSubtype_any) {
923  return IncludedFeatSubtype(annot_info.GetFeatSubtype());
924  }
925  if (annot_info.GetFeatType() != CSeqFeatData::e_not_set) {
926  return IncludedFeatType(annot_info.GetFeatType());
927  }
928  return IncludedAnnotType(annot_info.GetAnnotType());
929 }
930 
931 
933 {
934  if ( !m_LimitObject ) {
936  }
937 }
938 
939 
941 {
943  m_SourceLoc->AddLocation(loc);
944  return *this;
945 }
946 
947 
949 {
950  m_SourceLoc.reset();
951  return *this;
952 }
953 
954 
956 {
957 }
958 
959 
960 /////////////////////////////////////////////////////////////////////////////
961 // Zoom level manipulation functions
962 /////////////////////////////////////////////////////////////////////////////
963 
964 
965 bool ExtractZoomLevel(const string& full_name,
966  string* acc_ptr, int* zoom_level_ptr)
967 {
968  return CSeq_annot::ExtractZoomLevel(full_name, acc_ptr, zoom_level_ptr);
969 }
970 
971 
972 string CombineWithZoomLevel(const string& acc, int zoom_level)
973 {
974  try {
975  return CSeq_annot::CombineWithZoomLevel(acc, zoom_level);
976  }
977  catch (CSeqAnnotException& ex) {
978  NCBI_THROW_FMT(CAnnotException, eOtherError, ex.GetMsg());
979  }
980 }
981 
982 
983 void AddZoomLevel(string& acc, int zoom_level)
984 {
985  try {
986  CSeq_annot::AddZoomLevel(acc, zoom_level);
987  }
988  catch (CSeqAnnotException& ex) {
989  NCBI_THROW_FMT(CAnnotException, eOtherError, ex.GetMsg());
990  }
991 }
992 
993 
NCBI_PARAM_DEF(bool, OBJMGR, ADAPTIVE_DEPTH_BY_NAMED_ACC, true)
NCBI_PARAM_DECL(bool, OBJMGR, ADAPTIVE_DEPTH_BY_NAMED_ACC)
static SAnnotSelector::TAdaptiveDepthFlags s_DefaultAdaptiveDepthFlags
Annotation iterators exceptions.
const string & GetName(void) const
Definition: annot_name.hpp:62
bool IsNamed(void) const
Definition: annot_name.hpp:58
TFeatSubtype GetFeatSubtype(void) const
TFeatType GetFeatType(void) const
TAnnotType GetAnnotType(void) const
pair< size_t, size_t > TIndexRange
static TIndexRange GetFeatTypeRange(CSeqFeatData::E_Choice type)
static size_t GetSubtypeIndex(CSeqFeatData::ESubtype subtype)
static TIndexRange GetIndexRange(const SAnnotTypeSelector &sel)
static TIndexRange GetAnnotTypeRange(CSeq_annot::C_Data::E_Choice type)
CBioseq_Handle –.
void AddLocation(const CSeq_loc &loc, ETransSplicing trans_splcing=eNoTransSplicing)
static E_Choice GetTypeFromSubtype(ESubtype subtype)
CSeq_annot_Handle –.
static string CombineWithZoomLevel(const string &acc, int zoom_level)
Combine accession string and zoom level into a string with separator.
Definition: Seq_annot.cpp:254
static void AddZoomLevel(string &acc, int zoom_level)
Definition: Seq_annot.cpp:262
static bool ExtractZoomLevel(const string &full_name, string *acc_ptr, int *zoom_level_ptr)
Extract optional zoom level suffix from named annotation string.
Definition: Seq_annot.cpp:215
CSeq_entry_Handle –.
void Reset(void)
Reset to null state.
Definition: tse_handle.cpp:106
const CTSE_Info & x_GetTSE_Info(void) const
Definition: tse_handle.cpp:116
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
container_type::const_iterator const_iterator
Definition: map.hpp:53
static uch flags
static const struct name_t names[]
#define false
Definition: bool.h:36
static void DLIST_NAME() remove(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:90
static int type
Definition: getdata.c:31
void reset(element_type *p=0, EOwnership ownership=eTakeOwnership)
Reset will delete the old pointer (if owned), set content to the new value, and assume the ownership ...
Definition: ncbimisc.hpp:480
#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
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
#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
const CTSE_Handle & GetTSE_Handle(void) const
Get CTSE_Handle of containing TSE.
const CTSE_Handle & GetTSE_Handle(void) const
const CTSE_Handle & GetTSE_Handle(void) const
const CSeq_entry_Info & x_GetInfo(void) const
const CSeq_annot_Info & x_GetInfo(void) const
vector< SAnnotTypeSelector > TAdaptiveTriggers
AutoPtr< CHandleRangeMap > m_SourceLoc
EResolveMethod m_ResolveMethod
SAnnotSelector(TAnnotType annot=CSeq_annot::C_Data::e_not_set, TFeatType feat=CSeqFeatData::e_not_set, bool feat_product=false)
SAnnotSelector & IncludeFeatSubtype(TFeatSubtype subtype)
Include feature subtype in the search.
SAnnotSelector & SetAdaptiveTrigger(const SAnnotTypeSelector &sel)
SetAdaptiveTrigger() allows to change default set of adaptive trigger annotations.
SAnnotSelector & SetResolveTSE(void)
SetResolveTSE() is equivalent to SetResolveMethod(eResolve_TSE).
SAnnotSelector & ExcludeFeatSubtype(TFeatSubtype subtype)
Exclude feature subtype from the search.
SAnnotSelector & operator=(const SAnnotSelector &sel)
CBioseq_Handle m_IgnoreFarLocationsForSorting
SAnnotSelector & ForceAnnotType(TAnnotType type)
Set annot type, include all subtypes.
SAnnotSelector & ResetUnnamedAnnots(void)
Reset special processing of unnamed annots (added or excluded)
SAnnotSelector & SetAllNamedAnnots(void)
Look for all named Seq-annots Resets the filter, and then excludes unnamed annots.
TTSE_Limits m_ExcludedTSE
TAdaptiveDepthFlags m_AdaptiveDepthFlags
SAnnotSelector & ExcludeFeatType(TFeatType type)
Exclude feature type from the search.
bool IsIncludedAnyNamedAnnotAccession(void) const
check if any named annot accession is included in the search
SAnnotSelector & ExcludeAnnotType(TAnnotType type)
Exclude annotation type from the search.
SAnnotSelector & SetSearchExternal(const CTSE_Handle &tse)
Set all flags for searching standard GenBank external annotations.
EUnresolvedFlag m_UnresolvedFlag
virtual ~IFeatComparator()
CConstRef< CObject > m_LimitObject
bool HasWildcardInAnnotsNames() const
void CheckLimitObjectType(void) const
SAnnotSelector & SetSourceLoc(const CSeq_loc &loc)
Set filter for source location of annotations.
bool IsIncludedNamedAnnotAccession(const string &acc) const
check if named annot accession is included in the search
SAnnotSelector & ResetAnnotsNames(void)
Select annotations from all Seq-annots.
SAnnotSelector & ExcludeTSE(const CTSE_Handle &tse)
SAnnotSelector & ResetNamedAnnots(const CAnnotName &name)
Reset special processing of named annots (added or excluded)
void x_InitializeAnnotTypesSet(bool default_value)
ELimitObject m_LimitObjectType
SAnnotSelector & SetLimitNone(void)
Remove restrictions on the parent object of annotations.
SAnnotSelector & SetDataSource(const string &name)
Look for named annot.
bool IncludedFeatSubtype(TFeatSubtype subtype) const
SAnnotSelector & SetAdaptiveDepth(bool value=true)
SetAdaptiveDepth() requests to restrict subsegment resolution depending on annotations found on lower...
TAnnotTypesBitset m_AnnotTypesBitset
bool ExcludedAnnotName(const CAnnotName &name) const
SAnnotSelector & SetAdaptiveDepthFlags(TAdaptiveDepthFlags flags)
SetAdaptiveDepthFlags() sets flags for adaptive depth heuristics.
string CombineWithZoomLevel(const string &acc, int zoom_level)
Combine accession string and zoom level into a string with separator.
SAnnotSelector & SetLimitSeqAnnot(const CSeq_annot_Handle &limit)
Limit annotations to those from the seq-annot only.
TMaxSearchTime m_MaxSearchTime
TAdaptiveTriggers m_AdaptiveTriggers
bool IncludedAnnotType(TAnnotType type) const
Return true if at least one subtype of the type is included or selected type is not set (any).
AutoPtr< TNamedAnnotAccessions > m_NamedAnnotAccessions
SAnnotSelector & IncludeNamedAnnotAccession(const string &acc, int zoom_level=0)
SAnnotSelector & SetSearchUnresolved(void)
ESortOrder m_SortOrder
SAnnotSelector & IncludeFeatType(TFeatType type)
Include feature type in the search.
void AddZoomLevel(string &acc, int zoom_level)
TMaxSearchSegments m_MaxSearchSegments
CTSE_Handle m_LimitTSE
EMaxSearchSegmentsAction m_MaxSearchSegmentsAction
SAnnotSelector & IncludeAnnotType(TAnnotType type)
Include annotation type in the search.
SAnnotSelector & SetAnnotType(TAnnotType type)
Set annotation type (feat, align, graph)
static TAdaptiveDepthFlags GetDefaultAdaptiveDepthFlags()
Get default set of adaptive depth flags.
SAnnotSelector & ResetExcludedTSE(void)
map< string, int > TNamedAnnotAccessions
TSNPScaleLimit m_SNPScaleLimit
bool IncludedAnnotName(const CAnnotName &name) const
bool HasIncludedOnlyNamedAnnotAccessions() const
bool m_ExcludeIfGeneIsSuppressed
static void SetDefaultAdaptiveDepthFlags(TAdaptiveDepthFlags flags)
Set default set of adaptive depth flags.
TBitFilter m_FilterMask
SAnnotSelector & AddNamedAnnots(const CAnnotName &name)
Add named annot to set of annots names to look for.
bool ExtractZoomLevel(const string &full_name, string *acc_ptr, int *zoom_level_ptr)
Extract optional zoom level suffix from named annotation string.
EOverlapType m_OverlapType
TBitFilter m_FilterBits
bool ExcludedTSE(const CTSE_Handle &tse) const
SAnnotSelector & ExcludeNamedAnnots(const CAnnotName &name)
Add named annot to set of annots names to exclude.
SAnnotSelector & SetLimitTSE(const CTSE_Handle &limit)
Limit annotations to those from the TSE only.
SAnnotSelector & ExcludeUnnamedAnnots(void)
Add unnamed annots to set of annots names to exclude.
bool m_HasWildcardInAnnotsNames
CIRef< IFeatComparator > m_FeatComparator
bool IsSetIncludedAnnotsNames(void) const
SAnnotSelector & ResetSourceLoc(void)
Reset filter for source location of annotations.
TAnnotsNames m_IncludeAnnotsNames
SAnnotSelector & AddUnnamedAnnots(void)
Add unnamed annots to set of annots names to look for.
SAnnotSelector & ExcludeNamedAnnotAccession(const string &acc)
bool MatchType(const CAnnotObject_Info &annot_info) const
Check if type of the annotation matches the selector.
SAnnotSelector & ResetNamedAnnotAccessions(void)
Add named annot accession (NA*) in the search.
TAnnotsNames m_ExcludeAnnotsNames
bool IncludedFeatType(TFeatType type) const
SAnnotSelector & SetLimitSeqEntry(const CSeq_entry_Handle &limit)
Limit annotations to those from the seq-entry only.
void x_ClearAnnotTypesSet(void)
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:1439
#define NCBI_PARAM_TYPE(section, name)
Generate typename for a parameter from its {section, name} attributes.
Definition: ncbi_param.hpp:149
#define numeric_limits
Pre-declaration of the "numeric_limits<>" template Forcibly overrides (using preprocessor) the origin...
Definition: ncbi_limits.hpp:92
#define kMax_Int
Definition: ncbi_limits.h:184
#define kMax_UInt
Definition: ncbi_limits.h:185
#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
NCBI_NS_STD::string::size_type SIZE_TYPE
Definition: ncbistr.hpp:132
#define NPOS
Definition: ncbistr.hpp:133
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5412
E_Choice
Choice variants.
@ e_not_set
No variant selected.
@ e_not_set
No variant selected.
Definition: Seq_annot_.hpp:132
int i
yy_size_t n
range(_Ty, _Ty) -> range< _Ty >
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
const CharType(& source)[N]
Definition: pointer.h:1149
T max(T x_, T y_)
SAnnotSelector –.
TFeatSubtype GetFeatSubtype(void) const
CSeq_annot::C_Data::E_Choice TAnnotType
TAnnotType GetAnnotType(void) const
TFeatType GetFeatType(void) const
void SetAnnotType(TAnnotType type)
void SetFeatType(TFeatType type)
void SetFeatSubtype(TFeatSubtype subtype)
Definition: type.c:6
#define _ASSERT
Modified on Wed Apr 24 14:20:13 2024 by modify_doxy.py rev. 669887