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

Go to the SVN repository for this file.

1 /* $Id: convert_feat.cpp 45230 2020-06-18 20:00:43Z 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: Colleen Bollin
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
49 
50 #include <objmgr/feat_ci.hpp>
51 #include <objmgr/util/sequence.hpp>
60 
63 
64 
66  : m_To(feat_to) , m_From(feat_from)
67 {
68  m_Options.clear();
71  }
74  } else if (m_To == CSeqFeatData::eSubtype_site) {
76  } else if (m_To == CSeqFeatData::eSubtype_bond) {
78  } else if (m_To == CSeqFeatData::eSubtype_region && !x_IsProtSubtype(feat_from)) {
80  } else if (m_To == CSeqFeatData::eSubtype_cdregion) {
82  }
83 }
84 
85 
86 // often a class converts to a single subtype, but this can be overridden
87 // for example, converting to different subtypes of RNAs or import features
89 {
90  if (subtype == m_To) {
91  return true;
92  } else {
93  return false;
94  }
95 }
96 
97 
98 // often a class converts to a single subtype, but this can be overridden
99 // for example, converting to different subtypes of RNAs or import features
101 {
102  if (subtype == m_From) {
103  return true;
104  } else {
105  return false;
106  }
107 }
108 
109 
111 {
112  CRef<CSeq_feat> new_feat(new CSeq_feat());
113  new_feat->Assign(orig);
114  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
115 
116  return cmd;
117 }
118 
119 
121 {
123  switch (subtype) {
126  break;
129  processed = CProt_ref::eProcessed_mature;
130  break;
134  break;
138  break;
139  default:
140  break;
141  }
142  return processed;
143 }
144 
145 
147 {
149 
150  switch (subtype) {
153  rna_type = CRNA_ref::eType_premsg;
154  break;
156  rna_type = CRNA_ref::eType_mRNA;
157  break;
159  rna_type = CRNA_ref::eType_tRNA;
160  break;
162  rna_type = CRNA_ref::eType_rRNA;
163  break;
165  rna_type = CRNA_ref::eType_snRNA;
166  break;
168  rna_type = CRNA_ref::eType_scRNA;
169  break;
171  rna_type = CRNA_ref::eType_snoRNA;
172  break;
174  rna_type = CRNA_ref::eType_ncRNA;
175  break;
177  rna_type = CRNA_ref::eType_tmRNA;
178  break;
180  rna_type = CRNA_ref::eType_miscRNA;
181  break;
183  rna_type = CRNA_ref::eType_other;
184  break;
185  default:
186  // leave as unknown;
187  break;
188  }
189  return rna_type;
190 }
191 
192 
194 {
195  CRef<CCmdComposite> cmd(new CCmdComposite("Convert Feature"));
196 
197  if (x_IsProtSubtype(m_To)) {
198  new_feat->SetData().SetProt().SetProcessed(GetProtProcessedFromFeatureSubtype(m_To));
199  } else if (x_IsRnaSubtype(m_To)) {
200  new_feat->SetData().SetRna().SetType(GetRnaTypeFromFeatureSubtype(m_To));
201  } else if (x_IsImportSubtype(m_To)) {
202  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
203  }
204 
205  if (new_feat->IsSetProduct()) {
206  CRef<CConversionOption> remove_transcript = FindRemoveTranscriptId();
207  if (!remove_transcript || (remove_transcript && remove_transcript->IsBool() && remove_transcript->GetBool()->GetVal())) {
208  new_feat->ResetProduct();
209  }
210  }
213  if (ncrna_class && ncrna_class->IsString() && !NStr::IsBlank(ncrna_class->GetString()->GetVal())) {
214  new_feat->SetData().SetRna().SetExt().SetGen().SetClass(ncrna_class->GetString()->GetVal());
215  }
216  }
219  if (site_type && site_type->IsString() && !NStr::IsBlank(site_type->GetString()->GetVal())) {
220  new_feat->SetData().SetSite(m_SiteList.GetSiteType(site_type->GetString()->GetVal()));
221  }
222  }
225  if (bond_type && bond_type->IsString() && !NStr::IsBlank(bond_type->GetString()->GetVal())) {
226  new_feat->SetData().SetBond(m_BondList.GetBondType(bond_type->GetString()->GetVal()));
227  }
228  }
231  if (on_prot && on_prot->IsBool() && on_prot->GetBool()->GetVal()) {
232  if (!x_MoveFeatureToProtein(orig, new_feat, keep_orig, scope)) {
233  return CRef<CCmdComposite>(NULL);
234  }
235  }
236  }
237 
238 
239  if (keep_orig) {
240  CBioseq_Handle bsh = scope.GetBioseqHandle(new_feat->GetLocation());
242  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_feat)));
243  } else {
244  // create new feature
245  CBioseq_Handle bsh = scope.GetBioseqHandle(new_feat->GetLocation());
247  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_feat)));
248  // delete original feature (will also remove product and renormalize nuc-prot set
249  cmd->AddCommand(*GetDeleteFeatureCommand(scope.GetSeq_featHandle(orig)));
250  }
251 
253  if (remove_gene && remove_gene->IsBool() && remove_gene->GetBool()->GetVal() && !(orig.IsSetData() && orig.GetData().IsGene())) {
254  CConstRef<CSeq_feat> gene = sequence::GetOverlappingGene(orig.GetLocation(), scope);
255  if (gene) {
256  cmd->AddCommand(*GetDeleteFeatureCommand(scope.GetSeq_featHandle(*gene)));
257  }
258  }
259 
261  if (remove_mrna && remove_mrna->IsBool() && remove_mrna->GetBool()->GetVal() && !(orig.IsSetData() && orig.GetData().GetSubtype() == CSeqFeatData::eSubtype_mRNA)) {
262  CConstRef<CSeq_feat> mrna = sequence::GetOverlappingmRNA(orig.GetLocation(), scope);
263  if (mrna) {
264  cmd->AddCommand(*GetDeleteFeatureCommand(scope.GetSeq_featHandle(*mrna)));
265  }
266  }
267 
268  return cmd;
269 }
270 
271 
273  (const CSeq_feat& orig,
274  CRef<CSeq_feat> new_feat,
275  bool keep_orig,
276  CScope& scope,
277  vector<string> products)
278 {
279  bool make_pseudo = false;
281  if (is_pseudo && is_pseudo->IsBool() && is_pseudo->GetBool()->GetVal()) {
282  make_pseudo = true;
283  }
285  if (make_pseudo) {
286  new_feat->SetPseudo(true);
287  ITERATE(vector<string>, it, products) {
288  x_AddToComment(*it, new_feat);
289  }
290  cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
291  } else {
292  // translate new coding region
293  CBioseq_Handle bsh = scope.GetBioseqHandle(new_feat->GetLocation());
298  ITERATE(vector<string>, it, products) {
299  prot->SetData().SetProt().SetName().push_back(*it);
300  }
301 
303  cmd.Reset(new CCmdComposite("Convert to coding region"));
304  cmd->AddCommand(*CRef<CCmdAddSeqEntry>(new CCmdAddSeqEntry(protein, seh)));
305  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_feat)));
306  if (!keep_orig) {
307  cmd->AddCommand(*GetDeleteFeatureCommand(scope.GetSeq_featHandle(orig)));
308  }
309  }
310 
311  return cmd;
312 }
313 
314 
316 {
317  string product = "";
318  if (orig.IsSetProduct()) {
319  CBioseq_Handle bsh = scope.GetBioseqHandle(orig.GetProduct());
320  if (bsh) {
322  if (f && f->IsSetData() && f->GetData().IsProt()
323  && f->GetData().GetProt().IsSetName()
324  && f->GetData().GetProt().GetName().size() > 0) {
325  product = f->GetData().GetProt().GetName().front();
326  }
327  }
328  } else if (orig.IsSetXref()) {
329  ITERATE(CSeq_feat::TXref, it, orig.GetXref()) {
330  if ((*it)->IsSetData() && (*it)->GetData().IsProt()
331  && (*it)->GetData().GetProt().IsSetName()
332  && (*it)->GetData().GetProt().GetName().size() > 0) {
333  product = (*it)->GetData().GetProt().GetName().front();
334  }
335  }
336  }
337  return product;
338 }
339 
340 static void AdjustMappedStop(CRef<CSeq_loc> loc, const CSeq_loc &product, CScope& scope)
341 {
342  CBioseq_Handle protein = scope.GetBioseqHandle(product);
343  if (protein)
344  {
345  TSeqPos length = protein.GetBioseqLength();
346  if ( loc && loc->GetId() && loc->GetStop(eExtreme_Positional) >= length)
347  {
348  CRef<CSeq_id> prot_id(new CSeq_id);
349  prot_id->Assign(*loc->GetId());
350  bool partial_stop = loc->IsPartialStop(eExtreme_Positional);
351  CSeq_loc sub(*prot_id, length, loc->GetStop(eExtreme_Positional), loc->GetStrand());
353  new_loc->SetPartialStop(partial_stop, eExtreme_Positional);
354  loc->Assign(*new_loc);
355  }
356  }
357 }
358 
360 {
361  if (orig.GetData().IsCdregion() && keep_orig) {
362  if (!orig.IsSetProduct()) {
363  return false;
364  }
366  mapper.SetMergeAbutting();
367  CRef<CSeq_loc> loc = mapper.Map(orig.GetLocation());
368  if ( !loc || loc->Which() == CSeq_loc::e_Null) {
369  return false;
370  }
371  AdjustMappedStop(loc, orig.GetProduct(), scope);
372  new_feat->SetLocation().Assign(*loc);
373  } else {
376  if (!overlapping_cds || !overlapping_cds->IsSetProduct() || overlapping_cds.GetPointer() == &orig) {
377  return false;
378  } else {
379  CSeq_loc_Mapper mapper(*overlapping_cds, CSeq_loc_Mapper::eLocationToProduct, &scope);
380  mapper.SetMergeAbutting();
381  CRef<CSeq_loc> loc = mapper.Map(orig.GetLocation());
382  if ( !loc || loc->Which() == CSeq_loc::e_Null) {
383  return false;
384  }
385  AdjustMappedStop(loc, overlapping_cds->GetProduct(), scope);
386  new_feat->SetLocation().Assign(*loc);
387  }
388  }
389  return true;
390 }
391 
392 
393 vector<string> CConvertFeatureBase::x_ExtractQuals(CRef<CSeq_feat> new_feat, string qual_name)
394 {
395  vector<string> vals;
396 
397  if (new_feat->IsSetQual()) {
398  CSeq_feat::TQual::iterator it = new_feat->SetQual().begin();
399  while (it != new_feat->SetQual().end()) {
400  if ((*it)->IsSetQual() && NStr::EqualNocase((*it)->GetQual(), qual_name)) {
401  if ((*it)->IsSetVal() && !NStr::IsBlank((*it)->GetVal())) {
402  vals.push_back((*it)->GetVal());
403  }
404  it = new_feat->SetQual().erase(it);
405  } else {
406  ++it;
407  }
408  }
409  if (new_feat->GetQual().size() == 0) {
410  new_feat->ResetQual();
411  }
412  }
413  return vals;
414 }
415 
416 
418 {
419  return x_ExtractQuals(new_feat, "product");
420 }
421 
422 void CConvertFeatureBase::x_AddToComment(string comment, CRef<CSeq_feat> new_feat, edit::EExistingText existing_text)
423 {
424  if (NStr::IsBlank(comment)) {
425  return;
426  }
427 
428  if (!new_feat->IsSetComment() || NStr::IsBlank(new_feat->GetComment())) {
429  new_feat->SetComment(comment);
430  } else {
431  string orig_val = new_feat->GetComment();
432  if (edit::AddValueToString(orig_val, comment, existing_text)) {
433  new_feat->SetComment(orig_val);
434  }
435  }
436 }
437 
439 {
440  new_feat->ResetId();
441  new_feat->SetLocation().SetPartialStart(false, eExtreme_Biological);
442  new_feat->SetLocation().SetPartialStop(false, eExtreme_Biological);
443  new_feat->ResetExcept();
444  new_feat->ResetExcept_text();
445  new_feat->ResetComment();
446  new_feat->ResetProduct();
447  new_feat->ResetQual();
448  new_feat->ResetTitle();
449  new_feat->ResetCit();
450  new_feat->ResetDbxref();
451  new_feat->ResetPseudo();
452 }
453 
454 const string CConvertFeatureBase::s_RemovemRNA("Remove overlapping mRNA");
455 const string CConvertFeatureBase::s_RemoveGene("Remove overlapping gene");
456 const string CConvertFeatureBase::s_RemoveTranscriptID("Remove transcript ID");
457 const string CConvertFeatureBase::s_NcrnaClass("ncRNA class");
458 const string CConvertFeatureBase::s_SiteType("Site type");
459 const string CConvertFeatureBase::s_BondType("Bond type");
460 const string CConvertFeatureBase::s_PlaceOnProt("Create region features on protein sequence of overlapping coding region");
461 const string CConvertFeatureBase::s_IsPseudo("Pseudo");
462 
464 {
466  remove_mrna->SetBool();
467  m_Options.push_back(remove_mrna);
469  remove_gene->SetBool();
470  m_Options.push_back(remove_gene);
472  remove_transcript->SetBool();
473  m_Options.push_back(remove_transcript);
474 }
475 
476 
478 {
480  is_pseudo->SetBool();
481  m_Options.push_back(is_pseudo);
482 }
483 
484 
486 {
489  CRef<CConversionOptionString> val = ncrna_class->SetString();
490  vector<string> class_vals = CRNA_gen::GetncRNAClassList();
491  ITERATE(vector<string>, it, class_vals) {
492  val->AddSuggestedValue(*it);
493  }
494  val->SetOnlySuggested(false);
495 
496  m_Options.push_back(ncrna_class);
497  }
498 }
499 
500 
502 {
504  CRef<CConversionOptionString> val = site_type->SetString();
506  while (it != m_SiteList.end()) {
507  val->AddSuggestedValue(it->first);
508  ++it;
509  }
510  val->SetDefaultVal("active");
511  val->SetOnlySuggested(true);
512  m_Options.push_back(site_type);
513 }
514 
515 
517 {
519  CRef<CConversionOptionString> val = bond_type->SetString();
521  while (it != m_BondList.end()) {
522  val->AddSuggestedValue(it->first);
523  ++it;
524  }
525  val->SetDefaultVal("disulfide");
526  val->SetOnlySuggested(true);
527  m_Options.push_back(bond_type);
528 }
529 
530 
532 {
534  CRef<CConversionOptionBool> val = on_prot->SetBool();
535  m_Options.push_back(on_prot);
536 }
537 
538 
540 {
541  ITERATE(TOptions, it, m_Options) {
542  if (NStr::Equal((*it)->GetLabel(), label)) {
543  return *it;
544  }
545  }
547 }
548 
549 
551 {
552  return x_FindOption(s_RemoveGene);
553 }
554 
555 
557 {
558  return x_FindOption(s_RemovemRNA);
559 }
560 
561 
563 {
565 }
566 
567 
569 {
570  return x_FindOption(s_NcrnaClass);
571 }
572 
573 
575 {
576  return x_FindOption(s_SiteType);
577 }
578 
579 
581 {
582  return x_FindOption(s_BondType);
583 }
584 
585 
587 {
588  return x_FindOption(s_PlaceOnProt);
589 }
590 
591 
593 {
594  return x_FindOption(s_IsPseudo);
595 }
596 
597 
599 {
601  return true;
602  } else {
603  return false;
604  }
605 }
606 
607 
609 {
611  return true;
612  } else {
613  return false;
614  }
615 }
616 
617 
619 {
621  return true;
622  } else {
623  return false;
624  }
625 }
626 
627 
629 {
631  while (it != m_SiteList.end() && site_type != it->second) {
632  ++it;
633  }
634  if (it) {
635  return it->first;
636  } else {
637  return "";
638  }
639 }
640 
641 
643 {
644  CRef<CSeq_feat> new_feat(new CSeq_feat());
645  new_feat->Assign(orig);
646  new_feat->SetData().SetGene();
647  if (orig.IsSetComment()) {
648  new_feat->SetData().SetGene().SetLocus(orig.GetComment());
649  size_t pos = NStr::Find(new_feat->GetComment(), ";");
650  if (pos == string::npos) {
651  new_feat->ResetComment();
652  } else {
653  new_feat->SetData().SetGene().SetLocus(new_feat->GetData().GetGene().GetLocus().substr(0, pos));
654  new_feat->SetComment(new_feat->GetComment().substr(pos));
655  }
656  }
657 
658  return x_SimpleConversion(orig, new_feat, keep_orig, scope);
659 }
660 
661 
663 {
664  CRef<CSeq_feat> new_feat(new CSeq_feat());
665  new_feat->Assign(orig);
666 
667  return x_SimpleConversion(orig, new_feat, keep_orig, scope);
668 }
669 
670 
672 {
674  CRef<CSeq_feat> new_feat(new CSeq_feat());
675  new_feat->Assign(orig);
676  new_feat->SetData().SetRna().SetType(GetRnaTypeFromFeatureSubtype(m_To));
677 
678  // get protein name
679  string product = x_GetCDSProduct(orig, scope);
680  if (!NStr::IsBlank(product)) {
681  string remainder = "";
682  new_feat->SetData().SetRna().SetRnaProductName(product, remainder);
683  x_AddToComment(remainder, new_feat);
684  }
685 
686  cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
687 
688  return cmd;
689 }
690 
691 
692 void CConvertGeneToRNA::x_AddOneGeneField(string& product, string& comment, const string& field)
693 {
694  if (NStr::IsBlank(field)) {
695  return;
696  }
697  if (NStr::IsBlank(product)) {
698  product = field;
699  } else if (NStr::Find(product, field) == string::npos && NStr::Find(comment, field) == string::npos) {
700  comment = comment + "; " + field;
701  }
702 }
703 
704 
706 {
707  string product = "";
708  string comment = "";
709  if (new_feat->IsSetComment()) {
710  comment = new_feat->GetComment();
711  }
712 
713  if (orig.IsSetLocus()) {
714  x_AddOneGeneField(product, comment, orig.GetLocus());
715  }
716  if (orig.IsSetAllele()) {
717  x_AddOneGeneField(product, comment, orig.GetAllele());
718  }
719  if (orig.IsSetDesc()) {
720  x_AddOneGeneField(product, comment, orig.GetDesc());
721  }
722  if (orig.IsSetMaploc()) {
723  x_AddOneGeneField(product, comment, orig.GetMaploc());
724  }
725  if (orig.IsSetLocus_tag()) {
726  x_AddOneGeneField(product, comment, orig.GetLocus_tag());
727  }
728 
729  string remainder = "";
730  new_feat->SetData().SetRna().SetRnaProductName(product, remainder);
731  if (!NStr::IsBlank(remainder)) {
732  comment = comment + "; " + remainder;
733  }
734  if (NStr::StartsWith(comment, ";")) {
735  comment = comment.substr(1);
736  }
738  if (!NStr::IsBlank(comment)) {
739  new_feat->SetComment(comment);
740  }
741 }
742 
743 
745 {
746  CRef<CSeq_feat> new_feat(new CSeq_feat());
747  new_feat->Assign(orig);
748  new_feat->SetData().SetRna().SetType(GetRnaTypeFromFeatureSubtype(m_To));
749  x_AddGeneFieldsToComment(orig.GetData().GetGene(), new_feat);
750  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
751 
752  return cmd;
753 }
754 
755 
757 {
758  CRef<CSeq_feat> new_feat(new CSeq_feat());
759  new_feat->Assign(orig);
760  new_feat->SetData().SetImp().SetKey("repeat_region");
761 
762  bool is_transposon = false;
763  bool is_insertion = false;
764  string transposon_name = "";
765  string insertion_name = "";
766  string comment = "";
767  if (orig.IsSetComment()) {
768  comment = orig.GetComment();
769  }
770 
771  if (orig.IsSetData() && orig.GetData().IsBiosrc()) {
772  if (orig.GetData().GetBiosrc().IsSetSubtype()) {
773  ITERATE(CBioSource::TSubtype, it, orig.GetData().GetBiosrc().GetSubtype()) {
774  if ((*it)->IsSetSubtype()) {
775  if ((*it)->GetSubtype() == CSubSource::eSubtype_transposon_name) {
776  is_transposon = true;
777  if ((*it)->IsSetName() && !NStr::IsBlank((*it)->GetName())) {
778  if (NStr::IsBlank(transposon_name)) {
779  transposon_name = (*it)->GetName();
780  } else {
781  transposon_name = transposon_name + ";" + (*it)->GetName();
782  }
783  }
784  } else if ((*it)->GetSubtype() == CSubSource::eSubtype_insertion_seq_name) {
785  is_insertion = true;
786  if ((*it)->IsSetName() && !NStr::IsBlank((*it)->GetName())) {
787  if (NStr::IsBlank(insertion_name)) {
788  insertion_name = (*it)->GetName();
789  } else {
790  insertion_name = insertion_name + ";" + (*it)->GetName();
791  }
792  }
793  } else if ((*it)->GetSubtype() == CSubSource::eSubtype_other
794  && (*it)->IsSetName()
795  && !NStr::IsBlank((*it)->GetName())) {
796  if (NStr::IsBlank(comment)) {
797  comment = (*it)->GetName();
798  } else {
799  comment = comment + ";" + (*it)->GetName();
800  }
801  }
802  }
803  }
804  }
805  if (orig.GetData().GetBiosrc().IsSetOrg()
806  && orig.GetData().GetBiosrc().GetOrg().IsSetOrgname()
807  && orig.GetData().GetBiosrc().GetOrg().GetOrgname().IsSetMod()) {
808  ITERATE (COrgName::TMod, it, orig.GetData().GetBiosrc().GetOrg().GetOrgname().GetMod()) {
809  if ((*it)->IsSetSubtype() && (*it)->GetSubtype() == COrgMod::eSubtype_other
810  && (*it)->IsSetSubname() && !NStr::IsBlank((*it)->GetSubname())) {
811  if (NStr::IsBlank(comment)) {
812  comment = (*it)->GetSubname();
813  } else {
814  comment = comment + ";" + (*it)->GetSubname();
815  }
816  }
817  }
818  }
819  }
820  if (is_transposon) {
821  CRef<CGb_qual> q(new CGb_qual("mobile_element", "transposon:" + transposon_name));
822  new_feat->SetQual().push_back(q);
823  }
824 
825  if (is_insertion) {
826  CRef<CGb_qual> q(new CGb_qual("mobile_element", "insertion sequence:" + insertion_name));
827  new_feat->SetQual().push_back(q);
828  }
829 
830  if (!NStr::IsBlank(comment)) {
831  new_feat->SetComment(comment);
832  }
833 
834 
835  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
836 
837  return cmd;
838 }
839 
840 
842 {
843  CRef<CSeq_feat> new_feat(new CSeq_feat());
844  new_feat->Assign(orig);
845  new_feat->SetData().SetImp().SetKey("misc_feature");
846  new_feat->ResetProduct();
847 
848  EDIT_EACH_GBQUAL_ON_SEQFEAT(qual, *new_feat)
849  {
850  const string& qual_str = (*qual)->GetQual();
851  if ( NStr::Equal (qual_str, "gsdb_id"))
852  continue;
855  {
856  ERASE_GBQUAL_ON_SEQFEAT(qual, *new_feat);
857  }
858  }
859  if (new_feat->IsSetQual() && new_feat->GetQual().empty())
860  new_feat->ResetQual();
861 
862  bool cross_origin = false;
863  const CSeq_loc& cds_loc = orig.GetLocation();
864  if (cds_loc.GetStrand() == eNa_strand_plus) {
865  cross_origin = cds_loc.GetStart(eExtreme_Positional) >= cds_loc.GetStop(eExtreme_Positional);
866  }
867  else if (cds_loc.GetStrand() == eNa_strand_minus) {
868  cross_origin = cds_loc.GetStop(eExtreme_Positional) >= cds_loc.GetStart(eExtreme_Positional);
869  }
870 
871  if (cross_origin) {
872  // copy the location as is when it crosses the origin
873  CRef<CSeq_loc> new_loc(new CSeq_loc);
874  new_loc->Assign(orig.GetLocation());
875  new_feat->SetLocation(*new_loc);
876  }
877  else {
878  // otherwise, merge location into single interval
879  CSeq_loc::TRange range = orig.GetLocation().GetTotalRange();
880  ENa_strand strand = orig.GetLocation().GetStrand();
881  bool part5 = orig.GetLocation().IsPartialStart(eExtreme_Positional);
882  bool part3 = orig.GetLocation().IsPartialStop(eExtreme_Positional);
883 
884  CRef<CSeq_loc> new_loc(new CSeq_loc);
885  CRef<CSeq_id> id(new CSeq_id);
886  id->Assign(*orig.GetLocation().GetId());
887 
888  CRef<CSeq_interval> new_int(new CSeq_interval(*id, range.GetFrom(), range.GetTo(), strand));
889  new_int->SetPartialStart(part5, eExtreme_Positional);
890  new_int->SetPartialStop(part3, eExtreme_Positional);
891  new_loc->SetInt(*new_int);
892  new_feat->SetLocation(*new_loc);
893  }
894 
895  string product = x_GetCDSProduct(orig, scope);
896  if (!product.empty())
897  {
898  string comment = product;
899  if (m_Similar)
900  {
901  comment = "similar to "+product;
902  }
903  else if (m_Nonfunctional)
904  {
905  comment = "nonfunctional "+product+" due to mutation";
906  }
907  x_AddToComment(comment, new_feat);
908  }
909 
910  const string& prot_desc = x_GetProteinDesc(orig, scope);
911  x_AddToComment(prot_desc, new_feat, edit::eExistingText_append_semi);
912 
913  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
914 
915  return cmd;
916 }
917 
919 {
920  if (!cds.IsSetProduct()) {
921  return kEmptyStr;
922  }
923 
924  string desc(kEmptyStr);
925  CBioseq_Handle bsh = scope.GetBioseqHandle(cds.GetProduct());
926  if (bsh) {
928  if (f && f->IsSetData() && f->GetData().IsProt()
929  && f->GetData().GetProt().IsSetDesc()) {
930  desc = f->GetData().GetProt().GetDesc();
931  }
932  }
933  return desc;
934 }
935 
937 {
938  CRef<CSeq_feat> new_feat(new CSeq_feat());
939  new_feat->Assign(orig);
940  new_feat->SetData().SetProt().SetProcessed(GetProtProcessedFromFeatureSubtype(m_To));
941 
942  if (!x_MoveFeatureToProtein(orig, new_feat, keep_orig, scope)) {
943  return CRef<CCmdComposite>(NULL);
944  }
945 
948  string product = x_GetCDSProduct(*overlapping_cds, scope);
949  new_feat->SetData().SetProt().SetName().push_back(product);
950 
951  if (new_feat->IsSetQual()) {
952  CSeq_feat::TQual::iterator it = new_feat->SetQual().begin();
953  while (it != new_feat->SetQual().end()) {
954  string val = "";
955  if ((*it)->IsSetVal()) {
956  val = (*it)->GetVal();
957  }
958  if (!(*it)->IsSetQual()) {
959  it++;
960  } else if (NStr::EqualNocase((*it)->GetQual(), "product")) {
961  // product qualifier
962  if (!NStr::IsBlank(val)) {
963  new_feat->SetData().SetProt().SetName().push_back((*it)->GetVal());
964  }
965  it = new_feat->SetQual().erase(it);
966  } else if (NStr::EqualNocase((*it)->GetQual(), "EC_number")) {
967  // EC number qualifiers
968  if (!NStr::IsBlank(val)) {
969  new_feat->SetData().SetProt().SetEc().push_back((*it)->GetVal());
970  }
971  it = new_feat->SetQual().erase(it);
972  } else if (NStr::EqualNocase((*it)->GetQual(), "function")) {
973  // activity
974  if (!NStr::IsBlank(val)) {
975  new_feat->SetData().SetProt().SetActivity().push_back((*it)->GetVal());
976  }
977  it = new_feat->SetQual().erase(it);
978  } else if (NStr::EqualNocase((*it)->GetQual(), "dbxref")) {
979  // dbxrefs
980  if (!NStr::IsBlank(val)) {
981  CRef<CDbtag> db(new CDbtag());
982  size_t pos = NStr::Find(val, ":");
983  if (pos == string::npos) {
984  db->SetDb(val);
985  } else {
986  db->SetDb(val.substr(0, pos));
987  db->SetTag().SetStr(val.substr(pos));
988  }
989  new_feat->SetData().SetProt().SetDb().push_back(db);
990  }
991  it = new_feat->SetQual().erase(it);
992  } else {
993  it++;
994  }
995  }
996 
997  }
998 
999  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1000 
1001  return cmd;
1002 }
1003 
1004 
1006 {
1007  CBioseq_Handle bsh = scope.GetBioseqHandle(orig.GetLocation());
1008  if (!bsh) {
1009  return CRef<CCmdComposite>(NULL);
1010  }
1011  const CSeq_feat * overlapping_cds = sequence::GetCDSForProduct(bsh);
1012  if (!overlapping_cds) {
1013  return CRef<CCmdComposite>(NULL);
1014  }
1015 
1016  // map to corresponding location on protein sequence
1017  CSeq_loc_Mapper mapper(*overlapping_cds, CSeq_loc_Mapper::eProductToLocation);
1018  mapper.SetMergeAbutting();
1019  CRef<CSeq_loc> loc = mapper.Map(orig.GetLocation());
1020  if ( !loc ) {
1021  return CRef<CCmdComposite>(NULL);
1022  }
1023 
1024  CRef<CSeq_feat> new_feat(new CSeq_feat());
1025  new_feat->Assign(orig);
1026  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
1027 
1028  new_feat->SetLocation().Assign(*loc);
1029 
1030  // product qualifier
1031  const CProt_ref& prot = orig.GetData().GetProt();
1032  if (prot.IsSetName()
1033  && prot.GetName().size() > 0
1034  && !NStr::IsBlank (prot.GetName().front())) {
1035  CRef<CGb_qual> q(new CGb_qual("product", prot.GetName().front()));
1036  new_feat->SetQual().push_back(q);
1037  } else if (prot.IsSetDesc()
1038  && !NStr::IsBlank(prot.GetDesc())) {
1039  CRef<CGb_qual> q(new CGb_qual("product", prot.GetDesc()));
1040  new_feat->SetQual().push_back(q);
1041  }
1042 
1043  // EC number qualifiers
1044  if (prot.IsSetEc()) {
1045  ITERATE(CProt_ref::TEc, it, prot.GetEc()) {
1046  CRef<CGb_qual> q(new CGb_qual("EC_number", (*it)));
1047  new_feat->SetQual().push_back(q);
1048  }
1049  }
1050 
1051  // activity
1052  if (prot.IsSetActivity()) {
1053  ITERATE(CProt_ref::TActivity, it, prot.GetActivity()) {
1054  CRef<CGb_qual> q(new CGb_qual("function", (*it)));
1055  new_feat->SetQual().push_back(q);
1056  }
1057  }
1058 
1059  // dbxrefs
1060  if (prot.IsSetDb()) {
1061  ITERATE(CProt_ref::TDb, it, prot.GetDb()) {
1062  string val = "";
1063  (*it)->GetLabel(&val);
1064  CRef<CGb_qual> q(new CGb_qual("dbxref", val));
1065  new_feat->SetQual().push_back(q);
1066  }
1067  }
1068 
1069 
1070  CRef<CCmdComposite> cmd(new CCmdComposite("Convert Feature"));
1071 
1072  // create new feature
1073  CBioseq_Handle nuc_bsh = scope.GetBioseqHandle(new_feat->GetLocation());
1074  CSeq_entry_Handle seh = nuc_bsh.GetSeq_entry_Handle();
1075  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_feat)));
1076  // delete original coding region (will also remove product and renormalize nuc-prot set
1077  if (!keep_orig)
1078  {
1079  cmd->AddCommand(*GetDeleteFeatureCommand(scope.GetSeq_featHandle(orig)));
1080  }
1081 
1082  return cmd;
1083 }
1084 
1085 
1087 {
1088  CRef<CSeq_feat> new_feat(new CSeq_feat());
1089  new_feat->Assign(orig);
1090  new_feat->SetData().SetRna().SetType(GetRnaTypeFromFeatureSubtype(m_To));
1091 
1092  vector<string> products = x_ExtractProductQuals(new_feat);
1093  if (products.size() > 0) {
1094  string product = products[0];
1095  for(size_t i = 1; i < products.size(); i++) {
1096  product += "; " + products[i];
1097  }
1098  string remainder = "";
1099  new_feat->SetData().SetRna().SetRnaProductName(product, remainder);
1100  x_AddToComment(remainder, new_feat);
1101  }
1102 
1103  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1104 
1105  return cmd;
1106 }
1107 
1108 
1110 {
1111  CRef<CSeq_feat> new_feat(new CSeq_feat());
1112  new_feat->Assign(orig);
1113  new_feat->SetData().SetCdregion();
1114  vector<string> products = x_ExtractProductQuals(new_feat);
1115  if (products.size() == 0 && new_feat->IsSetComment() && !NStr::IsBlank(new_feat->GetComment())) {
1116  products.push_back(new_feat->GetComment());
1117  new_feat->ResetComment();
1118  }
1119 
1120  return x_ConvertToCDS(orig, new_feat, keep_orig, scope, products);
1121 }
1122 
1123 
1125 {
1126  CRef<CSeq_feat> new_feat(new CSeq_feat());
1127  new_feat->Assign(orig);
1128  new_feat->SetData().SetGene();
1129 
1130  vector<string> gene_vals = x_ExtractQuals(new_feat, "gene");
1131  if (gene_vals.size() == 0 && new_feat->IsSetComment() && !NStr::IsBlank(new_feat->GetComment())) {
1132  gene_vals.push_back(new_feat->GetComment());
1133  new_feat->ResetComment();
1134  }
1135 
1136  if (gene_vals.size() > 0) {
1137  string gene = gene_vals[0];
1138  for(size_t i = 1; i < gene_vals.size(); i++) {
1139  gene += "; " + gene_vals[i];
1140  }
1141  new_feat->SetData().SetGene().SetLocus(gene);
1142  }
1143 
1144  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1145 
1146  return cmd;
1147 }
1148 
1149 
1151 {
1152  CRef<CSeq_feat> new_feat(new CSeq_feat());
1153  new_feat->Assign(orig);
1154  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
1155  x_AddToComment(orig.GetData().GetRegion(), new_feat);
1156 
1157  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1158 
1159  return cmd;
1160 }
1161 
1162 
1164 {
1165  CRef<CSeq_feat> new_feat(new CSeq_feat());
1166  new_feat->Assign(orig);
1167  new_feat->SetData().SetRna().SetType(GetRnaTypeFromFeatureSubtype(m_To));
1168 
1169  string product = orig.GetData().GetRegion();
1170  string remainder = "";
1171  new_feat->SetData().SetRna().SetRnaProductName(product, remainder);
1172  x_AddToComment(remainder, new_feat);
1173 
1174  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1175 
1176  return cmd;
1177 }
1178 
1179 
1181 {
1182  CRef<CSeq_feat> new_feat(new CSeq_feat());
1183  new_feat->Assign(orig);
1184  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
1185 
1186  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1187 
1188  return cmd;
1189 }
1190 
1191 
1193 {
1194  CRef<CSeq_feat> new_feat(new CSeq_feat());
1195  new_feat->Assign(orig);
1196  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
1197  string orig_comment = "";
1198  if (new_feat->IsSetComment()) {
1199  orig_comment = new_feat->GetComment();
1200  }
1201  new_feat->ResetComment();
1202  const CGene_ref& gene = orig.GetData().GetGene();
1203  if (gene.IsSetLocus()
1205  x_AddToComment(gene.GetLocus(), new_feat);
1206  }
1207  if (gene.IsSetDesc()
1209  x_AddToComment(gene.GetDesc(), new_feat);
1210  }
1211  x_AddToComment(orig_comment, new_feat);
1212 
1213  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1214 
1215  return cmd;
1216 }
1217 
1218 
1220 {
1221  CRef<CSeq_feat> new_feat(new CSeq_feat());
1222  new_feat->Assign(orig);
1223  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
1224  string product = orig.GetData().GetRna().GetRnaProductName();
1225  x_AddToComment(product, new_feat);
1226 
1227  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1228 
1229  return cmd;
1230 }
1231 
1232 
1234 {
1235  CRef<CSeq_feat> new_feat(new CSeq_feat());
1236  new_feat->Assign(orig);
1237  new_feat->SetData().SetCdregion();
1238 
1239  vector<string> products;
1240  products.push_back(orig.GetData().GetRna().GetRnaProductName());
1241 
1242  return x_ConvertToCDS(orig, new_feat, keep_orig, scope, products);
1243 }
1244 
1245 
1247 {
1248  CRef<CSeq_feat> new_feat(new CSeq_feat());
1249  new_feat->Assign(orig);
1250 
1251  string product = orig.GetData().GetRna().GetRnaProductName();
1252  new_feat->SetData().SetGene().SetDesc(product);
1253 
1254  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1255 
1256  return cmd;
1257 }
1258 
1259 
1261 {
1262  CRef<CSeq_feat> new_feat(new CSeq_feat());
1263  new_feat->Assign(orig);
1264  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
1265  string site_name = GetSiteName(orig.GetData().GetSite());
1266  x_AddToComment(site_name, new_feat);
1267 
1268  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1269 
1270  return cmd;
1271 }
1272 
1273 
1275 {
1276  CRef<CSeq_feat> new_feat(new CSeq_feat());
1277  new_feat->Assign(orig);
1278  if (!x_MoveFeatureToProtein(orig, new_feat, keep_orig, scope)) {
1279  return CRef<CCmdComposite>(NULL);
1280  }
1281  new_feat->SetData().SetProt().SetName().push_back(orig.GetData().GetRegion());
1282 
1283  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1284 
1285  return cmd;
1286 }
1287 
1288 
1290 {
1291  CRef<CSeq_feat> new_feat(new CSeq_feat());
1292  new_feat->Assign(orig);
1293  new_feat->SetData().SetRna().SetType(GetRnaTypeFromFeatureSubtype(m_To));
1294  string product = orig.GetData().GetRna().GetRnaProductName();
1295  string remainder = "";
1296  new_feat->SetData().SetRna().SetRnaProductName(product, remainder);
1297  x_AddToComment(remainder, new_feat);
1298 
1299  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1300 
1301  return cmd;
1302 }
1303 
1304 
1306 {
1307  CRef<CSeq_feat> new_feat(new CSeq_feat());
1308  new_feat->Assign(orig);
1309  x_ClearGenericFields(new_feat);
1310  if (orig.IsSetComment() && !NStr::IsBlank(orig.GetComment())) {
1311  new_feat->SetComment(orig.GetComment());
1312  }
1313  CSeq_loc_CI ci(orig.GetLocation());
1314  new_feat->SetLocation().SetBond().SetA().SetId().Assign(ci.GetSeq_id());
1315  new_feat->SetLocation().SetBond().SetA().SetPoint(orig.GetLocation().GetStart(eExtreme_Biological));
1316  CSeq_loc_CI ci_next = ci;
1317  ++ci_next;
1318  while (ci_next) {
1319  ++ci;
1320  ++ci_next;
1321  }
1322  new_feat->SetLocation().SetBond().SetB().SetId().Assign(ci.GetSeq_id());
1323  new_feat->SetLocation().SetBond().SetB().SetPoint(orig.GetLocation().GetStop(eExtreme_Biological));
1324 
1325  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1326 
1327  return cmd;
1328 }
1329 
1330 
1332 {
1333  CRef<CSeq_feat> new_feat(new CSeq_feat());
1334  new_feat->Assign(orig);
1335  x_ClearGenericFields(new_feat);
1336  if (orig.IsSetComment() && !NStr::IsBlank(orig.GetComment())) {
1337  new_feat->SetComment(orig.GetComment());
1338  }
1339  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1340 
1341  return cmd;
1342 }
1343 
1344 
1346 {
1347  if (x_IsProtSubtype(m_From)) {
1348  return "Create region feature with the protein name as the region name";
1349  } else {
1350  return "Create Region feature on nucleotide sequence or protein product sequence of overlapping coding region as specified. Use comment on feature for region name.\n\
1351 All feature ID, partialness, except, comment, product, location, genbank qualifiers, title, citation, experimental evidence, gene xrefs, db xrefs, and pseudo-ness information is discarded.";
1352  }
1353 }
1354 
1355 
1357 {
1358  CRef<CSeq_feat> new_feat(new CSeq_feat());
1359  new_feat->Assign(orig);
1360  new_feat->SetData().SetRegion();
1361  x_ClearGenericFields(new_feat);
1362  if (orig.GetData().IsProt()) {
1363  if (orig.GetData().GetProt().IsSetName() && orig.GetData().GetProt().GetName().size() > 0) {
1364  new_feat->SetData().SetRegion(orig.GetData().GetProt().GetName().front());
1365  }
1366  } else if (orig.IsSetComment()) {
1367  new_feat->SetData().SetRegion(orig.GetComment());
1368  }
1369  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1370 
1371  return cmd;
1372 }
1373 
1374 
1376 {
1377  string subtype_name = CSeqFeatData::SubtypeValueToName(m_To);
1378  string desc = "If coding region is overlapped by another coding region, convert the coding region to a "
1379  + subtype_name
1380  + " on the overlapping coding region's protein sequence, otherwise if you have checked \"Leave Original Feature\" it will create a "
1381  + subtype_name + " with the same protein names and description on the protein sequence for the coding region.";
1382  return desc;
1383 }
1384 
1385 
1387 {
1388  CRef<CSeq_feat> new_feat(new CSeq_feat());
1389  new_feat->Assign(orig);
1390  if (!x_MoveFeatureToProtein(orig, new_feat, keep_orig, scope)) {
1391  return CRef<CCmdComposite>(NULL);
1392  }
1393  string product = x_GetCDSProduct(orig, scope);
1394  new_feat->SetData().SetProt().SetName().push_back(product);
1396  {
1397  new_feat->ResetProduct();
1398  if (orig.IsSetProduct())
1399  {
1400  CBioseq_Handle prot_bsh = scope.GetBioseqHandle(orig.GetProduct());
1401  if (prot_bsh && prot_bsh.IsProtein())
1402  {
1403  CFeat_CI prot_feat_ci(prot_bsh, CSeqFeatData::e_Prot);
1404  if (prot_feat_ci && prot_feat_ci->GetOriginalFeature().IsSetData() && prot_feat_ci->GetOriginalFeature().GetData().IsProt()
1405  && prot_feat_ci->GetOriginalFeature().GetData().GetProt().IsSetDesc())
1406  {
1407  new_feat->SetData().SetProt().SetDesc(prot_feat_ci->GetOriginalFeature().GetData().GetProt().GetDesc());
1408  }
1409  }
1410  }
1411  }
1412  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1413 
1414  return cmd;
1415 }
1416 
1417 
1419 {
1420  CRef<CSeq_feat> new_feat(new CSeq_feat());
1421  new_feat->Assign(orig);
1422  new_feat->SetData().SetGene();
1423 
1424  if (orig.IsSetProduct()) {
1425  CBioseq_Handle bsh = scope.GetBioseqHandle(orig.GetProduct());
1426  if (bsh) {
1428  if (f && f->IsSetData() && f->GetData().IsProt()) {
1429  const CProt_ref& prot = f->GetData().GetProt();
1430  if (prot.IsSetName()) {
1431  ITERATE(CProt_ref::TName, it, prot.GetName()) {
1432  x_AddToComment(*it, new_feat);
1433  }
1434  }
1435  if (prot.IsSetDesc()) {
1436  x_AddToComment(prot.GetDesc(), new_feat);
1437  }
1438  if (prot.IsSetActivity()) {
1439  ITERATE(CProt_ref::TActivity, it, prot.GetActivity()) {
1440  x_AddToComment(*it, new_feat);
1441  }
1442  }
1443  if (prot.IsSetDb()) {
1444  ITERATE(CProt_ref::TDb, it, prot.GetDb()) {
1445  string val = "";
1446  (*it)->GetLabel(&val);
1447  x_AddToComment(val, new_feat);
1448  }
1449  }
1450  if (prot.IsSetEc()) {
1451  ITERATE(CProt_ref::TEc, it, prot.GetEc()) {
1452  x_AddToComment(*it, new_feat);
1453  }
1454  }
1455  }
1456  }
1457  }
1458  new_feat->ResetProduct();
1459  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1460 
1461  return cmd;
1462 }
1463 
1464 
1467 {
1468  // choose appropriate converter
1469 
1471 
1472  if (subtype_from != subtype_to) {
1473  rval = new CConvertCDSToRNA(subtype_to);
1474  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1475  return rval;
1476  }
1477  rval = new CConvertGeneToRNA(subtype_to);
1478  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1479  return rval;
1480  }
1481  rval = new CConvertMiscFeatToGene();
1482  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1483  return rval;
1484  }
1485  rval = new CConvertImpToImp(subtype_to, subtype_from);
1486  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1487  return rval;
1488  }
1489  rval = new CConvertBioSrcToRptRegion();
1490  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1491  return rval;
1492  }
1493  rval = new CConvertCDSToMiscFeat();
1494  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1495  return rval;
1496  }
1497  rval = new CConvertImpToProt(subtype_to, subtype_from);
1498  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1499  return rval;
1500  }
1501  rval = new CConvertImpToRNA(subtype_to, subtype_from);
1502  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1503  return rval;
1504  }
1505  rval = new CConvertImpToCDS(subtype_from);
1506  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1507  return rval;
1508  }
1509  rval = new CConvertImpToGene(subtype_from);
1510  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1511  return rval;
1512  }
1513  rval = new CConvertRegionToImp(subtype_to);
1514  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1515  return rval;
1516  }
1517  rval = new CConvertRegionToRna(subtype_to);
1518  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1519  return rval;
1520  }
1521  rval = new CConvertCommentToImp(subtype_to);
1522  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1523  return rval;
1524  }
1525  rval = new CConvertGeneToImp(subtype_to);
1526  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1527  return rval;
1528  }
1529  rval = new CConvertRnaToImp(subtype_to, subtype_from);
1530  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1531  return rval;
1532  }
1533  rval = new CConvertmRNAToCDS(subtype_to, subtype_from);
1534  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1535  return rval;
1536  }
1537  rval = new CConverttRNAToGene(subtype_to, subtype_from);
1538  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1539  return rval;
1540  }
1541  rval = new CConvertSiteToImp(subtype_to);
1542  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1543  return rval;
1544  }
1545  rval = new CConvertRNAToRNA(subtype_to, subtype_from);
1546  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1547  return rval;
1548  }
1549  rval = new CConvertRegionToProt(subtype_to);
1550  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1551  return rval;
1552  }
1553  rval = new CConvertToBond(subtype_from);
1554  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1555  return rval;
1556  }
1557  rval = new CConvertToSite(subtype_from);
1558  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1559  return rval;
1560  }
1561  rval = new CConvertToRegion(subtype_from);
1562  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1563  return rval;
1564  }
1565  rval = new CConvertProtToProt(subtype_to, subtype_from);
1566  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1567  return rval;
1568  }
1569  rval = new CConvertCDSToProt(subtype_to);
1570  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1571  return rval;
1572  }
1573  rval = new CConvertCDSToGene();
1574  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1575  return rval;
1576  }
1577  rval = new CConvertProtToImp(subtype_to, subtype_from);
1578  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1579  return rval;
1580  }
1581 
1582  }
1583 
1584  // return "no conversion found" if no appropriate one found
1585  rval = new CConvertFeatureBase();
1586  return rval;
1587 }
1588 
1589 
1591 {
1592  if (m_Choice != e_Bool) {
1594  m_Object = new_obj;
1595  }
1597  m_Choice = e_Bool;
1598  return obj;
1599 }
1600 
1601 
1603 {
1604  if (m_Choice != e_Bool) {
1606  } else {
1608  }
1609 }
1610 
1611 
1613 {
1614  if (m_Choice != e_String) {
1616  m_Object = new_obj;
1617  }
1619  m_Choice = e_String;
1620  return obj;
1621 }
1622 
1623 
1625 {
1626  if (m_Choice != e_String) {
1628  } else {
1630  }
1631 }
1632 
1634 {
1637  m_Options.clear();
1638  //x_AddCDSSourceConversionOptions();
1639  //CRef<CConversionOption> is_pseudo(new CConversionOption(kIsPseudo));
1640  //is_pseudo->SetBool();
1641  //m_Options.push_back(is_pseudo);
1642 }
1643 
1645 {
1646  CRef<CCmdComposite> cmd(new CCmdComposite("Convert Feature"));
1647 
1648  CConstRef<CSeq_feat> gene = sequence::GetOverlappingGene(orig.GetLocation(), scope);
1649 
1650  CRef<CSeq_feat> new_feat(new CSeq_feat());
1651  new_feat->Assign(orig);
1652  new_feat->SetData().SetGene();
1653  if (gene)
1654  {
1655  CRef<CSeq_feat> copy_gene(new CSeq_feat());
1656  copy_gene->Assign(*gene);
1657  new_feat->SetData().SetGene(copy_gene->SetData().SetGene());
1658  cmd->AddCommand(*GetDeleteFeatureCommand(scope.GetSeq_featHandle(*gene)));
1659  }
1660 
1661  CRef<CGene_ref> gene_ref(&new_feat->SetData().SetGene());
1662  if (orig.IsSetProduct()) {
1663  CBioseq_Handle bsh = scope.GetBioseqHandle(orig.GetProduct());
1664  if (bsh) {
1666  if (f && f->IsSetData() && f->GetData().IsProt()) {
1667  const CProt_ref& prot = f->GetData().GetProt();
1668 
1669  if (f->IsSetComment()) {
1670  x_AddToComment(f->GetComment(), new_feat);
1671  }
1672  if (prot.IsSetDesc()) {
1673  x_AddToComment(prot.GetDesc(), new_feat);
1674  }
1675 
1676  if (prot.IsSetName()) {
1677  if (!gene_ref->IsSetDesc()) {
1678  ITERATE(CProt_ref::TName, it, prot.GetName()) {
1680  }
1681  }
1682  else {
1683  // prepend list of protein product names to gene comment
1684  string protein_names;
1685  ITERATE(CProt_ref::TName, it, prot.GetName()) {
1687  }
1688  x_AddToComment(protein_names, new_feat);
1689  }
1690  }
1691  }
1692  }
1693  }
1694 
1695  new_feat->SetPseudo(true);
1696  new_feat->ResetProduct();
1697 
1698  if (keep_orig) {
1699  CBioseq_Handle bsh = scope.GetBioseqHandle(new_feat->GetLocation());
1701  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_feat)));
1702  } else if (orig.IsSetData() && orig.GetData().IsCdregion()) {
1703  // create new feature
1704  CBioseq_Handle bsh = scope.GetBioseqHandle(new_feat->GetLocation());
1706  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_feat)));
1707  // delete original coding region (will also remove product and renormalize nuc-prot set
1708  cmd->AddCommand(*GetDeleteFeatureCommand(scope.GetSeq_featHandle(orig)));
1709  } else {
1710  cmd->AddCommand(*CRef<CCmdChangeSeq_feat>(new CCmdChangeSeq_feat(scope.GetSeq_featHandle(orig), *new_feat)));
1711  }
1712 
1713  return cmd;
1714 }
1715 
1717 {
1718  if (NStr::IsBlank(text)) {
1719  return;
1720  }
1721 
1722  if (!gene->IsSetLocus() || NStr::IsBlank(gene->GetLocus())) {
1723  gene->SetLocus(text);
1724  } else {
1725  string orig_val = gene->GetLocus();
1726  if (edit::AddValueToString(orig_val, text, existing_text)) {
1727  gene->SetLocus(orig_val);
1728  }
1729  }
1730 }
1731 
1733 {
1734  if (NStr::IsBlank(text)) {
1735  return;
1736  }
1737 
1738  if (!gene->IsSetDesc() || NStr::IsBlank(gene->GetDesc())) {
1739  gene->SetDesc(text);
1740  } else {
1741  string orig_val = gene->GetDesc();
1742  if (edit::AddValueToString(orig_val, text, existing_text)) {
1743  gene->SetDesc(orig_val);
1744  }
1745  }
1746 }
1747 
1748 
User-defined methods of the data storage class.
@ eExtreme_Positional
numerical value
Definition: Na_strand.hpp:63
@ eExtreme_Biological
5' and 3'
Definition: Na_strand.hpp:62
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CBioseq_Handle –.
TBondMap::const_iterator const_iterator
CConstRef< CConversionOptionString > GetString() const
CRef< CConversionOptionBool > SetBool()
CRef< CConversionOptionString > SetString()
CRef< CObject > m_Object
CConstRef< CConversionOptionBool > GetBool() const
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
string x_GetProteinDesc(const objects::CSeq_feat &cds, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual string GetDescription()
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
void x_AddToGeneDescr(string text, CRef< objects::CGene_ref > gene, objects::edit::EExistingText existing_text)
void x_AddToGeneLocus(string text, CRef< objects::CGene_ref > gene, objects::edit::EExistingText existing_text)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
static CRef< CConvertFeatureBase > Create(objects::CSeqFeatData::ESubtype subtype_from, objects::CSeqFeatData::ESubtype subtype_to)
CRef< CConversionOption > x_FindPseudo()
void x_AddToComment(string comment, CRef< objects::CSeq_feat > new_feat, objects::edit::EExistingText existing_text=objects::edit::eExistingText_prefix_semi)
bool x_IsRnaSubtype(objects::CSeqFeatData::ESubtype subtype)
static const string s_PlaceOnProt
void x_AddRnaDestinationConversionOptions()
bool x_IsImportSubtype(objects::CSeqFeatData::ESubtype subtype)
static const string s_RemoveTranscriptID
vector< string > x_ExtractProductQuals(CRef< objects::CSeq_feat > new_feat)
void x_AddCDSSourceConversionOptions()
virtual bool CanConvertFrom(objects::CSeqFeatData::ESubtype subtype)
CRef< CConversionOption > x_FindRemovemRNA()
CConvertFeatureBase(objects::CSeqFeatData::ESubtype feat_to=objects::CSeqFeatData::eSubtype_bad, objects::CSeqFeatData::ESubtype feat_from=objects::CSeqFeatData::eSubtype_bad)
void x_AddCDSDestinationConversionOptions()
bool x_MoveFeatureToProtein(const objects::CSeq_feat &orig, CRef< objects::CSeq_feat > new_feat, bool keep_orig, objects::CScope &scope)
static const string s_SiteType
void x_AddRegionDestionationConversionOptions()
CRef< CConversionOption > x_FindRemoveGene()
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
CRef< CCmdComposite > x_ConvertToCDS(const objects::CSeq_feat &orig, CRef< objects::CSeq_feat > new_feat, bool keep_orig, objects::CScope &scope, vector< string > product)
static const string s_BondType
virtual bool CanConvertTo(objects::CSeqFeatData::ESubtype subtype)
void x_AddSiteDestinationConversionOptions()
CRef< CCmdComposite > x_SimpleConversion(const objects::CSeq_feat &orig, CRef< objects::CSeq_feat > new_feat, bool keep_orig, objects::CScope &scope)
CRef< CConversionOption > x_FindSiteType()
static const string s_NcrnaClass
CRef< CConversionOption > x_FindNcrnaClass()
string x_GetCDSProduct(const objects::CSeq_feat &orig, objects::CScope &scope)
static const string s_IsPseudo
CRef< CConversionOption > FindRemoveTranscriptId()
static const string s_RemovemRNA
void x_ClearGenericFields(CRef< objects::CSeq_feat > new_feat)
vector< string > x_ExtractQuals(CRef< objects::CSeq_feat > new_feat, string qual_name)
objects::CBondList m_BondList
string GetSiteName(objects::CSeqFeatData::TSite site_type)
vector< CRef< CConversionOption > > TOptions
CRef< CConversionOption > x_FindPlaceOnProt()
objects::CSeqFeatData::ESubtype m_To
CRef< CConversionOption > x_FindBondType()
objects::CSeqFeatData::ESubtype m_From
static const string s_RemoveGene
CRef< CConversionOption > x_FindOption(const string &label)
void x_AddBondDestinationConversionOptions()
objects::CSiteList m_SiteList
bool x_IsProtSubtype(objects::CSeqFeatData::ESubtype subtype)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
void x_AddGeneFieldsToComment(const objects::CGene_ref &orig, CRef< objects::CSeq_feat > new_feat)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
void x_AddOneGeneField(string &product, string &comment, const string &field)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual string GetDescription()
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
Definition: Dbtag.hpp:53
CFeat_CI –.
Definition: feat_ci.hpp:64
@Gb_qual.hpp User-defined methods of the data storage class.
Definition: Gb_qual.hpp:61
static vector< string > GetncRNAClassList()
Definition: RNA_gen.cpp:86
CScope –.
Definition: scope.hpp:92
bool IsLegalQualifier(EQualifier qual) const
Test wheather a certain qualifier is legal for the feature.
EQualifier
List of available qualifiers for feature keys.
static E_Choice GetTypeFromSubtype(ESubtype subtype)
@ eSubtype_transit_peptide
@ eSubtype_transit_peptide_aa
static EQualifier GetQualifierType(CTempString qual)
convert qual string to enumerated value
static CTempString SubtypeValueToName(ESubtype eSubtype)
Turns a ESubtype into its string value which is NOT necessarily related to the identifier of the enum...
CSeq_entry_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
void SetPartialStart(bool val, ESeqLocExtremes ext)
void SetPartialStop(bool val, ESeqLocExtremes ext)
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
Definition: Seq_loc.hpp:453
CSeq_loc_Mapper –.
TSiteMap::const_iterator const_iterator
CRef< objects::CSeq_entry > CreateTranslatedProteinSequence(CRef< objects::CSeq_feat > cds, objects::CBioseq_Handle nuc_h, bool create_general_only, int *offset=nullptr)
CRef< objects::CSeq_feat > AddProteinFeatureToProtein(CRef< objects::CSeq_entry > protein, bool partial5, bool partial3)
USING_SCOPE(objects)
CProt_ref::EProcessed GetProtProcessedFromFeatureSubtype(CSeqFeatData::ESubtype subtype)
CRNA_ref::EType GetRnaTypeFromFeatureSubtype(CSeqFeatData::ESubtype subtype)
static void AdjustMappedStop(CRef< CSeq_loc > loc, const CSeq_loc &product, CScope &scope)
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
static FILE * f
Definition: readconf.c:23
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 NULL
Definition: ncbistd.hpp:225
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
Definition: Seq_id.cpp:318
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
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
Definition: Seq_loc.cpp:337
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
Definition: Seq_loc.cpp:915
void SetInt(TInt &v)
Definition: Seq_loc.hpp:983
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
const CSeq_id & GetSeq_id(void) const
Get seq_id of the current location.
Definition: Seq_loc.hpp:1028
void SetPartialStop(bool val, ESeqLocExtremes ext)
Definition: Seq_loc.cpp:3313
bool IsPartialStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:3251
TSeqPos GetStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:963
@ fMerge_All
Definition: Seq_loc.hpp:331
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
CRef< CSeq_loc > Seq_loc_Subtract(const CSeq_loc &loc1, const CSeq_loc &loc2, CSeq_loc::TOpFlags flags, CScope *scope)
Subtract the second seq-loc from the first one.
@ eOverlap_Contained
2nd contained within 1st extremes
const CSeq_feat * GetCDSForProduct(const CBioseq &product, CScope *scope)
Get the encoding CDS feature of a given protein sequence.
Definition: sequence.cpp:2549
CConstRef< CSeq_feat > GetOverlappingmRNA(const CSeq_loc &loc, CScope &scope)
Definition: sequence.cpp:1572
CConstRef< CSeq_feat > GetOverlappingGene(const CSeq_loc &loc, CScope &scope, ETransSplicing eTransSplicing=eTransSplicing_Auto)
Definition: sequence.cpp:1366
@ fBestFeat_FavorLonger
favor longer features over shorter features
Definition: sequence.hpp:339
@ fBestFeat_Defaults
default options: do everything
Definition: sequence.hpp:346
CRef< CSeq_loc > Map(const CSeq_loc &src_loc)
Map seq-loc.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
CSeq_loc_Mapper_Base & SetMergeAbutting(void)
Merge only abutting intervals, keep overlapping.
CSeq_feat_Handle GetSeq_featHandle(const CSeq_feat &feat, EMissing action=eMissing_Default)
Definition: scope.cpp:200
@ eProductToLocation
Map from the feature's product to location.
@ eLocationToProduct
Map from the feature's location to product.
TSeqPos GetBioseqLength(void) const
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
bool IsProtein(void) const
const CSeq_feat & GetOriginalFeature(void) const
Get original feature with unmapped location/product.
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:1684
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define kEmptyStr
Definition: ncbistr.hpp:123
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
Definition: ncbistr.cpp:3192
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
Definition: ncbistr.cpp:2882
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:5406
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5347
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
Definition: ncbistr.hpp:5378
static const char label[]
list< CRef< CSubSource > > TSubtype
Definition: BioSource_.hpp:145
const TDesc & GetDesc(void) const
Get the Desc member data.
Definition: Gene_ref_.hpp:599
bool IsSetLocus(void) const
Official gene symbol Check if a value has been assigned to Locus data member.
Definition: Gene_ref_.hpp:493
bool IsSetDesc(void) const
descriptive name Check if a value has been assigned to Desc data member.
Definition: Gene_ref_.hpp:587
void SetLocus(const TLocus &value)
Assign a value to Locus data member.
Definition: Gene_ref_.hpp:514
const TLocus & GetLocus(void) const
Get the Locus member data.
Definition: Gene_ref_.hpp:505
void SetDesc(const TDesc &value)
Assign a value to Desc data member.
Definition: Gene_ref_.hpp:608
void SetTag(TTag &value)
Assign a value to Tag data member.
Definition: Dbtag_.cpp:66
void SetDb(const TDb &value)
Assign a value to Db data member.
Definition: Dbtag_.hpp:229
list< CRef< COrgMod > > TMod
Definition: OrgName_.hpp:332
@ eSubtype_other
ASN5: old-name (254) will be added to next spec.
Definition: OrgMod_.hpp:125
bool IsSetDesc(void) const
description (instead of name) Check if a value has been assigned to Desc data member.
Definition: Prot_ref_.hpp:391
EProcessed
processing status
Definition: Prot_ref_.hpp:95
vector< CRef< CDbtag > > TDb
Definition: Prot_ref_.hpp:112
list< string > TName
Definition: Prot_ref_.hpp:108
list< string > TActivity
Definition: Prot_ref_.hpp:111
list< string > TEc
Definition: Prot_ref_.hpp:110
const TDesc & GetDesc(void) const
Get the Desc member data.
Definition: Prot_ref_.hpp:403
@ eProcessed_signal_peptide
Definition: Prot_ref_.hpp:99
@ eProcessed_transit_peptide
Definition: Prot_ref_.hpp:100
EType
type of RNA feature
Definition: RNA_ref_.hpp:95
@ eType_scRNA
will become ncRNA, with RNA-gen.class = scRNA
Definition: RNA_ref_.hpp:102
@ eType_snoRNA
will become ncRNA, with RNA-gen.class = snoRNA
Definition: RNA_ref_.hpp:103
@ eType_ncRNA
non-coding RNA; subsumes snRNA, scRNA, snoRNA
Definition: RNA_ref_.hpp:104
@ eType_snRNA
will become ncRNA, with RNA-gen.class = snRNA
Definition: RNA_ref_.hpp:101
bool IsSetComment(void) const
Check if a value has been assigned to Comment data member.
Definition: Seq_feat_.hpp:1037
void ResetTitle(void)
Reset Title data member.
Definition: Seq_feat_.cpp:142
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
Definition: Seq_feat_.hpp:913
bool IsSetQual(void) const
qualifiers Check if a value has been assigned to Qual data member.
Definition: Seq_feat_.hpp:1135
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
void SetComment(const TComment &value)
Assign a value to Comment data member.
Definition: Seq_feat_.hpp:1058
void ResetExcept(void)
Reset Except data member.
Definition: Seq_feat_.hpp:1002
const TQual & GetQual(void) const
Get the Qual member data.
Definition: Seq_feat_.hpp:1147
void ResetExcept_text(void)
Reset Except_text data member.
Definition: Seq_feat_.cpp:194
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
void ResetPseudo(void)
Reset Pseudo data member.
Definition: Seq_feat_.hpp:1358
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 SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_feat_.cpp:94
void ResetComment(void)
Reset Comment data member.
Definition: Seq_feat_.cpp:99
const TProduct & GetProduct(void) const
Get the Product member data.
Definition: Seq_feat_.hpp:1096
const TComment & GetComment(void) const
Get the Comment member data.
Definition: Seq_feat_.hpp:1049
void SetPseudo(TPseudo value)
Assign a value to Pseudo data member.
Definition: Seq_feat_.hpp:1374
const TGene & GetGene(void) const
Get the variant data.
const TProt & GetProt(void) const
Get the variant data.
vector< CRef< CSeqFeatXref > > TXref
Definition: Seq_feat_.hpp:122
void ResetProduct(void)
Reset Product data member.
Definition: Seq_feat_.cpp:105
void ResetDbxref(void)
Reset Dbxref data member.
Definition: Seq_feat_.cpp:188
TQual & SetQual(void)
Assign a value to Qual data member.
Definition: Seq_feat_.hpp:1153
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
Definition: Seq_feat_.hpp:1084
void ResetQual(void)
Reset Qual data member.
Definition: Seq_feat_.cpp:136
void ResetCit(void)
Reset Cit data member.
Definition: Seq_feat_.cpp:165
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_loc_.hpp:475
@ eNa_strand_plus
Definition: Na_strand_.hpp:66
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
@ e_Null
not placed
Definition: Seq_loc_.hpp:98
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
int i
static void text(MDB_val *v)
Definition: mdb_dump.c:62
range(_Ty, _Ty) -> range< _Ty >
Utility macros and typedefs for exploring NCBI objects from seqfeat.asn.
#define EDIT_EACH_GBQUAL_ON_SEQFEAT(Itr, Var)
#define ERASE_GBQUAL_ON_SEQFEAT(Itr, Var)
ERASE_GBQUAL_ON_SEQFEAT.
bool QualifierNamesAreEquivalent(string name1, string name2)
EExistingText
@ eExistingText_append_semi
bool AddValueToString(string &str, const string &value, EExistingText existing_text)
Add text to an existing string, using the "existing_text" directive to combine new text with existing...
SAnnotSelector –.
CRef< CCmdComposite > GetDeleteFeatureCommand(const objects::CSeq_feat_Handle &fh, bool remove_proteins=true)
Modified on Fri Sep 20 14:57:53 2024 by modify_doxy.py rev. 669887