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

Go to the SVN repository for this file.

1 /* $Id: import_feat_table.cpp 46706 2021-09-09 19:54:51Z 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, Andrea Asztalos
27  */
28 
29 #include <ncbi_pch.hpp>
34 #include <objmgr/util/sequence.hpp>
38 
52 
56 
57 #include <wx/richmsgdlg.h>
58 #include <wx/clipbrd.h>
59 #include <unordered_set>
60 
64 #include "cmd_cleanup.hpp"
65 
68 
69 const wxString kfeaturetableinstructions = "\
70 you can import a gff3 file, an ncbi 5-column feature table file, or a fasta file with protein sequences for your coding regions. click ok to select and load the file.\r\n\
71 \r\n\
72 if you are importing a protein fasta file, make sure that the sequence ids for the protein sequences match the nucleotide sequences on which the coding regions should be created.\r\n\
73 \r\n\
74 features tables for influenza a and b sequences can be created here:\r\n\
75 https://www.ncbi.nlm.nih.gov/genomes/flu/database/annotation.cgi \r\n\
76 \r\n\
77 an ncbi 5-column feature table must be a plain text file. \r\n\
78 \r\n\
79 - the header line begins with >feature lcl| \r\n\
80 \r\n\
81 - the text following \"lcl|\" must contain the sequence id of the sequences in your records.\r\n\
82  for example: >feature lcl|abc-1\r\n\
83  in this example, abc-1 is the sequence id. \r\n\
84 \r\n\
85 - the table is composed of 5, tab-separated columns:\r\n\
86  column 1- nucleotide position of the start of the feature\r\n\
87  column 2- nucleotide location of the end of a feature\r\n\
88  column 3- feature type (gene, cds, etc.)\r\n\
89  column 4- feature qualifier (note, product, etc.)\r\n\
90  column 5- qualifier value (for example: gag protein)\r\n\
91 \r\n\
92 - the columns in the table must be separated by tabs. \r\n\
93  use the tab key on your keyboard to separate each column.\r\n\
94  the qualifiers follow on lines starting with three tabs. \r\n\
95 \r\n\
96 - for more feature table format information: \r\n\
97 https://www.ncbi.nlm.nih.gov/sequin/table.html#table layout \r\n\
98 \r\n\
99 - questions about the feature table format? write to: info@ncbi.nlm.nih.gov\r\n\
100 --------------------------------------------------\r\n\
101 example feature table for 2 sequences:\r\n\
102 --------------------------------------------------\r\n\
103 >feature lcl|abc-1\r\n\
104 24 1458 gene\r\n\
105  gene pb2\r\n\
106 24 1458 cds\r\n\
107  product polymerase pb2\r\n\
108 >feature lcl|abc-2\r\n\
109 4 985 gene\r\n\
110  gene m2\r\n\
111 4 29 cds\r\n\
112 718 985\r\n\
113  product matrix protein 2\r\n\
114 4 762 gene\r\n\
115  gene m1\r\n\
116 4 762 cds\r\n\
117  product matrix protein 1\r\n\
118 ";
119 
121 {
122  static bool showDialog(true);
123  if (!showDialog)
124  return;
125 
126  wxRichMessageDialog dlg(NULL, wxT("Feature table instructions"), wxEmptyString, wxOK|wxCENTER);
127  dlg.ShowDetailedText(kfeaturetableinstructions);
128  dlg.ShowCheckBox("Don't show this dialog in the current session");
129  dlg.ShowModal();
130 
131  if (dlg.IsCheckBoxChecked()) {
132  showDialog = false;
133  }
134 }
135 
136 
137 CIRef<IEditCommand> CImportFeatTable::ImportFeaturesFromFile(const wxString& workDir, const string &format_id)
138 {
139  CIRef<IEditCommand> cmd = x_DoImportFeaturesFromFile(workDir, format_id);
140 
141  if (!NStr::IsBlank(m_Error)) {
143  report->SetTitle(wxT("Import Feature Table Report"));
144  report->SetText(ToWxString(m_Error));
145  report->Show(true);
146  }
147 
148  if (!cmd)
149  return cmd;
150 
152 }
153 
155 {
157 
158  if (!NStr::IsBlank(m_Error)) {
160  report->SetTitle(wxT("Import Feature Table Report"));
161  report->SetText(ToWxString(m_Error));
162  report->Show(true);
163  }
164 
165  if (!cmd)
166  return cmd;
167 
169 }
170 
172  unsigned int &startingLocusTagNumber, unsigned int &startingFeatureId, const string &locus_tag, bool euk)
173 {
174  CIRef<IEditCommand> cmd = AddSeqAnnotToSeqEntry(orig_annot, ftbl_seqid_map,
175  startingLocusTagNumber, startingFeatureId, locus_tag, euk);
176  if (!cmd) {
177  return cmd;
178  }
179 
181 }
182 
184 {
185  if (!start_cmd)
186  return CIRef<IEditCommand>();
187 
188  CRef<CCmdComposite> composite(new CCmdComposite("Import Feature Table"));
189  composite->AddCommand(*start_cmd);
190 
191  composite->AddCommand(*CIRef<IEditCommand>(
193 
194  composite->AddCommand(*CIRef<IEditCommand>(
196 
197  // assigns feature local ids to features and places Xrefs between CDS and mRNA
198  composite->AddCommand(*CCmdFeatIdXrefsFromQualifiers::Create(m_Seh, { "protein_id", "orig_protein_id" }));
199 
200  composite->AddCommand(*CIRef<IEditCommand>(
202 
203  // removes Xrefs to proteins from CDS
204  composite->AddCommand(*CIRef<IEditCommand>(
205  new CCmdCleanup(m_Seh, false, false)));
206 
207  return CIRef<IEditCommand>(composite);
208 }
209 
210 
211 
212 CIRef<IEditCommand> CImportFeatTable::x_DoImportFeaturesFromFile(const wxString& workDir, const string &format_id)
213 {
214  CRef<CFileLoadWizard> fileManager(new CFileLoadWizard());
215  vector<string> format_ids;
216  if (format_id.empty())
217  {
218  format_ids.push_back("file_loader_gff");
219  format_ids.push_back("file_loader_5col");
220  }
221  else
222  {
223  format_ids.push_back(format_id);
224  }
225  fileManager->LoadFormats(format_ids);
226  fileManager->SetWorkDir(workDir);
227 
228  vector<CIRef<IOpenObjectsPanelClient> > loadManagers;
229  loadManagers.push_back(CIRef<IOpenObjectsPanelClient>(fileManager.GetPointer()));
230 
231  COpenObjectsDlg dlg(NULL);
232  dlg.SetSize(710, 480);
233 
234  dlg.SetRegistryPath("Dialogs.Edit.ImportFeatTable");
235  dlg.SetManagers(loadManagers);
236  if (format_id == "file_loader_5col")
237  dlg.SetHelpUrl(_("https://www.ncbi.nlm.nih.gov/tools/gbench/manual11/#5-column-feature-table"));
238  if (format_id == "file_loader_gff")
239  dlg.SetHelpUrl(_("https://www.ncbi.nlm.nih.gov/tools/gbench/manual11/#gff3-file"));
240 
241  if (dlg.ShowModal() != wxID_OK)
242  return CIRef<IEditCommand>();
243 
244  CIRef<IObjectLoader> object_loader(dlg.GetObjectLoader());
245  if (!object_loader) {
246  wxMessageBox(wxT("Failed to get object loader"), wxT("Error"), wxOK | wxICON_ERROR);
247  return CIRef<IEditCommand>();
248  }
249 
250  CGffObjectLoader* gff_loader = dynamic_cast<CGffObjectLoader*>(object_loader.GetPointer());
251  if (gff_loader)
252  m_is_gff = true;
253 
254  IExecuteUnit* execute_unit = dynamic_cast<IExecuteUnit*>(object_loader.GetPointer());
255  if (execute_unit) {
256  if (!execute_unit->PreExecute())
257  return CIRef<IEditCommand>();
258 
259  if (!GUI_AsyncExecUnit(*execute_unit, wxT("Reading file(s)...")))
260  return CIRef<IEditCommand>(); // Canceled
261 
262  if (!execute_unit->PostExecute())
263  return CIRef<IEditCommand>();
264  }
265 
266  const IObjectLoader::TObjects& objects = object_loader->GetObjects();
267  if (!objects.empty() && x_ContainsDuplicateIds(objects)) {
268  return CIRef<IEditCommand>();
269  }
270  string msg = x_CheckConsistentProteinIds(objects);
271  if (!msg.empty()) {
272  wxMessageBox(ToWxString(msg), wxT("Error"), wxOK | wxICON_ERROR);
273  return CIRef<IEditCommand>();
274  }
276  if (!msg.empty()) {
277  wxMessageBox(ToWxString(msg), wxT("Error"), wxOK | wxICON_ERROR);
278  return CIRef<IEditCommand>();
279  }
280  return x_CreateCommand(objects);
281 }
282 
284 {
285  string fname;
286  if (wxTheClipboard->Open())
287  {
288  wxTextDataObject data;
289  if (wxTheClipboard->IsSupported( wxDF_UNICODETEXT ))
290  wxTheClipboard->GetData( data );
291  if (data.GetText().length() == 0) {
292  wxMessageBox("No data in clipboard for table");
293  wxTheClipboard->Close();
294  return CIRef<IEditCommand>();
295  }
296 
298  f.AsOutputFile(CTmpFile::eIfExists_ReturnCurrent) << data.GetText();
299  fname = f.GetFileName();
300  wxTheClipboard->Close();
301  }
302 
303  vector<wxString> fnames;
304  fnames.push_back(ToWxString(fname));
305 
306  CRef<C5ColObjectLoader> execute_unit(new C5ColObjectLoader(fnames));
307  if (!execute_unit) {
308  wxMessageBox(wxT("Failed to get object loader"), wxT("Error"), wxOK | wxICON_ERROR);
309  return CIRef<IEditCommand>();
310  }
311 
312  CReportLoaderErrors* reporter = dynamic_cast<CReportLoaderErrors*>(execute_unit.GetPointer());
313  if (reporter)
314  reporter->SetWorkDir(workDir);
315 
316  if (!execute_unit->PreExecute())
317  return CIRef<IEditCommand>();
318 
319  if (!GUI_AsyncExecUnit(*execute_unit, wxT("Reading clipboard...")))
320  return CIRef<IEditCommand>(); // Canceled
321 
322  if (!execute_unit->PostExecute())
323  return CIRef<IEditCommand>();
324 
325  CFile tmp_file(fname);
326  tmp_file.Remove();
327  const IObjectLoader::TObjects& objects = execute_unit->GetObjects();
328  if (!objects.empty() && x_ContainsDuplicateIds(objects)) {
329  return CIRef<IEditCommand>();
330  }
331  string msg = x_CheckConsistentProteinIds(objects);
332  if (!msg.empty()) {
333  wxMessageBox(ToWxString(msg), wxT("Error"), wxOK | wxICON_ERROR);
334  return CIRef<IEditCommand>();
335  }
337  if (!msg.empty()) {
338  wxMessageBox(ToWxString(msg), wxT("Error"), wxOK | wxICON_ERROR);
339  return CIRef<IEditCommand>();
340  }
341  return x_CreateCommand(objects);
342 }
343 
345 {
346  unordered_set<string> product_ids;
347  // check protein ids as well as transcript ids
348  for (auto& obj_it : objects) {
349  const CSeq_annot* annot = dynamic_cast<const CSeq_annot*>(obj_it.GetObjectPtr());
350  if (annot && annot->IsFtable()) {
351  const CSeq_annot::C_Data::TFtable& ftbl = annot->GetData().GetFtable();
352  for (auto& feat_it : ftbl) {
353  if (feat_it->IsSetProduct() &&
354  feat_it->IsSetData() &&
355  (feat_it->GetData().IsCdregion() || feat_it->GetData().GetSubtype() == CSeqFeatData::eSubtype_mRNA)) {
356  if (const CSeq_id* id = feat_it->GetProduct().GetId()) {
357  auto id_string = id->GetSeqIdString(true);
358  auto res = product_ids.insert(id_string);
359  if (!res.second) {
360  return true;
361  }
362  }
363  }
364  }
365  }
366  }
367  return false;
368 }
369 
371 {
373  if (!cds_it)
374  return kEmptyStr;
375 
376  string msg;
377  unordered_set<string> product_ids;
378  for (auto& obj_it : objects) {
379  const CSeq_annot* annot = dynamic_cast<const CSeq_annot*>(obj_it.GetObjectPtr());
380  if (annot && annot->IsFtable()) {
381  const CSeq_annot::C_Data::TFtable& ftbl = annot->GetData().GetFtable();
382  for (auto& feat_it : ftbl) {
383  if (feat_it->IsSetProduct() && feat_it->IsSetData()) {
384  const CSeq_id* id = feat_it->GetProduct().GetId();
385  const string id_string = (id) ? id->GetSeqIdString(true) : kEmptyStr;
386  if (id && feat_it->GetData().IsCdregion()) {
387  product_ids.insert(id_string);
388  }
389  }
390  }
391  }
392  }
393  // we have the set of all product ids and check them against all protein seq-ids from scope
394 
395  vector<string> dupl_product_ids;
396  for (CBioseq_CI bseq(m_Seh, CSeq_inst::eMol_aa); bseq; ++bseq) {
397  for (auto&& id_it : bseq->GetCompleteBioseq()->GetId()) {
398  const string id_string = id_it->GetSeqIdString(true);
399  if (product_ids.find(id_string) != product_ids.end()) {
400  dupl_product_ids.push_back(id_string);
401  }
402  }
403  }
404 
405  for (auto&& it : dupl_product_ids) {
406  if (!msg.empty())
407  msg += "\n";
408  msg += "CDS feature with product id " + it + " already exists in your data";
409  }
410  return msg;
411 }
412 
413 static bool s_IsPseudo(const CSeq_feat& feat)
414 {
415  return (feat.IsSetPseudo() && feat.GetPseudo());
416 }
417 
418 
420 {
421  if (objects.empty())
422  return kEmptyStr;
423 
424  string msg;
425  for (auto& obj_it : objects) {
426  const CSeq_annot* annot = dynamic_cast<const CSeq_annot*>(obj_it.GetObjectPtr());
427  if (!annot || !annot->IsFtable())
428  continue;
429 
430  const auto& ftbl = annot->GetData().GetFtable();
431  if (ftbl.size() == 1)
432  continue;
433 
434  auto feat_it = ftbl.begin();
435  while (feat_it != ftbl.end()) {
436  auto feature = *feat_it;
437  if (feature->IsSetData() && feature->GetData().IsCdregion() && !s_IsPseudo(*feature)) {
438  auto it_cds = feat_it;
439 
440  ++feat_it;
441  while (feat_it != ftbl.end() &&
442  !((*feat_it)->IsSetData() && (*feat_it)->GetData().IsCdregion() && !s_IsPseudo(**feat_it))) {
443  ++feat_it;
444  }
445  auto next_cds = feat_it;
446  if (next_cds != ftbl.end()) {
447  const string& this_pid = (*it_cds)->GetNamedQual("protein_id");
448  const string& next_pid = (*next_cds)->GetNamedQual("protein_id");
449  bool has_pid = !this_pid.empty();
450  bool next_has_pid = !next_pid.empty();
451 
452  bool has_local_pid = false;
453  bool next_has_local_pid = false;
454  if (!has_pid != !next_has_pid) {
455  if (has_pid) {
456  CBioseq::TId prot_ids;
457  try {
458  CSeq_id::ParseFastaIds(prot_ids, this_pid);
459  }
460  catch (const CSeqIdException&) {
461  }
462  if (!prot_ids.empty() && prot_ids.front()->IsLocal()) {
463  has_local_pid = true;
464  }
465  }
466 
467  if (next_has_pid) {
468  CBioseq::TId prot_ids;
469  try {
470  CSeq_id::ParseFastaIds(prot_ids, next_pid);
471  }
472  catch (const CSeqIdException&) {
473  }
474  if (!prot_ids.empty() && prot_ids.front()->IsLocal()) {
475  next_has_local_pid = true;
476  }
477  }
478  if (!has_local_pid != !next_has_local_pid) {
479  msg = "Some coding regions have a protein_id qualifier and others do not. "
480  "Protein id qualifiers are used to generate protein sequence ids and they should "
481  "be consistently present or absent in the feature table";
482  return msg;
483  }
484  }
485  }
486  }
487  else {
488  ++feat_it;
489  }
490  }
491  }
492 
493  return msg;
494 }
495 
497 {
498  TUniqueFeatTblIDs non_matched_ftbl_ids;
499  TFeatSeqIDMap autofix_map;
500 
501  CTSE_Handle tseh = m_Seh.GetTSE_Handle();
503  const CObject& ptr = obj_it->GetObject();
504  const CSeq_annot* annot = dynamic_cast<const CSeq_annot*>(&ptr);
505  if (annot && annot->IsFtable()) {
506  // assume that all features within a seq_annot would go to the same sequence
507  const CSeq_annot::C_Data::TFtable& ftbl = annot->GetData().GetFtable();
508  if (!ftbl.empty()) {
509  const CSeq_feat& feat = *ftbl.front();
510  const CSeq_id* feat_id = feat.GetLocation().GetId();
511  if (feat_id) {
512  CSeq_id_Handle match_id = x_GetFixedId(*feat_id, tseh);
513  if (!match_id) {
514  non_matched_ftbl_ids.insert(CSeq_id_Handle::GetHandle(*feat_id));
515  } else if (!match_id.GetSeqId()->Equals(*feat_id)) {
516  autofix_map[CSeq_id_Handle::GetHandle(*feat_id)] = match_id;
517  }
518  }
519  }
520  }
521  }
522 
523  TFeatSeqIDMap ftbl_seqid_map;
524  if (!non_matched_ftbl_ids.empty()) {
525  CMatchFeatureTableDlg dlg(NULL, m_Seh, non_matched_ftbl_ids);
526  if (dlg.ShowModal() == wxID_OK) {
527  dlg.GetFtableIDToSeqIDMap(ftbl_seqid_map);
528  } else {
529  return CIRef<IEditCommand>();
530  }
531  }
532 
533  ITERATE(TFeatSeqIDMap, it, autofix_map) {
534  ftbl_seqid_map[it->first] = it->second;
535  }
536 
537  unsigned int startingLocusTagNumber = 1;
538  unsigned int startingFeatureId = 1;
539  string locus_tag;
540  bool euk = false;
541  if (m_is_gff)
542  {
544  {
545  const CObject& ptr = obj_it->GetObject();
546  const CSeq_annot* annot = dynamic_cast<const CSeq_annot*>(&ptr);
547  if (annot && annot->IsFtable())
548  {
549  for ( auto&& feat_it : annot->GetData().GetFtable())
550  {
551  const CSeq_feat& feat = *feat_it;
552  if (feat.IsSetData() && feat.GetData().IsGene() && feat.GetData().GetGene().IsSetLocus_tag())
553  locus_tag = feat.GetData().GetGene().GetLocus_tag();
554  else if (feat.GetGeneXref() != nullptr && feat.GetGeneXref()->IsSetLocus_tag())
555  locus_tag = feat.GetGeneXref()->GetLocus_tag();
556  else
557  locus_tag = feat.GetNamedQual("locus_tag");
558  if (!locus_tag.empty())
559  break;
560  }
561  }
562  if (!locus_tag.empty())
563  break;
564  }
565 
566  string prefix, offset;
567  if (NStr::SplitInTwo(locus_tag, "_", prefix, offset))
568  {
570  if (tail != -1)
571  {
572  startingLocusTagNumber = tail;
573  }
574  else
575  {
576  if (!offset.empty())
577  {
578  ERR_POST(Error << "Invalid locus tag: Only one \"_\", and suffix must be numeric");
579  prefix = locus_tag;
580  }
581  }
582  }
583  else
584  {
585  prefix = locus_tag;
586  }
587 
589  if (dlg.ShowModal() == wxID_OK)
590  {
591  locus_tag = dlg.GetLocusTag();
592  euk = dlg.GetEuk();
593  if (locus_tag.empty())
594  startingLocusTagNumber = 1;
595  } else
596  {
597  return CIRef<IEditCommand>();
598  }
599  }
600 
601 
602 
603  m_Error.clear();
605 
607  const CObject& ptr = obj_it->GetObject();
608  const CSeq_annot* annot = dynamic_cast<const CSeq_annot*>(&ptr);
609  //LOG_POST(Info << "Read seq-annot:\n" << MSerial_AsnText << *annot);
610  if (annot) {
611  CStopWatch sw;
612  sw.Start();
613  CIRef<IEditCommand> cmd = AddSeqAnnotToSeqEntry(*annot, ftbl_seqid_map, startingLocusTagNumber, startingFeatureId, locus_tag, euk);
614  LOG_POST(Info << "AddSeqAnnotToSeqEntry took " << sw.Elapsed() << " seconds");
615  if (cmd) {
616  if (!result)
617  result.Reset(new CCmdComposite("Import feature tables"));
618  result->AddCommand(*cmd);
619  }
620  }
621  }
622  return CIRef<IEditCommand>(result);
623 }
624 
625 
626 static void s_RemapFeatureSeqIds(CSeq_feat& feat, const CSeq_id& set_id)
627 {
628  CTypeIterator<CSeq_loc> visitor(feat);
629 
630  while (visitor){
631  CSeq_loc& loc = *visitor;
632  if (feat.IsSetProduct() && (&loc == &feat.GetProduct())) {
633  // don't change product ids
634  }
635  else {
636  CRef<CSeq_id> new_id(new CSeq_id());
637  new_id->Assign(set_id);
638  loc.SetId(*new_id);
639  }
640  ++visitor;
641  }
642 }
643 
645  const CSeq_annot& orig_annot,
646  CImportFeatTable::TFeatSeqIDMap& ftbl_seqid_map,
647  unsigned int &startingLocusTagNumber,
648  unsigned int &startingFeatureId,
649  const string &locus_tag,
650  bool euk)
651 {
652  CTSE_Handle tseh = m_Seh.GetTSE_Handle();
653 
655  if (orig_annot.IsFtable()) {
656  CRef<CSeq_annot> annot(new CSeq_annot);
657  annot->Assign(orig_annot);
658  if (m_is_gff)
659  {
660  xPostProcessAnnot(*annot, startingLocusTagNumber, startingFeatureId, locus_tag, euk);
661  }
662  vector<CRef<CSeq_feat>> imported_cds;
663  for (auto&& feat_it: annot->GetData().GetFtable()) {
664  const CSeq_feat& feat = *feat_it;
665  CBioseq_Handle bsh = x_FindLocalBioseq_Handle(feat, tseh);
666 
668  TFeatSeqIDMap::const_iterator it = ftbl_seqid_map.find(idh);
669  // don't add feature tables whose IDs were not found:
670  if (!bsh && it == ftbl_seqid_map.end()) {
671  if (NStr::IsBlank(m_Error)) {
672  m_Error.assign("Feature table identifiers do not match record\n");
673  }
675  m_Error += "->";
676  m_Error += feat.GetLocation().GetId()->AsFastaString();
677  m_Error += "\n";
678  continue;
679  }
680 
681  CRef<CSeq_feat> new_feat(new CSeq_feat());
682  new_feat->Assign(feat);
683  if (!bsh && it != ftbl_seqid_map.end()) {
684  s_RemapFeatureSeqIds(*new_feat, *(it->second.GetSeqId()));
685  bsh = m_Seh.GetScope().GetBioseqHandle(it->second.GetSeqId().GetObject());
686  }
687 
688  _ASSERT(bsh);
689  if (!result)
690  result.Reset(new CCmdComposite("Create Features"));
691 
692  if (new_feat->IsSetData() && new_feat->GetData().IsCdregion()) {
693  imported_cds.push_back(new_feat);
694  }
695  CIRef<IEditCommand> cmd(new CCmdCreateFeatBioseq(bsh, *new_feat));
696  result->AddCommand(*cmd);
697  }
698 
699  if (result) {
700  result->Execute();
701  CRef<CCmdComposite> cds_cmd(new CCmdComposite("Import CDS"));
702  for (auto new_feat : imported_cds) {
704  if (cmd)
705  cds_cmd->AddCommand(*cmd);
706  }
707  result->Unexecute();
708  result->AddCommand(*cds_cmd);
709  }
710  }
711  return CIRef<IEditCommand>(result);
712 }
713 
714 
715 void CImportFeatTable::xPostProcessAnnot(CSeq_annot& annot, unsigned int &startingLocusTagNumber, unsigned int &startingFeatureId, const string &locus_tag, bool euk)
716 // ----------------------------------------------------------------------------
717 {
718  edit::CFeatTableEdit fte(annot, locus_tag, startingLocusTagNumber, startingFeatureId);
719  fte.InferPartials();
720  fte.GenerateMissingParentFeatures(euk);
721  fte.GenerateLocusTags();
722  fte.GenerateProteinAndTranscriptIds();
723  //fte.InstantiateProducts();
724  fte.InstantiateProductsNames();
725  fte.EliminateBadQualifiers();
726  fte.SubmitFixProducts();
727 
728  startingLocusTagNumber = fte.PendingLocusTagNumber();
729  startingFeatureId = fte.PendingFeatureId();
730 
732  CConstRef<CCleanupChange> changed = cleanup.BasicCleanup(annot);
733 }
734 
735 static string s_GetIdBase(const CSeq_id& id)
736 {
737  string id_base;
738  id.GetLabel(&id_base, CSeq_id::eContent);
739  return id_base;
740 }
741 
742 static string s_GetIdBase(CBioseq_Handle bsh)
743 {
744  string id_base;
745  CSeq_id_Handle hid;
746 
747  ITERATE(CBioseq_Handle::TId, it, bsh.GetId()) {
748  if (!hid || !it->IsBetter(hid)) {
749  hid = *it;
750  }
751  }
752 
753  hid.GetSeqId()->GetLabel(&id_base, CSeq_id::eContent);
754  return id_base;
755 }
756 
757 
759 {
760  _ASSERT(feat->GetData().IsCdregion());
761  CCdregion& cds = feat->SetData().SetCdregion();
762  CBioseq_Handle bsh = m_Seh.GetScope().GetBioseqHandle(feat->GetLocation());
763  // set genetic code if it's not set already
764  if (!cds.IsSetCode()) {
766  if (code) {
767  cds.SetCode(*code);
768  }
769  }
770  // if frame is not set, it defaults to 1
771  if (!cds.IsSetFrame()) {
773  }
774 
775  CCleanup::ParseCodeBreaks(*feat, m_Seh.GetScope());
776 
777  // store all ids from protein_id qualifiers and add it later to the protein sequence
778  CBioseq::TId prot_ids;
779  try {
780  CSeq_id::ParseFastaIds(prot_ids, feat->GetNamedQual("protein_id"));
781  }
782  catch (const CSeqIdException& e) {
783  if (!m_Error.empty()) {
784  m_Error += "\n";
785  }
786  m_Error += e.GetMsg() + ": " + feat->GetNamedQual("protein_id");
787  return CIRef<IEditCommand>();
788  }
789 
790  // translate coding region only if its location falls within the sequence
791  const CSeq_loc& feat_loc = feat->GetLocation();
792  TSeqPos stop = feat_loc.GetStop(eExtreme_Positional);
793  if (stop >= bsh.GetBioseqLength()) {
794  return CIRef<IEditCommand>();
795  }
796 
797  if (sequence::IsPseudo(*feat, m_Seh.GetScope())) {
798  return CIRef<IEditCommand>();
799  }
800 
801  CRef<CBioseq> protein(new CBioseq);
802 
803  string prot_str;
804  try {
805  CSeqTranslator::Translate(*feat, bsh.GetScope(), prot_str);
806  } catch(const CSeqVectorException&) {}
807 
808  if (prot_str.empty())
809  return CIRef<IEditCommand>();
810 
811  if (NStr::EndsWith(prot_str, "*")) {
812  prot_str = prot_str.substr(0, prot_str.length() - 1);
813  }
814 
815  protein->SetInst().ResetExt();
816  protein->SetInst().SetRepr(CSeq_inst::eRepr_raw);
817  if (NStr::Find(prot_str, "-") == NPOS) {
818  protein->SetInst().SetSeq_data().SetIupacaa().Set(prot_str);
819  } else {
820  protein->SetInst().SetSeq_data().SetNcbieaa().Set(prot_str);
821  }
822  protein->SetInst().SetLength(TSeqPos(prot_str.length()));
823  protein->SetInst().SetMol(CSeq_inst::eMol_aa);
824 
825  if (feat->IsSetProduct()
826  && feat->GetProduct().IsWhole()
827  && (feat->GetProduct().GetWhole().IsGenbank() || feat->GetProduct().GetWhole().IsGeneral())) {
828  // don't change CDS product_id
829  for (auto& it : prot_ids) {
830  protein->SetId().push_back(it);
831  }
832  }
833  else {
834  const string& prot_id_qual = feat->GetNamedQual("protein_id");
835  if (!prot_id_qual.empty()) {
836  for (auto& it : prot_ids) {
837  protein->SetId().push_back(it);
838  }
839  // don't update existing CDS product id
840  if (!feat->IsSetProduct()) {
841  CRef<CSeq_id> best_id = FindBestChoice(prot_ids, CSeq_id::BestRank);
842  feat->SetProduct().SetWhole().Assign(*best_id);
843  }
844  }
845  else {
846  int offset = 0;
847  string base;
848  if (feat->IsSetProduct()) {
849  // get the base name of a protein id as there might be more than one
850  // in the seq-entry; here the offset starts from 0
851  base = s_GetIdBase(*(feat->GetProduct().GetId()));
852 
853  if (feat->GetProduct().IsWhole() && feat->GetProduct().GetWhole().IsLocal()) {
854  string base_na = s_GetIdBase(bsh);
855  string product_id;
856  feat->GetProduct().GetId()->GetLabel(&product_id, CSeq_id::eContent);
857  if (NStr::StartsWith(product_id, base_na + "_", NStr::eCase)) {
858  base = base_na;
859  offset = 1;
860  }
861  }
862  }
863  else {
864  // get the base name of a na sequence to generate protein ids for one
865  // nuc-prot set; here the offset starts from 1
866  base = s_GetIdBase(bsh);
867  offset = 1;
868  }
869 
870  if (m_OffsetForId.find(base) != m_OffsetForId.end()) {
871  offset = m_OffsetForId[base];
872  offset++;
873  }
874  // change CDS product_id
875  CRef<CSeq_id> prot_id = edit::GetNewLocalProtId(base, m_Seh.GetScope(), offset);
876  m_OffsetForId[base] = offset;
877  feat->SetProduct().SetWhole().Assign(*prot_id);
878 
879  bool has_protid = false;
880  for (auto& it : prot_ids) {
881  string base = s_GetIdBase(*it);
882  if (m_OffsetForId.find(base) == m_OffsetForId.end()) {
883  protein->SetId().push_back(it);
884  has_protid |= (prot_id->Match(*it));
885  }
886  }
887  if (!has_protid) {
888  protein->SetId().push_back(prot_id);
889  }
890  }
891  }
892 
893  // remove protein_id qualifiers
894  feat->RemoveQualifier("protein_id");
895 
896  CRef<CSeq_entry> prot_entry(new CSeq_entry());
897  prot_entry->SetSeq().Assign(*protein);
898  SetMolinfoForProtein(prot_entry,
901 
902 
906  const CProt_ref* orig_ref = feat->GetProtXref();
907  if (orig_ref) {
908  CRef<CProt_ref> prot_ref(new CProt_ref());
909  prot_ref->Assign(*orig_ref);
910  prot->SetData().SetProt(*prot_ref);
911  }
912 
913  CSeq_entry_Handle add_seh = bsh.GetSeq_entry_Handle();
914  return CIRef<IEditCommand>(new CCmdAddSeqEntry(prot_entry, add_seh));
915 }
916 
918 {
920  CBioseq_Handle bsh = tseh.GetBioseqHandle(idh);
921  if (bsh) {
922  return idh;
923  }
924 
925  if (!id.IsLocal()) {
926  CSeq_id_Handle none;
927  return none;
928  }
929  // try alternate form of ID
930  if (id.GetLocal().IsStr()) {
931  CRef<CSeq_id> tmp_id(new CSeq_id());
932  try {
933  tmp_id->SetLocal().SetId(NStr::StringToNonNegativeInt(id.GetLocal().GetStr()));
934  idh = CSeq_id_Handle::GetHandle(*tmp_id);
935  bsh = tseh.GetBioseqHandle(idh);
936  if (bsh) {
937  return idh;
938  }
939  } catch (const CException&) {
940  }
941  } else if (id.GetLocal().IsId()) {
942  CRef<CSeq_id> tmp_id(new CSeq_id());
943  tmp_id->SetLocal().SetStr(NStr::NumericToString(id.GetLocal().GetId()));
944  idh = CSeq_id_Handle::GetHandle(*tmp_id);
945  bsh = tseh.GetBioseqHandle(idh);
946  if (bsh) {
947  return idh;
948  }
949  }
950  CSeq_id_Handle none;
951  return none;
952 }
953 
954 
956 {
958  CBioseq_Handle bsh = m_Seh.GetScope().GetBioseqHandleFromTSE(idh, tseh);
959  return bsh;
960 }
961 
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
bool GUI_AsyncExecUnit(IExecuteUnit &exec_unit, const wxString &msg)
Definition: async_call.cpp:53
CRef< objects::CSeq_id > GetNewLocalProtId(const string &id_base, CScope &scope, int &offset)
Definition: cds_fix.cpp:1146
CRef< CGenetic_code > GetGeneticCodeForBioseq(CBioseq_Handle bh)
GetGeneticCodeForBioseq A function to construct the appropriate CGenetic_code object to use when cons...
Definition: cds_fix.cpp:707
C5ColObjectLoader.
CBioseq_CI –.
Definition: bioseq_ci.hpp:69
CBioseq_Handle –.
CCdregion –.
Definition: Cdregion.hpp:66
static bool ParseCodeBreaks(CSeq_feat &feat, CScope &scope)
Parses all valid transl_except Gb-quals into code-breaks for cdregion, then removes the transl_except...
Definition: cleanup.cpp:4556
void AddCommand(IEditCommand &command)
static CIRef< IEditCommand > Create(const objects::CSeq_entry_Handle &seh, const vector< string > &quals)
CConstRef –.
Definition: ncbiobj.hpp:1266
virtual void SetRegistryPath(const string &path)
Definition: dialog.cpp:59
CFeat_CI –.
Definition: feat_ci.hpp:64
CFile –.
Definition: ncbifile.hpp:1604
void SetText(const wxString &text)
CGffObjectLoader.
map< string, int > m_OffsetForId
CIRef< IEditCommand > x_CreateCommand(const IObjectLoader::TObjects &objects)
CIRef< IEditCommand > x_DoImportCDS(CRef< objects::CSeq_feat > feat)
objects::CBioseq_Handle x_FindLocalBioseq_Handle(const objects::CSeq_feat &feat, const objects::CTSE_Handle &tseh) const
CIRef< IEditCommand > ImportFeaturesFromClipboard(const wxString &workDir)
string x_CheckCollidingIds(const IObjectLoader::TObjects &objects)
void xPostProcessAnnot(objects::CSeq_annot &annot, unsigned int &startingLocusTagNumber, unsigned int &startingFeatureId, const string &locus_tag, bool euk)
objects::CSeq_id_Handle x_GetFixedId(const objects::CSeq_id &id, const objects::CTSE_Handle &tseh) const
CIRef< IEditCommand > x_DoImportFeaturesFromFile(const wxString &workDir, const string &format_id=kEmptyStr)
CIRef< IEditCommand > x_DoImportFeaturesFromClipboard(const wxString &workDir)
CIRef< IEditCommand > ImportFeaturesFromFile(const wxString &workDir=wxEmptyString, const string &format_id=kEmptyStr)
static void ShowTableInfo()
CIRef< IEditCommand > x_GatherAdditionalChanges(CIRef< IEditCommand > &start_cmd)
CIRef< IEditCommand > AddSeqAnnotToSeqEntry(const objects::CSeq_annot &orig_annot, TFeatSeqIDMap &ftbl_seqid_map, unsigned int &startingLocusTagNumber, unsigned int &startingFeatureId, const string &locus_tag, bool euk)
objects::CSeq_entry_Handle m_Seh
bool x_ContainsDuplicateIds(const IObjectLoader::TObjects &objects)
returns true if the feature table contains at least one pair of duplicate protein/transcript ids
string x_CheckConsistentProteinIds(const IObjectLoader::TObjects &objects)
CIRef< IEditCommand > TestImport(const objects::CSeq_annot &orig_annot, TFeatSeqIDMap &ftbl_seqid_map, unsigned int &startingLocusTagNumber, unsigned int &startingFeatureId, const string &locus_tag, bool euk)
void GetFtableIDToSeqIDMap(TFeatSeqIDMap &ftbl_seqid_map)
CObject –.
Definition: ncbiobj.hpp:180
IObjectLoader * GetObjectLoader()
void SetManagers(vector< CIRef< IOpenObjectsPanelClient > > &managers)
CReportLoaderErrors.
void SetWorkDir(const wxString &workDir)
ESubtype GetSubtype(void) const
static CTempString SubtypeValueToName(ESubtype eSubtype)
Turns a ESubtype into its string value which is NOT necessarily related to the identifier of the enum...
CSeqIdException –.
Definition: Seq_id.hpp:1001
SeqVector related exceptions.
bool IsFtable(void) const
Definition: Seq_annot.cpp:177
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
const CProt_ref * GetProtXref(void) const
get protein (if present) from Seq-feat.xref list
Definition: Seq_feat.cpp:222
const string & GetNamedQual(const CTempString &qual_name) const
Return a named qualifier.
Definition: Seq_feat.cpp:429
void RemoveQualifier(const string &qual_name)
Remove all qualifiers with the given name; do nothing if no such qualifier exists.
Definition: Seq_feat.cpp:315
const CGene_ref * GetGeneXref(void) const
See related function in util/feature.hpp.
Definition: Seq_feat.cpp:181
CStopWatch –.
Definition: ncbitime.hpp:1938
CBioseq_Handle GetBioseqHandle(const CSeq_id &id) const
Get Bioseq handle from this TSE.
Definition: tse_handle.cpp:217
CTmpFile –.
Definition: ncbifile.hpp:2352
Template class for iteration on objects of class C.
Definition: iterator.hpp:673
void SetHelpUrl(const wxString &url)
Definition: wizard_dlg.cpp:154
virtual bool PreExecute()=0
virtual bool PostExecute()=0
vector< SObject > TObjects
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
bool empty() const
Definition: set.hpp:133
void SetMolinfoForProtein(CRef< objects::CSeq_entry > protein, bool partial5, bool partial3)
CRef< objects::CSeq_feat > AddProteinFeatureToProtein(CRef< objects::CSeq_entry > protein, bool partial5, bool partial3)
#define _(proto)
Definition: ct_nlmzip_i.h:78
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
static void cleanup(void)
Definition: ct_dynamic.c:30
int offset
Definition: replacements.h:160
char data[12]
Definition: iconv.c:80
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NULL
Definition: ncbistd.hpp:225
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
Definition: ncbidiag.hpp:186
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
void Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
virtual bool Remove(TRemoveFlags flags=eRecursive) const
Remove a directory entry.
Definition: ncbifile.cpp:2595
@ eIfExists_ReturnCurrent
Return reference to current stream, create new one if it does not exists yet.
Definition: ncbifile.hpp:2383
@ eNoRemove
Do not remove file.
Definition: ncbifile.hpp:2357
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual bool Equals(const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
Check if both objects contain the same values.
const string AsFastaString(void) const
Definition: Seq_id.cpp:2266
string GetSeqIdString(bool with_version=false) const
Return seqid string with optional version for text seqid type.
Definition: Seq_id.cpp:2145
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
Definition: Seq_id.cpp:318
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
Definition: Seq_id.cpp:2040
CConstRef< CSeq_id > GetSeqId(void) const
static SIZE_TYPE ParseFastaIds(CBioseq::TId &ids, const CTempString &s, bool allow_partial_failure=false)
Parse an entire set of |-delimited FASTA-style IDs, appending the results to IDS.
Definition: Seq_id.cpp:2603
bool Match(const CSeq_id &sid2) const
Match() - TRUE if SeqIds are equivalent.
Definition: Seq_id.hpp:1065
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
static int BestRank(const CRef< CSeq_id > &id)
Definition: Seq_id.hpp:774
bool IsBetter(const CSeq_id_Handle &h) const
True if "this" is a better bioseq than "h".
@ eContent
Untagged human-readable accession or the like.
Definition: Seq_id.hpp:605
bool IsPartialStart(ESeqLocExtremes ext) const
check start or stop of location for e_Lim fuzz
Definition: Seq_loc.cpp:3222
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
Definition: Seq_loc.cpp:3474
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
Definition: Seq_loc.hpp:941
bool IsPartialStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:3251
TSeqPos GetStop(ESeqLocExtremes ext) const
Definition: Seq_loc.cpp:963
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
bool IsPseudo(const CSeq_feat &feat, CScope &scope)
Determines whether given feature is pseudo, using gene associated with feature if necessary Checks to...
Definition: sequence.cpp:1428
static void Translate(const string &seq, string &prot, const CGenetic_code *code, bool include_stop=true, bool remove_trailing_X=false, bool *alt_start=NULL, bool is_5prime_complete=true, bool is_3prime_complete=true)
Translate a string using a specified genetic code.
Definition: sequence.cpp:4095
vector< CSeq_id_Handle > TId
TSeqPos GetBioseqLength(void) const
CSeq_entry_Handle GetSeq_entry_Handle(void) const
Get parent Seq-entry handle.
CScope & GetScope(void) const
Get scope this handle belongs to.
const TId & GetId(void) const
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
static int StringToNonNegativeInt(const CTempString str, TStringToNumFlags flags=0)
Convert string to non-negative integer value.
Definition: ncbistr.cpp:457
#define kEmptyStr
Definition: ncbistr.hpp:123
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
Definition: ncbistr.hpp:5430
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
#define NPOS
Definition: ncbistr.hpp:133
static 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:2891
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5412
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
Definition: ncbistr.cpp:3554
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition: ncbistr.hpp:673
@ eCase
Case sensitive compare.
Definition: ncbistr.hpp:1205
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
Definition: ncbitime.hpp:2776
void Start(void)
Start the timer.
Definition: ncbitime.hpp:2765
C::value_type FindBestChoice(const C &container, F score_func)
Find the best choice (lowest score) for values in a container.
Definition: ncbiutil.hpp:250
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:781
const TLocus_tag & GetLocus_tag(void) const
Get the Locus_tag member data.
Definition: Gene_ref_.hpp:793
TStr & SetStr(void)
Select the variant.
Definition: Object_id_.hpp:304
TId & SetId(void)
Select the variant.
Definition: Object_id_.hpp:277
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
Definition: Seq_feat_.hpp:913
bool IsSetCode(void) const
genetic code used Check if a value has been assigned to Code data member.
Definition: Cdregion_.hpp:700
bool IsCdregion(void) const
Check if variant Cdregion is selected.
void SetProduct(TProduct &value)
Assign a value to Product data member.
Definition: Seq_feat_.cpp:110
void SetCode(TCode &value)
Assign a value to Code data member.
Definition: Cdregion_.cpp:68
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
bool IsGene(void) const
Check if variant Gene is selected.
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
TPseudo GetPseudo(void) const
Get the Pseudo member data.
Definition: Seq_feat_.hpp:1365
const TProduct & GetProduct(void) const
Get the Product member data.
Definition: Seq_feat_.hpp:1096
bool IsSetPseudo(void) const
annotated on pseudogene? Check if a value has been assigned to Pseudo data member.
Definition: Seq_feat_.hpp:1346
const TGene & GetGene(void) const
Get the variant data.
bool IsSetProduct(void) const
product of process Check if a value has been assigned to Product data member.
Definition: Seq_feat_.hpp:1084
void SetFrame(TFrame value)
Assign a value to Frame data member.
Definition: Cdregion_.hpp:540
bool IsSetFrame(void) const
Check if a value has been assigned to Frame data member.
Definition: Cdregion_.hpp:509
bool IsGenbank(void) const
Check if variant Genbank is selected.
Definition: Seq_id_.hpp:841
const TWhole & GetWhole(void) const
Get the variant data.
Definition: Seq_loc_.cpp:172
bool IsGeneral(void) const
Check if variant General is selected.
Definition: Seq_id_.hpp:877
TLocal & SetLocal(void)
Select the variant.
Definition: Seq_id_.cpp:199
bool IsLocal(void) const
Check if variant Local is selected.
Definition: Seq_id_.hpp:775
bool IsWhole(void) const
Check if variant Whole is selected.
Definition: Seq_loc_.hpp:522
TSeq & SetSeq(void)
Select the variant.
Definition: Seq_entry_.cpp:108
TId & SetId(void)
Assign a value to Id data member.
Definition: Bioseq_.hpp:296
list< CRef< CSeq_id > > TId
Definition: Bioseq_.hpp:94
void SetInst(TInst &value)
Assign a value to Inst data member.
Definition: Bioseq_.cpp:86
const TFtable & GetFtable(void) const
Get the variant data.
Definition: Seq_annot_.hpp:621
list< CRef< CSeq_feat > > TFtable
Definition: Seq_annot_.hpp:193
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_annot_.hpp:873
@ eRepr_raw
continuous sequence
Definition: Seq_inst_.hpp:94
static CStopWatch sw
USING_SCOPE(objects)
static string s_GetIdBase(const CSeq_id &id)
static void s_RemapFeatureSeqIds(CSeq_feat &feat, const CSeq_id &set_id)
const wxString kfeaturetableinstructions
static bool s_IsPseudo(const CSeq_feat &feat)
#define wxT(x)
Definition: muParser.cpp:41
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
static const char * prefix[]
Definition: pcregrep.c:405
SAnnotSelector –.
Definition: inftrees.h:24
#define _ASSERT
else result
Definition: token2.c:20
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
Modified on Thu Apr 25 08:18:11 2024 by modify_doxy.py rev. 669887