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

Go to the SVN repository for this file.

1 /* $Id: promote.cpp 93572 2021-04-30 13:48:31Z stakhovv $
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: Mati Shomrat, NCBI
27 *
28 * File Description:
29 * Utility class for fleshing out NCBI data model from features.
30 */
31 #include <ncbi_pch.hpp>
32 #include <corelib/ncbistd.hpp>
33 #include <util/static_map.hpp>
34 #include <objects/seq/Bioseq.hpp>
35 #include <objects/seq/Seq_data.hpp>
37 #include <objects/seq/Seqdesc.hpp>
38 #include <objects/seq/MolInfo.hpp>
45 #include <objmgr/scope.hpp>
46 #include <objmgr/seq_vector.hpp>
48 #include <objmgr/annot_ci.hpp>
52 #include <objmgr/util/sequence.hpp>
56 #include <objtools/error_codes.hpp>
57 
58 
59 #define NCBI_USE_ERRCODE_X Objtools_Edit
60 
61 
65 
66 USING_SCOPE(sequence);
67 
68 
69 // constructor
71  m_Seq(seq), m_Flags(flags), m_Types(types)
72 {
73  if ( !m_Seq ) {
74  NCBI_THROW(CEditException, eInvalid,
75  "Cannot initialize with a NULL bioseq handle");
76  }
77 }
78 
79 
80 // Set / Get promote flags
82 {
83  return m_Flags;
84 }
85 
86 
88 {
89  m_Flags = flags;
90 }
91 
92 // Set / Get feature types to promote
94 {
95  return m_Types;
96 }
97 
98 
100 {
101  m_Types = types;
102 }
103 
104 
105 // Promote features from all attached Seq-annot
107 {
109  sel.SetResolveNone();
110 
111  for (CAnnot_CI it(m_Seq, sel); it; ++it) {
112  PromoteFeatures(*it);
113  }
114 }
115 
116 
117 // Promote features from a specific Seq-annot
119 {
120  _ASSERT(annot);
121 
122  // NB: due to lack of feature editing support from the object manger
123  // we remove the annotation from scope, edit and then insert it back
124  // into scope. (Temporary
125 
126  // detach Seq-annot from scope
128  if ( !sap->GetData().IsFtable() ) {
129  NCBI_THROW(CEditException, eInvalid,
130  "Cannot promote a non-Ftable annotation");
131  }
132  annot.GetEditHandle().Remove();
133 
134  // do the actual promotion
135  x_PromoteFeatures(const_cast<CSeq_annot&>(*sap));
136 
137  // re-attach the annotation
138  m_Seq.GetEditHandle().AttachAnnot(const_cast<CSeq_annot&>(*sap));
139 }
140 
141 
143 {
144  TRnaMap rna_map;
145 
146  CSeq_annot::C_Data::TFtable& feats = annot.SetData().SetFtable();
147 
148  // if GPS first expand mRNA features into cDNA product sequences
149  if ( (m_Flags & fPromote_GenProdSet) != 0 && x_DoPromoteRna() ) {
151  CSeq_feat& feat = **it;
152  if ( feat.CanGetData() && feat.CanGetLocation() &&
153  feat.GetData().IsRna() ) {
154  x_PromoteRna(feat);
155  // NB: we build a maping between mRNA to the mRNA feature to be used
156  // later when doing coding region promotion.
157  // This is done because no obeject manager functionality can be used
158  // to locate the MRNA feature, due to the fact that temporarily
159  // all feature editing is done outside the object manager.
160  if ( feat.CanGetProduct() ) {
162  if ( rna ) {
163  rna_map[rna] = *it;
164  }
165  }
166  }
167  }
168  }
169 
170  // promote other feature types
172  CSeq_feat& feat = **it;
173  if ( !feat.CanGetData() || !feat.CanGetLocation() ) {
174  continue;
175  }
176 
177  // expand coding region features into protein product sequences
178  if ( x_DoPromoteCdregion() && feat.GetData().IsCdregion() ) {
179  x_PromoteCdregion(feat, &rna_map);
180  }
181 
182  // promote full lenght pub feature to descriptors
183  if ( x_DoPromotePub() && feat.GetData().IsPub() ) {
184  x_PromotePub(feat);
185  }
186  }
187 }
188 
189 
190 // Promote a single coding region feature
192 {
194 
195  CSeq_annot_Handle annot = feat.GetAnnot();
197  annot.GetEditHandle().Remove();
198  CConstRef<CSeq_feat> cds = feat.GetSeq_feat();
199 
200  x_PromoteCdregion(const_cast<CSeq_feat&>(*cds));
201 
202  m_Seq.GetEditHandle().AttachAnnot(const_cast<CSeq_annot&>(*sap));
203 }
204 
205 
206 void CPromote::x_PromoteCdregion(CSeq_feat& feat, TRnaMap* rna_map) const
207 {
208  _ASSERT(feat.GetData().IsCdregion());
209 
210  CSeq_feat::TXref::iterator it = feat.SetXref().begin();
211  while ( it != feat.SetXref().end() ) {
212  CSeqFeatXref& xref = **it;
213  if ( xref.IsSetData() && xref.GetData().IsProt() &&
214  !feat.CanGetProduct() &&
215  (!feat.IsSetPseudo() || !feat.GetPseudo()) ) {
216  CRef<CProt_ref> prp(&xref.SetData().SetProt());
217  _ASSERT(prp);
218  it = feat.SetXref().erase(it);
219 
220  // get protein sequence by translating the coding region
221  string data;
222  bool include_stop = (m_Flags & fPromote_IncludeStop) != 0;
223  bool remove_trailingX = (m_Flags & fPromote_RemoveTrailingX) != 0;
225  feat,
226  x_Scope(),
227  include_stop,
228  remove_trailingX);
229  if ( data[data.length() - 1] == '*' ) {
230  data.erase(data.length() - 1);
231  }
232 
233  // find / make the protein's id
234  CRef<CSeq_id> pid(x_GetProteinId(feat));
235  if ( !pid ) {
236  // !!! Make new protein seq-id
237  }
238  _ASSERT(pid);
239 
240  // create protein bioseq
242 
243  //add MolInfo descriptor
244  CRef<CSeq_descr> descr(new CSeq_descr);
245  CRef<CSeqdesc> desc(x_MakeMolinfoDesc(feat));
247  descr->Set().push_back(desc);
248  prot.SetDescr(*descr);
249 
250  // set feature product
251  x_SetSeqFeatProduct(feat, prot);
252 
253  // add Prot feature on protein
254  const CSeq_loc& loc = feat.GetLocation();
256  prot,
257  *prp,
260 
261  // find the seq-entry to put the protein in.
262  CBioseq_Handle mrna;
263  if ( (m_Flags & fPromote_GenProdSet) != 0 ) {
264  CRef<CSeq_id> mid(x_GetTranscriptId(feat));
265  if ( mid ) {
266  mrna = x_Scope().GetBioseqHandleFromTSE(*mid, m_Seq);
267  }
268  if ( mrna && (m_Flags & fCopyCdregionTomRNA) != 0 ) {
269  x_CopyCdregionToRNA(feat, mrna, rna_map);
270  }
271  }
272  if ( !mrna ) {
273  mrna = m_Seq;
274  }
275  _ASSERT(mrna);
276  CSeq_entry_Handle entry =
278  if ( !entry ) {
279  entry = mrna.GetParentEntry();
280  }
281 
282  // adding a protein might change the structure of the seq-entry,
283  // so use AddSeqEntryToSeqEntry
284  AddSeqEntryToSeqEntry(entry, prot.GetParentEntry());
285  } else {
286  ++it;
287  }
288  }
289 
290  if ( feat.GetXref().empty() ) {
291  feat.ResetXref();
292  }
293 }
294 
295 
297 (const CSeq_feat& cds,
298  CBioseq_Handle& mrna,
299  TRnaMap* rna_map) const
300 {
301  _ASSERT(mrna);
302 
303  if ( (rna_map == 0) || (rna_map->find(mrna) == rna_map->end()) ) {
304  return;
305  }
306 
307  CSeq_entry_Handle gps =
309  if ( !gps ) {
310  return;
311  }
312 
313  // create new feature and assign genomic CDS values
314  CRef<CSeq_feat> mcds(new CSeq_feat);
315  mcds->Assign(cds);
316 
317  // create mapper from genomic to mRNA using mRNA feature
318  CConstRef<CSeq_feat> mfeat = (*rna_map)[mrna];
319  if ( !mfeat ) {
320  return;
321  }
323  mapper.SetMergeAbutting();
324 
325  // update location
326  CRef<CSeq_loc> loc = mapper.Map(cds.GetLocation());
327  if ( !loc ) {
328  return;
329  }
330  mcds->SetLocation(*loc);
331 
332  // update code break locations
333  NON_CONST_ITERATE(CCdregion::TCode_break, it, mcds->SetData().SetCdregion().SetCode_break()) {
334  CCode_break& cbr = **it;
335  cbr.SetLoc(*mapper.Map(cbr.GetLoc()));
336  }
337 
338  CRef<CSeq_annot> annot(new CSeq_annot);
339  annot->SetData().SetFtable().push_back(mcds);
340  mrna.GetEditHandle().AttachAnnot(*annot);
341 }
342 
343 
344 // Promote a single mRNA feature
346 {
348 
349  CSeq_annot_Handle annot = feat.GetAnnot();
351  annot.GetEditHandle().Remove();
353 
354  x_PromoteRna(const_cast<CSeq_feat&>(*rna));
355 
356  m_Seq.GetEditHandle().AttachAnnot(const_cast<CSeq_annot&>(*sap));
357 }
358 
359 
361 {
362  // find gen-prod set
364  CSeq_entry_Handle gps =
366  if ( !gps ) {
367  return;
368  }
369  _ASSERT(gps);
370 
371  // find the mRNA id
372  CRef<CSeq_id> sip;
373  if ( !feat.IsSetProduct() && (!feat.IsSetPseudo() || !feat.GetPseudo()) ) {
374  sip.Reset(x_GetTranscriptId(feat));
375  }
376  if ( !sip ) {
377  return;
378  }
379 
380  // get the actual mRNA sequence
381  CSeqVector rnaseq(feat.GetLocation(), m_Seq.GetScope());
382  string data;
383  rnaseq.GetSeqData(0, rnaseq.size(), data);
384 
385  // create mRNA bioseq
386  CBioseq_EditHandle mrna =
387  x_MakeNewRna(*sip, data, rnaseq.GetCoding(), rnaseq.size());
388 
389  // add MolInfo descriptor
390  CRef<CSeq_descr> descr(new CSeq_descr);
391  CRef<CSeqdesc> desc(x_MakeMolinfoDesc(feat));
392  descr->Set().push_back(desc);
393  mrna.SetDescr(*descr);
394 
395  // set feature pruduct
396  x_SetSeqFeatProduct(feat, mrna);
397 
398  // move mRNA to genomic product set
399  mrna.MoveTo(gps.GetEditHandle());
400 }
401 
402 
403 // Prompte a single publication feature
405 {
407 
408  CSeq_annot_Handle annot = feat.GetAnnot();
410  annot.GetEditHandle().Remove();
412 
413  x_PromotePub(const_cast<CSeq_feat&>(*rna));
414 
415  m_Seq.GetEditHandle().AttachAnnot(const_cast<CSeq_annot&>(*sap));
416 }
417 
418 
420 {
421  // !!!
422 }
423 
424 
426 (CSeq_id& id,
427  CSeq_inst::TMol mol,
428  const string& data,
430  size_t length) const
431 {
432  CRef<CBioseq> bsp(new CBioseq);
433  bsp->SetId().push_back(CRef<CSeq_id>(&id));
435  _ASSERT(seq);
436 
437  // set repr, mol, length and id
439  seq.SetInst_Mol(mol);
440 
441  // set actual sequence and length
442  CRef<CSeq_data> sdata(new CSeq_data(data, code));
443  seq.SetInst_Seq_data(*sdata);
444  seq.SetInst_Length(length);
445 
446  return seq;
447 }
448 
449 
451 (CSeq_id& id,
452  const string& data,
454  size_t length) const
455 {
456  return x_MakeNewBioseq(id, CSeq_inst::eMol_rna, data, code, length);
457 }
458 
459 
461 {
463  CSeq_data::e_Ncbieaa, data.length());
464 }
465 
466 
467 CSeq_id* CPromote::x_GetProductId(CSeq_feat& feat, const string& qval) const
468 {
469  static const string kRNA = "RNA";
470  static const string kCDS = "CDS";
471  const string* ftype = feat.GetData().IsRna() ? &kRNA : &kCDS;
472 
473  CRef<CSeq_id> sip;
474  string id;
475  CSeq_feat::TQual::iterator it = feat.SetQual().begin();
476  while ( it != feat.SetQual().end() ) {
477  const CGb_qual& qual = **it;
478  if ( qual.IsSetQual() && qual.GetQual() == qval &&
479  qual.IsSetVal() && !qual.GetVal().empty() ) {
480  if ( !id.empty() ) {
481  LOG_POST_X(1, Warning << *ftype << " " << qval << " "
482  << qual.GetVal() << " replacing " << id);
483  }
484  id = qual.GetVal();
485  it = feat.SetQual().erase(it);
486  } else {
487  ++it;
488  }
489  }
490  if ( feat.GetQual().empty() ) {
491  feat.ResetQual();
492  }
493  if ( !id.empty() ) {
494  try {
495  sip.Reset(new CSeq_id(id));
496  } catch (...) {}
497  }
498 
499  return sip.ReleaseOrNull();
500 }
501 
502 
504 {
505  return x_GetProductId(feat, "transcript_id");
506 }
507 
508 
510 {
511  return x_GetProductId(feat, "protein_id");
512 }
513 
514 
517 static const TBiomolPair kBiomolMap[] = {
518  // for Cdregion feature
520  // for RNA features
529 };
531 
532 
534 {
535  // create new MolInfo descriptor
536  CRef<CSeqdesc> desc(new CSeqdesc);
537  CSeqdesc::TMolinfo& mi = desc->SetMolinfo();
538 
539  // set biomol
541  sc_BiomolMap.find(feat.GetData().GetSubtype());
542  if ( it != sc_BiomolMap.end() ) {
543  mi.SetBiomol(it->second);
544  }
545 
546  // set completeness
547  bool partial_left = feat.GetLocation().IsPartialStart(eExtreme_Biological);
548  bool partial_right = feat.GetLocation().IsPartialStop(eExtreme_Biological);
549  SetMolInfoCompleteness(mi, partial_left, partial_right);
550 
551  return desc.Release();
552 }
553 
554 
556 {
557  _ASSERT(prod);
558 
559  CConstRef<CSeq_id> prod_id = prod.GetSeqId();
560  feat.SetProduct().SetWhole().Assign(*prod_id);
561 }
562 
563 
565 {
566  return (m_Types & eFeatType_Cdregion) != 0;
567 }
568 
569 
570 bool CPromote::x_DoPromoteRna(void) const
571 {
572  return (m_Types & eFeatType_Rna) != 0;
573 }
574 
575 
576 bool CPromote::x_DoPromotePub(void) const
577 {
578  return (m_Types & eFeatType_Pub) != 0;
579 }
580 
581 
583  bool partial_left, bool partial_right) const
584 {
585  // creat new Prot feature
587  prot->SetData().SetProt(prp);
588 
589  // set feature location
590  CRef<CSeq_loc> loc(new CSeq_loc);
591  loc->SetWhole().Assign(*pseq.GetSeqId());
592  loc->SetPartialStart(partial_left, eExtreme_Biological);
593  loc->SetPartialStop(partial_right, eExtreme_Biological);
594  prot->SetLocation(*loc);
595 
596  // create new Ftable annotation and insert feature
597  CRef<CSeq_annot> annot(new CSeq_annot);
598  annot->SetData().SetFtable().push_back(prot);
599 
600  // add annotation to sequence
601  pseq.AttachAnnot(*annot);
602 }
603 
605 {
606  return m_Seq.GetScope();
607 }
608 
609 
610 /////////////////////////////////////////////////////////////////////////////
611 // static functions
612 
613 // Promote features from all attached Seq-annots
615 (CBioseq_Handle& seq,
618 {
620 }
621 
622 
623 // Promote features from a specific Seq-annot
625 (CBioseq_Handle& seq,
626  CSeq_annot_Handle& annot,
629 {
630  CPromote(seq, flags, types).PromoteFeatures(annot);
631 }
632 
633 
634 // Promote a single coding region feature
636  bool include_stop, bool remove_trailingX)
637 {
639  if ( include_stop ) {
641  }
642  if ( remove_trailingX ) {
644  }
646 }
647 
648 
649 // Promote a single mRNA feature
651 {
653 }
654 
655 
656 // Prompte a single publication feature
658 {
660 }
661 
662 
663 bool SetMolInfoCompleteness (CMolInfo& mi, bool partial5, bool partial3)
664 {
665  bool changed = false;
666  CMolInfo::ECompleteness new_val;
667  if ( partial5 && partial3 ) {
669  } else if ( partial5 ) {
671  } else if ( partial3 ) {
673  } else {
675  }
676  if (!mi.IsSetCompleteness() || mi.GetCompleteness() != new_val) {
677  mi.SetCompleteness(new_val);
678  changed = true;
679  }
680  return changed;
681 }
682 
683 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
@ eExtreme_Biological
5' and 3'
Definition: Na_strand.hpp:62
User-defined methods of the data storage class.
CAnnot_CI –.
Definition: annot_ci.hpp:59
CBioseq_EditHandle –.
CBioseq_Handle –.
CCode_break –.
Definition: Code_break.hpp:66
@Gb_qual.hpp User-defined methods of the data storage class.
Definition: Gb_qual.hpp:61
bool x_DoPromoteRna(void) const
Definition: promote.cpp:570
void SetFlags(TFlags flags)
Definition: promote.cpp:87
void x_CopyCdregionToRNA(const CSeq_feat &cds, CBioseq_Handle &mrna, TRnaMap *rna_map=nullptr) const
Definition: promote.cpp:297
CBioseq_EditHandle x_MakeNewBioseq(CSeq_id &id, CSeq_inst::TMol mol, const string &data, TCoding code, size_t length) const
Definition: promote.cpp:426
CSeq_id * x_GetProductId(CSeq_feat &feat, const string &qval) const
Definition: promote.cpp:467
void PromoteRna(CSeq_feat_Handle &feat) const
Definition: promote.cpp:345
void x_PromotePub(CSeq_feat &feat) const
Definition: promote.cpp:419
@ fPromote_GenProdSet
Definition: promote.hpp:61
@ fPromote_IncludeStop
Definition: promote.hpp:62
@ fPromote_RemoveTrailingX
Definition: promote.hpp:63
@ fCopyCdregionTomRNA
Definition: promote.hpp:64
CSeq_id * x_GetTranscriptId(CSeq_feat &feat) const
Definition: promote.cpp:503
bool x_DoPromotePub(void) const
Definition: promote.cpp:576
TFlags m_Flags
Definition: promote.hpp:137
CSeq_id * x_GetProteinId(CSeq_feat &feat) const
Definition: promote.cpp:509
void x_PromoteCdregion(CSeq_feat &feat, TRnaMap *rna_map=nullptr) const
Definition: promote.cpp:206
void x_AddProtFeature(CBioseq_EditHandle pseq, CProt_ref &prp, bool partial_left, bool partial_right) const
Definition: promote.cpp:582
void PromotePub(CSeq_feat_Handle &feat) const
Definition: promote.cpp:404
CScope & x_Scope(void) const
Definition: promote.cpp:604
TFeatTypes m_Types
Definition: promote.hpp:138
bool x_DoPromoteCdregion(void) const
Definition: promote.cpp:564
Uint4 TFlags
Definition: promote.hpp:66
Uint4 TFeatTypes
Definition: promote.hpp:76
TFeatTypes GetFeatTypes(void) const
Definition: promote.cpp:93
void x_SetSeqFeatProduct(CSeq_feat &feat, const CBioseq_Handle &prod) const
Definition: promote.cpp:555
@ eFeatType_Pub
Definition: promote.hpp:74
@ eFeatType_Cdregion
Definition: promote.hpp:72
@ eFeatType_Rna
Definition: promote.hpp:73
void x_PromoteRna(CSeq_feat &feat) const
Definition: promote.cpp:360
void x_PromoteFeatures(CSeq_annot &annot) const
Definition: promote.cpp:142
CBioseq_EditHandle x_MakeNewRna(CSeq_id &id, const string &data, TCoding code, size_t length) const
Definition: promote.cpp:451
void SetFeatTypes(TFeatTypes types)
Definition: promote.cpp:99
TFlags GetFlags(void) const
Definition: promote.cpp:81
void PromoteFeatures(void) const
Definition: promote.cpp:106
void PromoteCdregion(CSeq_feat_Handle &feat) const
Definition: promote.cpp:191
CSeqdesc * x_MakeMolinfoDesc(const CSeq_feat &feat) const
Definition: promote.cpp:533
CBioseq_EditHandle x_MakeNewProtein(CSeq_id &id, const string &data) const
Definition: promote.cpp:460
CBioseq_Handle m_Seq
Definition: promote.hpp:136
CScope –.
Definition: scope.hpp:92
ESubtype GetSubtype(void) const
CSeqFeatXref –.
Definition: SeqFeatXref.hpp:66
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_feat_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CSeq_loc_Mapper –.
class CStaticArrayMap<> is an array adaptor that provides an STLish interface to statically-defined a...
Definition: static_map.hpp:105
TBase::const_iterator const_iterator
Definition: static_map.hpp:109
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
Definition: map.hpp:338
Include a standard set of the NCBI C++ Toolkit most basic headers.
static uch flags
static const struct type types[]
Definition: type.c:22
char data[12]
Definition: iconv.c:80
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
#define LOG_POST_X(err_subcode, message)
Definition: ncbidiag.hpp:553
#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
void Warning(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1191
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
void SetWhole(TWhole &v)
Definition: Seq_loc.hpp:982
bool IsPartialStart(ESeqLocExtremes ext) const
check start or stop of location for e_Lim fuzz
Definition: Seq_loc.cpp:3222
void SetPartialStart(bool val, ESeqLocExtremes ext)
set / remove e_Lim fuzz on start or stop (lt/gt - indicating partial interval)
Definition: Seq_loc.cpp:3280
void SetPartialStop(bool val, ESeqLocExtremes ext)
Definition: Seq_loc.cpp:3313
bool IsPartialStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:3251
static void TranslateCdregion(string &prot, const CBioseq_Handle &bsh, const CSeq_loc &loc, const CCdregion &cdr, bool include_stop=true, bool remove_trailing_X=false, bool *alt_start=0, ETranslationLengthProblemOptions options=eThrowException)
translation coding region into ncbieaa protein sequence
Definition: sequence.cpp:4384
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 AddBioseq(CBioseq &bioseq, TPriority pri=kPriority_Default, EExist action=eExist_Throw)
Add bioseq, return bioseq handle.
Definition: scope.cpp:530
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
CSeq_loc_Mapper_Base & SetMergeAbutting(void)
Merge only abutting intervals, keep overlapping.
@ eLocationToProduct
Map from the feature's location to product.
const CSeq_annot_Handle & GetAnnot(void) const
Get handle to seq-annot for this feature.
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
void SetDescr(TDescr &v) const
CBioseq_EditHandle MoveTo(const CSeq_entry_EditHandle &entry, int index=-1) const
Move current bioseq into seq-entry.
void Remove(void) const
Remove current annot.
virtual CConstRef< CSeq_feat > GetSeq_feat(void) const
void SetInst_Mol(TInst_Mol v) const
void SetInst_Seq_data(TInst_Seq_data &v) const
void SetInst_Length(TInst_Length v) const
CConstRef< CSeq_annot > GetCompleteSeq_annot(void) const
Complete and return const reference to the current seq-annot.
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
CSeq_annot_EditHandle AttachAnnot(CSeq_annot &annot) const
Attach an annotation.
void SetInst_Repr(TInst_Repr v) const
CSeq_entry_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
CBioseq_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
CSeq_annot_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
CScope & GetScope(void) const
Get scope this handle belongs to.
CSeq_entry_Handle GetExactComplexityLevel(CBioseq_set::EClass cls) const
Return level with exact complexity, or empty handle if not found.
CSeqFeatData::E_Choice GetFeatType(void) const
SAnnotSelector & SetResolveNone(void)
SetResolveNone() is equivalent to SetResolveMethod(eResolve_None).
TCoding GetCoding(void) const
Target sequence coding.
Definition: seq_vector.hpp:312
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
Definition: seq_vector.cpp:304
TSeqPos size(void) const
Definition: seq_vector.hpp:291
TObjectType * ReleaseOrNull(void)
Release a reference to the object and return a pointer to the object.
Definition: ncbiobj.hpp:816
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
TObjectType * Release(void)
Release a reference to the object and return a pointer to the object.
Definition: ncbiobj.hpp:846
#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
const TVal & GetVal(void) const
Get the Val member data.
Definition: Gb_qual_.hpp:259
TXref & SetXref(void)
Assign a value to Xref data member.
Definition: Seq_feat_.hpp:1314
void SetData(TData &value)
Assign a value to Data data member.
const TData & GetData(void) const
Get the Data member data.
bool IsProt(void) const
Check if variant Prot is selected.
void SetLocation(TLocation &value)
Assign a value to Location data member.
Definition: Seq_feat_.cpp:131
bool IsCdregion(void) const
Check if variant Cdregion is selected.
const TLoc & GetLoc(void) const
Get the Loc member data.
void SetProduct(TProduct &value)
Assign a value to Product data member.
Definition: Seq_feat_.cpp:110
const TQual & GetQual(void) const
Get the Qual member data.
Definition: Seq_feat_.hpp:1147
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
list< CRef< CCode_break > > TCode_break
Definition: Cdregion_.hpp:111
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_feat_.hpp:925
bool CanGetData(void) const
Check if it is safe to call GetData method.
Definition: Seq_feat_.hpp:919
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
bool IsPub(void) const
Check if variant Pub is selected.
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_feat_.cpp:94
bool CanGetLocation(void) const
Check if it is safe to call GetLocation method.
Definition: Seq_feat_.hpp:1111
TPseudo GetPseudo(void) const
Get the Pseudo member data.
Definition: Seq_feat_.hpp:1365
void SetLoc(TLoc &value)
Assign a value to Loc data member.
const TProduct & GetProduct(void) const
Get the Product member data.
Definition: Seq_feat_.hpp:1096
bool IsSetQual(void) const
Check if a value has been assigned to Qual data member.
Definition: Gb_qual_.hpp:200
bool IsSetPseudo(void) const
annotated on pseudogene? Check if a value has been assigned to Pseudo data member.
Definition: Seq_feat_.hpp:1346
const TXref & GetXref(void) const
Get the Xref member data.
Definition: Seq_feat_.hpp:1308
bool CanGetProduct(void) const
Check if it is safe to call GetProduct method.
Definition: Seq_feat_.hpp:1090
const TQual & GetQual(void) const
Get the Qual member data.
Definition: Gb_qual_.hpp:212
void ResetXref(void)
Reset Xref data member.
Definition: Seq_feat_.cpp:182
TQual & SetQual(void)
Assign a value to Qual data member.
Definition: Seq_feat_.hpp:1153
bool IsSetVal(void) const
Check if a value has been assigned to Val data member.
Definition: Gb_qual_.hpp:247
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
Definition: Seq_feat_.hpp:1084
bool IsRna(void) const
Check if variant Rna is selected.
void ResetQual(void)
Reset Qual data member.
Definition: Seq_feat_.cpp:136
@ e_Pub
publication applies to this seq
@ eClass_nuc_prot
nuc acid and coded proteins
Definition: Bioseq_set_.hpp:99
@ eClass_gen_prod_set
genomic products, chrom+mRNA+protein
void SetCompleteness(TCompleteness value)
Assign a value to Completeness data member.
Definition: MolInfo_.hpp:600
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_annot_.cpp:244
bool IsSetCompleteness(void) const
Check if a value has been assigned to Completeness data member.
Definition: MolInfo_.hpp:569
TId & SetId(void)
Assign a value to Id data member.
Definition: Bioseq_.hpp:296
E_Choice
Choice variants.
Definition: Seq_data_.hpp:102
void SetBiomol(TBiomol value)
Assign a value to Biomol data member.
Definition: MolInfo_.hpp:453
EMol
molecule class in living organism
Definition: Seq_inst_.hpp:108
TCompleteness GetCompleteness(void) const
Get the Completeness member data.
Definition: MolInfo_.hpp:594
list< CRef< CSeq_feat > > TFtable
Definition: Seq_annot_.hpp:193
bool IsFtable(void) const
Check if variant Ftable is selected.
Definition: Seq_annot_.hpp:615
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_annot_.hpp:873
Tdata & Set(void)
Assign a value to data member.
Definition: Seq_descr_.hpp:172
void SetTech(TTech value)
Assign a value to Tech data member.
Definition: MolInfo_.hpp:503
TMolinfo & SetMolinfo(void)
Select the variant.
Definition: Seqdesc_.cpp:594
@ eRepr_raw
continuous sequence
Definition: Seq_inst_.hpp:94
@ eCompleteness_complete
complete biological entity
Definition: MolInfo_.hpp:156
@ eCompleteness_no_left
missing 5' or NH3 end
Definition: MolInfo_.hpp:158
@ eCompleteness_no_right
missing 3' or COOH end
Definition: MolInfo_.hpp:159
@ eCompleteness_no_ends
missing both ends
Definition: MolInfo_.hpp:160
@ eTech_concept_trans
conceptual translation
Definition: MolInfo_.hpp:131
@ e_Ncbieaa
extended ASCII 1 letter aa codes
Definition: Seq_data_.hpp:111
@ eBiomol_pre_RNA
precursor RNA of any sort really
Definition: MolInfo_.hpp:102
@ eBiomol_transcribed_RNA
transcribed RNA other than existing classes
Definition: MolInfo_.hpp:113
Definition of all error codes used in objtools libraries.
constexpr bool empty(list< Ts... >) noexcept
Definition: fix_pub.hpp:45
void PromoteFeatures(CBioseq_Handle &seq, CPromote::TFlags flags, CPromote::TFeatTypes types)
Definition: promote.cpp:615
DEFINE_STATIC_ARRAY_MAP(TBiomolMap, sc_BiomolMap, kBiomolMap)
bool SetMolInfoCompleteness(CMolInfo &mi, bool partial5, bool partial3)
Definition: promote.cpp:663
static const TBiomolPair kBiomolMap[]
Definition: promote.cpp:517
USING_SCOPE(sequence)
void PromoteRna(CBioseq_Handle &seq, CSeq_feat_Handle &feat)
Definition: promote.cpp:650
CStaticPairArrayMap< CSeqFeatData::ESubtype, CMolInfo::TBiomol > TBiomolMap
Definition: promote.cpp:516
SStaticPair< CSeqFeatData::ESubtype, CMolInfo::TBiomol > TBiomolPair
Definition: promote.cpp:515
void PromotePub(CBioseq_Handle &seq, CSeq_feat_Handle &feat)
Definition: promote.cpp:657
void PromoteCdregion(CBioseq_Handle &seq, CSeq_feat_Handle &feat, bool include_stop, bool remove_trailingX)
Definition: promote.cpp:635
SAnnotSelector –.
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...
Definition: static_set.hpp:60
Definition: inftrees.h:24
bool AddSeqEntryToSeqEntry(const objects::CSeq_entry *entry, objects::CSeq_entry_Handle seh, CRef< CCmdComposite > cmd, bool &has_nuc, bool &has_prot, bool create_general_only)
#define _ASSERT
Modified on Fri Sep 20 14:57:44 2024 by modify_doxy.py rev. 669887