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 37942 2017-03-07 17:11:31Z bollin $
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 
48 
49 #include <objmgr/feat_ci.hpp>
50 #include <objmgr/util/sequence.hpp>
53 
59 
62 
63 
65  : m_To(feat_to) , m_From(feat_from)
66 {
67  m_Options.clear();
70  }
73  } else if (m_To == CSeqFeatData::eSubtype_site) {
75  } else if (m_To == CSeqFeatData::eSubtype_bond) {
77  } else if (m_To == CSeqFeatData::eSubtype_region && !x_IsProtSubtype(feat_from)) {
79  } else if (m_To == CSeqFeatData::eSubtype_cdregion) {
81  }
82 }
83 
84 
85 // often a class converts to a single subtype, but this can be overridden
86 // for example, converting to different subtypes of RNAs or import features
88 {
89  if (subtype == m_To) {
90  return true;
91  } else {
92  return false;
93  }
94 }
95 
96 
97 // often a class converts to a single subtype, but this can be overridden
98 // for example, converting to different subtypes of RNAs or import features
100 {
101  if (subtype == m_From) {
102  return true;
103  } else {
104  return false;
105  }
106 }
107 
108 
110 {
111  CRef<CSeq_feat> new_feat(new CSeq_feat());
112  new_feat->Assign(orig);
113  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
114 
115  return cmd;
116 }
117 
118 
120 {
122  switch (subtype) {
125  break;
128  processed = CProt_ref::eProcessed_mature;
129  break;
133  break;
137  break;
138  default:
139  break;
140  }
141  return processed;
142 }
143 
144 
146 {
148 
149  switch (subtype) {
152  rna_type = CRNA_ref::eType_premsg;
153  break;
155  rna_type = CRNA_ref::eType_mRNA;
156  break;
158  rna_type = CRNA_ref::eType_tRNA;
159  break;
161  rna_type = CRNA_ref::eType_rRNA;
162  break;
164  rna_type = CRNA_ref::eType_snRNA;
165  break;
167  rna_type = CRNA_ref::eType_scRNA;
168  break;
170  rna_type = CRNA_ref::eType_snoRNA;
171  break;
173  rna_type = CRNA_ref::eType_ncRNA;
174  break;
176  rna_type = CRNA_ref::eType_tmRNA;
177  break;
179  rna_type = CRNA_ref::eType_miscRNA;
180  break;
182  rna_type = CRNA_ref::eType_other;
183  break;
184  default:
185  // leave as unknown;
186  break;
187  }
188  return rna_type;
189 }
190 
191 
193 {
194  CRef<CCmdComposite> cmd(new CCmdComposite("Convert Feature"));
195 
196  if (x_IsProtSubtype(m_To)) {
197  new_feat->SetData().SetProt().SetProcessed(GetProtProcessedFromFeatureSubtype(m_To));
198  } else if (x_IsRnaSubtype(m_To)) {
199  new_feat->SetData().SetRna().SetType(GetRnaTypeFromFeatureSubtype(m_To));
200  } else if (x_IsImportSubtype(m_To)) {
201  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
202  }
203 
204  if (new_feat->IsSetProduct()) {
205  CRef<CConversionOption> remove_transcript = FindRemoveTranscriptId();
206  if (!remove_transcript || (remove_transcript && remove_transcript->IsBool() && remove_transcript->GetBool()->GetVal())) {
207  new_feat->ResetProduct();
208  }
209  }
212  if (ncrna_class && ncrna_class->IsString() && !NStr::IsBlank(ncrna_class->GetString()->GetVal())) {
213  new_feat->SetData().SetRna().SetExt().SetGen().SetClass(ncrna_class->GetString()->GetVal());
214  }
215  }
218  if (site_type && site_type->IsString() && !NStr::IsBlank(site_type->GetString()->GetVal())) {
219  new_feat->SetData().SetSite(m_SiteList.GetSiteType(site_type->GetString()->GetVal()));
220  }
221  }
224  if (bond_type && bond_type->IsString() && !NStr::IsBlank(bond_type->GetString()->GetVal())) {
225  new_feat->SetData().SetBond(m_BondList.GetBondType(bond_type->GetString()->GetVal()));
226  }
227  }
230  if (on_prot && on_prot->IsBool() && on_prot->GetBool()->GetVal()) {
231  if (!x_MoveFeatureToProtein(orig, new_feat, keep_orig, scope)) {
232  return CRef<CCmdComposite>(NULL);
233  }
234  }
235  }
236 
237 
238  if (keep_orig) {
239  CBioseq_Handle bsh = scope.GetBioseqHandle(new_feat->GetLocation());
241  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_feat)));
242  } else {
243  // create new feature
244  CBioseq_Handle bsh = scope.GetBioseqHandle(new_feat->GetLocation());
246  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_feat)));
247  // delete original feature (will also remove product and renormalize nuc-prot set
249  }
250 
252  if (remove_gene && remove_gene->IsBool() && remove_gene->GetBool()->GetVal() && !(orig.IsSetData() && orig.GetData().IsGene())) {
254  if (gene) {
256  }
257  }
258 
260  if (remove_mrna && remove_mrna->IsBool() && remove_mrna->GetBool()->GetVal() && !(orig.IsSetData() && orig.GetData().GetSubtype() == CSeqFeatData::eSubtype_mRNA)) {
262  if (mrna) {
264  }
265  }
266 
267  return cmd;
268 }
269 
270 
272 (const CSeq_feat& orig,
273  CRef<CSeq_feat> new_feat,
274  bool keep_orig,
275  CScope& scope,
276  vector<string> products)
277 {
278  bool make_pseudo = false;
279  CRef<CConversionOption> is_pseudo = x_FindPseudo();
280  if (is_pseudo && is_pseudo->IsBool() && is_pseudo->GetBool()->GetVal()) {
281  make_pseudo = true;
282  }
284  if (make_pseudo) {
285  new_feat->SetPseudo(true);
286  ITERATE(vector<string>, it, products) {
287  x_AddToComment(*it, new_feat);
288  }
289  cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
290  } else {
291  // translate new coding region
292  CBioseq_Handle bsh = scope.GetBioseqHandle(new_feat->GetLocation());
297  ITERATE(vector<string>, it, products) {
298  prot->SetData().SetProt().SetName().push_back(*it);
299  }
300 
301  objects::CSeq_entry_Handle seh = bsh.GetSeq_entry_Handle();
302  cmd.Reset(new CCmdComposite("Convert to coding region"));
303  cmd->AddCommand(*CRef<objects::CCmdAddSeqEntry>(new objects::CCmdAddSeqEntry(protein, seh)));
304  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_feat)));
305  if (!keep_orig) {
307  }
308  }
309 
310  return cmd;
311 }
312 
313 
315 {
316  string product = "";
317  if (orig.IsSetProduct()) {
318  CBioseq_Handle bsh = scope.GetBioseqHandle(orig.GetProduct());
319  if (bsh) {
321  if (f && f->IsSetData() && f->GetData().IsProt()
322  && f->GetData().GetProt().IsSetName()
323  && f->GetData().GetProt().GetName().size() > 0) {
324  product = f->GetData().GetProt().GetName().front();
325  }
326  }
327  } else if (orig.IsSetXref()) {
328  ITERATE(CSeq_feat::TXref, it, orig.GetXref()) {
329  if ((*it)->IsSetData() && (*it)->GetData().IsProt()
330  && (*it)->GetData().GetProt().IsSetName()
331  && (*it)->GetData().GetProt().GetName().size() > 0) {
332  product = (*it)->GetData().GetProt().GetName().front();
333  }
334  }
335  }
336  return product;
337 }
338 
339 static void AdjustMappedStop(CRef<CSeq_loc> loc, const CSeq_loc &product, CScope& scope)
340 {
341  CBioseq_Handle protein = scope.GetBioseqHandle(product);
342  if (protein)
343  {
344  TSeqPos length = protein.GetBioseqLength();
345  if ( loc && loc->GetId() && loc->GetStop(objects::eExtreme_Positional) >= length)
346  {
347  CRef<CSeq_id> prot_id(new CSeq_id);
348  prot_id->Assign(*loc->GetId());
349  bool partial_stop = loc->IsPartialStop(objects::eExtreme_Positional);
350  CSeq_loc sub(*prot_id, length, loc->GetStop(objects::eExtreme_Positional), loc->GetStrand());
352  new_loc->SetPartialStop(partial_stop, objects::eExtreme_Positional);
353  loc->Assign(*new_loc);
354  }
355  }
356 }
357 
358 bool CConvertFeatureBase::x_MoveFeatureToProtein(const CSeq_feat& orig, CRef<CSeq_feat> new_feat, bool keep_orig, CScope& scope)
359 {
360  if (orig.GetData().IsCdregion() && keep_orig) {
361  if (!orig.IsSetProduct()) {
362  return false;
363  }
365  mapper.SetMergeAbutting();
366  CRef<CSeq_loc> loc = mapper.Map(orig.GetLocation());
367  if ( !loc || loc->Which() == CSeq_loc::e_Null) {
368  return false;
369  }
370  AdjustMappedStop(loc, orig.GetProduct(), scope);
371  new_feat->SetLocation().Assign(*loc);
372  } else {
375  if (!overlapping_cds || !overlapping_cds->IsSetProduct() || overlapping_cds.GetPointer() == &orig) {
376  return false;
377  } else {
378  CSeq_loc_Mapper mapper(*overlapping_cds, CSeq_loc_Mapper::eLocationToProduct, &scope);
379  mapper.SetMergeAbutting();
380  CRef<CSeq_loc> loc = mapper.Map(orig.GetLocation());
381  if ( !loc || loc->Which() == CSeq_loc::e_Null) {
382  return false;
383  }
384  AdjustMappedStop(loc, overlapping_cds->GetProduct(), scope);
385  new_feat->SetLocation().Assign(*loc);
386  }
387  }
388  return true;
389 }
390 
391 
392 vector<string> CConvertFeatureBase::x_ExtractQuals(CRef<CSeq_feat> new_feat, string qual_name)
393 {
394  vector<string> vals;
395 
396  if (new_feat->IsSetQual()) {
397  CSeq_feat::TQual::iterator it = new_feat->SetQual().begin();
398  while (it != new_feat->SetQual().end()) {
399  if ((*it)->IsSetQual() && NStr::EqualNocase((*it)->GetQual(), qual_name)) {
400  if ((*it)->IsSetVal() && !NStr::IsBlank((*it)->GetVal())) {
401  vals.push_back((*it)->GetVal());
402  }
403  it = new_feat->SetQual().erase(it);
404  } else {
405  ++it;
406  }
407  }
408  if (new_feat->GetQual().size() == 0) {
409  new_feat->ResetQual();
410  }
411  }
412  return vals;
413 }
414 
415 
417 {
418  return x_ExtractQuals(new_feat, "product");
419 }
420 
421 void CConvertFeatureBase::x_AddToComment(string comment, CRef<CSeq_feat> new_feat, edit::EExistingText existing_text)
422 {
423  if (NStr::IsBlank(comment)) {
424  return;
425  }
426 
427  if (!new_feat->IsSetComment() || NStr::IsBlank(new_feat->GetComment())) {
428  new_feat->SetComment(comment);
429  } else {
430  string orig_val = new_feat->GetComment();
431  if (edit::AddValueToString(orig_val, comment, existing_text)) {
432  new_feat->SetComment(orig_val);
433  }
434  }
435 }
436 
438 {
439  new_feat->ResetId();
440  new_feat->SetLocation().SetPartialStart(false, eExtreme_Biological);
441  new_feat->SetLocation().SetPartialStop(false, eExtreme_Biological);
442  new_feat->ResetExcept();
443  new_feat->ResetExcept_text();
444  new_feat->ResetComment();
445  new_feat->ResetProduct();
446  new_feat->ResetQual();
447  new_feat->ResetTitle();
448  new_feat->ResetCit();
449  new_feat->ResetDbxref();
450  new_feat->ResetPseudo();
451 }
452 
453 const string CConvertFeatureBase::s_RemovemRNA("Remove overlapping mRNA");
454 const string CConvertFeatureBase::s_RemoveGene("Remove overlapping gene");
455 const string CConvertFeatureBase::s_RemoveTranscriptID("Remove transcript ID");
456 const string CConvertFeatureBase::s_NcrnaClass("ncRNA class");
457 const string CConvertFeatureBase::s_SiteType("Site type");
458 const string CConvertFeatureBase::s_BondType("Bond type");
459 const string CConvertFeatureBase::s_PlaceOnProt("Create region features on protein sequence of overlapping coding region");
460 const string CConvertFeatureBase::s_IsPseudo("Pseudo");
461 
463 {
465  remove_mrna->SetBool();
466  m_Options.push_back(remove_mrna);
468  remove_gene->SetBool();
469  m_Options.push_back(remove_gene);
471  remove_transcript->SetBool();
472  m_Options.push_back(remove_transcript);
473 }
474 
475 
477 {
479  is_pseudo->SetBool();
480  m_Options.push_back(is_pseudo);
481 }
482 
483 
485 {
488  CRef<CConversionOptionString> val = ncrna_class->SetString();
489  vector<string> class_vals = CRNA_gen::GetncRNAClassList();
490  ITERATE(vector<string>, it, class_vals) {
491  val->AddSuggestedValue(*it);
492  }
493  val->SetOnlySuggested(false);
494 
495  m_Options.push_back(ncrna_class);
496  }
497 }
498 
499 
501 {
503  CRef<CConversionOptionString> val = site_type->SetString();
505  while (it != m_SiteList.end()) {
506  val->AddSuggestedValue(it->first);
507  ++it;
508  }
509  val->SetDefaultVal("active");
510  val->SetOnlySuggested(true);
511  m_Options.push_back(site_type);
512 }
513 
514 
516 {
518  CRef<CConversionOptionString> val = bond_type->SetString();
520  while (it != m_BondList.end()) {
521  val->AddSuggestedValue(it->first);
522  ++it;
523  }
524  val->SetDefaultVal("disulfide");
525  val->SetOnlySuggested(true);
526  m_Options.push_back(bond_type);
527 }
528 
529 
531 {
533  CRef<CConversionOptionBool> val = on_prot->SetBool();
534  m_Options.push_back(on_prot);
535 }
536 
537 
539 {
540  ITERATE(TOptions, it, m_Options) {
541  if (NStr::Equal((*it)->GetLabel(), label)) {
542  return *it;
543  }
544  }
546 }
547 
548 
550 {
551  return x_FindOption(s_RemoveGene);
552 }
553 
554 
556 {
557  return x_FindOption(s_RemovemRNA);
558 }
559 
560 
562 {
564 }
565 
566 
568 {
569  return x_FindOption(s_NcrnaClass);
570 }
571 
572 
574 {
575  return x_FindOption(s_SiteType);
576 }
577 
578 
580 {
581  return x_FindOption(s_BondType);
582 }
583 
584 
586 {
587  return x_FindOption(s_PlaceOnProt);
588 }
589 
590 
592 {
593  return x_FindOption(s_IsPseudo);
594 }
595 
596 
598 {
600  return true;
601  } else {
602  return false;
603  }
604 }
605 
606 
608 {
610  return true;
611  } else {
612  return false;
613  }
614 }
615 
616 
618 {
620  return true;
621  } else {
622  return false;
623  }
624 }
625 
626 
628 {
630  while (it != m_SiteList.end() && site_type != it->second) {
631  ++it;
632  }
633  if (it) {
634  return it->first;
635  } else {
636  return "";
637  }
638 }
639 
640 
642 {
643  CRef<CSeq_feat> new_feat(new CSeq_feat());
644  new_feat->Assign(orig);
645  new_feat->SetData().SetGene();
646  if (orig.IsSetComment()) {
647  new_feat->SetData().SetGene().SetLocus(orig.GetComment());
648  size_t pos = NStr::Find(new_feat->GetComment(), ";");
649  if (pos == string::npos) {
650  new_feat->ResetComment();
651  } else {
652  new_feat->SetData().SetGene().SetLocus(new_feat->GetData().GetGene().GetLocus().substr(0, pos));
653  new_feat->SetComment(new_feat->GetComment().substr(pos));
654  }
655  }
656 
657  return x_SimpleConversion(orig, new_feat, keep_orig, scope);
658 }
659 
660 
661 CRef<CCmdComposite> CConvertImpToImp::Convert(const CSeq_feat& orig, bool keep_orig, CScope& scope)
662 {
663  CRef<CSeq_feat> new_feat(new CSeq_feat());
664  new_feat->Assign(orig);
665 
666  return x_SimpleConversion(orig, new_feat, keep_orig, scope);
667 }
668 
669 
670 CRef<CCmdComposite> CConvertCDSToRNA::Convert(const CSeq_feat& orig, bool keep_orig, CScope& scope)
671 {
673  CRef<CSeq_feat> new_feat(new CSeq_feat());
674  new_feat->Assign(orig);
675  new_feat->SetData().SetRna().SetType(GetRnaTypeFromFeatureSubtype(m_To));
676 
677  // get protein name
678  string product = x_GetCDSProduct(orig, scope);
679  if (!NStr::IsBlank(product)) {
680  string remainder = "";
681  new_feat->SetData().SetRna().SetRnaProductName(product, remainder);
682  x_AddToComment(remainder, new_feat);
683  }
684 
685  cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
686 
687  return cmd;
688 }
689 
690 
691 void CConvertGeneToRNA::x_AddOneGeneField(string& product, string& comment, const string& field)
692 {
693  if (NStr::IsBlank(field)) {
694  return;
695  }
696  if (NStr::IsBlank(product)) {
697  product = field;
698  } else if (NStr::Find(product, field) == string::npos && NStr::Find(comment, field) == string::npos) {
699  comment = comment + "; " + field;
700  }
701 }
702 
703 
705 {
706  string product = "";
707  string comment = "";
708  if (new_feat->IsSetComment()) {
709  comment = new_feat->GetComment();
710  }
711 
712  if (orig.IsSetLocus()) {
713  x_AddOneGeneField(product, comment, orig.GetLocus());
714  }
715  if (orig.IsSetAllele()) {
716  x_AddOneGeneField(product, comment, orig.GetAllele());
717  }
718  if (orig.IsSetDesc()) {
719  x_AddOneGeneField(product, comment, orig.GetDesc());
720  }
721  if (orig.IsSetMaploc()) {
722  x_AddOneGeneField(product, comment, orig.GetMaploc());
723  }
724  if (orig.IsSetLocus_tag()) {
725  x_AddOneGeneField(product, comment, orig.GetLocus_tag());
726  }
727 
728  string remainder = "";
729  new_feat->SetData().SetRna().SetRnaProductName(product, remainder);
730  if (!NStr::IsBlank(remainder)) {
731  comment = comment + "; " + remainder;
732  }
733  if (NStr::StartsWith(comment, ";")) {
734  comment = comment.substr(1);
735  }
737  if (!NStr::IsBlank(comment)) {
738  new_feat->SetComment(comment);
739  }
740 }
741 
742 
744 {
745  CRef<CSeq_feat> new_feat(new CSeq_feat());
746  new_feat->Assign(orig);
747  new_feat->SetData().SetRna().SetType(GetRnaTypeFromFeatureSubtype(m_To));
748  x_AddGeneFieldsToComment(orig.GetData().GetGene(), new_feat);
749  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
750 
751  return cmd;
752 }
753 
754 
756 {
757  CRef<CSeq_feat> new_feat(new CSeq_feat());
758  new_feat->Assign(orig);
759  new_feat->SetData().SetImp().SetKey("repeat_region");
760 
761  bool is_transposon = false;
762  bool is_insertion = false;
763  string transposon_name = "";
764  string insertion_name = "";
765  string comment = "";
766  if (orig.IsSetComment()) {
767  comment = orig.GetComment();
768  }
769 
770  if (orig.IsSetData() && orig.GetData().IsBiosrc()) {
771  if (orig.GetData().GetBiosrc().IsSetSubtype()) {
773  if ((*it)->IsSetSubtype()) {
774  if ((*it)->GetSubtype() == CSubSource::eSubtype_transposon_name) {
775  is_transposon = true;
776  if ((*it)->IsSetName() && !NStr::IsBlank((*it)->GetName())) {
777  if (NStr::IsBlank(transposon_name)) {
778  transposon_name = (*it)->GetName();
779  } else {
780  transposon_name = transposon_name + ";" + (*it)->GetName();
781  }
782  }
783  } else if ((*it)->GetSubtype() == CSubSource::eSubtype_insertion_seq_name) {
784  is_insertion = true;
785  if ((*it)->IsSetName() && !NStr::IsBlank((*it)->GetName())) {
786  if (NStr::IsBlank(insertion_name)) {
787  insertion_name = (*it)->GetName();
788  } else {
789  insertion_name = insertion_name + ";" + (*it)->GetName();
790  }
791  }
792  } else if ((*it)->GetSubtype() == CSubSource::eSubtype_other
793  && (*it)->IsSetName()
794  && !NStr::IsBlank((*it)->GetName())) {
795  if (NStr::IsBlank(comment)) {
796  comment = (*it)->GetName();
797  } else {
798  comment = comment + ";" + (*it)->GetName();
799  }
800  }
801  }
802  }
803  }
804  if (orig.GetData().GetBiosrc().IsSetOrg()
805  && orig.GetData().GetBiosrc().GetOrg().IsSetOrgname()
806  && orig.GetData().GetBiosrc().GetOrg().GetOrgname().IsSetMod()) {
808  if ((*it)->IsSetSubtype() && (*it)->GetSubtype() == COrgMod::eSubtype_other
809  && (*it)->IsSetSubname() && !NStr::IsBlank((*it)->GetSubname())) {
810  if (NStr::IsBlank(comment)) {
811  comment = (*it)->GetSubname();
812  } else {
813  comment = comment + ";" + (*it)->GetSubname();
814  }
815  }
816  }
817  }
818  }
819  if (is_transposon) {
820  CRef<CGb_qual> q(new CGb_qual("mobile_element", "transposon:" + transposon_name));
821  new_feat->SetQual().push_back(q);
822  }
823 
824  if (is_insertion) {
825  CRef<CGb_qual> q(new CGb_qual("mobile_element", "insertion sequence:" + insertion_name));
826  new_feat->SetQual().push_back(q);
827  }
828 
829  if (!NStr::IsBlank(comment)) {
830  new_feat->SetComment(comment);
831  }
832 
833 
834  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
835 
836  return cmd;
837 }
838 
839 
841 {
842  CRef<CSeq_feat> new_feat(new CSeq_feat());
843  new_feat->Assign(orig);
844  new_feat->SetData().SetImp().SetKey("misc_feature");
845  new_feat->ResetProduct();
846  CRef<objects::CSeq_id> id(new objects::CSeq_id);
847  id->Assign(*orig.GetLocation().GetId());
849  objects::ENa_strand strand = orig.GetLocation().GetStrand();
852  CRef<objects::CSeq_loc> new_loc(new objects::CSeq_loc);
853  CRef<objects::CSeq_interval> new_int(new objects::CSeq_interval(*id, range.GetFrom(), range.GetTo(), strand));
854  new_int->SetPartialStart(part5, objects::eExtreme_Positional);
855  new_int->SetPartialStop(part3, objects::eExtreme_Positional);
856  new_loc->SetInt(*new_int);
857  new_feat->SetLocation(*new_loc);
858 
859  string product = x_GetCDSProduct(orig, scope);
860  string comment = product;
861  if (m_Similar)
862  {
863  comment = "similar to "+product;
864  }
865  else if (m_Nonfunctional)
866  {
867  comment = "nonfunctional "+product+" due to mutation";
868  }
869  x_AddToComment(comment, new_feat);
870 
871  const string& prot_desc = x_GetProteinDesc(orig, scope);
872  x_AddToComment(prot_desc, new_feat, edit::eExistingText_append_semi);
873 
874  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
875 
876  return cmd;
877 }
878 
880 {
881  if (!cds.IsSetProduct()) {
882  return kEmptyStr;
883  }
884 
885  string desc(kEmptyStr);
886  CBioseq_Handle bsh = scope.GetBioseqHandle(cds.GetProduct());
887  if (bsh) {
889  if (f && f->IsSetData() && f->GetData().IsProt()
890  && f->GetData().GetProt().IsSetDesc()) {
891  desc = f->GetData().GetProt().GetDesc();
892  }
893  }
894  return desc;
895 }
896 
898 {
899  CRef<CSeq_feat> new_feat(new CSeq_feat());
900  new_feat->Assign(orig);
901  new_feat->SetData().SetProt().SetProcessed(GetProtProcessedFromFeatureSubtype(m_To));
902 
903  if (!x_MoveFeatureToProtein(orig, new_feat, keep_orig, scope)) {
904  return CRef<CCmdComposite>(NULL);
905  }
906 
909  string product = x_GetCDSProduct(*overlapping_cds, scope);
910  new_feat->SetData().SetProt().SetName().push_back(product);
911 
912  if (new_feat->IsSetQual()) {
913  CSeq_feat::TQual::iterator it = new_feat->SetQual().begin();
914  while (it != new_feat->SetQual().end()) {
915  string val = "";
916  if ((*it)->IsSetVal()) {
917  val = (*it)->GetVal();
918  }
919  if (!(*it)->IsSetQual()) {
920  it++;
921  } else if (NStr::EqualNocase((*it)->GetQual(), "product")) {
922  // product qualifier
923  if (!NStr::IsBlank(val)) {
924  new_feat->SetData().SetProt().SetName().push_back((*it)->GetVal());
925  }
926  it = new_feat->SetQual().erase(it);
927  } else if (NStr::EqualNocase((*it)->GetQual(), "EC_number")) {
928  // EC number qualifiers
929  if (!NStr::IsBlank(val)) {
930  new_feat->SetData().SetProt().SetEc().push_back((*it)->GetVal());
931  }
932  it = new_feat->SetQual().erase(it);
933  } else if (NStr::EqualNocase((*it)->GetQual(), "function")) {
934  // activity
935  if (!NStr::IsBlank(val)) {
936  new_feat->SetData().SetProt().SetActivity().push_back((*it)->GetVal());
937  }
938  it = new_feat->SetQual().erase(it);
939  } else if (NStr::EqualNocase((*it)->GetQual(), "dbxref")) {
940  // dbxrefs
941  if (!NStr::IsBlank(val)) {
942  CRef<CDbtag> db(new CDbtag());
943  size_t pos = NStr::Find(val, ":");
944  if (pos == string::npos) {
945  db->SetDb(val);
946  } else {
947  db->SetDb(val.substr(0, pos));
948  db->SetTag().SetStr(val.substr(pos));
949  }
950  new_feat->SetData().SetProt().SetDb().push_back(db);
951  }
952  it = new_feat->SetQual().erase(it);
953  } else {
954  it++;
955  }
956  }
957 
958  }
959 
960  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
961 
962  return cmd;
963 }
964 
965 
967 {
968  CBioseq_Handle bsh = scope.GetBioseqHandle(orig.GetLocation());
969  if (!bsh) {
970  return CRef<CCmdComposite>(NULL);
971  }
972  const CSeq_feat * overlapping_cds = sequence::GetCDSForProduct(bsh);
973  if (!overlapping_cds) {
974  return CRef<CCmdComposite>(NULL);
975  }
976 
977  // map to corresponding location on protein sequence
978  CSeq_loc_Mapper mapper(*overlapping_cds, CSeq_loc_Mapper::eProductToLocation);
979  mapper.SetMergeAbutting();
980  CRef<CSeq_loc> loc = mapper.Map(orig.GetLocation());
981  if ( !loc ) {
982  return CRef<CCmdComposite>(NULL);
983  }
984 
985  CRef<CSeq_feat> new_feat(new CSeq_feat());
986  new_feat->Assign(orig);
987  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
988 
989  new_feat->SetLocation().Assign(*loc);
990 
991  // product qualifier
992  const CProt_ref& prot = orig.GetData().GetProt();
993  if (prot.IsSetName()
994  && prot.GetName().size() > 0
995  && !NStr::IsBlank (prot.GetName().front())) {
996  CRef<CGb_qual> q(new CGb_qual("product", prot.GetName().front()));
997  new_feat->SetQual().push_back(q);
998  } else if (prot.IsSetDesc()
999  && !NStr::IsBlank(prot.GetDesc())) {
1000  CRef<CGb_qual> q(new CGb_qual("product", prot.GetDesc()));
1001  new_feat->SetQual().push_back(q);
1002  }
1003 
1004  // EC number qualifiers
1005  if (prot.IsSetEc()) {
1006  ITERATE(CProt_ref::TEc, it, prot.GetEc()) {
1007  CRef<CGb_qual> q(new CGb_qual("EC_number", (*it)));
1008  new_feat->SetQual().push_back(q);
1009  }
1010  }
1011 
1012  // activity
1013  if (prot.IsSetActivity()) {
1015  CRef<CGb_qual> q(new CGb_qual("function", (*it)));
1016  new_feat->SetQual().push_back(q);
1017  }
1018  }
1019 
1020  // dbxrefs
1021  if (prot.IsSetDb()) {
1022  ITERATE(CProt_ref::TDb, it, prot.GetDb()) {
1023  string val = "";
1024  (*it)->GetLabel(&val);
1025  CRef<CGb_qual> q(new CGb_qual("dbxref", val));
1026  new_feat->SetQual().push_back(q);
1027  }
1028  }
1029 
1030 
1031  CRef<CCmdComposite> cmd(new CCmdComposite("Convert Feature"));
1032 
1033  // create new feature
1034  CBioseq_Handle nuc_bsh = scope.GetBioseqHandle(new_feat->GetLocation());
1035  CSeq_entry_Handle seh = nuc_bsh.GetSeq_entry_Handle();
1036  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_feat)));
1037  // delete original coding region (will also remove product and renormalize nuc-prot set
1038  if (!keep_orig)
1039  {
1041  }
1042 
1043  return cmd;
1044 }
1045 
1046 
1048 {
1049  CRef<CSeq_feat> new_feat(new CSeq_feat());
1050  new_feat->Assign(orig);
1051  new_feat->SetData().SetRna().SetType(GetRnaTypeFromFeatureSubtype(m_To));
1052 
1053  vector<string> products = x_ExtractProductQuals(new_feat);
1054  if (products.size() > 0) {
1055  string product = products[0];
1056  for(size_t i = 1; i < products.size(); i++) {
1057  product += "; " + products[i];
1058  }
1059  string remainder = "";
1060  new_feat->SetData().SetRna().SetRnaProductName(product, remainder);
1061  x_AddToComment(remainder, new_feat);
1062  }
1063 
1064  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1065 
1066  return cmd;
1067 }
1068 
1069 
1071 {
1072  CRef<CSeq_feat> new_feat(new CSeq_feat());
1073  new_feat->Assign(orig);
1074  new_feat->SetData().SetCdregion();
1075  vector<string> products = x_ExtractProductQuals(new_feat);
1076  if (products.size() == 0 && new_feat->IsSetComment() && !NStr::IsBlank(new_feat->GetComment())) {
1077  products.push_back(new_feat->GetComment());
1078  new_feat->ResetComment();
1079  }
1080 
1081  return x_ConvertToCDS(orig, new_feat, keep_orig, scope, products);
1082 }
1083 
1084 
1086 {
1087  CRef<CSeq_feat> new_feat(new CSeq_feat());
1088  new_feat->Assign(orig);
1089  new_feat->SetData().SetGene();
1090 
1091  vector<string> gene_vals = x_ExtractQuals(new_feat, "gene");
1092  if (gene_vals.size() == 0 && new_feat->IsSetComment() && !NStr::IsBlank(new_feat->GetComment())) {
1093  gene_vals.push_back(new_feat->GetComment());
1094  new_feat->ResetComment();
1095  }
1096 
1097  if (gene_vals.size() > 0) {
1098  string gene = gene_vals[0];
1099  for(size_t i = 1; i < gene_vals.size(); i++) {
1100  gene += "; " + gene_vals[i];
1101  }
1102  new_feat->SetData().SetGene().SetLocus(gene);
1103  }
1104 
1105  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1106 
1107  return cmd;
1108 }
1109 
1110 
1112 {
1113  CRef<CSeq_feat> new_feat(new CSeq_feat());
1114  new_feat->Assign(orig);
1115  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
1116  x_AddToComment(orig.GetData().GetRegion(), new_feat);
1117 
1118  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1119 
1120  return cmd;
1121 }
1122 
1123 
1125 {
1126  CRef<CSeq_feat> new_feat(new CSeq_feat());
1127  new_feat->Assign(orig);
1128  new_feat->SetData().SetRna().SetType(GetRnaTypeFromFeatureSubtype(m_To));
1129 
1130  string product = orig.GetData().GetRegion();
1131  string remainder = "";
1132  new_feat->SetData().SetRna().SetRnaProductName(product, remainder);
1133  x_AddToComment(remainder, new_feat);
1134 
1135  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1136 
1137  return cmd;
1138 }
1139 
1140 
1142 {
1143  CRef<CSeq_feat> new_feat(new CSeq_feat());
1144  new_feat->Assign(orig);
1145  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
1146 
1147  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1148 
1149  return cmd;
1150 }
1151 
1152 
1154 {
1155  CRef<CSeq_feat> new_feat(new CSeq_feat());
1156  new_feat->Assign(orig);
1157  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
1158  string orig_comment = "";
1159  if (new_feat->IsSetComment()) {
1160  orig_comment = new_feat->GetComment();
1161  }
1162  new_feat->ResetComment();
1163  const CGene_ref& gene = orig.GetData().GetGene();
1164  if (gene.IsSetLocus()
1166  x_AddToComment(gene.GetLocus(), new_feat);
1167  }
1168  if (gene.IsSetDesc()
1170  x_AddToComment(gene.GetDesc(), new_feat);
1171  }
1172  x_AddToComment(orig_comment, 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  string product = orig.GetData().GetRna().GetRnaProductName();
1186  x_AddToComment(product, new_feat);
1187 
1188  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1189 
1190  return cmd;
1191 }
1192 
1193 
1195 {
1196  CRef<CSeq_feat> new_feat(new CSeq_feat());
1197  new_feat->Assign(orig);
1198  new_feat->SetData().SetCdregion();
1199 
1200  vector<string> products;
1201  products.push_back(orig.GetData().GetRna().GetRnaProductName());
1202 
1203  return x_ConvertToCDS(orig, new_feat, keep_orig, scope, products);
1204 }
1205 
1206 
1208 {
1209  CRef<CSeq_feat> new_feat(new CSeq_feat());
1210  new_feat->Assign(orig);
1211 
1212  string product = orig.GetData().GetRna().GetRnaProductName();
1213  new_feat->SetData().SetGene().SetDesc(product);
1214 
1215  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1216 
1217  return cmd;
1218 }
1219 
1220 
1222 {
1223  CRef<CSeq_feat> new_feat(new CSeq_feat());
1224  new_feat->Assign(orig);
1225  new_feat->SetData().SetImp().SetKey(CSeqFeatData::SubtypeValueToName(m_To));
1226  string site_name = GetSiteName(orig.GetData().GetSite());
1227  x_AddToComment(site_name, new_feat);
1228 
1229  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1230 
1231  return cmd;
1232 }
1233 
1234 
1236 {
1237  CRef<CSeq_feat> new_feat(new CSeq_feat());
1238  new_feat->Assign(orig);
1239  if (!x_MoveFeatureToProtein(orig, new_feat, keep_orig, scope)) {
1240  return CRef<CCmdComposite>(NULL);
1241  }
1242  new_feat->SetData().SetProt().SetName().push_back(orig.GetData().GetRegion());
1243 
1244  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1245 
1246  return cmd;
1247 }
1248 
1249 
1251 {
1252  CRef<CSeq_feat> new_feat(new CSeq_feat());
1253  new_feat->Assign(orig);
1254  new_feat->SetData().SetRna().SetType(GetRnaTypeFromFeatureSubtype(m_To));
1255  string product = orig.GetData().GetRna().GetRnaProductName();
1256  string remainder = "";
1257  new_feat->SetData().SetRna().SetRnaProductName(product, remainder);
1258  x_AddToComment(remainder, new_feat);
1259 
1260  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1261 
1262  return cmd;
1263 }
1264 
1265 
1266 CRef<CCmdComposite> CConvertToBond::Convert(const CSeq_feat& orig, bool keep_orig, CScope& scope)
1267 {
1268  CRef<CSeq_feat> new_feat(new CSeq_feat());
1269  new_feat->Assign(orig);
1270  x_ClearGenericFields(new_feat);
1271  CSeq_loc_CI ci(orig.GetLocation());
1272  new_feat->SetLocation().SetBond().SetA().SetId().Assign(ci.GetSeq_id());
1273  new_feat->SetLocation().SetBond().SetA().SetPoint(orig.GetLocation().GetStart(eExtreme_Biological));
1274  CSeq_loc_CI ci_next = ci;
1275  ++ci_next;
1276  while (ci_next) {
1277  ++ci;
1278  ++ci_next;
1279  }
1280  new_feat->SetLocation().SetBond().SetB().SetId().Assign(ci.GetSeq_id());
1281  new_feat->SetLocation().SetBond().SetB().SetPoint(orig.GetLocation().GetStop(eExtreme_Biological));
1282 
1283  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1284 
1285  return cmd;
1286 }
1287 
1288 
1289 CRef<CCmdComposite> CConvertToSite::Convert(const CSeq_feat& orig, bool keep_orig, CScope& scope)
1290 {
1291  CRef<CSeq_feat> new_feat(new CSeq_feat());
1292  new_feat->Assign(orig);
1293  x_ClearGenericFields(new_feat);
1294  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1295 
1296  return cmd;
1297 }
1298 
1299 
1301 {
1302  if (x_IsProtSubtype(m_From)) {
1303  return "Create region feature with the protein name as the region name";
1304  } else {
1305  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\
1306 All feature ID, partialness, except, comment, product, location, genbank qualifiers, title, citation, experimental evidence, gene xrefs, db xrefs, and pseudo-ness information is discarded.";
1307  }
1308 }
1309 
1310 
1312 {
1313  CRef<CSeq_feat> new_feat(new CSeq_feat());
1314  new_feat->Assign(orig);
1315  new_feat->SetData().SetRegion();
1316  x_ClearGenericFields(new_feat);
1317  if (orig.GetData().IsProt()) {
1318  if (orig.GetData().GetProt().IsSetName() && orig.GetData().GetProt().GetName().size() > 0) {
1319  new_feat->SetData().SetRegion(orig.GetData().GetProt().GetName().front());
1320  }
1321  } else if (orig.IsSetComment()) {
1322  new_feat->SetData().SetRegion(orig.GetComment());
1323  }
1324  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1325 
1326  return cmd;
1327 }
1328 
1329 
1331 {
1332  string subtype_name = CSeqFeatData::SubtypeValueToName(m_To);
1333  string desc = "If coding region is overlapped by another coding region, convert the coding region to a "
1334  + subtype_name
1335  + " on the overlapping coding region's protein sequence, otherwise if you have checked \"Leave Original Feature\" it will create a "
1336  + subtype_name + " with the same protein names and description on the protein sequence for the coding region.";
1337  return desc;
1338 }
1339 
1340 
1342 {
1343  CRef<CSeq_feat> new_feat(new CSeq_feat());
1344  new_feat->Assign(orig);
1345  if (!x_MoveFeatureToProtein(orig, new_feat, keep_orig, scope)) {
1346  return CRef<CCmdComposite>(NULL);
1347  }
1348  string product = x_GetCDSProduct(orig, scope);
1349  new_feat->SetData().SetProt().SetName().push_back(product);
1351  {
1352  new_feat->ResetProduct();
1353  if (orig.IsSetProduct())
1354  {
1355  CBioseq_Handle prot_bsh = scope.GetBioseqHandle(orig.GetProduct());
1356  if (prot_bsh && prot_bsh.IsProtein())
1357  {
1358  CFeat_CI prot_feat_ci(prot_bsh, CSeqFeatData::e_Prot);
1359  if (prot_feat_ci && prot_feat_ci->GetOriginalFeature().IsSetData() && prot_feat_ci->GetOriginalFeature().GetData().IsProt()
1360  && prot_feat_ci->GetOriginalFeature().GetData().GetProt().IsSetDesc())
1361  {
1362  new_feat->SetData().SetProt().SetDesc(prot_feat_ci->GetOriginalFeature().GetData().GetProt().GetDesc());
1363  }
1364  }
1365  }
1366  }
1367  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1368 
1369  return cmd;
1370 }
1371 
1372 
1374 {
1375  CRef<CSeq_feat> new_feat(new CSeq_feat());
1376  new_feat->Assign(orig);
1377  new_feat->SetData().SetGene();
1378 
1379  if (orig.IsSetProduct()) {
1380  CBioseq_Handle bsh = scope.GetBioseqHandle(orig.GetProduct());
1381  if (bsh) {
1383  if (f && f->IsSetData() && f->GetData().IsProt()) {
1384  const CProt_ref& prot = f->GetData().GetProt();
1385  if (prot.IsSetName()) {
1386  ITERATE(CProt_ref::TName, it, prot.GetName()) {
1387  x_AddToComment(*it, new_feat);
1388  }
1389  }
1390  if (prot.IsSetDesc()) {
1391  x_AddToComment(prot.GetDesc(), new_feat);
1392  }
1393  if (prot.IsSetActivity()) {
1395  x_AddToComment(*it, new_feat);
1396  }
1397  }
1398  if (prot.IsSetDb()) {
1399  ITERATE(CProt_ref::TDb, it, prot.GetDb()) {
1400  string val = "";
1401  (*it)->GetLabel(&val);
1402  x_AddToComment(val, new_feat);
1403  }
1404  }
1405  if (prot.IsSetEc()) {
1406  ITERATE(CProt_ref::TEc, it, prot.GetEc()) {
1407  x_AddToComment(*it, new_feat);
1408  }
1409  }
1410  }
1411  }
1412  }
1413 
1414  CRef<CCmdComposite> cmd = x_SimpleConversion(orig, new_feat, keep_orig, scope);
1415 
1416  return cmd;
1417 }
1418 
1419 
1422 {
1423  // choose appropriate converter
1424 
1426 
1427  if (subtype_from != subtype_to) {
1428  rval = new CConvertCDSToRNA(subtype_to);
1429  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1430  return rval;
1431  }
1432  rval = new CConvertGeneToRNA(subtype_to);
1433  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1434  return rval;
1435  }
1436  rval = new CConvertMiscFeatToGene();
1437  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1438  return rval;
1439  }
1440  rval = new CConvertImpToImp(subtype_to, subtype_from);
1441  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1442  return rval;
1443  }
1444  rval = new CConvertBioSrcToRptRegion();
1445  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1446  return rval;
1447  }
1448  rval = new CConvertCDSToMiscFeat();
1449  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1450  return rval;
1451  }
1452  rval = new CConvertImpToProt(subtype_to, subtype_from);
1453  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1454  return rval;
1455  }
1456  rval = new CConvertImpToRNA(subtype_to, subtype_from);
1457  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1458  return rval;
1459  }
1460  rval = new CConvertImpToCDS(subtype_from);
1461  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1462  return rval;
1463  }
1464  rval = new CConvertImpToGene(subtype_from);
1465  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1466  return rval;
1467  }
1468  rval = new CConvertRegionToImp(subtype_to);
1469  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1470  return rval;
1471  }
1472  rval = new CConvertRegionToRna(subtype_to);
1473  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1474  return rval;
1475  }
1476  rval = new CConvertCommentToImp(subtype_to);
1477  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1478  return rval;
1479  }
1480  rval = new CConvertGeneToImp(subtype_to);
1481  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1482  return rval;
1483  }
1484  rval = new CConvertRnaToImp(subtype_to, subtype_from);
1485  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1486  return rval;
1487  }
1488  rval = new CConvertmRNAToCDS(subtype_to, subtype_from);
1489  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1490  return rval;
1491  }
1492  rval = new CConverttRNAToGene(subtype_to, subtype_from);
1493  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1494  return rval;
1495  }
1496  rval = new CConvertSiteToImp(subtype_to);
1497  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1498  return rval;
1499  }
1500  rval = new CConvertRNAToRNA(subtype_to, subtype_from);
1501  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1502  return rval;
1503  }
1504  rval = new CConvertRegionToProt(subtype_to);
1505  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1506  return rval;
1507  }
1508  rval = new CConvertToBond(subtype_from);
1509  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1510  return rval;
1511  }
1512  rval = new CConvertToSite(subtype_from);
1513  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1514  return rval;
1515  }
1516  rval = new CConvertToRegion(subtype_from);
1517  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1518  return rval;
1519  }
1520  rval = new CConvertProtToProt(subtype_to, subtype_from);
1521  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1522  return rval;
1523  }
1524  rval = new CConvertCDSToProt(subtype_to);
1525  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1526  return rval;
1527  }
1528  rval = new CConvertCDSToGene();
1529  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1530  return rval;
1531  }
1532  rval = new CConvertProtToImp(subtype_to, subtype_from);
1533  if (rval->CanConvertFrom(subtype_from) && rval->CanConvertTo(subtype_to)) {
1534  return rval;
1535  }
1536 
1537  }
1538 
1539  // return "no conversion found" if no appropriate one found
1540  rval = new CConvertFeatureBase();
1541  return rval;
1542 }
1543 
1544 
1546 {
1547  if (m_Choice != e_Bool) {
1549  m_Object = new_obj;
1550  }
1551  CRef<CConversionOptionBool> obj(dynamic_cast<CConversionOptionBool *>(m_Object.GetPointer()));
1552  m_Choice = e_Bool;
1553  return obj;
1554 }
1555 
1556 
1558 {
1559  if (m_Choice != e_Bool) {
1561  } else {
1563  }
1564 }
1565 
1566 
1568 {
1569  if (m_Choice != e_String) {
1571  m_Object = new_obj;
1572  }
1573  CRef<CConversionOptionString> obj(dynamic_cast<CConversionOptionString *>(m_Object.GetPointer()));
1574  m_Choice = e_String;
1575  return obj;
1576 }
1577 
1578 
1580 {
1581  if (m_Choice != e_String) {
1583  } else {
1585  }
1586 }
1587 
1589 {
1592  m_Options.clear();
1593  //x_AddCDSSourceConversionOptions();
1594  //CRef<CConversionOption> is_pseudo(new CConversionOption(kIsPseudo));
1595  //is_pseudo->SetBool();
1596  //m_Options.push_back(is_pseudo);
1597 }
1598 
1600 {
1601  CRef<CCmdComposite> cmd(new CCmdComposite("Convert Feature"));
1602 
1604 
1605  CRef<CSeq_feat> new_feat(new CSeq_feat());
1606  new_feat->Assign(orig);
1607  new_feat->SetData().SetGene();
1608  if (gene)
1609  {
1610  CRef<CSeq_feat> copy_gene(new CSeq_feat());
1611  copy_gene->Assign(*gene);
1612  new_feat->SetData().SetGene(copy_gene->SetData().SetGene());
1614  }
1615 
1616  CRef<CGene_ref> gene_ref(&new_feat->SetData().SetGene());
1617  if (orig.IsSetProduct()) {
1618  CBioseq_Handle bsh = scope.GetBioseqHandle(orig.GetProduct());
1619  if (bsh) {
1621  if (f && f->IsSetData() && f->GetData().IsProt()) {
1622  const CProt_ref& prot = f->GetData().GetProt();
1623 
1624  if (f->IsSetComment()) {
1625  x_AddToComment(f->GetComment(), new_feat);
1626  }
1627  if (prot.IsSetDesc()) {
1628  x_AddToComment(prot.GetDesc(), new_feat);
1629  }
1630 
1631  if (!gene_ref->IsSetLocus()) {
1632  // use protein product names for gene locus if gene does not already have one
1633  if (prot.IsSetName()) {
1634  ITERATE (CProt_ref::TName, it, prot.GetName()) {
1636 
1637  }
1638  }
1639  } else if (!gene_ref->IsSetDesc()) {
1640  // use protein product names for gene description if gene does not already have one
1641  if (prot.IsSetName()) {
1642  ITERATE (CProt_ref::TName, it, prot.GetName()) {
1644  }
1645  }
1646  } else {
1647  // prepend list of protein product names to gene comment
1648  if (prot.IsSetName()) {
1649  string protein_names;
1650  ITERATE (CProt_ref::TName, it, prot.GetName()) {
1652  }
1653  x_AddToComment(protein_names, new_feat);
1654  }
1655  }
1656  }
1657  }
1658  }
1659 
1660  new_feat->SetPseudo(true);
1661  new_feat->ResetProduct();
1662 
1663  if (keep_orig) {
1664  CBioseq_Handle bsh = scope.GetBioseqHandle(new_feat->GetLocation());
1666  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_feat)));
1667  } else if (orig.IsSetData() && orig.GetData().IsCdregion()) {
1668  // create new feature
1669  CBioseq_Handle bsh = scope.GetBioseqHandle(new_feat->GetLocation());
1671  cmd->AddCommand(*CRef<CCmdCreateFeat>(new CCmdCreateFeat(seh, *new_feat)));
1672  // delete original coding region (will also remove product and renormalize nuc-prot set
1674  } else {
1675  cmd->AddCommand(*CRef<CCmdChangeSeq_feat>(new CCmdChangeSeq_feat(scope.GetSeq_featHandle(orig), *new_feat)));
1676  }
1677 
1678  return cmd;
1679 }
1680 
1682 {
1683  if (NStr::IsBlank(text)) {
1684  return;
1685  }
1686 
1687  if (!gene->IsSetLocus() || NStr::IsBlank(gene->GetLocus())) {
1688  gene->SetLocus(text);
1689  } else {
1690  string orig_val = gene->GetLocus();
1691  if (edit::AddValueToString(orig_val, text, existing_text)) {
1692  gene->SetLocus(orig_val);
1693  }
1694  }
1695 }
1696 
1698 {
1699  if (NStr::IsBlank(text)) {
1700  return;
1701  }
1702 
1703  if (!gene->IsSetDesc() || NStr::IsBlank(gene->GetDesc())) {
1704  gene->SetDesc(text);
1705  } else {
1706  string orig_val = gene->GetDesc();
1707  if (edit::AddValueToString(orig_val, text, existing_text)) {
1708  gene->SetDesc(orig_val);
1709  }
1710  }
1711 }
1712 
1713 
CConstRef< CConversionOptionString > GetString() const
static void AdjustMappedStop(CRef< CSeq_loc > loc, const CSeq_loc &product, CScope &scope)
void SetPseudo(TPseudo value)
Assign a value to Pseudo data member.
Definition: Seq_feat_.hpp:1332
CBioseq_Handle –.
will become ncRNA, with RNA-gen.class = scRNA
Definition: RNA_ref_.hpp:102
static E_Choice GetTypeFromSubtype(ESubtype subtype)
TSiteMap::const_iterator const_iterator
bool IsSetOrg(void) const
Check if a value has been assigned to Org data member.
Definition: BioSource_.hpp:485
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:3209
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
void x_AddCDSSourceConversionOptions()
bool IsSetSubtype(void) const
Check if a value has been assigned to Subtype data member.
Definition: BioSource_.hpp:515
virtual string GetDescription()
list< CRef< CSubSource > > TSubtype
Definition: BioSource_.hpp:145
CConvertFeatureBase(objects::CSeqFeatData::ESubtype feat_to=objects::CSeqFeatData::eSubtype_bad, objects::CSeqFeatData::ESubtype feat_from=objects::CSeqFeatData::eSubtype_bad)
ENa_strand GetStrand(void) const
Get the location's strand.
Definition: Seq_loc.cpp:865
void x_AddCDSDestinationConversionOptions()
void SetDb(const TDb &value)
Assign a value to Db data member.
Definition: Dbtag_.hpp:220
void ResetQual(void)
Reset Qual data member.
Definition: Seq_feat_.cpp:136
EProcessed
processing status
Definition: Prot_ref_.hpp:95
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:102
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
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.
bool IsSetDesc(void) const
descriptive name Check if a value has been assigned to Desc data member.
Definition: Gene_ref_.hpp:553
bool IsBiosrc(void) const
Check if variant Biosrc is selected.
objects::CBondList m_BondList
default options: do everything
Definition: sequence.hpp:345
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:970
void AddSuggestedValue(const string &val)
bool IsSetEc(void) const
E.C.
Definition: Prot_ref_.hpp:418
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:836
vector< CRef< CSeqFeatXref > > TXref
Definition: Seq_feat_.hpp:122
CRef< CConversionOption > x_FindBondType()
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...
const TComment & GetComment(void) const
Get the Comment member data.
Definition: Seq_feat_.hpp:1021
bool IsBool() const
User-defined methods of the data storage class.
USING_SCOPE(objects)
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)
void ResetDbxref(void)
Reset Dbxref data member.
Definition: Seq_feat_.cpp:188
const TProduct & GetProduct(void) const
Get the Product member data.
Definition: Seq_feat_.hpp:1061
bool IsSetAllele(void) const
Official allele designation Check if a value has been assigned to Allele data member.
Definition: Gene_ref_.hpp:513
objects::CSeqFeatData::ESubtype m_To
const TMaploc & GetMaploc(void) const
Get the Maploc member data.
Definition: Gene_ref_.hpp:605
User-defined methods of the data storage class.
static CRef< CConvertFeatureBase > Create(objects::CSeqFeatData::ESubtype subtype_from, objects::CSeqFeatData::ESubtype subtype_to)
non-coding RNA; subsumes snRNA, scRNA, snoRNA
Definition: RNA_ref_.hpp:104
virtual bool CanConvertTo(objects::CSeqFeatData::ESubtype subtype)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
list< string > TEc
Definition: Prot_ref_.hpp:110
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
Map from the feature's location to product.
favor longer features over shorter features
Definition: sequence.hpp:338
objects::CSeqFeatData::ESubtype m_From
CProt_ref::EProcessed GetProtProcessedFromFeatureSubtype(CSeqFeatData::ESubtype subtype)
bool IsSetLocus(void) const
Official gene symbol Check if a value has been assigned to Locus data member.
Definition: Gene_ref_.hpp:473
bool IsCdregion(void) const
Check if variant Cdregion is selected.
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
bool IsSetName(void) const
protein name Check if a value has been assigned to Name data member.
Definition: Prot_ref_.hpp:353
bool IsSetActivity(void) const
activities Check if a value has been assigned to Activity data member.
Definition: Prot_ref_.hpp:443
void x_AddSiteDestinationConversionOptions()
void ResetExcept(void)
Reset Except data member.
Definition: Seq_feat_.hpp:974
TRange GetTotalRange(void) const
Definition: Seq_loc.hpp:897
const NCBI_NS_NCBI::CEnumeratedTypeValues *ENUM_METHOD_NAME() ENa_strand(void)
Access to ENa_strand's attributes (values, names) as defined in spec.
SAnnotSelector –.
void x_AddOneGeneField(string &product, string &comment, const string &field)
bool IsString() const
#define NULL
Definition: ncbistd.hpp:225
User-defined methods of the data storage class.
const TDesc & GetDesc(void) const
Get the Desc member data.
Definition: Gene_ref_.hpp:565
User-defined methods of the data storage class.
bool QualifierNamesAreEquivalent(string name1, string name2)
const TMod & GetMod(void) const
Get the Mod member data.
Definition: OrgName_.hpp:815
#define kEmptyStr
Definition: ncbistr.hpp:120
bool IsSetComment(void) const
Check if a value has been assigned to Comment data member.
Definition: Seq_feat_.hpp:1009
const TName & GetName(void) const
Get the Name member data.
Definition: Prot_ref_.hpp:365
bool x_IsRnaSubtype(objects::CSeqFeatData::ESubtype subtype)
void SetLocation(TLocation &value)
Assign a value to Location data member.
Definition: Seq_feat_.cpp:131
CRef< CConversionOption > x_FindPseudo()
void ResetExcept_text(void)
Reset Except_text data member.
Definition: Seq_feat_.cpp:194
void SetDefaultVal(const string &val)
CRef< CConversionOption > x_FindRemovemRNA()
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:776
TBondMap::const_iterator const_iterator
const TAllele & GetAllele(void) const
Get the Allele member data.
Definition: Gene_ref_.hpp:525
int i
bool IsSetXref(void) const
cite other relevant features Check if a value has been assigned to Xref data member.
Definition: Seq_feat_.hpp:1254
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1082
const TBiosrc & GetBiosrc(void) const
Get the variant data.
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
EExistingText
static const string s_IsPseudo
static const string s_RemoveTranscriptID
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
vector< CRef< CConversionOption > > TOptions
void x_AddRegionDestionationConversionOptions()
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
CLocalRange< TOffset > TRange
define for the fundamental building block of sequence ranges
Definition: base.hpp:115
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:2786
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
static const string s_SiteType
bool IsPartialStart(ESeqLocExtremes ext) const
check start or stop of location for e_Lim fuzz
Definition: Seq_loc.cpp:3205
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
Definition: Seq_loc.cpp:898
void x_AddRnaDestinationConversionOptions()
Seq-loc iterator class – iterates all intervals from a seq-loc in the correct order.
Definition: Seq_loc.hpp:439
CFeat_CI –.
Definition: feat_ci.hpp:63
void x_AddBondDestinationConversionOptions()
TSite GetSite(void) const
Get the variant data.
list< string > TName
Definition: Prot_ref_.hpp:108
void ResetCit(void)
Reset Cit data member.
Definition: Seq_feat_.cpp:165
TSeqPos GetStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:946
void SetTag(TTag &value)
Assign a value to Tag data member.
Definition: Dbtag_.cpp:66
void x_AddToGeneLocus(string text, CRef< objects::CGene_ref > gene, objects::edit::EExistingText existing_text)
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
virtual string GetDescription()
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
CConstRef< CConversionOptionBool > GetBool() const
will become ncRNA, with RNA-gen.class = snoRNA
Definition: RNA_ref_.hpp:103
void ResetComment(void)
Reset Comment data member.
Definition: Seq_feat_.cpp:99
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
2nd contained within 1st extremes
bool IsSetMaploc(void) const
descriptive map location Check if a value has been assigned to Maploc data member.
Definition: Gene_ref_.hpp:593
bool IsSetOrgname(void) const
Check if a value has been assigned to Orgname data member.
Definition: Org_ref_.hpp:501
bool IsSetComment(void) const
static const string s_BondType
static const NCBI_NS_NCBI::CEnumeratedTypeValues *ENUM_METHOD_NAME() EType(void)
Access to EType's attributes (values, names) as defined in spec.
CSeq_loc_Mapper_Base & SetMergeAbutting(void)
Merge only abutting intervals, keep overlapping.
void x_AddGeneFieldsToComment(const objects::CGene_ref &orig, CRef< objects::CSeq_feat > new_feat)
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
bool IsSetData(void) const
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_feat_.cpp:94
objects::CSiteList m_SiteList
const TRna & GetRna(void) const
Get the variant data.
const TSubtype & GetSubtype(void) const
Get the Subtype member data.
Definition: BioSource_.hpp:527
numerical value
Definition: Na_strand.hpp:63
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
CRef< CObject > m_Object
void ResetId(void)
Reset Id data member.
Definition: Seq_feat_.cpp:68
const TGene & GetGene(void) const
Get the variant data.
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
CRef< CConversionOption > x_FindSiteType()
const CSeq_feat * GetCDSForProduct(const CBioseq &product, CScope *scope)
Get the encoding CDS feature of a given protein sequence.
Definition: sequence.cpp:2429
const TDb & GetDb(void) const
Get the Db member data.
Definition: Prot_ref_.hpp:480
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
Definition: Seq_feat_.hpp:1049
CRNA_ref::EType GetRnaTypeFromFeatureSubtype(CSeqFeatData::ESubtype subtype)
CRef< CConversionOption > x_FindNcrnaClass()
CSeq_entry_Handle –.
static const string s_NcrnaClass
bool IsSetLocus_tag(void) const
systematic gene name (e.g., MI0001, ORF0069) Check if a value has been assigned to Locus_tag data mem...
Definition: Gene_ref_.hpp:733
bool x_IsImportSubtype(objects::CSeqFeatData::ESubtype subtype)
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
Definition: Seq_feat_.hpp:885
const TActivity & GetActivity(void) const
Get the Activity member data.
Definition: Prot_ref_.hpp:455
bool x_IsProtSubtype(objects::CSeqFeatData::ESubtype subtype)
.hpp User-defined methods of the data storage class.
Definition: Gb_qual.hpp:60
void SetLocus(const TLocus &value)
Assign a value to Locus data member.
Definition: Gene_ref_.hpp:494
CRef< CCmdComposite > GetDeleteFeatureCommand(const objects::CSeq_feat_Handle &fh, bool remove_proteins=true)
Definition: util_cmds.cpp:95
virtual bool CanConvertFrom(objects::CSeqFeatData::ESubtype subtype)
bool IsSetDb(void) const
ids in other dbases Check if a value has been assigned to Db data member.
Definition: Prot_ref_.hpp:468
vector< string > x_ExtractProductQuals(CRef< objects::CSeq_feat > new_feat)
void SetDesc(const TDesc &value)
Assign a value to Desc data member.
Definition: Gene_ref_.hpp:574
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
CRef< CConversionOption > x_FindRemoveGene()
CRef< CCmdComposite > x_SimpleConversion(const objects::CSeq_feat &orig, CRef< objects::CSeq_feat > new_feat, bool keep_orig, objects::CScope &scope)
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
void x_ClearGenericFields(CRef< objects::CSeq_feat > new_feat)
const TEc & GetEc(void) const
Get the Ec member data.
Definition: Prot_ref_.hpp:430
bool IsProt(void) const
Check if variant Prot is selected.
void SetOnlySuggested(bool val)
CRef< CConversionOption > FindRemoveTranscriptId()
static const string & SubtypeValueToName(ESubtype eSubtype)
Turns a ESubtype into its string value which is NOT necessarily related to the identifier of the enum...
CRef< CConversionOptionString > SetString()
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_loc_.hpp:475
TSeqPos GetBioseqLength(void) const
void ResetProduct(void)
Reset Product data member.
Definition: Seq_feat_.cpp:105
CConstRef< CSeq_feat > GetOverlappingGene(const CSeq_loc &loc, CScope &scope, ETransSplicing eTransSplicing=eTransSplicing_Auto)
Definition: sequence.cpp:1255
CScope –.
Definition: scope.hpp:90
const TLocus & GetLocus(void) const
Get the Locus member data.
Definition: Gene_ref_.hpp:485
string x_GetCDSProduct(const objects::CSeq_feat &orig, objects::CScope &scope)
const TQual & GetQual(void) const
Get the Qual member data.
Definition: Seq_feat_.hpp:1112
CRef< objects::CSeq_feat > AddProteinFeatureToProtein(CRef< objects::CSeq_entry > protein, bool partial5, bool partial3)
const TOrgname & GetOrgname(void) const
Get the Orgname member data.
Definition: Org_ref_.hpp:513
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
will become ncRNA, with RNA-gen.class = snRNA
Definition: RNA_ref_.hpp:101
list< string > TActivity
Definition: Prot_ref_.hpp:111
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
void SetComment(const TComment &value)
Assign a value to Comment data member.
Definition: Seq_feat_.hpp:1030
bool IsProtein(void) const
CRef< CConversionOption > x_FindOption(const string &label)
list< CRef< COrgMod > > TMod
Definition: OrgName_.hpp:332
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:925
ASN5: old-name (254) will be added to next spec.
Definition: OrgMod_.hpp:124
const CSeq_feat & GetOriginalFeature(void) const
Get original feature with unmapped location/product.
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
vector< string > x_ExtractQuals(CRef< objects::CSeq_feat > new_feat, string qual_name)
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
Definition: ncbistr.cpp:3096
CSeq_loc_Mapper –.
void ResetTitle(void)
Reset Title data member.
Definition: Seq_feat_.cpp:142
bool IsSetDesc(void) const
description (instead of name) Check if a value has been assigned to Desc data member.
Definition: Prot_ref_.hpp:378
CConstRef< CSeq_feat > GetOverlappingmRNA(const CSeq_loc &loc, CScope &scope)
Definition: sequence.cpp:1458
vector< CRef< CDbtag > > TDb
Definition: Prot_ref_.hpp:112
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)
const TRegion & GetRegion(void) const
Get the variant data.
const CSeqFeatData & GetData(void) const
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
Definition: Seq_id.cpp:278
static bool EqualNocase(const CTempString str, SIZE_TYPE pos, SIZE_TYPE n, const char *pattern)
Case-insensitive equality of a substring with a pattern.
Definition: ncbistr.hpp:5358
CRef< CCmdComposite > x_ConvertToCDS(const objects::CSeq_feat &orig, CRef< objects::CSeq_feat > new_feat, bool keep_orig, objects::CScope &scope, vector< string > product)
string x_GetProteinDesc(const objects::CSeq_feat &cds, objects::CScope &scope)
CRef< objects::CSeq_entry > CreateTranslatedProteinSequence(CRef< objects::CSeq_feat > cds, objects::CBioseq_Handle nuc_h)
namespace ncbi::objects::
Definition: Seq_feat.hpp:56
string GetSiteName(objects::CSeqFeatData::TSite site_type)
void ResetPseudo(void)
Reset Pseudo data member.
Definition: Seq_feat_.hpp:1316
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:1564
bool IsSetMod(void) const
Check if a value has been assigned to Mod data member.
Definition: OrgName_.hpp:803
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
Definition: Seq_loc.cpp:336
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
string GetRnaProductName(void) const
Definition: RNA_ref.cpp:145
bool IsGene(void) const
Check if variant Gene is selected.
CSeq_feat_Handle GetSeq_featHandle(const CSeq_feat &feat, EMissing action=eMissing_Default)
Definition: scope.cpp:188
static const string s_PlaceOnProt
const TXref & GetXref(void) const
Get the Xref member data.
Definition: Seq_feat_.hpp:1266
bool IsPartialStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:3234
static void text(MDB_val *v)
Definition: mdb_dump.c:62
Map from the feature's product to location.
void AddCommand(IEditCommand &command)
const string & GetComment(void) const
const TDesc & GetDesc(void) const
Get the Desc member data.
Definition: Prot_ref_.hpp:390
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
TQual & SetQual(void)
Assign a value to Qual data member.
Definition: Seq_feat_.hpp:1118
bool x_MoveFeatureToProtein(const objects::CSeq_feat &orig, CRef< objects::CSeq_feat > new_feat, bool keep_orig, objects::CScope &scope)
static bool Equal(const CTempString str, SIZE_TYPE pos, SIZE_TYPE n, const char *pattern, ECase use_case=eCase)
Test for equality of a substring with a pattern.
Definition: ncbistr.hpp:5384
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
CRef< CConversionOption > x_FindPlaceOnProt()
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
Definition: Dbtag.hpp:52
void x_AddToGeneDescr(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)
static vector< string > GetncRNAClassList()
Definition: RNA_gen.cpp:83
const TProt & GetProt(void) const
Get the variant data.
const TLocus_tag & GetLocus_tag(void) const
Get the Locus_tag member data.
Definition: Gene_ref_.hpp:745
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
static const string s_RemovemRNA
const TOrg & GetOrg(void) const
Get the Org member data.
Definition: BioSource_.hpp:497
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
static const string s_RemoveGene
CRef< CConversionOptionBool > SetBool()
void x_AddToComment(string comment, CRef< objects::CSeq_feat > new_feat, objects::edit::EExistingText existing_text=objects::edit::eExistingText_prefix_semi)
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:756
bool IsSetQual(void) const
qualifiers Check if a value has been assigned to Qual data member.
Definition: Seq_feat_.hpp:1100
ESubtype GetSubtype(void) const
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_feat_.hpp:897
CRef< CSeq_loc > Map(const CSeq_loc &src_loc)
Map seq-loc.
virtual CRef< CCmdComposite > Convert(const objects::CSeq_feat &orig, bool keep_orig, objects::CScope &scope)
static char cmd[512]
Definition: bcp.c:20
Modified on Wed Aug 16 05:54:44 2017 by modify_doxy.py rev. 533848