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 71718 2016-03-24 15:33:11Z 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 ) {
105  state |= fState_not_found;
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?
505  eNa_strand_minus: eNa_strand_plus);
506 }
507 
508 
510 {
511  return CSeqVector(*this, eCoding_Ncbi,
512  strand == eStrand_Minus?
513  eNa_strand_minus: eNa_strand_plus);
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  if (cls == CBioseq_set::eClass_other) {
583  // adjust 255 to the correct value
584  cls = CBioseq_set::EClass(sizeof(ctab) - 1);
585  }
587  _ASSERT(last && last.IsSeq());
589  while ( e ) {
590  _ASSERT(e.IsSet());
591  // Found good level
592  if ( last.IsSet() &&
593  ctab[last.GetSet().GetClass()] == ctab[cls] )
594  break;
595  // Gone too high
596  if ( ctab[e.GetSet().GetClass()] > ctab[cls] ) {
597  break;
598  }
599  // Go up one level
600  last = e;
601  e = e.GetParentEntry();
602  }
603  return last;
604 }
605 
606 
609 {
611  if ( ret &&
612  (!ret.IsSet() || !ret.GetSet().IsSetClass() ||
613  ret.GetSet().GetClass() != cls) ) {
614  ret.Reset();
615  }
616  return ret;
617 }
618 
619 
621 {
623  return mapper.Map(loc);
624 }
625 
626 
629  int index) const
630 {
631  return entry.CopyBioseq(*this, index);
632 }
633 
634 
637  int index) const
638 {
639  return seqset.CopyBioseq(*this, index);
640 }
641 
642 
645 {
646  return entry.CopySeq(*this);
647 }
648 
649 
650 /////////////////////////////////////////////////////////////////////////////
651 // CBioseq_EditHandle
652 /////////////////////////////////////////////////////////////////////////////
653 
655 {
656 }
657 
658 
660  : CBioseq_Handle(h)
661 {
662  if ( !h.GetTSE_Handle().CanBeEdited() ) {
663  NCBI_THROW(CObjMgrException, eInvalidHandle,
664  "object is not in editing mode");
665  }
666 }
667 
668 
670  CBioseq_ScopeInfo& binfo)
671  : CBioseq_Handle(id, binfo)
672 {
673 }
674 
675 
677  const TLock& lock)
678  : CBioseq_Handle(id, lock)
679 {
680 }
681 
682 
684 {
686  if ( *this ) {
687  ret = CSeq_entry_EditHandle(x_GetInfo().GetParentSeq_entry_Info(),
688  GetTSE_Handle());
689  }
690  return ret;
691 }
692 
693 
696 {
697  return GetParentEntry().AttachAnnot(annot);
698 }
699 
700 
703 {
704  return GetParentEntry().CopyAnnot(annot);
705 }
706 
707 
710 {
711  return GetParentEntry().TakeAnnot(annot);
712 }
713 
714 
717  int index) const
718 {
719  return entry.TakeBioseq(*this, index);
720 }
721 
722 
725  int index) const
726 {
727  return seqset.TakeBioseq(*this, index);
728 }
729 
730 
733 {
734  return entry.TakeSeq(*this);
735 }
736 
738 {
739  if (mode == eKeepSeq_entry)
740  x_Detach();
741  else {
742  CRef<IScopeTransaction_Impl> tr(x_GetScopeImpl().CreateTransaction());
744  x_Detach();
745  parent.Remove();
746  tr->Commit();
747  }
748 }
749 
751 {
752  typedef CRemoveBioseq_EditCommand TCommand;
753  CCommandProcessor processor(x_GetScopeImpl());
754  processor.run(new TCommand(*this, x_GetScopeImpl()));
755  // x_GetScopeImpl().RemoveBioseq(*this);
756 }
757 
758 
759 /////////////////////////////////////////////////////////////////////////////
760 // Bioseq members
761 
763 {
765  CCommandProcessor processor(x_GetScopeImpl());
766  processor.run(new CResetIds_EditCommand(*this));
767 }
768 
769 
771 {
773  CCommandProcessor processor(x_GetScopeImpl());
774  return processor.run(new CAddId_EditCommand(*this,id));
775 }
776 
777 
779 {
781  CCommandProcessor processor(x_GetScopeImpl());
782  return processor.run(new CRemoveId_EditCommand(*this,id));
783 }
784 
785 
787 {
789  CCommandProcessor processor(x_GetScopeImpl());
790  processor.run(new TCommand(*this));
791 }
792 
793 
795 {
797  CCommandProcessor processor(x_GetScopeImpl());
798  processor.run(new TCommand(*this, v));
799 }
800 
801 
803 {
804  if (x_GetScopeImpl().IsTransactionActive()
805  || GetTSE_Handle().x_GetTSE_Info().GetEditSaver() ) {
806  NCBI_THROW(CObjMgrException, eTransaction,
807  "TDescr& CBioseq_EditHandle::SetDescr(): "
808  "method can not be called if a transaction is required");
809  }
810  return x_GetInfo().SetDescr();
811 }
812 
813 
815 {
817  CCommandProcessor processor(x_GetScopeImpl());
818  return processor.run(new TCommand(*this, d));
819 }
820 
821 
823 {
825  CCommandProcessor processor(x_GetScopeImpl());
826  return processor.run(new TCommand(*this, d));
827 }
828 
829 
831 {
833  CCommandProcessor processor(x_GetScopeImpl());
834  processor.run(new TCommand(*this, v));
835  // x_GetInfo().AddSeq_descr(v);
836 }
837 
838 
840 {
841  typedef CSet_SeqInst_EditCommand TCommand;
842  CCommandProcessor processor(x_GetScopeImpl());
843  processor.run(new TCommand(*this, v));
844  // x_GetInfo().SetInst(v);
845 }
846 
847 
849 {
850  typedef CSet_SeqInstRepr_EditCommand TCommand;
851  CCommandProcessor processor(x_GetScopeImpl());
852  processor.run(new TCommand(*this, v));
853  // x_GetInfo().SetInst_Repr(v);
854 }
855 
856 
858 {
859  typedef CSet_SeqInstMol_EditCommand TCommand;
860  CCommandProcessor processor(x_GetScopeImpl());
861  processor.run(new TCommand(*this, v));
862  // x_GetInfo().SetInst_Mol(v);
863 }
864 
865 
867 {
868  typedef CSet_SeqInstLength_EditCommand TCommand;
869  CCommandProcessor processor(x_GetScopeImpl());
870  processor.run(new TCommand(*this, v));
871  // x_GetInfo().SetInst_Length(v);
872 }
873 
874 
876 {
877  typedef CSet_SeqInstFuzz_EditCommand TCommand;
878  CCommandProcessor processor(x_GetScopeImpl());
879  processor.run(new TCommand(*this, v));
880  // x_GetInfo().SetInst_Fuzz(v);
881 }
882 
883 
885 {
886  typedef CSet_SeqInstTopology_EditCommand TCommand;
887  CCommandProcessor processor(x_GetScopeImpl());
888  processor.run(new TCommand(*this, v));
889  // x_GetInfo().SetInst_Topology(v);
890 }
891 
892 
894 {
895  typedef CSet_SeqInstStrand_EditCommand TCommand;
896  CCommandProcessor processor(x_GetScopeImpl());
897  processor.run(new TCommand(*this, v));
898  // x_GetInfo().SetInst_Strand(v);
899 }
900 
901 
903 {
904  typedef CSet_SeqInstSeq_data_EditCommand TCommand;
905  CCommandProcessor processor(x_GetScopeImpl());
906  processor.run(new TCommand(*this, v));
907  // x_GetInfo().SetInst_Seq_data(v);
908 }
909 
910 
912 {
913  typedef CSet_SeqInstExt_EditCommand TCommand;
914  CCommandProcessor processor(x_GetScopeImpl());
915  processor.run(new TCommand(*this, v));
916  // x_GetInfo().SetInst_Ext(v);
917 }
918 
919 
921 {
922  typedef CSet_SeqInstHist_EditCommand TCommand;
923  CCommandProcessor processor(x_GetScopeImpl());
924  processor.run(new TCommand(*this, v));
925  // x_GetInfo().SetInst_Hist(v);
926 }
927 
928 
930 {
932  // First try original id
933  if ( id ) {
934  return id;
935  }
936  // Then try to find gi
937  ITERATE ( TId, it, GetId() ) {
938  if ( it->IsGi() ) {
939  CBioseq_Handle bh =
941  if ( bh == *this ) {
942  id = *it;
943  _ASSERT(id);
944  return id;
945  }
946  }
947  }
948  // Then try to find accession
949  ITERATE ( TId, it, GetId() ) {
950  if ( !it->IsGi() && it->GetSeqId()->GetTextseq_Id() ) {
951  CBioseq_Handle bh =
953  if ( bh == *this ) {
954  id = *it;
955  _ASSERT(id);
956  return id;
957  }
958  }
959  }
960  // Then try to find any other id
961  ITERATE ( TId, it, GetId() ) {
962  if ( !it->IsGi() && !it->GetSeqId()->GetTextseq_Id() ) {
963  CBioseq_Handle bh =
965  if ( bh == *this ) {
966  id = *it;
967  _ASSERT(id);
968  return id;
969  }
970  }
971  }
972  NCBI_THROW(CObjMgrException, eOtherError,
973  "CBioseq_Handle::GetAccessSeq_id_Handle "
974  "can not find seq-id to access this bioseq");
975 }
976 
977 
979  TSeqPos stop,
980  ENa_strand strand) const
981 {
983  CRef<CSeq_id> id(new CSeq_id);
984  id->Assign(*orig_id.GetSeqId());
985  CRef<CSeq_loc> res(new CSeq_loc);
986  if (start == 0 && stop == 0) {
987  if ( strand == eNa_strand_unknown ) {
988  res->SetWhole(*id);
989  }
990  else {
991  CRef<CSeq_interval> interval
992  (new CSeq_interval(*id, 0, GetBioseqLength()-1, strand));
993  res->SetInt(*interval);
994  }
995  }
996  else {
998  (*id, start, stop, strand));
999  res->SetInt(*interval);
1000  }
1001  return res;
1002 }
1003 
1004 
1006 {
1007  return GetTSE_Handle().AddUsedTSE(bh.GetTSE_Handle());
1008 }
1009 
1010 
1011 ///////////////////////////////////////////////////////////////////////////////
1013 {
1014  x_GetInfo().ResetDescr();
1015 }
1016 
1017 
1019 {
1020  x_GetInfo().SetDescr(v);
1021 }
1022 
1023 
1025 {
1026  return x_GetInfo().AddSeqdesc(d);
1027 }
1028 
1029 
1031 {
1032  return x_GetInfo().RemoveSeqdesc(d);
1033 }
1034 
1035 
1037 {
1038  x_GetInfo().AddSeq_descr(v);
1039 }
1040 
1042 {
1043  x_GetScopeInfo().ResetId();
1044 }
1045 
1046 
1048 {
1049  return x_GetScopeInfo().AddId(id);
1050 }
1051 
1053 {
1054  return x_GetScopeInfo().RemoveId(id);
1055 }
1056 
1057 
1059 {
1060  x_GetInfo().SetInst(v);
1061 }
1062 
1063 
1065 {
1066  x_GetInfo().SetInst_Repr(v);
1067 }
1068 
1069 
1071 {
1072  x_GetInfo().SetInst_Mol(v);
1073 }
1074 
1075 
1077 {
1079 }
1080 
1081 
1083 {
1084  x_GetInfo().SetInst_Fuzz(v);
1085 }
1086 
1087 
1089 {
1091 }
1092 
1093 
1095 {
1097 }
1098 
1099 
1101 {
1103 }
1104 
1105 
1107 {
1108  x_GetInfo().SetInst_Ext(v);
1109 }
1110 
1111 
1113 {
1114  x_GetInfo().SetInst_Hist(v);
1115 }
1117 {
1118  x_GetInfo().ResetInst();
1119 }
1121 {
1123 }
1125 {
1127 }
1129 {
1131 }
1133 {
1135 }
1137 {
1139 }
1141 {
1143 }
1145 {
1147 }
1149 {
1151 }
1153 {
1155 }
1156 
1157 
1159 {
1160  return const_cast<CSeqMap&>(GetSeqMap());
1161 }
1162 
1163 
1166 {
1168 }
1169 
1170 
1173 {
1175 }
1176 
1177 
1178 // end of Bioseq members
1179 /////////////////////////////////////////////////////////////////////////////
1180 
1181 
const TInst_Hist & GetInst_Hist(void) const
void Reset(void)
Reset the handle (remove seq-id reference)
bool IsSetInst_Fuzz(void) const
CConstRef< TObject > GetCompleteBioseq(void) const
CBioseq_Handle –.
TMol GetBioseqMolType(void) const
Get some values from core:
bool CanBeEdited(void) const
Return true if this TSE handle is local to scope and can be edited.
Definition: tse_handle.cpp:222
void ResetInst_Seq_data()
Iterator over CSeqMap.
Definition: seq_map_ci.hpp:251
bool CanGetInst_Strand(void) const
CSeq_annot_EditHandle CopyAnnot(const CSeq_annot_Handle &annot) const
Attach a copy of the annotation.
CSeq_annot_EditHandle AttachAnnot(CSeq_annot &annot) const
Attach an annotation.
bool CanGetInst_Topology(void) const
bool IsNucleotide(void) const
CSeq_entry_EditHandle GetParentEntry(void) const
Navigate object tree.
map from segments to the top level bioseq
void x_RealSetInst(TInst &v) const
const TInst & GetInst(void) const
const CBioObjectId & GetBioObjectId(void) const
Get unique object id.
CBioseq_Handle GetBioseqHandleFromTSE(const CSeq_id &id, const CTSE_Handle &tse)
Get bioseq handle for sequence withing one TSE.
Definition: scope.cpp:241
CScope_Impl & x_GetScopeImpl(void) const
bool CanGetInst_Length(void) const
void SetInst_Ext(TInst_Ext &v)
void ResetDescr(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
const CBioseq_Info & GetObjectInfo(void) const
Definition: scope_info.hpp:517
TInst_Strand GetInst_Strand(void) const
void SetInst_Topology(TInst_Topology v)
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
void SetInst(TInst &v) const
const TInst_Ext & GetInst_Ext(void) const
bool CanGetInst_Fuzz(void) const
SSeqMapSelector & SetLimitTSE(const CSeq_entry_Handle &tse)
Limit TSE to resolve references.
Definition: seq_map_ci.cpp:80
TSeq CopySeq(const CBioseq_Handle &seq) const
Make the empty Seq-entry be in seq state with specified Bioseq object.
void AddSeq_descr(TDescr &v) const
void ResetInst_Topology()
bool AddId(const CSeq_id_Handle &id)
CBioseq_EditHandle –.
Selector used in CSeqMap methods returning iterators.
Definition: seq_map_ci.hpp:112
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:73
bool RemoveId(const CSeq_id_Handle &id)
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:953
const CBioseq_ScopeInfo & x_GetScopeInfo(void) const
bool IsSetInst_Hist(void) const
TInst_Strand GetInst_Strand(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, stop == 0, and strand == eNa_strand_unknown, CSeq_loc will be of type 'whole'.
bool HasBioseq(void) const
bool IsSetInst_Ext(void) const
TInst_Mol GetInst_Mol(void) const
void SetInst(TInst &v)
bool IsSetInst_Repr(void) const
void x_RealResetDescr(void) const
CRef< CSeqdesc > RemoveSeqdesc(const CSeqdesc &d)
CSeq_annot_EditHandle TakeAnnot(const CSeq_annot_EditHandle &annot) const
Remove the annotation from its location and attach to current one.
void SetInst_Seq_data(TInst_Seq_data &v) const
bool CanGetInst_Mol(void) const
bool CanGetInst_Topology(void) const
bool CanGetInst_Hist(void) const
TDescr & SetDescr(void)
bool CanGetInst_Seq_data(void) const
void Remove(ERemoveMode mode=eRemoveSeq_entry) const
bool CanGetInst_Mol(void) const
void x_RealSetDescr(TDescr &v) const
bool ContainsSynonym(const CSeq_id_Handle &id) const
bool CanGetInst(void) const
void x_RealSetInst_Mol(TInst_Mol v) const
bool IsSetInst_Strand(void) const
const TInst & GetInst(void) const
const CSeqMap & GetSeqMap(void) const
Get sequence map.
void x_RealSetInst_Length(TInst_Length v) const
CConstRef< CSynonymsSet > GetSynonyms(void) const
Get the bioseq's synonyms.
const CSeqMap & GetSeqMap(void) const
bool IsSynonym(const CSeq_id &id) const
Check if this id can be used to obtain this bioseq handle.
TSet GetSet(void) const
void x_RealResetInst_Mol() 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...
const TInst_Seq_data & GetInst_Seq_data(void) const
CId_EditCommand< false > CRemoveId_EditCommand
void SetInst_Mol(TInst_Mol v)
TInst::TLength TInst_Length
void x_RealResetInst_Ext() const
void ResetId(void) const
CSeq_annot_EditHandle AttachAnnot(CSeq_annot &annot) const
Attach an annotation.
CBioseq_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
TInst_Length GetInst_Length(void) const
bool CanGetInst_Ext(void) const
void SetInst_Mol(TInst_Mol v) const
ERepr
representation class
Definition: Seq_inst_.hpp:91
void ResetInst()
const NCBI_NS_NCBI::CEnumeratedTypeValues *ENUM_METHOD_NAME() ENa_strand(void)
Access to ENa_strand's attributes (values, names) as defined in spec.
const CSeq_entry_Info & GetParentSeq_entry_Info(void) const
bool x_RealAddId(const CSeq_id_Handle &id) const
bool IsSetInst_Seq_data(void) const
void ResetInst_Mol()
bool IsSetId(void) const
Set coding to binary coding (Ncbi4na or Ncbistdaa)
void x_RealResetInst_Topology() const
void x_RealResetInst_Fuzz() const
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
void SetWhole(TWhole &v)
Definition: Seq_loc.hpp:964
bool CanGetInst_Fuzz(void) const
bool IsSetInst(void) const
const TInst_Fuzz & GetInst_Fuzz(void) const
.hpp User-defined methods of the data storage class.
Definition: Seq_descr.hpp:54
CBioseq_EditHandle CopyBioseq(const CBioseq_Handle &seq, int index=-1) const
Attach a copy of the bioseq.
bool IsSetInst_Strand(void) const
void x_RealResetInst_Seq_data() const
bool CanGetInst(void) const
CSeq_annot_EditHandle CopyAnnot(const CSeq_annot_Handle &annot) const
Attach a copy of the annotation.
bool CanGetInst_Ext(void) const
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:893
TSeq TakeSeq(const TSeq &seq) const
Make the empty Seq-entry be in seq state with moving bioseq object from the argument seq...
bool IsSetClass(void) const
void SetInst_Strand(TInst_Strand v)
void ResetInst_Repr()
const TId & GetId(void) const
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
bool CanGetInst_Hist(void) const
void SetInst_Repr(TInst_Repr v)
bool IsAa(void) const
TBioseqCore GetBioseqCore(void) const
Get bioseq core structure.
void ResetInst_Hist()
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
void x_Detach(void) const
void ResetId(void)
const TInst_Fuzz & GetInst_Fuzz(void) const
bool IsSetInst_Repr(void) const
void SetInst_Hist(TInst_Hist &v)
void SetInst_Ext(TInst_Ext &v) const
bool CanGetId(void) const
TBioseqStateFlags GetState(void) const
Get state of the bioseq.
void Reset(void)
Reset handle and make it not to point to any bioseq.
void x_RealResetId(void) const
void x_RealResetInst() const
void AddSeq_descr(const TDescr &v)
CBioseq_EditHandle CopyTo(const CSeq_entry_EditHandle &entry, int index=-1) const
Copy current bioseq into seq-entry.
CBioseq_EditHandle MoveTo(const CSeq_entry_EditHandle &entry, int index=-1) const
Move current bioseq into seq-entry.
void x_RealSetInst_Ext(TInst_Ext &v) const
void SetInst_Hist(TInst_Hist &v) const
CMDReturn< CMD >::TReturn run(CMD *cmd)
bool IsSetInst_Fuzz(void) const
static const TComplexityTable & sx_GetComplexityTable(void)
CBioseq_set_Handle –.
bool IsSetInst_Topology(void) const
CSeq_id_Handle m_Handle_Seq_id
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
CSeq_annot_EditHandle TakeAnnot(const CSeq_annot_EditHandle &annot) const
Remove the annotation from its location and attach to current one.
void SetInst_Length(TInst_Length v)
void SetInst_Strand(TInst_Strand v) const
void x_RealSetInst_Hist(TInst_Hist &v) const
friend class CSeq_entry_EditHandle
CBioseq_set_Handle GetParentBioseq_set(void) const
Return a handle for the parent Bioseq-set, or null handle.
bool x_RealAddSeqdesc(CSeqdesc &d) const
bool IsSetInst_Length(void) const
CSeqMap –.
Definition: seq_map.hpp:92
EVectorCoding
CSeqVector constructor flags.
void SetInst_Length(TInst_Length v) const
void x_RealResetInst_Hist() const
CBioseq_EditHandle CopyToSeq(const CSeq_entry_EditHandle &entry) const
Copy current bioseq into seq-entry and set seq-entry as bioseq.
void Remove(void) const
Remove this Seq-entry from parent, or scope if it's top level Seq-entry.
virtual void Commit()=0
CSeqVector –.
Definition: seq_vector.hpp:64
bool CanGetInst_Length(void) const
const TInst_Ext & GetInst_Ext(void) const
ETopology
topology of molecule
Definition: Seq_inst_.hpp:121
bool CanGetDescr(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 HasParent_Info(void) const
CSeq_entry_Handle –.
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 ...
bool IsSetInst_Topology(void) const
CBioseq_EditHandle TakeBioseq(const CBioseq_EditHandle &seq, int index=-1) const
Remove bioseq from its location and attach to current one.
TInst_Repr GetInst_Repr(void) const
const TDescr & GetDescr(void) const
CBioseq_EditHandle TakeBioseq(const CBioseq_EditHandle &seq, int index=-1) const
Remove bioseq from its location and attach to current one.
bool CanGetDescr(void) const
TClass GetClass(void) const
const CTSE_Handle & GetTSE_Handle(void) const
Definition: tse_handle.hpp:341
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
CSeq_annot_Handle –.
CSeq_ext –.
Definition: Seq_ext.hpp:65
EFeatureFetchPolicy
Feature fetch policy describes when to look for features on sequence segments.
CSeq_entry_Handle –.
EStrand
strandedness in living organism
Definition: Seq_inst_.hpp:133
CSeq_entry_Handle GetExactComplexityLevel(CBioseq_set::EClass cls) const
Return level with exact complexity, or empty handle if not found.
CBioseq_EditHandle MoveToSeq(const CSeq_entry_EditHandle &entry) const
Move current bioseq into seq-entry and set seq-entry as bioseq.
CSeqMap & SetSeqMap(void) const
Get CSeqMap object for sequence editing.
CRef< CSeqdesc > x_RealRemoveSeqdesc(const CSeqdesc &d) const
void SetInst_Fuzz(TInst_Fuzz &v) const
void x_RealResetInst_Length() const
TInst_Repr GetInst_Repr(void) const
CConstRef< TObject > GetBioseqCore(void) const
CSeqMap_CI BeginResolved(CScope *scope) const
Definition: seq_map.cpp:798
bool RemoveId(const CSeq_id_Handle &id) const
EMol
molecule class in living organism
Definition: Seq_inst_.hpp:108
bool IsSetDescr(void) const
CConstRef< CSeq_id > GetInitialSeqIdOrNull(void) const
Get id used to obtain this bioseq handle.
void SetInst_Fuzz(TInst_Fuzz &v)
Base class for all object manager exceptions.
void x_RealSetInst_Topology(TInst_Topology v) const
const CTSE_Info & x_GetTSE_Info(void) const
Definition: tse_handle.cpp:115
const CBioseq_set_Info & GetParentBioseq_set_Info(void) const
CConstRef< CSeq_id > GetSeqId(void) const
void Reset(void)
Reset handle and make it not to point to any seq-entry.
CBioseq_Info & x_GetInfo(void) const
bool x_RealRemoveId(const CSeq_id_Handle &id) const
const CSeq_id_Handle & GetSeq_id_Handle(void) const
Get handle of id used to obtain this bioseq handle.
TInst_Length GetInst_Length(void) const
void x_RealSetInst_Repr(TInst_Repr v) const
ESequenceClass GetSequenceClass(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...
bool CanGetInst_Repr(void) const
virtual const CBioObjectId & GetBioObjectId(void) const
CId_EditCommand< true > CAddId_EditCommand
TBlobState GetBlobState(void) const
Definition: tse_info.hpp:776
void SetInst_Repr(TInst_Repr v) const
const TInst_Hist & GetInst_Hist(void) const
TSeqPos GetBioseqLength(void) const
void x_RealSetInst_Seq_data(TInst_Seq_data &v) const
void SetInt(TInt &v)
Definition: Seq_loc.hpp:965
ERemoveMode
Remove current bioseq from its location.
bool CanGetInst_Strand(void) const
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
EFindSegment
Segment search flags.
bool IsSeq(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...
TInst_Topology GetInst_Topology(void) const
bool IsProtein(void) const
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:216
bool IsSetInst_Seq_data(void) const
bool AddId(const CSeq_id_Handle &id) const
CSeq_loc_Mapper –.
bool IsSetDescr(void) const
const TDescr & GetDescr(void) const
const TInst_Seq_data & GetInst_Seq_data(void) const
bool CanGetId(void) const
void ResetInst_Ext()
void SetInst_Topology(TInst_Topology v) const
void x_RealResetInst_Repr() const
CSeq_hist –.
Definition: Seq_hist.hpp:65
TInst_Topology GetInst_Topology(void) const
void x_RealSetInst_Strand(TInst_Strand v) const
bool IsSetInst_Mol(void) const
bool IsSetInst_Hist(void) const
bool IsNa(void) const
#define _ASSERT
void SetInst_Seq_data(TInst_Seq_data &v)
CRef< CSeq_loc > MapLocation(const CSeq_loc &loc) const
Map a seq-loc from the bioseq's segment to the bioseq.
bool HasAnnots(void) const
SSeqMapSelector & SetResolveCount(size_t res_cnt)
Set max depth of resolving seq-map.
Definition: seq_map_ci.hpp:151
CBioseq_EditHandle CopyBioseq(const CBioseq_Handle &seq, int index=-1) const
Attach a copy of the existing bioseq.
SSeqMapSelector & SetFlags(TFlags flags)
Select segment type(s)
Definition: seq_map_ci.hpp:179
bool HasAnnots(void) const
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:70
void ResetInst_Length()
#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:546
CRef< CSeqdesc > RemoveSeqdesc(const CSeqdesc &d) const
CBioseq_set_EditHandle –.
const CTSE_Handle & GetTSE_Handle(void) const
Get CTSE_Handle of containing TSE.
#define const
Definition: zconf.h:217
const CBioseq_Info & x_GetInfo(void) const
TMol GetSequenceType(void) const
void Reset(void)
Definition: tse_handle.hpp:553
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
void x_RealResetInst_Strand() const
bool CanGetInst_Repr(void) const
bool IsSet(void) const
static const NCBI_NS_NCBI::CEnumeratedTypeValues *ENUM_METHOD_NAME() EClass(void)
Access to EClass's attributes (values, names) as defined in spec.
bool IsSetId(void) const
CBioseq_ScopeInfo & x_GetScopeInfo(void) const
vector< CSeq_id_Handle > TId
const TId & GetId(void) const
bool IsSetInst(void) const
void ResetInst_Strand()
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
bool CanGetInst_Seq_data(void) const
EFeatureFetchPolicy GetFeatureFetchPolicy(void) const
TSeqPos GetLength(CScope *scope) const
Definition: seq_map.hpp:480
bool AddSeqdesc(CSeqdesc &d)
void ResetInst_Fuzz()
bool AddSeqdesc(CSeqdesc &d) const
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
bool IsSetInst_Mol(void) const
bool IsSetInst_Ext(void) const
TBlobStateFlags GetBlobState(void) const
Definition: scope_info.hpp:536
Resolve in the parent TSE only.
CConstRef< CSynonymsSet > GetSynonyms(const CSeq_id &id)
Get bioseq synonyms, resolving to the bioseq in this scope.
Definition: scope.cpp:443
bool IsSetInst_Length(void) const
CTSE_Handle GetEditHandle(const CTSE_Handle &src_tse)
void x_RealSetInst_Fuzz(TInst_Fuzz &v) const
TInst_Mol GetInst_Mol(void) const
TDescr & SetDescr(void) const
IEditSaver * GetEditSaver(const Handle &handle)
CSeqVector GetSeqVector(EVectorCoding coding, ENa_strand strand=eNa_strand_plus) const
Get sequence: Iupacna or Iupacaa if use_iupac_coding is true.
CRef< CSeq_loc > Map(const CSeq_loc &src_loc)
Map seq-loc.
CConstRef< CSeq_id > GetSeqIdOrNull(void) const
void x_RealAddSeq_descr(TDescr &v) const
Modified on Fri Apr 29 18:24:56 2016 by modify_doxy.py rev. 426318