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

Go to the SVN repository for this file.

1 /* $Id: bioseq_handle.cpp 84799 2018-12-12 19:07:08Z 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 *
30 */
31 
32 #include <ncbi_pch.hpp>
33 #include <objmgr/bioseq_handle.hpp>
37 #include <objmgr/seq_vector.hpp>
38 #include <objmgr/bio_object_id.hpp>
39 
42 #include <objmgr/impl/tse_info.hpp>
47 #include <objmgr/impl/tse_info.hpp>
49 #include <objmgr/impl/synonyms.hpp>
51 
57 
58 #include <objects/seq/Bioseq.hpp>
60 #include <objects/seq/Seqdesc.hpp>
61 
62 #include <algorithm>
63 
64 
67 
68 /////////////////////////////////////////////////////////////////////////////
69 // CBioseq_Handle
70 /////////////////////////////////////////////////////////////////////////////
71 
73  const CBioseq_ScopeInfo& binfo)
74  : m_Handle_Seq_id(id),
75  m_Info(const_cast<CBioseq_ScopeInfo&>(binfo).GetLock(null))
76 {
77 }
78 
79 
81  const TLock& lock)
82  : m_Handle_Seq_id(id),
83  m_Info(lock)
84 {
85 }
86 
87 
89 {
90  m_Info.Reset();
92 }
93 
94 
96 {
97  if ( !m_Info ) {
98  return fState_no_data;
99  }
101  if ( m_Info->HasBioseq() ) {
103  }
104  if ( state == 0 && !*this ) {
106  }
107  return state;
108 }
109 
110 
112 {
113  return *m_Info;
114 }
115 
116 
118 {
119  return m_Info->GetObjectInfo();
120 }
121 
122 
124 {
125  return GetSeq_id_Handle().GetSeqIdOrNull();
126 }
127 
129 {
130  return GetAccessSeq_id_Handle().GetSeqId();
131 }
132 
134 {
135  return x_GetInfo().GetBioObjectId();
136 }
137 
139 {
140  return x_GetInfo().GetCompleteBioseq();
141 }
142 
143 
145 {
146  return x_GetInfo().GetBioseqCore();
147 }
148 
149 
151 {
152  return x_GetScopeImpl().GetEditHandle(*this);
153 }
154 
155 
156 /////////////////////////////////////////////////////////////////////////////
157 // Bioseq members
158 
159 bool CBioseq_Handle::IsSetId(void) const
160 {
161  return x_GetInfo().IsSetId();
162 }
163 
164 
165 bool CBioseq_Handle::CanGetId(void) const
166 {
167  return *this && x_GetInfo().CanGetId();
168 }
169 
170 
172 {
173  return x_GetInfo().GetId();
174 }
175 
176 
178 {
179  return x_GetInfo().IsSetDescr();
180 }
181 
182 
184 {
185  return *this && x_GetInfo().CanGetDescr();
186 }
187 
188 
190 {
191  return x_GetInfo().GetDescr();
192 }
193 
194 
196 {
197  return x_GetInfo().IsSetInst();
198 }
199 
200 
202 {
203  return *this && x_GetInfo().CanGetInst();
204 }
205 
206 
208 {
209  return x_GetInfo().GetInst();
210 }
211 
212 
214 {
215  return x_GetInfo().IsSetInst_Repr();
216 }
217 
218 
220 {
221  return *this && x_GetInfo().CanGetInst_Repr();
222 }
223 
224 
226 {
227  return x_GetInfo().GetInst_Repr();
228 }
229 
230 
232 {
233  return x_GetInfo().IsSetInst_Mol();
234 }
235 
236 
238 {
239  return *this && x_GetInfo().CanGetInst_Mol();
240 }
241 
242 
244 {
245  return x_GetInfo().GetInst_Mol();
246 }
247 
248 
250 {
251  return x_GetInfo().IsSetInst_Length();
252 }
253 
254 
256 {
257  return *this && x_GetInfo().CanGetInst_Length();
258 }
259 
260 
262 {
263  return x_GetInfo().GetInst_Length();
264 }
265 
266 
268 {
269  if ( IsSetInst_Length() ) {
270  return GetInst_Length();
271  }
272  else {
273  return GetSeqMap().GetLength(&GetScope());
274  }
275 }
276 
277 
279 {
280  return x_GetInfo().IsSetInst_Fuzz();
281 }
282 
283 
285 {
286  return *this && x_GetInfo().CanGetInst_Fuzz();
287 }
288 
289 
291 {
292  return x_GetInfo().GetInst_Fuzz();
293 }
294 
295 
297 {
298  return x_GetInfo().IsSetInst_Topology();
299 }
300 
301 
303 {
304  return *this && x_GetInfo().CanGetInst_Topology();
305 }
306 
307 
309 {
310  return x_GetInfo().GetInst_Topology();
311 }
312 
313 
315 {
316  return x_GetInfo().IsSetInst_Strand();
317 }
318 
319 
321 {
322  return *this && x_GetInfo().CanGetInst_Strand();
323 }
324 
325 
327 {
328  return x_GetInfo().GetInst_Strand();
329 }
330 
331 
333 {
334  return x_GetInfo().IsSetInst_Seq_data();
335 }
336 
337 
339 {
340  return *this && x_GetInfo().CanGetInst_Seq_data();
341 }
342 
343 
346 {
347  return x_GetInfo().GetInst_Seq_data();
348 }
349 
350 
352 {
353  return x_GetInfo().IsSetInst_Ext();
354 }
355 
356 
358 {
359  return *this && x_GetInfo().CanGetInst_Ext();
360 }
361 
362 
364 {
365  return x_GetInfo().GetInst_Ext();
366 }
367 
368 
370 {
371  return x_GetInfo().IsSetInst_Hist();
372 }
373 
374 
376 {
377  return *this && x_GetInfo().CanGetInst_Hist();
378 }
379 
380 
382 {
383  return x_GetInfo().GetInst_Hist();
384 }
385 
386 
388 {
389  return x_GetInfo().HasAnnots();
390 }
391 
392 
393 // end of Bioseq members
394 /////////////////////////////////////////////////////////////////////////////
395 
396 
398 {
399  return GetSequenceType();
400 }
401 
402 
403 bool CBioseq_Handle::IsNa(void) const
404 {
405  return IsNucleotide();
406 }
407 
408 
409 bool CBioseq_Handle::IsAa(void) const
410 {
411  return IsProtein();
412 }
413 
414 
416 {
417  return x_GetInfo().GetSeqMap();
418 }
419 
420 
422  size_t resolve_depth,
423  EFindSegment limit_flag) const
424 {
426  resolve_depth,
427  limit_flag);
428 }
429 
430 
432  size_t resolve_depth,
433  EFindSegment limit_flag) const
434 {
435  CConstRef<CSynonymsSet> syns = part.GetSynonyms();
436  if ( !syns ) {
437  return false;
438  }
439  SSeqMapSelector sel;
441  if ( limit_flag == eFindSegment_LimitTSE ) {
443  }
444  sel.SetResolveCount(resolve_depth);
445  CSeqMap_CI it = GetSeqMap().BeginResolved(&GetScope(), sel);
446  for ( ; it; ++it) {
447  if ( syns->ContainsSynonym(it.GetRefSeqid()) ) {
448  return true;
449  }
450  }
451  return false;
452 }
453 
454 
456  size_t resolve_depth,
457  EFindSegment limit_flag) const
458 {
461  if ( h ) {
462  syns = h.GetSynonyms();
463  }
464  SSeqMapSelector sel;
466  if ( limit_flag == eFindSegment_LimitTSE ) {
468  }
469  sel.SetResolveCount(resolve_depth);
470  CSeqMap_CI it = GetSeqMap().BeginResolved(&GetScope(), sel);
471  for ( ; it; ++it) {
472  if ( syns ) {
473  if ( syns->ContainsSynonym(it.GetRefSeqid()) ) {
474  return true;
475  }
476  }
477  else {
478  if (it.GetRefSeqid() == id) {
479  return true;
480  }
481  }
482  }
483  return false;
484 }
485 
486 
488  ENa_strand strand) const
489 {
490  return CSeqVector(*this, coding, strand);
491 }
492 
493 
495 {
496  return CSeqVector(*this, eCoding_Ncbi, strand);
497 }
498 
499 
501  EVectorStrand strand) const
502 {
503  return CSeqVector(*this, coding,
504  strand == eStrand_Minus?
506 }
507 
508 
510 {
511  return CSeqVector(*this, eCoding_Ncbi,
512  strand == eStrand_Minus?
514 }
515 
516 
518 {
519  if ( !*this ) {
520  return CConstRef<CSynonymsSet>();
521  }
522  return GetScope().GetSynonyms(*this);
523 }
524 
525 
526 bool CBioseq_Handle::IsSynonym(const CSeq_id& id) const
527 {
529 }
530 
531 
533 {
535  return syns && syns->ContainsSynonym(idh);
536 }
537 
538 
540 {
542 }
543 
544 
546 {
547  CSeq_entry_Handle ret;
548  if ( *this ) {
549  ret = CSeq_entry_Handle(x_GetInfo().GetParentSeq_entry_Info(),
550  GetTSE_Handle());
551  }
552  return ret;
553 }
554 
555 
557 {
558  return GetParentEntry();
559 }
560 
561 
563 {
564  CBioseq_set_Handle ret;
565  const CBioseq_Info& info = x_GetInfo();
566  if ( info.HasParent_Info() ) {
567  const CSeq_entry_Info& entry = info.GetParentSeq_entry_Info();
568  if ( entry.HasParent_Info() ) {
570  GetTSE_Handle());
571  }
572  }
573  return ret;
574 }
575 
576 
579 {
582  const int ctab_size = sizeof(ctab) / sizeof(ctab[0]);
583  if (cls == CBioseq_set::eClass_other) {
584  // adjust 255 to the correct value
585  cls = CBioseq_set::EClass(ctab_size - 1);
586  }
588  _ASSERT(last && last.IsSeq());
589  CSeq_entry_Handle e = last.GetParentEntry();
590  while ( e ) {
591  _ASSERT(e.IsSet());
592  _ASSERT(cls < ctab_size);
593  _ASSERT(!last.IsSet() || last.GetSet().GetClass() < ctab_size);
594  _ASSERT(e.GetSet().GetClass() < ctab_size);
595  // Found good level
596  if ( last.IsSet() &&
597  ctab[last.GetSet().GetClass()] == ctab[cls] )
598  break;
599  // Gone too high
600  if ( ctab[e.GetSet().GetClass()] > ctab[cls] ) {
601  break;
602  }
603  // Go up one level
604  last = e;
605  e = e.GetParentEntry();
606  }
607  return last;
608 }
609 
610 
613 {
615  if ( ret &&
616  (!ret.IsSet() || !ret.GetSet().IsSetClass() ||
617  ret.GetSet().GetClass() != cls) ) {
618  ret.Reset();
619  }
620  return ret;
621 }
622 
623 
625 {
627  return mapper.Map(loc);
628 }
629 
630 
633  int index) const
634 {
635  return entry.CopyBioseq(*this, index);
636 }
637 
638 
641  int index) const
642 {
643  return seqset.CopyBioseq(*this, index);
644 }
645 
646 
649 {
650  return entry.CopySeq(*this);
651 }
652 
653 
654 /////////////////////////////////////////////////////////////////////////////
655 // CBioseq_EditHandle
656 /////////////////////////////////////////////////////////////////////////////
657 
659 {
660 }
661 
662 
664  : CBioseq_Handle(h)
665 {
666  if ( !h.GetTSE_Handle().CanBeEdited() ) {
667  NCBI_THROW(CObjMgrException, eInvalidHandle,
668  "object is not in editing mode");
669  }
670 }
671 
672 
674  CBioseq_ScopeInfo& binfo)
675  : CBioseq_Handle(id, binfo)
676 {
677 }
678 
679 
681  const TLock& lock)
682  : CBioseq_Handle(id, lock)
683 {
684 }
685 
686 
688 {
690  if ( *this ) {
691  ret = CSeq_entry_EditHandle(x_GetInfo().GetParentSeq_entry_Info(),
692  GetTSE_Handle());
693  }
694  return ret;
695 }
696 
697 
700 {
701  return GetParentEntry().AttachAnnot(annot);
702 }
703 
704 
707 {
708  return GetParentEntry().CopyAnnot(annot);
709 }
710 
711 
714 {
715  return GetParentEntry().TakeAnnot(annot);
716 }
717 
718 
721  int index) const
722 {
723  return entry.TakeBioseq(*this, index);
724 }
725 
726 
729  int index) const
730 {
731  return seqset.TakeBioseq(*this, index);
732 }
733 
734 
737 {
738  return entry.TakeSeq(*this);
739 }
740 
742 {
743  if (mode == eKeepSeq_entry)
744  x_Detach();
745  else {
746  CRef<IScopeTransaction_Impl> tr(x_GetScopeImpl().CreateTransaction());
748  x_Detach();
749  parent.Remove();
750  tr->Commit();
751  }
752 }
753 
755 {
756  typedef CRemoveBioseq_EditCommand TCommand;
757  CCommandProcessor processor(x_GetScopeImpl());
758  processor.run(new TCommand(*this, x_GetScopeImpl()));
759  // x_GetScopeImpl().RemoveBioseq(*this);
760 }
761 
762 
763 /////////////////////////////////////////////////////////////////////////////
764 // Bioseq members
765 
767 {
769  CCommandProcessor processor(x_GetScopeImpl());
770  processor.run(new CResetIds_EditCommand(*this));
771 }
772 
773 
775 {
777  CCommandProcessor processor(x_GetScopeImpl());
778  return processor.run(new CAddId_EditCommand(*this,id));
779 }
780 
781 
783 {
785  CCommandProcessor processor(x_GetScopeImpl());
786  return processor.run(new CRemoveId_EditCommand(*this,id));
787 }
788 
789 
791 {
793  CCommandProcessor processor(x_GetScopeImpl());
794  processor.run(new TCommand(*this));
795 }
796 
797 
799 {
801  CCommandProcessor processor(x_GetScopeImpl());
802  processor.run(new TCommand(*this, v));
803 }
804 
805 
807 {
808  if (x_GetScopeImpl().IsTransactionActive()
809  || GetTSE_Handle().x_GetTSE_Info().GetEditSaver() ) {
810  NCBI_THROW(CObjMgrException, eTransaction,
811  "TDescr& CBioseq_EditHandle::SetDescr(): "
812  "method can not be called if a transaction is required");
813  }
814  return x_GetInfo().SetDescr();
815 }
816 
817 
819 {
821  CCommandProcessor processor(x_GetScopeImpl());
822  return processor.run(new TCommand(*this, d));
823 }
824 
825 
827 {
829  CCommandProcessor processor(x_GetScopeImpl());
830  return processor.run(new TCommand(*this, d));
831 }
832 
833 
835 {
836  return x_RealReplaceSeqdesc(old_desc, new_desc);
837 }
838 
839 
841 {
843  CCommandProcessor processor(x_GetScopeImpl());
844  processor.run(new TCommand(*this, v));
845  // x_GetInfo().AddSeq_descr(v);
846 }
847 
848 
850 {
851  typedef CSet_SeqInst_EditCommand TCommand;
852  CCommandProcessor processor(x_GetScopeImpl());
853  processor.run(new TCommand(*this, v));
854  // x_GetInfo().SetInst(v);
855 }
856 
857 
859 {
860  typedef CSet_SeqInstRepr_EditCommand TCommand;
861  CCommandProcessor processor(x_GetScopeImpl());
862  processor.run(new TCommand(*this, v));
863  // x_GetInfo().SetInst_Repr(v);
864 }
865 
866 
868 {
869  typedef CSet_SeqInstMol_EditCommand TCommand;
870  CCommandProcessor processor(x_GetScopeImpl());
871  processor.run(new TCommand(*this, v));
872  // x_GetInfo().SetInst_Mol(v);
873 }
874 
875 
877 {
878  typedef CSet_SeqInstLength_EditCommand TCommand;
879  CCommandProcessor processor(x_GetScopeImpl());
880  processor.run(new TCommand(*this, v));
881  // x_GetInfo().SetInst_Length(v);
882 }
883 
884 
886 {
887  typedef CSet_SeqInstFuzz_EditCommand TCommand;
888  CCommandProcessor processor(x_GetScopeImpl());
889  processor.run(new TCommand(*this, v));
890  // x_GetInfo().SetInst_Fuzz(v);
891 }
892 
893 
895 {
896  typedef CSet_SeqInstTopology_EditCommand TCommand;
897  CCommandProcessor processor(x_GetScopeImpl());
898  processor.run(new TCommand(*this, v));
899  // x_GetInfo().SetInst_Topology(v);
900 }
901 
902 
904 {
905  typedef CSet_SeqInstStrand_EditCommand TCommand;
906  CCommandProcessor processor(x_GetScopeImpl());
907  processor.run(new TCommand(*this, v));
908  // x_GetInfo().SetInst_Strand(v);
909 }
910 
911 
913 {
914  typedef CSet_SeqInstSeq_data_EditCommand TCommand;
915  CCommandProcessor processor(x_GetScopeImpl());
916  processor.run(new TCommand(*this, v));
917  // x_GetInfo().SetInst_Seq_data(v);
918 }
919 
920 
922 {
923  typedef CSet_SeqInstExt_EditCommand TCommand;
924  CCommandProcessor processor(x_GetScopeImpl());
925  processor.run(new TCommand(*this, v));
926  // x_GetInfo().SetInst_Ext(v);
927 }
928 
929 
931 {
932  typedef CSet_SeqInstHist_EditCommand TCommand;
933  CCommandProcessor processor(x_GetScopeImpl());
934  processor.run(new TCommand(*this, v));
935  // x_GetInfo().SetInst_Hist(v);
936 }
937 
938 
940 {
942  // First try original id
943  if ( id ) {
944  return id;
945  }
946  // Then try to find gi
947  ITERATE ( TId, it, GetId() ) {
948  if ( it->IsGi() ) {
949  CBioseq_Handle bh =
951  if ( bh == *this ) {
952  id = *it;
953  _ASSERT(id);
954  return id;
955  }
956  }
957  }
958  // Then try to find accession
959  ITERATE ( TId, it, GetId() ) {
960  if ( !it->IsGi() && it->GetSeqId()->GetTextseq_Id() ) {
961  CBioseq_Handle bh =
963  if ( bh == *this ) {
964  id = *it;
965  _ASSERT(id);
966  return id;
967  }
968  }
969  }
970  // Then try to find any other id
971  ITERATE ( TId, it, GetId() ) {
972  if ( !it->IsGi() && !it->GetSeqId()->GetTextseq_Id() ) {
973  CBioseq_Handle bh =
975  if ( bh == *this ) {
976  id = *it;
977  _ASSERT(id);
978  return id;
979  }
980  }
981  }
982  NCBI_THROW(CObjMgrException, eOtherError,
983  "CBioseq_Handle::GetAccessSeq_id_Handle "
984  "can not find seq-id to access this bioseq");
985 }
986 
987 
989  TSeqPos stop,
990  ENa_strand strand) const
991 {
993  CRef<CSeq_id> id(new CSeq_id);
994  id->Assign(*orig_id.GetSeqId());
995  CRef<CSeq_loc> res(new CSeq_loc);
996  if (start == 0 && stop == 0) {
997  if ( strand == eNa_strand_unknown ) {
998  res->SetWhole(*id);
999  }
1000  else {
1001  CRef<CSeq_interval> interval
1002  (new CSeq_interval(*id, 0, GetBioseqLength()-1, strand));
1003  res->SetInt(*interval);
1004  }
1005  }
1006  else {
1007  CRef<CSeq_interval> interval(new CSeq_interval
1008  (*id, start, stop, strand));
1009  res->SetInt(*interval);
1010  }
1011  return res;
1012 }
1013 
1014 
1016 {
1017  return GetTSE_Handle().AddUsedTSE(bh.GetTSE_Handle());
1018 }
1019 
1020 
1021 ///////////////////////////////////////////////////////////////////////////////
1023 {
1024  x_GetInfo().ResetDescr();
1025 }
1026 
1027 
1029 {
1030  x_GetInfo().SetDescr(v);
1031 }
1032 
1033 
1035 {
1036  return x_GetInfo().AddSeqdesc(d);
1037 }
1038 
1039 
1041 {
1042  return x_GetInfo().RemoveSeqdesc(d);
1043 }
1044 
1045 
1047 {
1048  return x_GetInfo().ReplaceSeqdesc(old_desc, new_desc);
1049 }
1050 
1051 
1053 {
1054  x_GetInfo().AddSeq_descr(v);
1055 }
1056 
1058 {
1059  x_GetScopeInfo().ResetId();
1060 }
1061 
1062 
1064 {
1065  return x_GetScopeInfo().AddId(id);
1066 }
1067 
1069 {
1070  return x_GetScopeInfo().RemoveId(id);
1071 }
1072 
1073 
1075 {
1076  x_GetInfo().SetInst(v);
1077 }
1078 
1079 
1081 {
1082  x_GetInfo().SetInst_Repr(v);
1083 }
1084 
1085 
1087 {
1088  x_GetInfo().SetInst_Mol(v);
1089 }
1090 
1091 
1093 {
1095 }
1096 
1097 
1099 {
1100  x_GetInfo().SetInst_Fuzz(v);
1101 }
1102 
1103 
1105 {
1107 }
1108 
1109 
1111 {
1113 }
1114 
1115 
1117 {
1119 }
1120 
1121 
1123 {
1124  x_GetInfo().SetInst_Ext(v);
1125 }
1126 
1127 
1129 {
1130  x_GetInfo().SetInst_Hist(v);
1131 }
1133 {
1134  x_GetInfo().ResetInst();
1135 }
1137 {
1139 }
1141 {
1143 }
1145 {
1147 }
1149 {
1151 }
1153 {
1155 }
1157 {
1159 }
1161 {
1163 }
1165 {
1167 }
1169 {
1171 }
1172 
1173 
1175 {
1176  return const_cast<CSeqMap&>(GetSeqMap());
1177 }
1178 
1179 
1182 {
1184 }
1185 
1186 
1189 {
1191 }
1192 
1193 
1194 // end of Bioseq members
1195 /////////////////////////////////////////////////////////////////////////////
1196 
1197 
CId_EditCommand< true > CAddId_EditCommand
CId_EditCommand< false > CRemoveId_EditCommand
bool IsSetDescr(void) const
bool HasAnnots(void) const
CRef< CSeqdesc > RemoveSeqdesc(const CSeqdesc &d)
CRef< CSeqdesc > ReplaceSeqdesc(const CSeqdesc &old_desc, CSeqdesc &new_desc)
const TDescr & GetDescr(void) const
void AddSeq_descr(const TDescr &v)
bool AddSeqdesc(CSeqdesc &d)
TDescr & SetDescr(void)
bool CanGetDescr(void) const
CBioseq_EditHandle –.
CBioseq_Handle –.
bool CanGetId(void) const
TInst_Mol GetInst_Mol(void) const
const TInst_Fuzz & GetInst_Fuzz(void) const
bool CanGetInst_Hist(void) const
bool IsSetInst_Fuzz(void) const
bool CanGetInst_Strand(void) const
void ResetInst_Ext()
void ResetInst_Length()
void SetInst_Length(TInst_Length v)
bool CanGetInst_Seq_data(void) const
TInst_Topology GetInst_Topology(void) const
bool CanGetInst_Repr(void) const
TInst_Repr GetInst_Repr(void) const
bool CanGetInst(void) const
void ResetInst_Fuzz()
const CSeqMap & GetSeqMap(void) const
bool IsSetInst_Ext(void) const
bool IsSetInst_Seq_data(void) const
bool IsSetInst_Topology(void) const
void SetInst_Seq_data(TInst_Seq_data &v)
const TId & GetId(void) const
void SetInst_Mol(TInst_Mol v)
const TInst_Seq_data & GetInst_Seq_data(void) const
bool IsSetInst_Strand(void) const
CConstRef< TObject > GetCompleteBioseq(void) const
void ResetInst_Mol()
void SetInst_Topology(TInst_Topology v)
void SetInst_Ext(TInst_Ext &v)
void SetInst_Hist(TInst_Hist &v)
void SetInst_Strand(TInst_Strand v)
bool IsSetId(void) const
const TInst_Hist & GetInst_Hist(void) const
TInst_Length GetInst_Length(void) const
bool IsSetInst_Repr(void) const
bool IsSetInst_Mol(void) const
void SetInst_Repr(TInst_Repr v)
void ResetInst()
bool CanGetInst_Mol(void) const
bool IsSetInst_Hist(void) const
void ResetInst_Seq_data()
bool CanGetInst_Topology(void) const
void ResetInst_Topology()
void SetInst(TInst &v)
void ResetInst_Repr()
bool CanGetInst_Length(void) const
void ResetInst_Strand()
CConstRef< TObject > GetBioseqCore(void) const
bool IsSetInst_Length(void) const
TInst_Strand GetInst_Strand(void) const
const TInst_Ext & GetInst_Ext(void) const
const TInst & GetInst(void) const
bool IsSetInst(void) const
bool CanGetInst_Fuzz(void) const
void SetInst_Fuzz(TInst_Fuzz &v)
void ResetInst_Hist()
bool CanGetInst_Ext(void) const
TBlobStateFlags GetBlobState(void) const
Definition: scope_info.hpp:576
bool HasBioseq(void) const
bool AddId(const CSeq_id_Handle &id)
void ResetId(void)
bool RemoveId(const CSeq_id_Handle &id)
const CBioseq_Info & GetObjectInfo(void) const
Definition: scope_info.hpp:553
CBioseq_set_EditHandle –.
CBioseq_set_Handle –.
CMDReturn< CMD >::TReturn run(CMD *cmd)
Base class for all object manager exceptions.
const CTSE_Handle & GetTSE_Handle(void) const
Definition: tse_handle.hpp:445
void Reset(void)
Definition: tse_handle.hpp:654
CTSE_Handle GetEditHandle(const CTSE_Handle &src_tse)
Iterator over CSeqMap.
Definition: seq_map_ci.hpp:252
CSeqMap –.
Definition: seq_map.hpp:93
CSeqVector –.
Definition: seq_vector.hpp:65
CSeq_annot_Handle –.
@Seq_descr.hpp User-defined methods of the data storage class.
Definition: Seq_descr.hpp:55
CSeq_entry_Handle –.
CSeq_entry_Handle –.
const CBioseq_set_Info & GetParentBioseq_set_Info(void) const
CSeq_ext –.
Definition: Seq_ext.hpp:66
CSeq_hist –.
Definition: Seq_hist.hpp:66
CSeq_loc_Mapper –.
bool AddUsedTSE(const CTSE_Handle &tse) const
Register argument TSE as used by this TSE, so it will be released by scope only after this TSE is rel...
Definition: tse_handle.cpp:223
bool CanBeEdited(void) const
Return true if this TSE handle is local to scope and can be edited.
Definition: tse_handle.cpp:229
const CTSE_Info & x_GetTSE_Info(void) const
Definition: tse_handle.cpp:116
bool HasParent_Info(void) const
virtual const CBioObjectId & GetBioObjectId(void) const
TBlobState GetBlobState(void) const
Definition: tse_info.hpp:834
virtual void Commit()=0
IEditSaver * GetEditSaver(const Handle &handle)
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:51
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
@ null
Definition: ncbimisc.hpp:646
#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
CConstRef< CSeq_id > GetSeqId(void) const
void Reset(void)
Reset the handle (remove seq-id reference)
CConstRef< CSeq_id > GetSeqIdOrNull(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
void SetWhole(TWhole &v)
Definition: Seq_loc.hpp:982
void SetInt(TInt &v)
Definition: Seq_loc.hpp:983
CBioseq_Handle GetBioseqHandleFromTSE(const CSeq_id &id, const CTSE_Handle &tse)
Get bioseq handle for sequence withing one TSE.
Definition: scope.cpp:253
CRef< CSeq_loc > Map(const CSeq_loc &src_loc)
Map seq-loc.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
CConstRef< CSynonymsSet > GetSynonyms(const CSeq_id &id)
Get bioseq synonyms, resolving to the bioseq in this scope.
Definition: scope.cpp:486
@ eSeqMap_Up
map from segments to the top level bioseq
vector< CSeq_id_Handle > TId
void x_RealResetId(void) const
CSeq_entry_Handle GetComplexityLevel(CBioseq_set::EClass cls) const
Go up to a certain complexity level (or the nearest level of the same priority if the required class ...
void x_RealResetInst_Strand() const
bool IsSetInst_Strand(void) const
bool IsSetInst_Mol(void) const
void x_RealSetInst_Ext(TInst_Ext &v) const
void x_RealResetInst_Ext() const
bool CanGetInst_Repr(void) const
bool IsSetInst_Fuzz(void) const
bool IsNucleotide(void) const
EFeatureFetchPolicy GetFeatureFetchPolicy(void) const
bool AddId(const CSeq_id_Handle &id) const
const CTSE_Handle & GetTSE_Handle(void) const
Get CTSE_Handle of containing TSE.
bool IsSetInst_Seq_data(void) const
const TInst_Hist & GetInst_Hist(void) const
void x_RealResetInst_Topology() const
void x_Detach(void) const
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
TClass GetClass(void) const
const TInst_Ext & GetInst_Ext(void) const
TBioseqStateFlags GetState(void) const
Get state of the bioseq.
CSeq_annot_EditHandle TakeAnnot(const CSeq_annot_EditHandle &annot) const
Remove the annotation from its location and attach to current one.
CBioseq_set_Handle GetParentBioseq_set(void) const
Return a handle for the parent Bioseq-set, or null handle.
void x_RealSetInst_Fuzz(TInst_Fuzz &v) const
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
TBioseqCore GetBioseqCore(void) const
Get bioseq core structure.
CConstRef< CSeq_id > GetInitialSeqIdOrNull(void) const
Get id used to obtain this bioseq handle.
bool IsSetInst_Hist(void) const
CBioseq_EditHandle MoveTo(const CSeq_entry_EditHandle &entry, int index=-1) const
Move current bioseq into seq-entry.
bool IsSetInst_Ext(void) const
void x_RealResetInst() const
CBioseq_EditHandle CopyToSeq(const CSeq_entry_EditHandle &entry) const
Copy current bioseq into seq-entry and set seq-entry as bioseq.
EFindSegment
Segment search flags.
CRef< CSeqdesc > x_RealRemoveSeqdesc(const CSeqdesc &d) const
CScope_Impl & x_GetScopeImpl(void) const
void SetInst_Mol(TInst_Mol v) const
void x_RealResetDescr(void) const
CBioseq_Info & x_GetInfo(void) const
CSeq_id_Handle GetAccessSeq_id_Handle(void) const
Get any CSeq_id_Handle handle that can be used to access this bioseq Use GetSeq_id_Handle() if it's n...
static const TComplexityTable & sx_GetComplexityTable(void)
bool CanGetInst(void) const
void SetInst_Seq_data(TInst_Seq_data &v) const
TSeqPos GetBioseqLength(void) const
TInst::TLength TInst_Length
TSet GetSet(void) const
bool x_RealAddSeqdesc(CSeqdesc &d) const
bool IsAa(void) const
void Remove(void) const
Remove this Seq-entry from parent, or scope if it's top level Seq-entry.
const CSeq_id_Handle & GetSeq_id_Handle(void) const
Get handle of id used to obtain this bioseq handle.
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
CSeq_annot_EditHandle AttachAnnot(CSeq_annot &annot) const
Attach an annotation.
void x_RealResetInst_Hist() const
void SetInst_Length(TInst_Length v) const
void x_RealResetInst_Fuzz() const
bool AddUsedBioseq(const CBioseq_Handle &bh) const
Register argument bioseq as used by this bioseq, so it will be released by scope only after this bios...
TInst_Mol GetInst_Mol(void) const
bool CanGetInst_Length(void) const
void x_RealSetInst_Strand(TInst_Strand v) const
bool HasAnnots(void) const
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
const CBioseq_ScopeInfo & x_GetScopeInfo(void) const
EFeatureFetchPolicy
Feature fetch policy describes when to look for features on sequence segments.
void x_RealSetInst_Repr(TInst_Repr v) const
void SetInst(TInst &v) const
void x_RealSetDescr(TDescr &v) const
void Remove(ERemoveMode mode=eRemoveSeq_entry) const
CRef< CSeqdesc > ReplaceSeqdesc(const CSeqdesc &old_desc, CSeqdesc &new_desc) const
TInst_Strand GetInst_Strand(void) const
bool x_RealAddId(const CSeq_id_Handle &id) const
bool IsSetInst_Length(void) const
EVectorCoding
CSeqVector constructor flags.
bool CanGetInst_Hist(void) const
CSeq_annot_EditHandle AttachAnnot(CSeq_annot &annot) const
Attach an annotation.
bool IsProtein(void) const
CSeq_id_Handle m_Handle_Seq_id
bool RemoveId(const CSeq_id_Handle &id) const
void SetInst_Repr(TInst_Repr v) const
CBioseq_EditHandle TakeBioseq(const CBioseq_EditHandle &seq, int index=-1) const
Remove bioseq from its location and attach to current one.
TInst_Topology GetInst_Topology(void) const
CBioseq_EditHandle CopyBioseq(const CBioseq_Handle &seq, int index=-1) const
Attach a copy of the bioseq.
bool CanGetInst_Strand(void) const
CSeq_annot_EditHandle CopyAnnot(const CSeq_annot_Handle &annot) const
Attach a copy of the annotation.
const TDescr & GetDescr(void) const
CBioseq_EditHandle CopyTo(const CSeq_entry_EditHandle &entry, int index=-1) const
Copy current bioseq into seq-entry.
CBioseq_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
TInst_Length GetInst_Length(void) const
void x_RealResetInst_Mol() const
void x_RealSetInst(TInst &v) const
CBioseq_EditHandle CopyBioseq(const CBioseq_Handle &seq, int index=-1) const
Attach a copy of the existing bioseq.
TSeq CopySeq(const CBioseq_Handle &seq) const
Make the empty Seq-entry be in seq state with specified Bioseq object.
bool IsSetInst(void) const
void Reset(void)
Reset handle and make it not to point to any bioseq.
bool IsSetInst_Repr(void) const
bool ContainsSegment(const CSeq_id &id, size_t resolve_depth=kMax_Int, EFindSegment limit_flag=eFindSegment_NoLimit) const
Check if the seq-id describes a segment of the bioseq.
bool CanGetInst_Topology(void) const
bool IsSetClass(void) const
bool AddSeqdesc(CSeqdesc &d) const
bool CanGetInst_Fuzz(void) const
TMol GetSequenceType(void) const
TInst_Repr GetInst_Repr(void) const
CRef< CSeqdesc > RemoveSeqdesc(const CSeqdesc &d) const
void x_RealSetInst_Mol(TInst_Mol v) const
void x_RealSetInst_Hist(TInst_Hist &v) const
const CBioObjectId & GetBioObjectId(void) const
Get unique object id.
void x_RealAddSeq_descr(TDescr &v) const
CSeqMap & SetSeqMap(void) const
Get CSeqMap object for sequence editing.
CBioseq_EditHandle TakeBioseq(const CBioseq_EditHandle &seq, int index=-1) const
Remove bioseq from its location and attach to current one.
const TInst_Seq_data & GetInst_Seq_data(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
void SetInst_Strand(TInst_Strand v) const
ERemoveMode
Remove current bioseq from its location.
const CBioseq_Info & x_GetInfo(void) const
void x_RealSetInst_Seq_data(TInst_Seq_data &v) const
bool CanGetId(void) const
void x_RealResetInst_Repr() const
void SetInst_Hist(TInst_Hist &v) const
CSeq_entry_Handle GetExactComplexityLevel(CBioseq_set::EClass cls) const
Return level with exact complexity, or empty handle if not found.
bool IsSet(void) const
void x_RealResetInst_Length() const
void SetInst_Ext(TInst_Ext &v) const
void AddSeq_descr(TDescr &v) const
void ResetDescr(void) const
CSeq_annot_EditHandle TakeAnnot(const CSeq_annot_EditHandle &annot) const
Remove the annotation from its location and attach to current one.
const CSeqMap & GetSeqMap(void) const
Get sequence map.
bool IsSetDescr(void) const
void ResetId(void) const
bool IsSetId(void) const
CRef< CSeq_loc > GetRangeSeq_loc(TSeqPos start, TSeqPos stop, ENa_strand strand=eNa_strand_unknown) const
Return CSeq_loc referencing the given range and strand on the bioseq If start == 0,...
friend class CSeq_entry_EditHandle
void SetInst_Fuzz(TInst_Fuzz &v) const
bool IsNa(void) const
ESequenceClass GetSequenceClass(void) const
CBioseq_ScopeInfo & x_GetScopeInfo(void) const
void x_RealSetInst_Topology(TInst_Topology v) const
void Reset(void)
Reset handle and make it not to point to any seq-entry.
bool IsSetInst_Topology(void) const
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
TDescr & SetDescr(void) const
CSeq_annot_EditHandle CopyAnnot(const CSeq_annot_Handle &annot) const
Attach a copy of the annotation.
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
const TId & GetId(void) const
void SetInst_Topology(TInst_Topology v) const
CBioseq_EditHandle MoveToSeq(const CSeq_entry_EditHandle &entry) const
Move current bioseq into seq-entry and set seq-entry as bioseq.
bool CanGetInst_Seq_data(void) const
TSeq TakeSeq(const TSeq &seq) const
Make the empty Seq-entry be in seq state with moving bioseq object from the argument seq.
CRef< CSeq_loc > MapLocation(const CSeq_loc &loc) const
Map a seq-loc from the bioseq's segment to the bioseq.
CSeq_entry_EditHandle GetParentEntry(void) const
Navigate object tree.
bool x_RealRemoveId(const CSeq_id_Handle &id) const
void x_RealSetInst_Length(TInst_Length v) const
CConstRef< CSynonymsSet > GetSynonyms(void) const
Get the bioseq's synonyms.
CRef< CSeqdesc > x_RealReplaceSeqdesc(const CSeqdesc &old_desc, CSeqdesc &new_desc) const
bool CanGetInst_Ext(void) const
bool IsSynonym(const CSeq_id &id) const
Check if this id can be used to obtain this bioseq handle.
TMol GetBioseqMolType(void) const
Get some values from core:
CSeqVector GetSeqVector(EVectorCoding coding, ENa_strand strand=eNa_strand_plus) const
Get sequence: Iupacna or Iupacaa if use_iupac_coding is true.
void x_RealResetInst_Seq_data() const
bool CanGetDescr(void) const
const TInst_Fuzz & GetInst_Fuzz(void) const
bool CanGetInst_Mol(void) const
const TInst & GetInst(void) const
@ eFindSegment_LimitTSE
Resolve in the parent TSE only.
@ eStrand_Minus
Minus strand.
@ eCoding_Ncbi
Set coding to binary coding (Ncbi4na or Ncbistdaa)
SSeqMapSelector & SetResolveCount(size_t res_cnt)
Set max depth of resolving seq-map.
Definition: seq_map_ci.hpp:151
SSeqMapSelector & SetFlags(TFlags flags)
Select segment type(s)
Definition: seq_map_ci.hpp:179
SSeqMapSelector & SetLimitTSE(const CSeq_entry_Handle &tse)
Limit TSE to resolve references.
Definition: seq_map_ci.cpp:80
CSeq_id_Handle GetRefSeqid(void) const
The following function makes sense only when the segment is a reference to another seq.
Definition: seq_map_ci.cpp:312
CSeqMap_CI BeginResolved(CScope *scope) const
Definition: seq_map.cpp:837
TSeqPos GetLength(CScope *scope) const
Definition: seq_map.hpp:482
@ fFindRef
Definition: seq_map.hpp:137
#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
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
@ eNa_strand_plus
Definition: Na_strand_.hpp:66
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
@ eNa_strand_unknown
Definition: Na_strand_.hpp:65
ERepr
representation class
Definition: Seq_inst_.hpp:91
ETopology
topology of molecule
Definition: Seq_inst_.hpp:121
EMol
molecule class in living organism
Definition: Seq_inst_.hpp:108
EStrand
strandedness in living organism
Definition: Seq_inst_.hpp:133
static MDB_envinfo info
Definition: mdb_load.c:37
mdb_mode_t mode
Definition: lmdb++.h:38
Selector used in CSeqMap methods returning iterators.
Definition: seq_map_ci.hpp:113
#define _ASSERT
#define const
Definition: zconf.h:232
Modified on Sun Apr 14 05:25:33 2024 by modify_doxy.py rev. 669887