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

Go to the SVN repository for this file.

1 /* $Id: create_gene_model_tool_manager.cpp 47080 2022-07-22 18:11:54Z asztalos $
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  * Authors: Mike DiCuccio
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
36 #include <gui/core/document.hpp>
38 
43 #include <gui/objutils/label.hpp>
45 
51 #include <gui/objutils/label.hpp>
53 #include <objmgr/util/sequence.hpp>
57 
60 
61 
63 : CAlgoToolManagerBase("Create Gene Model",
64  "",
65  "Create a gene model from an alignment",
66  "Create a new gene model based on one or more "
67  "alignments of related transcripts to a genome",
68  "https://www.ncbi.nlm.nih.gov/tools/gbench/",
69  "Alignment Creation"),
70  m_ParamsPanel(NULL)
71 {
72 }
73 
74 
76 {
77  return "create_gene_model_tool_manager";
78 }
79 
80 
82 {
83  return "Create Gene Model Tool";
84 }
85 
86 
88 {
90 
92 }
93 
94 
96 {
98 
100 }
101 
102 
104 {
105  if(m_ParamsPanel == NULL) {
107 
109  m_ParamsPanel->Hide(); // to reduce flicker
112 
113  m_ParamsPanel->SetRegistryPath(m_RegPath + ".ParamsPanel");
115  }
116  return true;
117 }
118 
119 
121 {
122  string err;
123  if(m_Params.m_Alignments.size() == 0) {
124  err = "Please select at least one set of alignments!";
125  }
126  if( ! err.empty()) {
128  return false;
129  }
130  return true;
131 }
132 
133 
135 {
136  m_Params.m_Alignments.clear();
137  m_Alignments.clear();
138  ITERATE(vector<TConstScopedObjects>, it, m_InputObjects) {
139  ITERATE(TConstScopedObjects, it2, *it) {
140  const CSeq_align* align = dynamic_cast<const CSeq_align*>(it2->object.GetPointerOrNull());
141  if (align) m_Alignments.push_back(*it2);
142  }
143  }
144 
145  if (m_Alignments.empty()) {
146  x_ConvertInputObjects(CSeq_align::GetTypeInfo(), m_Alignments);
147  }
148 
150 }
151 
153 {
154  TConstScopedObjects temp;
155  for (auto& it: m_Alignments) {
156  if (find(temp.begin(), temp.end(), it) == temp.end()) {
157  temp.push_back(it);
158  }
159  }
160 
161  m_Alignments.assign(temp.begin(), temp.end());
162 }
163 
164 
166 {
167  return m_ParamsPanel;
168 }
169 
170 
172 {
173  return &m_Params;
174 }
175 
176 
178 {
179  return 0;
180 }
181 
183 {
184  if (m_ProjectSelPanel)
186  CSelectProjectOptions options;
188 
190  CRef<CCreateGeneModelTask> task(new CCreateGeneModelTask("Creating gene models", srv, options, m_Params));
191  return task.Release();
192 }
193 
194 //////////////////////////////////////////////////////////////
195 ///SGeneCdsmRnaFeats
196 
198 {
199  CConstRef<CSeq_id> seq_id;
200  if (gene) {
201  CSeq_id_Handle gene_idh = sequence::GetIdHandle(gene->GetLocation(), scope);
202  if (gene_idh) {
203  seq_id = gene_idh.GetSeqId();
204  }
205  }
206  if (!seq_id && cds) {
207  CSeq_id_Handle cds_idh = sequence::GetIdHandle(cds->GetLocation(), scope);
208  if (cds_idh) {
209  seq_id = cds_idh.GetSeqId();
210  if (!cds_idh.GetSeqId()->Match(*seq_id)) {
211  NCBI_USER_THROW("CDS and Gene Seq_ids are not matching!");
212  }
213  }
214  }
215  if (!seq_id && mRNA) {
216  CSeq_id_Handle mRNA_idh = sequence::GetIdHandle(mRNA->GetLocation(), scope);
217  if (mRNA_idh) {
218  seq_id = mRNA_idh.GetSeqId();
219  if (!mRNA_idh.GetSeqId()->Match(*seq_id)) {
220  NCBI_USER_THROW("mRNA and Gene Seq_ids are not matching!");
221  }
222  }
223  }
224  return seq_id;
225 }
226 
228 {
230  if (gene && mRNA) {
231  s_CreateDBXref(*(gene), *(mRNA), dbname);
232  s_CreateXRefLink(*(mRNA), *(gene));
233  s_CreateXRefLink(*(gene), *(mRNA));
234  }
235  if (gene && cds) {
236  s_CreateDBXref(*(gene), *(cds), dbname);
237  s_CreateXRefLink(*(cds), *(gene));
238  s_CreateXRefLink(*(gene), *(cds));
239  }
240  if (cds && mRNA) {
241  s_CreateXRefLink(*(cds), *(mRNA));
242  s_CreateXRefLink(*(mRNA), *(cds));
243  }
244 }
245 
247 {
249  xref->SetId(to_feat.SetId());
250  from_feat.SetXref().push_back(xref);
251 }
252 
253 void SGeneCdsmRnaFeats::s_CreateDBXref(const CSeq_feat& from_feat, CSeq_feat& to_feat, const string& dbname)
254 {
255  if (NStr::IsBlank(dbname) || !from_feat.IsSetDbxref())
256  return;
257 
259  if (tag && tag->IsSetTag()) {
260  if (tag->GetTag().IsId()) {
261  CObject_id::TId id = tag->GetTag().GetId();
262  to_feat.AddDbxref(dbname, id);
263  } else if (tag->GetTag().IsStr()) {
264  CObject_id::TStr str = tag->GetTag().GetStr();
265  to_feat.AddDbxref(dbname, str);
266  }
267  }
268 }
269 
270 
271 ///////////////////////////////////////////////////////////////
272 /// CCreateGeneModelTask
273 
274 const string CCreateGeneModelTask::sGeneDbName("GeneID");
275 
277 {
278 }
279 
281 {
283  if (cmd) {
284  if (m_Params.m_MergeResults) {
285 
287  _ASSERT(m_Scope);
288 
289  CRef<CGBWorkspace> ws = m_Service->GetGBWorkspace();
290  if (!ws) return eFailed;
291 
292  CGBDocument* doc = dynamic_cast<CGBDocument*>(ws->GetProjectFromScope(*m_Scope));
293  if (!doc) return eFailed;
294 
295  ICommandProccessor* cmdProcessor = &doc->GetUndoManager();
296  if (!cmdProcessor) return eFailed;
297 
298  cmdProcessor->Execute(cmd);
299  return eCompleted;
300 
301  } else {
302  if (!m_Items.empty()) {
305 
307  return eCanceled;
309  }
310  return eCompleted;
311  }
312  }
313 
314  return eFailed;
315 }
316 
317 static string s_RetrieveMessage(const string& msg)
318 {
319  if (NStr::IsBlank(msg))
320  return msg;
321 
322  string error(msg);
323  string msg_gmodel("CreateGeneModelFromAlign()");
324  if (NStr::StartsWith(error, msg_gmodel)) {
325  error = error.substr(msg_gmodel.length());
327  }
328 
329  if (!NStr::IsBlank(error)
330  && isalpha((unsigned char)error[0])
331  && islower((unsigned char)error[0])) {
332  error[0] = Upcase(error[0]);
333  }
334  return error;
335 }
336 
338 {
340  ///
341  /// assure we're all in one scope
342  ///
343  CRef<CScope> scope;
344  {{
345  ITERATE( TConstScopedObjects, iter, aligns ){
346  if( !scope ){
347  scope.Reset( const_cast<CScope*>(&*iter->scope) );
348  } else if( scope != &*iter->scope ){
349  scope.Reset();
351  "All alignments must be within the same project"
352  );
353  }
354  }
355  }}
356 
357  m_Scope = scope;
358 
359  ///
360  /// meat goes here
361  ///
363  if( m_Params.m_CreateGene ){
365  }
366  if( m_Params.m_CreateMrna ){
368  }
369  if( m_Params.m_CreateCds ){
371  }
374  }
377  }
378  if( m_Params.m_TranslateCds ){
380  }
383  }
384 
385  bool f_group_by_gene_id = m_Params.m_GroupByGeneId;
386  f_group_by_gene_id &= (opts & CGeneModel::fCreateGene) != 0;
387 
388 
389  list< CRef<CSeq_annot> > annots;
390  CRef<CSeq_entry> entry;
391 
392  TGeneCDSmRNAList generatedFeats;
393  ITERATE( TConstScopedObjects, iter, aligns ){
394  const CSeq_align& align = dynamic_cast<const CSeq_align&>(*iter->object);
395  try
396  {
397  CRef<CSeq_annot> annot( new CSeq_annot() );
398  CRef<CBioseq_set> translated_proteins( new CBioseq_set() );
399  CFeatureGenerator FeatureGenerator(*m_Scope);
401  FeatureGenerator.SetFlags(opts);
402  CConstRef<CSeq_align> clean_align = FeatureGenerator.CleanAlignment(align);
403  FeatureGenerator.ConvertAlignToAnnot(*clean_align, *annot, *translated_proteins);
404 
405  if( annot->IsSetData() ){
406  annots.push_back( annot );
407  if( translated_proteins->IsSetSeq_set() ){
408  if( !entry ){
409  entry.Reset( new CSeq_entry() );
410  }
411  CRef<CSeq_entry> proteins( new CSeq_entry() );
412  proteins->SetSet( *translated_proteins );
413  entry->SetSet().SetSeq_set().push_back( proteins );
414  }
415  x_StoreGeneratedFeats(*annot, generatedFeats);
416  }
417  } catch( CException& e ){
418  LOG_POST( Error << "CreateGeneModel tool failed: " << e.GetMsg() );
419  string msg = s_RetrieveMessage(e.GetMsg());
420  NcbiErrorBox(msg) ;
421  return CRef<CCmdComposite>();
422  }
423  }
424 
425  if (annots.empty())
426  return CRef<CCmdComposite>();
427 
429  ITERATE(TGeneCDSmRNAList, it, generatedFeats) {
430  CConstRef<CSeq_id> id = (*it).GetID(scope);
432  m_GeneModelMap[idh].push_back(*it);
433  }
434  ///
435  /// first, separate by seq-id
436  /// we plan to create a single annotation for each placed sequence
437  ///
438  typedef map<CSeq_id_Handle, list< CRef<CSeq_feat> > > TFeatMap;
439  TFeatMap feats;
440 
441  CRef<CScope> gb_scope;
442  NON_CONST_ITERATE (list< CRef<CSeq_annot> >, iter, annots) {
443  NON_CONST_ITERATE (CSeq_annot::TData::TFtable, i, (*iter)->SetData().SetFtable()) {
444  CSeq_feat& feat = **i;
445  CSeq_id_Handle idh = sequence::GetIdHandle(feat.GetLocation(), scope);
446  if (idh) { // check for an empty handle (e.g., when the location contains more than one id)
447 
448  do { // convert eligible product to GIs
450  || !feat.CanGetProduct()
451  || !feat.GetProduct().IsWhole()
452  || feat.GetProduct().GetWhole().IsGi())
453  break;
454 
455  CBioseq_Handle bsh = scope->GetBioseqHandle(feat.GetProduct().GetWhole());
456  if (!bsh)
457  break;
458  if (bsh.GetTSE_Handle().CanBeEdited()) // was edited with OM methods
459  break;
460  // Available in SC-15
461  //if (bsh.GetTSE_Handle().GetDataLoader() == 0) // was added to the scope by AddBioseq etc.
462  // break;
463 
464  if (!gb_scope) {
466  gb_scope.Reset(new CScope(*obj_mgr));
467  gb_scope->AddDefaults();
468  }
469  TGi gi = sequence::GetGiForId(feat.GetProduct().GetWhole(), *gb_scope);
470  if (gi > ZERO_GI)
471  feat.SetProduct().SetWhole().SetGi(gi);
472  } while (false);
473 
474 
475  // set all seq-id elements to be represented as GI numbers (CR0001)
476  const CSeq_id* seq_id = feat.GetLocation().GetId();
477  if (seq_id && !seq_id->IsGi()) {
478  TGi loc_gi = sequence::GetGiForId(*seq_id, *scope);
479  if (loc_gi > ZERO_GI) {
480  CRef<CSeq_id> new_id(new CSeq_id);
481  new_id->SetGi(loc_gi);
482  feat.SetLocation().SetId(*new_id);
483  }
484  }
485 
486  if (feat.GetData().IsCdregion()) {
487  CCdregion& cds = feat.SetData().SetCdregion();
488  // set CDS genetic code id to one by default (CR0022)
489  if (!cds.IsSetCode()) {
490  int id = 1;
492  code->SetId(id);
493  cds.SetCode(*code);
494  }
495  // set CDS frame to one by default (CR0019)
496  if (!cds.IsSetFrame()) {
498  }
499  }
500 
501  feats[idh].push_back(CRef<CSeq_feat>(&feat));
502  }
503  }
504  }
505  annots.clear();
506 
507  _ASSERT(m_GeneModelMap.size() == feats.size());
508 
509  CTime time(CTime::eCurrent);
510  if (feats.empty())
511  return CRef<CCmdComposite>();
512 
514  CRef<CCmdComposite> cmd(new CCmdComposite("Create New Annotation from Alignment"));
515  NON_CONST_ITERATE( TFeatMap, iter, feats ){
516  list< CRef<CSeq_feat> >::const_iterator feat_it = iter->second.begin();
517  if( feat_it == iter->second.end() ){
518  continue;
519  }
520 
521  TSeqRange range = (*feat_it)->GetLocation().GetTotalRange();
522  for( ++feat_it; feat_it != iter->second.end(); ++feat_it ){
523  range += (*feat_it)->GetLocation().GetTotalRange();
524  }
525 
526  CSeq_id_Handle idh = iter->first;
527  CRef<CSeq_annot> annot(new CSeq_annot());
528  if (!m_Params.m_MergeResults) {
529  string label;
530  CSeq_id_Handle idhbest = sequence::GetId( idh, *scope, sequence::eGetId_Best );
531  idhbest.GetSeqId()->GetLabel( &label, CSeq_id::eContent );
532  label += " (";
533  label += NStr::IntToString( range.GetFrom() + 1, NStr::fWithCommas );
534  label += "..";
535  label += NStr::IntToString( range.GetTo() + 1, NStr::fWithCommas );
536  label += ") ";
537  label += "Gene Models from Alignments";
538  annot->SetNameDesc( "Gene Models from Alignments" );
539  annot->SetTitleDesc( label );
540  annot->SetCreateDate( time );
541  }
542  annot->SetData().SetFtable().insert(
543  annot->SetData().SetFtable().end(),
544  iter->second.begin(), iter->second.end());
545 
546  ///
547  /// make sure we deal with single gene requirements
548  ///
549  if( f_group_by_gene_id ){
550  x_Group_By_GeneID(*annot, model_iter->first);
551  }
552 
553  annots.push_back( annot );
554 
555  if (m_Params.m_MergeResults) {
556  CBioseq_Handle bsh = scope->GetBioseqHandle(idh);
557  if (bsh) {
559 
560  if ( m_Params.m_CreateGene ) {
561  CObject_id::TId max_id = s_FindHighestFeatId(seh);
562  x_AssignIDsAndCrossLinkFeats(*annot, idh, max_id);
563  } else {
564  CRef<CCmdComposite> upd_genes = x_AssignIDsAndUpdateGenes(*annot, idh, seh);
565  if (upd_genes) {
566  cmd->AddCommand(*upd_genes);
567  }
568  }
569  cmd->AddCommand(*CRef<CCmdCreateSeq_annot>(new CCmdCreateSeq_annot(seh, annot.GetObject())));
570  }
571  }
572 
573  ///
574  /// add as appropriate
575  ///
576  if( !m_Params.m_MergeResults ){
577  NON_CONST_ITERATE( list< CRef<CSeq_annot> >, iter, annots ){
578  /// now create a Project Item for the data
579  CObject_id::TId max_id = 0;
580  x_AssignIDsAndCrossLinkFeats(**iter, idh, max_id);
581  CRef<CProjectItem> item(new CProjectItem());
582  item->SetItem().SetAnnot(**iter);
583 
584  string name;
585  CLabel::GetLabel(**iter, &name, CLabel::eDefault, scope.GetPointer());
586  item->SetLabel(name);
587 
588  m_Items.push_back(item);
589  }
590 
591  } else {
592  // We do not need any message like "No items created".
593  }
594 
595  ++model_iter;
596  }
597  return cmd;
598 }
599 
600 
602 {
603  CObject_id::TId gene_id = 0;
605  if( !tag ){
606  tag = feat.GetNamedDbxref("LocusLink");
607  }
608  if( tag ){
609  gene_id = tag->GetTag().GetId();
610  }
611  return gene_id;
612 }
613 
615 {
616  CObject_id::TId id = 0;
617  for (CFeat_CI feat_it(entry); feat_it; ++feat_it) {
618  if (feat_it->IsSetId()) {
619  const CFeat_id& feat_id = feat_it->GetId();
620  if (feat_id.IsLocal() && feat_id.GetLocal().IsId() && feat_id.GetLocal().GetId() > id) {
621  id = feat_id.GetLocal().GetId();
622  }
623  }
624  }
625  return id;
626 }
627 
629 {
630  FOR_EACH_SEQFEAT_ON_SEQANNOT(feat_it, annot) {
631  const CSeq_feat& feat = **feat_it;
632  if (feat.IsSetId() && feat.GetId().IsLocal()) {
633  return true;
634  }
635  }
636  return false;
637 }
638 
640 {
641  FOR_EACH_SEQFEAT_ON_SEQANNOT(feat_it, annot) {
642  const CSeq_feat& feat = **feat_it;
643  if (feat.IsSetXref()) {
645  if ((*it)->IsSetId() && (*it)->GetId().IsLocal())
646  return true;
647  }
648  }
649  }
650  return false;
651 }
652 
654 {
655  SGeneCdsmRnaFeats feats;
656  CSeq_annot::C_Data::TFtable::const_iterator it = annot.GetData().GetFtable().begin();
657  for ( ; it != annot.GetData().GetFtable().end(); ++it) {
658  if ((*it)->IsSetData()) {
659  const CSeqFeatData& data = (*it)->GetData();
660  if (data.IsGene())
661  feats.gene = *it;
662  else if (data.IsCdregion()) {
663  feats.cds = *it;
664  } else if (data.GetSubtype() == CSeqFeatData::eSubtype_mRNA) {
665  feats.mRNA = *it;
666  }
667  }
668  }
669  gene_cds_rna.push_back(feats);
670 }
671 
673 {
674  ///
675  /// now, find the gene for each list of features
676  /// when we're done, create an annotation for each
677  ///
678  typedef map<int, list< CRef<CSeq_feat> > > TGeneFeats;
679  TGeneFeats feats_by_gene;
680 
682  int gene_id = s_GetGeneID(**it);
683  feats_by_gene[gene_id].push_back(*it);
684  }
685 
686  list< CRef<CSeq_feat> > feats;
687  NON_CONST_ITERATE( TGeneFeats, it, feats_by_gene ){
688  if( !it->first ){
689  /// failed to find gene id - pass through
690  feats.insert( feats.end(), it->second.begin(), it->second.end() );
691 
692  } else {
693  /// scan for gene feature
694  CRef<CSeq_feat> gene;
695  TSeqRange longest_range;
696  list< CRef<CSeq_feat> >::iterator i = it->second.begin();
697  while( i != it->second.end() ){
698  CSeq_feat& feat = **i;
699  if( !feat.GetData().IsGene() ){
700  ++i;
701  } else {
702  if( !gene ){
703  gene = *i;
704  longest_range = gene->GetLocation().GetTotalRange();
705  } else {
706  TSeqRange range = (*i)->GetLocation().GetTotalRange();
707  longest_range += range;
708  }
709  i = it->second.erase(i);
710  }
711  }
712 
713  if( gene ){
714  gene->SetLocation().SetInt().SetFrom( longest_range.GetFrom() );
715  gene->SetLocation().SetInt().SetTo( longest_range.GetTo() );
716  feats.push_back( gene );
717  x_GroupGenes(idh, gene);
718  }
719 
720  feats.insert( feats.end(), it->second.begin(), it->second.end() );
721  }
722  }
723 
724  annot.SetData().SetFtable().swap( feats );
725 }
726 
728 {
729  CObject_id::TId gene_id = s_GetGeneID(*gene);
730  if (!gene_id) return;
731 
733  SGeneCdsmRnaFeats& feats = *it;
734  if (feats.gene) {
735  CObject_id::TId this_id = s_GetGeneID(*(feats.gene));
736  if (this_id == gene_id)
737  feats.gene = gene;
738  }
739  }
740 }
741 
743 {
744  if (!s_FeaturesHaveIDs(annot) && !s_FeaturesHaveXrefs(annot)) {
745  s_AssignFeatureIds(annot, max_id);
746 
748  SGeneCdsmRnaFeats& feats = *it;
749  feats.CrossLinkTriple();
750  }
751  }
752 }
753 
755 {
756  EDIT_EACH_SEQFEAT_ON_SEQANNOT(feat_it, annot) {
757  CSeq_feat& feat = **feat_it;
758  if (!feat.IsSetId()) {
759  feat.SetId().SetLocal().SetId(++max_id);
760  } else if (!feat.GetId().IsLocal()){
761  feat.ResetId();
762  feat.SetId().SetLocal().SetId(++max_id);
763  }
764  }
765 }
766 
768 {
770 
771  bool has_xref = false;
772  if (mrna.IsSetXref()) {
773  /// using FeatID from feature cross-references:
774  ///if mRNA refers to a CDS by feature ID, use that feature
775  CBioseq_Handle bsh = scope.GetBioseqHandle(mrna.GetLocation());
776  CTSE_Handle tse = bsh.GetTSE_Handle();
778  if ((*it)->IsSetId() && (*it)->GetId().IsLocal() && (*it)->GetId().GetLocal().IsId()) {
779  CSeq_feat_Handle cdsh = tse.GetFeatureWithId(CSeqFeatData::eSubtype_cdregion, (*it)->GetId().GetLocal().GetId());
780  if (cdsh) {
781  cds = cdsh.GetSeq_feat();
782  }
783  has_xref = true;
784  }
785  }
786  }
787  if (!has_xref) {
788  /// using location to find CDS:
789  /// mRNA must include the CDS location and the internal interval boundaries need to be identical
793  scope);
794  }
795  return cds;
796 }
797 
799 {
800  if (s_FeaturesHaveIDs(annot) || s_FeaturesHaveXrefs(annot)) {
801  return CRef<CCmdComposite>();
802  }
803 
804  CRef<CCmdComposite> cmd(new CCmdComposite("Replace older version of transcripts and update related genes"));
807  if (!it->mRNA)
808  continue;
809  const CSeq_id* it_id = it->mRNA->GetProduct().GetId();
811  if (NStr::IsBlank(new_id)) {
812  NCBI_USER_THROW("Accession for new mRNA transcript_id is not found");
813  }
814 
815  CSeq_feat_Handle fh;
816  for (CFeat_CI mrna_it(seh, SAnnotSelector(CSeqFeatData::eSubtype_mRNA)); mrna_it; ++mrna_it) {
817  CConstRef<CSeq_id> prod_id = mrna_it->GetProductId().GetSeqId();
819  if (NStr::IsBlank(old_id)) {
820  NCBI_USER_THROW("Accession for mRNA transcript_id is not found");
821  }
822  SIZE_TYPE pos = NStr::CommonPrefixSize(old_id, new_id);
823  if (pos == NStr::FindNoCase(old_id, ".") + 1) {
824  string old_version = old_id.substr(pos, NPOS);
825  string new_version = new_id.substr(pos, NPOS);
826  if (NStr::StringToInt(new_version) > NStr::StringToInt(old_version)) {
827  fh = *mrna_it;
828  }
829  break;
830  }
831  }
832 
833  if (!fh)
834  continue;
835 
836  // update the new mRNA with old mRNA's feat-id
837  if (fh.IsSetId()) {
838  CRef<CFeat_id> mrna_id(new CFeat_id);
839  mrna_id->Assign(fh.GetId());
840  it->mRNA->SetId(*mrna_id);
841  }
842 
843  // delete the old mRNA
844  const CSeq_annot_Handle& annot_handle = fh.GetAnnot();
845  CSeq_entry_EditHandle eh = annot_handle.GetParentEntry().GetEditHandle();
846  CRef<CCmdDelSeq_feat> del_mrna(new CCmdDelSeq_feat(fh));
847  cmd->AddCommand(*del_mrna);
848 
849  // update the coding region
851  if (!cds || !it->cds)
852  continue;
853 
854  // update the new CDS with old CDS's feat-id
855  if (cds->IsSetId()) {
856  CRef<CFeat_id> cds_id(new CFeat_id);
857  cds_id->Assign(cds->GetId());
858  it->cds->SetId(*cds_id);
859  }
860 
861  // delete the old CDS
862  CSeq_feat_Handle cdsh = m_Scope->GetSeq_featHandle(*cds);
863  CRef<CCmdDelSeq_feat> del_cds(new CCmdDelSeq_feat(cdsh));
864  cmd->AddCommand(*del_cds);
865 
866  }
867  }
868 
869  CObject_id::TId max_id = s_FindHighestFeatId(seh);
870  s_AssignFeatureIds(annot, max_id);
871 
872  x_GetUpdatedGeneCommand(seh, idh, cmd.GetPointer());
873  return cmd;
874 }
875 
877 {
878  typedef map<CConstRef<CSeq_feat>, TGeneCDSmRNAList> TMapGeneFeats;
879  TMapGeneFeats gene_feats_map;
880 
881  feature::CFeatTree feat_tree;
882  SAnnotSelector sel;
886  CFeat_CI feat_iter(seh, sel);
887 
888  feat_tree.AddFeatures(feat_iter);
889 
891  const SGeneCdsmRnaFeats& feats = *it;
892  if (feats.cds) {
893  CBioseq_Handle proth = seh.GetScope().GetBioseqHandle(feats.cds->GetProduct());
894  const CMappedFeat& mapped_cds = sequence::GetMappedCDSForProduct(proth);
895  feat_tree.AddGenesForCds(mapped_cds);
896 
897  CSeq_feat_Handle fh = feat_tree.GetBestGene(mapped_cds);
898  CConstRef<CSeq_feat> gene_feat;
899  if (fh) {
900  CSeq_id_Handle found_idh = fh.GetLocationId();
901  if (!seh.GetScope().IsSameBioseq(idh, found_idh, CScope::eGetBioseq_All)) {
902  const CSeq_feat& found_feat = *fh.GetOriginalSeq_feat();
903  if (found_feat.GetData().IsGene()) {
904  const CGene_ref& gene_ref = found_feat.GetData().GetGene();
905  if (gene_ref.IsSetLocus()) {
906  for (CFeat_CI feat_it(seh, CSeqFeatData::eSubtype_gene); feat_it; ++feat_it) {
907  if (feat_it->GetData().GetGene().IsSetLocus()
908  && NStr::EqualCase(feat_it->GetData().GetGene().GetLocus(), gene_ref.GetLocus())) {
909  gene_feat = feat_it->GetOriginalSeq_feat();
910  break;
911  }
912  }
913  }
914  }
915  }
916  else {
917  gene_feat = fh.GetOriginalSeq_feat();
918  }
919  }
920  if (gene_feat) {
921  gene_feats_map[gene_feat].push_back(feats);
922  }
923  }
924  }
925 
926  NON_CONST_ITERATE(TMapGeneFeats, it, gene_feats_map) {
927  if (it->first) {
928  const CSeq_feat& gene = *(it->first);
929  CRef<CSeq_feat> new_gene(new CSeq_feat);
930  new_gene->Assign(gene);
931 
932  bool modified = x_UpdateGeneOnSequence(it->second, new_gene);
933  if (modified) {
934  CSeq_feat_Handle fh = m_Scope->GetSeq_featHandle(gene);
935  CIRef<IEditCommand> chg_feat(new CCmdChangeSeq_feat(fh, *new_gene));
936  cmd->AddCommand(*chg_feat);
937  }
938  }
939  }
940 }
941 
943 {
944  if (!gene) return false;
945 
946  // link related features via feature id Xrefs:
947  NON_CONST_ITERATE(TGeneCDSmRNAList, it, gene_cds_rna) {
948  SGeneCdsmRnaFeats& feat = *it;
949  feat.gene.Reset(&(*gene));
950  feat.CrossLinkTriple();
951  }
952 
953  // update the gene range, and set the partialness of the updated gene
954  // gene range is updated to the union of all of its child features' location
955  CConstRef<CDbtag> gene_tag = gene->GetNamedDbxref(sGeneDbName);
956  if (!gene_tag) {
957  NCBI_USER_THROW("Could not update gene range, as no GeneID dbxref was found");
958  }
959 
960  TSeqPos gene_start = gene->GetLocation().GetStart(eExtreme_Positional);
961  TSeqPos gene_stop = gene->GetLocation().GetStop(eExtreme_Positional);
962  TSeqPos gene_start_upd = gene_start, gene_stop_upd = gene_stop;
963  bool partial_start = false, partial_stop = false;
964  ITERATE (TGeneCDSmRNAList, it, gene_cds_rna) {
965  const SGeneCdsmRnaFeats& feat = *it;
966  if (feat.mRNA) {
967  _ASSERT(gene->GetLocation().GetStrand() == feat.mRNA->GetLocation().GetStrand());
968  _ASSERT(feat.mRNA->GetNamedDbxref(sGeneDbName)->Match(*gene_tag));
969 
970  TSeqPos mrna_start = feat.mRNA->GetLocation().GetStart(eExtreme_Positional);
971  TSeqPos mrna_stop = feat.mRNA->GetLocation().GetStop(eExtreme_Positional);
972  if (mrna_start < gene_start_upd) {
973  gene_start_upd = mrna_start;
974  partial_start = feat.mRNA->GetLocation().IsPartialStart(eExtreme_Positional);
975  }
976  if (mrna_stop > gene_stop_upd) {
977  gene_stop_upd = mrna_stop;
978  partial_stop = feat.mRNA->GetLocation().IsPartialStop(eExtreme_Positional);
979  }
980 
981  } else if (feat.cds) {
982  _ASSERT(gene->GetLocation().GetStrand() == feat.cds->GetLocation().GetStrand());
983  _ASSERT(feat.cds->GetNamedDbxref(sGeneDbName)->Match(*gene_tag));
984 
985  TSeqPos cds_start = feat.cds->GetLocation().GetStart(eExtreme_Positional);
986  TSeqPos cds_stop = feat.cds->GetLocation().GetStop(eExtreme_Positional);
987  if (cds_start < gene_start_upd) {
988  gene_start_upd = cds_start;
989  partial_start = feat.cds->GetLocation().IsPartialStart(eExtreme_Positional);
990  }
991  if (cds_stop > gene_stop_upd) {
992  gene_stop_upd = cds_stop;
993  partial_stop = feat.cds->GetLocation().IsPartialStop(eExtreme_Positional);
994  }
995  }
996  }
997 
998  // for one gene end:
999  // if gene is complete and its child is partial, that end becomes partial
1000  // if gene is partial and is child is complete, that end becomes complete
1001  bool modified = false;
1002  if (gene_start_upd < gene_start) {
1003  gene->SetLocation().SetInt().SetFrom(gene_start_upd);
1004  modified = true;
1006  if (partial_start) {
1007  // do nothing
1008  } else {
1009  gene->SetLocation().SetPartialStart(false, eExtreme_Positional);
1010  }
1011 
1012  } else {
1013  if (partial_start) {
1014  gene->SetLocation().SetPartialStart(true, eExtreme_Positional);
1015  } else {
1016  // do nothing
1017  }
1018  }
1019  }
1020 
1021 
1022  if (gene_stop_upd > gene_stop) {
1023  gene->SetLocation().SetInt().SetTo(gene_stop_upd);
1024  modified = true;
1026  if (partial_stop) {
1027  // do nothing
1028  } else {
1029  gene->SetLocation().SetPartialStop(false, eExtreme_Positional);
1030  }
1031  } else {
1032  if (partial_stop) {
1033  gene->SetLocation().SetPartialStop(true, eExtreme_Positional);
1034  } else {
1035  // do nothing
1036  }
1037  }
1038  }
1039 
1040  // set the partial flag if at least one end of the gene is partial
1041  // unset the flag, if both ends are complete
1044  gene->SetPartial(true);
1045  } else {
1046  gene->ResetPartial();
1047  }
1048 
1049 
1050  return modified;
1051 }
1052 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
@ eExtreme_Positional
numerical value
Definition: Na_strand.hpp:63
User-defined methods of the data storage class.
CAlgoToolManagerBase This is base class for simple algorithmic tool managers.
CUIObject m_Descriptor
describes the Manager's UI properties
CProjectSelectorPanel * m_ProjectSelPanel
virtual void InitUI()
override this function in a derived class and initialize extra members
string m_RegPath
registry path to the settings
wxWindow * m_ParentWindow
a window that will serve as a parent for our panels
virtual void CleanUI()
override this function in a derived class and clean extra members
void x_ConvertInputObjects(const CTypeInfo *typeInfo, map< string, TConstScopedObjects > &results)
vector< TConstScopedObjects > m_InputObjects
original input objects, the tool needs to select a subset of objects that can serve as valid input
SProjectSelectorParams m_ProjectParams
CAlgoToolManagerParamsPanel.
CBioseq_Handle –.
CCdregion –.
Definition: Cdregion.hpp:66
bool Create(wxWindow *parent, wxWindowID id=ID_GENEMODELPARAMSPANEL, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxTAB_TRAVERSAL)
virtual void SetRegistryPath(const string &path)
CAlgoToolManagerParamsPanel.
void SetParams(SCreateGeneModelParams *params, TConstScopedObjects *objects)
CDataLoadingAppJob - a base class for Jobs loading data into projects.
CFeat_CI –.
Definition: feat_ci.hpp:64
CFeat_id –.
Definition: Feat_id.hpp:66
CRef< objects::CSeq_feat > ConvertAlignToAnnot(const objects::CSeq_align &align, objects::CSeq_annot &annot, objects::CBioseq_set &seqs, Int8 gene_id=0, const objects::CSeq_feat *cdregion_on_mrna=NULL)
Convert an alignment to an annotation.
void SetFlags(TFeatureGeneratorFlags)
Definition: gene_model.cpp:195
void SetAllowedUnaligned(TSeqPos)
Definition: gene_model.cpp:215
static const TSeqPos kDefaultAllowedUnaligned
Definition: gene_model.hpp:128
CConstRef< objects::CSeq_align > CleanAlignment(const objects::CSeq_align &align)
Clean an alignment according to our best guess of its biological representation.
Definition: gene_model.cpp:221
CGBDocument.
Definition: document.hpp:113
CUndoManager & GetUndoManager()
Definition: document.hpp:158
CMappedFeat –.
Definition: mapped_feat.hpp:59
static void PrefetchSeqDescr(IServiceLocator *serviceLocator, const vector< CRef< objects::CProjectItem > > &items)
void GetParams(SProjectSelectorParams &params) const
CProjectService - a service providing API for operations with Workspaces and Projects.
CRef –.
Definition: ncbiobj.hpp:618
CScope –.
Definition: scope.hpp:92
CProjectSelectOptions - describes how new Project Items shall be added to a workspace.
bool AddItemsToWorkspace(CProjectService *service, const TData &data)
CSeqFeatXref –.
Definition: SeqFeatXref.hpp:66
CSeq_annot_Handle –.
void SetNameDesc(const string &name)
Definition: Seq_annot.cpp:66
void SetCreateDate(const CTime &dt)
Definition: Seq_annot.cpp:121
void SetTitleDesc(const string &title)
Definition: Seq_annot.cpp:96
CSeq_entry_Handle –.
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
CSeq_feat_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CConstRef< CDbtag > GetNamedDbxref(const CTempString &db) const
Return a specified DB xref.
Definition: Seq_feat.cpp:415
void AddDbxref(const string &db_name, const string &db_key)
add a DB xref to this feature
Definition: Seq_feat.cpp:347
CSeq_feat_Handle GetFeatureWithId(CSeqFeatData::E_Choice type, TFeatureIdInt id) const
Definition: tse_handle.cpp:635
bool CanBeEdited(void) const
Return true if this TSE handle is local to scope and can be edited.
Definition: tse_handle.cpp:229
CTime –.
Definition: ncbitime.hpp:296
IAppTask.
Definition: app_task.hpp:83
Undo/Redo interface for editing operations.
virtual void Execute(IEditCommand *command, wxWindow *window=0)=0
IRegSettings An interface for objects that save / restore settings using CGuiRegistry.
size_type size() const
Definition: map.hpp:148
const_iterator begin() const
Definition: map.hpp:151
void clear()
Definition: map.hpp:169
USING_SCOPE(objects)
static string s_RetrieveMessage(const string &msg)
static CConstRef< CSeq_feat > s_GetCDSformRNA(const CSeq_feat &mrna, CScope &scope)
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
static const char * str(char *buf, int n)
Definition: stats.c:84
char data[12]
Definition: iconv.c:80
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
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
#define ZERO_GI
Definition: ncbimisc.hpp:1088
#define NULL
Definition: ncbistd.hpp:225
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
#define NCBI_USER_THROW(message)
Throw a quick-and-dirty runtime exception of type 'CException' with the given error message and error...
Definition: ncbiexpt.hpp:715
void Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
#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
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
Definition: service.hpp:91
ETaskState
List of task states defining the task management FSM.
Definition: app_task.hpp:87
@ eCanceled
canceled by Task Manager
Definition: app_task.hpp:94
@ eFailed
failed during execution
Definition: app_task.hpp:93
@ eCompleted
successfully finished
Definition: app_task.hpp:92
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
CRef< CCmdComposite > x_AssignIDsAndUpdateGenes(objects::CSeq_annot &annot, const objects::CSeq_id_Handle &idh, objects::CSeq_entry_Handle seh)
void x_StoreGeneratedFeats(const objects::CSeq_annot &annot, TGeneCDSmRNAList &gene_cds_rna) const
void x_GroupGenes(const objects::CSeq_id_Handle &idh, CRef< objects::CSeq_feat > gene)
void x_AssignIDsAndCrossLinkFeats(objects::CSeq_annot &annot, const objects::CSeq_id_Handle &idh, objects::CObject_id::TId max_id)
virtual bool x_ValidateParams()
validates user input in Parameters panel, report errors if any
static bool s_FeaturesHaveXrefs(const objects::CSeq_annot &annot)
void x_Group_By_GeneID(objects::CSeq_annot &annot, const objects::CSeq_id_Handle &idh)
static const string sGeneDbName
CCreateGeneModelTask.
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
CRef< CCmdComposite > x_GetCommand()
static objects::CObject_id::TId s_FindHighestFeatId(const objects::CSeq_entry_Handle seh)
list< SGeneCdsmRnaFeats > TGeneCDSmRNAList
a loader might be tied with a specific project item.
virtual IRegSettings * x_GetParamsAsRegSetting()
return a pointer to Parameters object as IRegSettings interface
virtual CAlgoToolManagerParamsPanel * x_GetParamsPanel()
returns a pointer to the parameters panel, override in derived classes
void x_GetUpdatedGeneCommand(objects::CSeq_entry_Handle seh, const objects::CSeq_id_Handle &idh, CCmdComposite *cmd)
static void s_CreateXRefLink(objects::CSeq_feat &from_feat, objects::CSeq_feat &to_feat)
CConstRef< objects::CSeq_id > GetID(objects::CScope *scope) const
SGeneCdsmRnaFeats.
virtual void CleanUI()
override this function in a derived class and clean extra members
virtual ETaskState x_Run()
override this function in derived classes
static bool s_FeaturesHaveIDs(const objects::CSeq_annot &annot)
virtual CDataLoadingAppJob * x_CreateLoadingJob()
factory method for creating the job that executes the tool algorithm override in derived classes
static void s_AssignFeatureIds(objects::CSeq_annot &annot, objects::CObject_id::TId &max_id)
CRef< objects::CSeq_feat > cds
virtual bool x_CreateParamsPanelIfNeeded()
returns / creates Parameters panel, override in derived classes see cpp file for example
CRef< objects::CSeq_feat > gene
virtual IAppTask * GetTask()
Once parameters are gathered and validated this function is called to produce the final Task object t...
static objects::CObject_id::TId s_GetGeneID(const objects::CSeq_feat &feat)
virtual void InitUI()
override this function in a derived class and initialize extra members
CCreateGeneModelParamsPanel * m_ParamsPanel
CSelectProjectOptions::TItems m_Items
CIRef< CProjectService > m_Service
static void s_CreateDBXref(const objects::CSeq_feat &from_feat, objects::CSeq_feat &to_feat, const string &dbname)
bool x_UpdateGeneOnSequence(TGeneCDSmRNAList &gene_cds_rna, CRef< objects::CSeq_feat > gene)
CRef< objects::CSeq_feat > mRNA
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
Definition: label.cpp:140
void NcbiErrorBox(const string &message, const string &title="Error")
specialized Message Box function for reporting critical errors
virtual const string & GetLabel() const
Definition: ui_object.cpp:124
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
@ eDefault
Definition: label.hpp:73
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
Definition: Seq_id.cpp:2040
CConstRef< CSeq_id > GetSeqId(void) const
bool Match(const CSeq_id &sid2) const
Match() - TRUE if SeqIds are equivalent.
Definition: Seq_id.hpp:1065
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
@ eContent
Untagged human-readable accession or the like.
Definition: Seq_id.hpp:605
bool IsPartialStart(ESeqLocExtremes ext) const
check start or stop of location for e_Lim fuzz
Definition: Seq_loc.cpp:3222
ENa_strand GetStrand(void) const
Get the location's strand.
Definition: Seq_loc.cpp:882
TRange GetTotalRange(void) const
Definition: Seq_loc.hpp:913
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
Definition: Seq_loc.cpp:915
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
Definition: Seq_loc.hpp:941
bool IsPartialStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:3251
TSeqPos GetStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:963
CMappedFeat GetBestOverlappingFeat(const CMappedFeat &feat, CSeqFeatData::ESubtype need_subtype, sequence::EOverlapType overlap_type, CFeatTree *feat_tree=0, const SAnnotSelector *base_sel=0)
Definition: feature.cpp:3653
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
CSeq_id_Handle GetIdHandle(const CSeq_loc &loc, CScope *scope)
@ eOverlap_CheckIntervals
2nd is a subset of 1st with matching boundaries
string GetAccessionForId(const objects::CSeq_id &id, CScope &scope, EAccessionVersion use_version=eWithAccessionVersion, EGetIdType flags=0)
Retrieve the accession string for a Seq-id.
Definition: sequence.cpp:708
TGi GetGiForId(const objects::CSeq_id &id, CScope &scope, EGetIdType flags=0)
Given a Seq-id retrieve the corresponding GI.
Definition: sequence.cpp:668
CMappedFeat GetMappedCDSForProduct(const CBioseq_Handle &product)
Definition: sequence.cpp:2568
@ eWithAccessionVersion
accession.version (when possible)
Definition: sequence.hpp:91
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
Definition: sequence.hpp:101
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
Definition: scope.cpp:504
bool IsSameBioseq(const CSeq_id_Handle &id1, const CSeq_id_Handle &id2, EGetBioseqFlag get_flag)
Check if two seq-ids are resolved to the same Bioseq.
Definition: scope.cpp:168
@ eGetBioseq_All
Search bioseq, load if not loaded yet.
Definition: scope.hpp:128
virtual CSeq_id_Handle GetLocationId(void) const
const CFeat_id & GetId(void) const
bool IsSetId(void) const
const CTSE_Handle & GetTSE_Handle(void) const
Get CTSE_Handle of containing TSE.
const CSeq_annot_Handle & GetAnnot(void) const
Get handle to seq-annot for this feature.
virtual CConstRef< CSeq_feat > GetSeq_feat(void) const
CSeq_entry_Handle GetParentEntry(void) const
Get parent Seq-entry handle.
CSeq_entry_EditHandle GetEditHandle(void) const
Get 'edit' version of handle.
CScope & GetScope(void) const
Get scope this handle belongs to.
CConstRef< CSeq_feat > GetOriginalSeq_feat(void) const
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
SAnnotSelector & IncludeFeatType(TFeatType type)
Include feature type in the search.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
TObjectType & GetObject(void)
Get object.
Definition: ncbiobj.hpp:1011
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
char Upcase(char c)
Definition: ncbistre.hpp:917
NCBI_NS_STD::string::size_type SIZE_TYPE
Definition: ncbistr.hpp:132
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
Definition: ncbistr.cpp:630
static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
Definition: ncbistr.cpp:2993
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
#define NPOS
Definition: ncbistr.hpp:133
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
static bool EqualCase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-sensitive equality of a substring with another string.
Definition: ncbistr.hpp:5325
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5412
static string Sanitize(CTempString str, TSS_Flags flags=fSS_print)
Sanitize a string, allowing only specified classes of characters.
Definition: ncbistr.hpp:2876
static SIZE_TYPE CommonPrefixSize(const CTempString s1, const CTempString s2)
Determine the common prefix of two strings.
Definition: ncbistr.hpp:5450
@ fSS_Reject
Reject specified characters, allow all other.
Definition: ncbistr.hpp:2843
@ fSS_punct
Check on ispunct()
Definition: ncbistr.hpp:2840
@ fWithCommas
Use commas as thousands separator.
Definition: ncbistr.hpp:254
@ eCurrent
Use current time. See also CCurrentTime.
Definition: ncbitime.hpp:300
static const char label[]
TTo GetTo(void) const
Get the To member data.
Definition: Range_.hpp:269
TFrom GetFrom(void) const
Get the From member data.
Definition: Range_.hpp:222
void SetLabel(const TLabel &value)
Assign a value to Label data member.
void SetItem(TItem &value)
Assign a value to Item data member.
bool IsSetLocus(void) const
Official gene symbol Check if a value has been assigned to Locus data member.
Definition: Gene_ref_.hpp:493
const TLocus & GetLocus(void) const
Get the Locus member data.
Definition: Gene_ref_.hpp:505
bool IsId(void) const
Check if variant Id is selected.
Definition: Object_id_.hpp:264
TId GetId(void) const
Get the variant data.
Definition: Object_id_.hpp:270
TXref & SetXref(void)
Assign a value to Xref data member.
Definition: Seq_feat_.hpp:1314
void ResetPartial(void)
Reset Partial data member.
Definition: Seq_feat_.hpp:955
bool IsSetCode(void) const
genetic code used Check if a value has been assigned to Code data member.
Definition: Cdregion_.hpp:700
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.
void SetPartial(TPartial value)
Assign a value to Partial data member.
Definition: Seq_feat_.hpp:971
void SetProduct(TProduct &value)
Assign a value to Product data member.
Definition: Seq_feat_.cpp:110
const TId & GetId(void) const
Get the Id member data.
Definition: Seq_feat_.hpp:904
const TLocal & GetLocal(void) const
Get the variant data.
Definition: Feat_id_.cpp:134
void SetCode(TCode &value)
Assign a value to Code data member.
Definition: Cdregion_.cpp:68
bool IsSetXref(void) const
cite other relevant features Check if a value has been assigned to Xref data member.
Definition: Seq_feat_.hpp:1296
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
bool IsLocal(void) const
Check if variant Local is selected.
Definition: Feat_id_.hpp:353
bool IsGene(void) const
Check if variant Gene is selected.
void ResetId(void)
Reset Id data member.
Definition: Seq_feat_.cpp:68
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_feat_.hpp:925
void SetId(TId &value)
Assign a value to Id data member.
Definition: Seq_feat_.cpp:73
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_feat_.cpp:94
bool IsSetId(void) const
Check if a value has been assigned to Id data member.
Definition: Seq_feat_.hpp:892
const TProduct & GetProduct(void) const
Get the Product member data.
Definition: Seq_feat_.hpp:1096
const TGene & GetGene(void) const
Get the variant data.
bool CanGetProduct(void) const
Check if it is safe to call GetProduct method.
Definition: Seq_feat_.hpp:1090
bool IsSetDbxref(void) const
support for xref to other databases Check if a value has been assigned to Dbxref data member.
Definition: Seq_feat_.hpp:1321
void SetFrame(TFrame value)
Assign a value to Frame data member.
Definition: Cdregion_.hpp:540
bool IsSetFrame(void) const
Check if a value has been assigned to Frame data member.
Definition: Cdregion_.hpp:509
const TWhole & GetWhole(void) const
Get the variant data.
Definition: Seq_loc_.cpp:172
TGi & SetGi(void)
Select the variant.
Definition: Seq_id_.hpp:896
bool IsGi(void) const
Check if variant Gi is selected.
Definition: Seq_id_.hpp:883
bool IsWhole(void) const
Check if variant Whole is selected.
Definition: Seq_loc_.hpp:522
TSet & SetSet(void)
Select the variant.
Definition: Seq_entry_.cpp:130
bool IsSetSeq_set(void) const
Check if a value has been assigned to Seq_set data member.
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_annot_.cpp:244
bool IsSetData(void) const
Check if a value has been assigned to Data data member.
Definition: Seq_annot_.hpp:861
const TFtable & GetFtable(void) const
Get the variant data.
Definition: Seq_annot_.hpp:621
list< CRef< CSeq_feat > > TFtable
Definition: Seq_annot_.hpp:193
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_annot_.hpp:873
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Definition: dblib.c:6929
int i
range(_Ty, _Ty) -> range< _Ty >
const char * tag
int isalpha(Uchar c)
Definition: ncbictype.hpp:61
int islower(Uchar c)
Definition: ncbictype.hpp:66
The Object manager core.
#define EDIT_EACH_SEQFEAT_ON_SEQANNOT(Itr, Var)
Definition: seq_macros.hpp:413
#define FOR_EACH_SEQFEAT_ON_SEQANNOT(Itr, Var)
FOR_EACH_SEQFEAT_ON_SEQANNOT EDIT_EACH_SEQFEAT_ON_SEQANNOT.
Definition: seq_macros.hpp:410
#define FOR_EACH_SEQFEATXREF_ON_SEQFEAT(Itr, Var)
FOR_EACH_SEQFEATXREF_ON_SEQFEAT EDIT_EACH_SEQFEATXREF_ON_SEQFEAT.
SAnnotSelector –.
void ToLoadingOptions(CSelectProjectOptions &options)
Definition: inftrees.h:24
#define _ASSERT
Modified on Wed Apr 17 13:08:22 2024 by modify_doxy.py rev. 669887