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

Go to the SVN repository for this file.

1 /* $Id: columnar_vcf_load_manager.cpp 46594 2021-07-28 17:36:25Z 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: Vladislav Evgeniev
27  *
28  */
29 
30 #include <ncbi_pch.hpp>
31 
33 
36 
37 #include <util/line_reader.hpp>
38 #include <serial/iterator.hpp>
40 #include <gui/objutils/label.hpp>
42 #include <gui/objutils/utils.hpp>
44 
57 
59 
63 
64 #include <util/md5.hpp>
65 #include <wx/filename.h>
66 #include <chrono>
67 
70 
71 ///////////////////////////////////////////////////////////////////////////////
72 /// CVcfLoadingJob
74  public CDataLoadingAppJob,
75  public CReportLoaderErrors
76 {
77 public:
78  using TSeqIdsVector = vector<CConstRef<CSeq_id>>;
79 
81 
82  /// @name CDataLoadingAppJob implementation
83  /// @{
84  void GetHTMLResults(wxString& title, wxString& html);
85  /// @}
86 
87  void SetVcfFiles(const vector<wxString>& files) { m_VcfFiles = files; }
91  void SetGenCollAssembly(const CRef<CGC_Assembly>& assm ) { m_GenCollAssm = assm; }
92 
95 
98 
99 protected:
100  /// @name CDataLoadingAppJob implementation
101  /// @{
102  virtual void x_CreateProjectItems();
103  /// @}
104 
105 private:
107  void x_CreateColumnarVCFProjectItem(const CSeq_id &seq_id, CVCFVariantList &vars);
108  void x_CreateSeqIdProjectItem(const CSeq_id &seq_id);
109  vector<string> x_FindSynonyms(const CSeq_id& seq_id, const CGC_Assembly::TSequenceList& chromosomes);
110 
111  vector<wxString> m_VcfFiles;
114  bool m_ReadAllChrms{ true };
116  unique_ptr<IIdMapper> m_IdMapper;
117  wxFileName m_CurrentFile;
118 
121 
124 };
125 
126 ///////////////////////////////////////////////////////////////////////////////
127 /// CColumnarVCFLoaderManager
129  : m_Descr("VCF (Variant Call Format) files", "")
130  , m_SrvLocator(nullptr)
131  , m_ParentWindow(nullptr)
132  , m_State(eInvalid)
133  , m_RefSequencesPanel(nullptr)
134  , m_ColumnsPanel(nullptr)
135  , m_SamplesPanel(nullptr)
136  , m_AssemblyPanel(nullptr)
137 {
138  m_Descr.SetLogEvent("loaders");
139 }
140 
141 //
142 // IFileLoadPanelClient implementation
143 //
144 
146 {
147  return m_Descr.GetLabel();
148 }
149 
151 {
154 }
155 
156 //
157 // IUILoadManager implementation
158 //
159 
161 {
162  m_SrvLocator = srv_locator;
163 }
164 
165 
167 {
168  m_ParentWindow = parent;
169 }
170 
171 
173 {
174  return m_Descr;
175 }
176 
177 
179 {
180  m_State = eAssembly;
181 }
182 
183 
185 {
186  m_State = eInvalid;
187  m_RefSequencesPanel = nullptr; // window is destroyed by the system
188  m_AssemblyPanel = nullptr; // window is destroyed by the system
189  m_ColumnsPanel = nullptr; // window is destroyed by the system
190  m_SamplesPanel = nullptr;
191 }
192 
194 {
195  switch (m_State) {
196  case eAssembly: {
197  m_RefSeqIds.clear();
198  if (m_AssemblyPanel == nullptr) {
200  if (!m_RegPath.empty()) {
203  }
204  } else {
206  }
207  m_AssemblyPanel->TransferDataToWindow();
208  return m_AssemblyPanel;
209  }
210  case eInfoSelection:
211  if (m_ColumnsPanel == nullptr) {
213  }
215  return m_ColumnsPanel;
216  case eSampleSelection:
217  if (m_SamplesPanel == nullptr) {
219  }
221  return m_SamplesPanel;
222  case eRefSequences:
223  {
224  if (m_RefSequencesPanel == nullptr) {
226  }
229  if (m_TopLevelSeqCount != 0)
231  return m_RefSequencesPanel;
232  }
233  default:
234  return nullptr;
235  }
236  return nullptr;
237 }
238 
239 
241 {
242  switch (m_State) {
243  case eAssembly:
244  return action == eNext;
245  case eInfoSelection:
246  case eSampleSelection:
247  case eRefSequences:
248  return action == eBack || action == eNext;
249  case eCompleted:
250  return action == eBack;
251  default:
252  _ASSERT(false);
253  return false;
254  }
255 }
256 
257 
259 {
260  return m_State == eCompleted;
261 }
262 
263 
265 {
266  return m_State == eCompleted;
267 }
268 
269 
271 {
272  if (m_State == eAssembly && action == eNext) {
273  if (m_AssemblyPanel->IsInputValid()) {
275  if (map_params.GetUseMapping())
276  m_AssmAcc = map_params.GetAssemblyAcc();
277  else
278  m_AssmAcc.clear();
279 
280  m_RefSeqIds.clear();
282  m_TopLevelSeqCount = 0;
283  wxBusyCursor wait;
284  x_GetRefSeqs();
285 
287  return true;
288  }
289  return false;
290  }
291  else if (m_State == eInfoSelection) {
292  if (action == eBack) {
293  m_State = eAssembly;
294  return true;
295  }
296  else if (action == eNext) {
297  if (!m_VCFreader.GetSamples().empty()) {
299  }
300  else {
302  }
303  return true;
304  }
305  }
306  else if (m_State == eSampleSelection) {
307  if (action == eBack) {
309  return true;
310  }
311  else if (action == eNext) {
313  return true;
314  }
315  }
316  else if (m_State == eRefSequences) {
317  if (action == eBack) {
318  if (!m_VCFreader.GetSamples().empty()) {
320  }
321  else {
323  }
324  return true;
325  }
326  else if (action == eNext) {
328  return true;
329  }
330  }
331  else if (m_State == eCompleted) {
332  if (action == eBack) {
334  return true;
335  }
336  }
337  _ASSERT(false);
338  return false;
339 }
340 
342 {
343  if (!m_AssmAcc.empty()) {
344  // this is used only by Gbench, so using seqconfig as assembly service should be safe
345  m_GenCollAssm = CGencollSvc::GetInstance()->GetGCAssembly(m_AssmAcc, true, "Gbench", nullptr, true);
346  }
347 
348  m_RefSeqIds.clear();
350  m_TopLevelSeqCount = 0;
351 
352  // retrieve all chromosomes
353  if (!m_GenCollAssm) {
354  LOG_POST(Error << "Chromosomes could not be retrieved as no assembly was found");
355  return;
356  }
357 
359 
360  CGC_Assembly::TSequenceList chromosomes;
361 
362  GUI_AsyncExec([this, &chromosomes](ICanceled& canceled)
363  {
364  m_GenCollAssm->GetMolecules(chromosomes, CGC_Assembly::eChromosome);
365 
366  auto start = chrono::steady_clock::now();
367 
369  m_GenCollAssm->GetMolecules(topLevel, CGC_Assembly::eTopLevel);
370  m_TopLevelSeqCount = topLevel.size();
371 
372  auto diff = chrono::steady_clock::now() - start;
373  LOG_POST(Info << "Got " << topLevel.size() << " top level sequences in " << chrono::duration_cast<chrono::milliseconds>(diff).count() << " ms ");
374 
375  }, wxT("Querying GenColl..."));
376 
377  set<string> added_ids;
378  for (const auto& it : chromosomes) {
379  CConstRef<CSeq_id> best_id = it->GetSynonymSeq_id(seqid_type, CGC_SeqIdAlias::e_Public);
380  if (best_id) {
381  const auto id_str = best_id->AsFastaString();
382  if (added_ids.insert(id_str).second) {
383  m_RefSeqIds.push_back(best_id);
384  }
385  }
386  }
387 }
388 
390 {
393  // create a wrapper task
394 
395  CSelectProjectOptions options;
396 
397  unique_ptr<CDataLoadingAppTask> task(new CDataLoadingAppTask(srv, options, *job));
398  task->SetReportErrors(false); // we handle errors ourselves
399 
400  job->SetVcfFiles(m_FileNames);
401  job->SetGenCollAssembly(m_GenCollAssm);
402  job->SetChromosomes() = m_RefSeqIds;
403 
404  if (m_RefSequencesPanel) {
405  m_RefSequencesPanel->GetSelectedReferenceSeqIds(job->SetSeqIdsToLoad());
406  job->SetReadAllChrms(m_RefSequencesPanel->ImportAll());
407  }
408  if (m_ColumnsPanel) {
409  m_ColumnsPanel->GetSelectedInfoFields(job->SetInfoFields());
410  job->SetReadAllInfoFields(m_ColumnsPanel->AllAreChecked());
411  }
412  if (m_SamplesPanel) {
413  m_SamplesPanel->GetSelectedSamples(job->SetSamples());
414  job->SetReadAllSamples(m_SamplesPanel->AllAreChecked());
415  }
416 
417  return task.release();
418 }
419 
421 {
422  return nullptr;
423 }
424 
426 {
429 }
430 
431 
432 bool CColumnarVCFLoaderManager::ValidateFilenames(const vector<wxString>&)
433 {
434  // not implemented
435  return true;
436 }
437 
438 
440 {
442 }
443 
445 {
447 }
448 
450 {
451  return m_State == eAssembly;
452 }
453 
454 
455 bool CColumnarVCFLoaderManager::RecognizeFormat(const wxString& filename)
456 {
457  wxString ext;
458  wxFileName::SplitPath(filename, 0, 0, &ext);
460 }
461 
463 {
464  return fmt == CFormatGuess::eVcf;
465 }
466 
468 {
469  static string sid("columnar_vcf_format_load_manager");
470  return sid;
471 }
472 
473 
475 {
476  static string slabel("VCF (Variant Call Format) Format Load Manager");
477  return slabel;
478 }
479 
481 {
482  m_RegPath = path; // store for later use
483 }
484 
485 static const char* kProjectParamsTag = "ProjectParams";
486 
488 {
489  if (!m_RegPath.empty()) {
490  if (m_AssemblyPanel)
492  }
493 }
494 
496 {
497  if (!m_RegPath.empty()) {
498  if (m_AssemblyPanel)
500  }
501 }
502 
503 
504 //CVcfLoadingJob
506 {
507  m_Descr = "Loading VCF file";
508 }
509 
510 void CVcfLoadingJob::GetHTMLResults(wxString& title, wxString& html)
511 {
512  title = "VCF import errors";
513  html = x_GetHTMLResults();
514 }
515 
517 {
520 
521  // Add the serialized VCF to the project
522  for (const auto& fn : m_VcfFiles) {
523  wxFileName wx_file(fn);
524  m_CurrentFile = wx_file;
525 
526  CCompressedFile file(fn);
527  CColumnarVCFReader reader;
531  reader.LoadSelectedSamples() = m_Samples;
532  CRef<CErrorContainer> err_cont{ new CErrorContainer(1000) };
533  if (m_ReadAllChrms) {
534  try {
535  CColumnarVCFReader::TOnVCFVariantListReady callback = std::bind(&CVcfLoadingJob::x_OnVCFVariantListReady, this, std::placeholders::_1);
536  CColumnarVCFReader::TReportProgress progress = bind(&CVcfLoadingJob::x_SetStatusText, this, placeholders::_1);
537  reader.ReadData(file.GetIstream(false), x_GetICanceled(), err_cont, progress, callback);
538  x_UpdateHTMLResults(fn, err_cont);
539  }
540  catch (const CException& e) {
541  LOG_POST(Error << "Loading VCF file " << wx_file.GetFullName().utf8_str() << " failed: " << e.GetMsg());
542  x_UpdateHTMLResults(fn, err_cont);
543  }
544  catch (const exception& e) {
545  LOG_POST(Error << "Loading VCF file " << wx_file.GetFullName().utf8_str() << " failed: " << e.what());
546  x_UpdateHTMLResults(fn, err_cont);
547  }
548  }
549  else {
550  // read only the requested ids
551  CGC_Assembly::TSequenceList top_level;
553 
554  vector<pair<CConstRef<CSeq_id>, vector<string>>> chrsyn_list;
555  for (const auto& seqid_it : m_SeqIdsToLoad) {
556  vector<string> synonyms = x_FindSynonyms(*seqid_it, top_level);
557  chrsyn_list.emplace_back(seqid_it, synonyms);
558  }
559 
560  try {
561  CColumnarVCFReader::TOnVCFVariantListReady callback = std::bind(&CVcfLoadingJob::x_OnVCFVariantListReady, this, std::placeholders::_1);
562  CColumnarVCFReader::TReportProgress progress = bind(&CVcfLoadingJob::x_SetStatusText, this, placeholders::_1);
563  auto variants_list = reader.ReadVariantsForChrs(file.GetIstream(false), chrsyn_list, x_GetICanceled(), err_cont, progress, callback);
564  x_UpdateHTMLResults(fn, err_cont);
565  }
566  catch (const CException& e) {
567  LOG_POST(Error << "Loading chromosomes from VCF file " << wx_file.GetFullName().utf8_str() << " failed: " << e.GetMsg());
568  x_UpdateHTMLResults(fn, err_cont);
569  }
570  catch (const exception& e) {
571  LOG_POST(Error << "Loading chromosomes from VCF file " << wx_file.GetFullName().utf8_str() << " failed: " << e.what());
572  x_UpdateHTMLResults(fn, err_cont);
573  }
574  }
575  }
576 }
577 
579 {
580  const auto &chr = vars.GetChrName();
581  CRef<CSeq_id> mapped_id = CSeqUtils::MapStringId(chr, m_IdMapper.get());
582  if (!mapped_id) {
583  LOG_POST(Warning << "VCF ID " << chr << " cannot be mapped.");
584  try {
585  mapped_id.Reset(new CSeq_id(chr));
586  }
587  catch (const CException &) {
588  LOG_POST(Warning << "VCF ID " << chr << " cannot be used as local ID.");
589  return;
590  }
591  }
592  x_SetStatusText("Creating items for " + chr + " (" + mapped_id->GetSeqIdString(true) + ")...");
593  if (vars.Count() > 0) {
594  x_CreateColumnarVCFProjectItem(*mapped_id, vars);
595  x_CreateSeqIdProjectItem(*mapped_id);
596  }
597  else {
598  LOG_POST(Error << "No variants were read for " + mapped_id->GetSeqIdString(true) + " due to a reading error");
599  }
600  x_SetTextResult("");
601 }
602 
604 {
605  CRef<CProjectItem> item(new CProjectItem());
606  CProjectItem::TItem& sub_item = item->SetItem();
607 
608  CAbstractProjectItem &other = sub_item.SetOther();
609 
610  other.SetType("ColumnarVCF: " + vars.s_GetCurrentVersion());
612 
613  // Time consuming part
614  const auto &vars_data = vars.GetSerializedData();
615  data.resize(vars_data.size());
616  std::copy(vars_data.begin(), vars_data.end(), data.begin());
617 
619  label += " variants on ";
620  label += seq_id.GetSeqIdString(true);
621  label += " (";
622  label += m_CurrentFile.GetFullName().utf8_str();
623  label += ')';
624  item->SetLabel(label);
625  item->AddTag(seq_id.AsFastaString());
626  // Add the item to a list
627  AddProjectItem(*item);
628 
629  CProjectItemExtra::SetStr(*item, "OriginalPath", string(m_CurrentFile.GetPath(true).utf8_str()));
630  CProjectItemExtra::SetStr(*item, "OriginalFile", string(m_CurrentFile.GetFullName().utf8_str()));
631  {
632  string filename{ m_CurrentFile.GetFullPath().utf8_str() };
633  CMD5 md5;
634  md5.Update(filename.c_str(), filename.length());
635  auto fasta_id = seq_id.AsFastaString();
636  md5.Update(fasta_id.c_str(), fasta_id.length());
637  CProjectItemExtra::SetStr(*item, "AnnotName", string("ColumnarVCF_") + md5.GetHexSum());
638  }
639  // Add the Seq-id to the project item
640  CRef<CAnnotdesc> annot(new CAnnotdesc());
641  annot->SetSrc().Assign(seq_id);
642  item->SetDescr().push_back(annot);
643 }
644 
646 {
647  CRef<CProjectItem> item(new CProjectItem());
648  CRef<CSeq_id> seqId(new CSeq_id());
649  seqId->Assign(seq_id);
650  item->SetObject(*seqId);
652  // add item to a list
653  AddProjectItem(*item);
654 }
655 
656 vector<string> CVcfLoadingJob::x_FindSynonyms(const CSeq_id& seq_id, const CGC_Assembly::TSequenceList& chromosomes)
657 {
659  vector<string> syn;
660  for (const auto& chr_it : chromosomes) {
661  CConstRef<CSeq_id> best_id = chr_it->GetSynonymSeq_id(seqid_type, CGC_SeqIdAlias::e_Public);
662  if (best_id && best_id->Equals(seq_id)) {
663  if (!chr_it->IsSetSeq_id_synonyms()) {
664  break;
665  }
666 
667  ITERATE(CGC_Sequence::TSeq_id_synonyms, syn_iter, chr_it->GetSeq_id_synonyms()) {
668  CTypeConstIterator<CSeq_id> id_iter(**syn_iter);
669  for (; id_iter; ++id_iter) {
670  if (id_iter->IsGi())
671  continue;
672 
673  string label;
674  id_iter->GetLabel(&label, CSeq_id::eContent);
675  syn.push_back(label);
676  }
677  }
678  break;
679  }
680  }
681  sort(syn.begin(), syn.end());
682  syn.erase(unique(syn.begin(), syn.end()), syn.end());
683  return syn;
684 }
685 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
std::invoke_result< _Fty, ICanceled & >::type GUI_AsyncExec(_Fty &&_Fnarg, const wxString &msg=wxT("Accessing network..."))
Definition: async_call.hpp:130
CAnnotdesc –.
Definition: Annotdesc.hpp:66
CMapAssemblyParams & GetData()
Data access.
Class responsible to read VCF files.
const set< CConstRef< SVcfFieldData > > & GetInfoFields() const
map< unsigned, string > & LoadSelectedSamples()
function< void(const string &)> TReportProgress
void LoadAllInfo(bool value)
void LoadAllSamples(bool value)
std::function< void(CVCFVariantList &)> TOnVCFVariantListReady
Defines a callable object, used when a variants list is processed by the reader.
set< string > & LoadSelectedInfoFields()
const map< unsigned, string > & GetSamples() const
vector< TSeqIdVarsListPair > ReadVariantsForChrs(CNcbiIstream &in, const vector< pair< CConstRef< objects::CSeq_id >, vector< string >>> &chr_list, ICanceled *canceled=nullptr, objects::ILineErrorListener *listener=nullptr, TReportProgress prog_func=TReportProgress(), TOnVCFVariantListReady on_variants_list_ready=TOnVCFVariantListReady())
Reads a list of variants.
bool ReadData(CNcbiIstream &in, ICanceled *canceled=nullptr, objects::ILineErrorListener *listener=nullptr, TReportProgress prog_func=TReportProgress(), TOnVCFVariantListReady on_variants_list_ready=TOnVCFVariantListReady())
Reads only the data section of the file.
CDataLoadingAppJob - a base class for Jobs loading data into projects.
void AddProjectItem(objects::CProjectItem &item)
CRef< objects::CScope > m_Scope
void x_SetTextResult(const string &result)
CDataLoadingAppTask - a task that executes CDataLoadingAppJob.
CErrorContainer.
static bool RecognizeExtension(EFileType fileType, const wxString &extension)
static wxString GetDialogFilter(EFileType fileType)
EFormat
The formats are checked in the same order as declared here.
@ eVcf
VCF, CVcfReader.
bool IsGenBank() const
Is this assembly a GenBank assembly?
list< CConstRef< CGC_Sequence > > TSequenceList
Definition: GC_Assembly.hpp:67
void GetMolecules(TSequenceList &molecules, ESubset subset) const
Retrieve a subset of molecules.
static CRef< CGencollSvc > GetInstance(void)
Definition: gencoll_svc.cpp:54
Definition: md5.hpp:46
string GetAssemblyAcc() const
static void SetStr(objects::CProjectItem &pi, const string &tag, const string &value)
the item we represent
void AddTag(const string &tag)
Definition: ProjectItem.hpp:96
void SetObject(CSerialObject &object)
wrapper for setting the object pointed to by this item
CProjectService - a service providing API for operations with Workspaces and Projects.
CReportLoaderErrors.
wxString x_GetHTMLResults() const
void x_UpdateHTMLResults(const wxString &object, objects::ILineErrorListener *errCont, const string &exception="", const string &error_msg="", const wxString &objectName=wxT("File:"))
CProjectSelectOptions - describes how new Project Items shall be added to a workspace.
Template class for iteration on objects of class C (non-medifiable version)
Definition: iterator.hpp:767
const string & GetChrName() const
const vector< char > & GetSerializedData() const
static string s_GetCurrentVersion(bool format_only=false)
virtual void SetRegistryPath(const string &path)
void SetNewFile(const wxString &input_vcf)
void SetInfoFields(const set< CConstRef< SVcfFieldData >> &fields)
void GetSelectedInfoFields(set< string > &selected)
vector< wxString > m_VcfFiles
void SetVcfFiles(const vector< wxString > &files)
vector< CConstRef< CSeq_id > > TSeqIdsVector
set< string > & SetInfoFields()
map< unsigned, string > m_Samples
void SetReadAllChrms(bool value)
vector< string > x_FindSynonyms(const CSeq_id &seq_id, const CGC_Assembly::TSequenceList &chromosomes)
void GetHTMLResults(wxString &title, wxString &html)
void x_CreateSeqIdProjectItem(const CSeq_id &seq_id)
virtual void x_CreateProjectItems()
override this function in derived classes and populate m_Items.
void SetReadAllInfoFields(bool value)
TSeqIdsVector & SetChromosomes()
void x_OnVCFVariantListReady(CVCFVariantList &vars)
CRef< CGC_Assembly > m_GenCollAssm
void x_CreateColumnarVCFProjectItem(const CSeq_id &seq_id, CVCFVariantList &vars)
map< unsigned, string > & SetSamples()
unique_ptr< IIdMapper > m_IdMapper
void SetReadAllSamples(bool value)
void SetGenCollAssembly(const CRef< CGC_Assembly > &assm)
TSeqIdsVector & SetSeqIdsToLoad()
void SetTopLevelSeqCount(size_t count)
void GetSelectedReferenceSeqIds(vector< CConstRef< objects::CSeq_id > > &selSeqIds) const
void SetReferenceSeqIds(const vector< CConstRef< objects::CSeq_id > > &refSeqIds)
void SetGenCollAssembly(const CRef< objects::CGC_Assembly > &gc_assm)
void SetSamples(const map< unsigned, string > &samples)
void GetSelectedSamples(map< unsigned, string > &selected)
IAppTask.
Definition: app_task.hpp:83
Interface for testing cancellation request in a long lasting operation.
Definition: icanceled.hpp:51
IServiceLocator - an abstract mechanism for locating services.
Definition: service.hpp:71
IUIObject - object that provides basic properties often required in a UI object.
Definition: ui_object.hpp:63
bool empty() const
Definition: map.hpp:149
void clear()
Definition: map.hpp:169
USING_SCOPE(objects)
static const char * kProjectParamsTag
#define md5
Definition: compat-1.3.h:2010
char data[12]
Definition: iconv.c:80
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#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 Warning(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1191
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
Definition: ncbiexpt.cpp:342
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
Definition: service.hpp:91
static IIdMapper * GetIdMapper(CRef< objects::CGC_Assembly > assm)
Definition: utils.cpp:2826
static CRef< objects::CSeq_id > MapStringId(const string &str, objects::IIdMapper *mapper)
Definition: utils.cpp:2394
virtual wxPanel * GetCurrentPanel()
Return the panel corresponding to the current state of Tool Manager.
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual bool ValidateFilenames(const vector< wxString > &filenames)
checks given filenames and returns true if the manager can handle them, otherwise - shows an error me...
virtual void InitUI()
Initializes the Manager before using it in UI.
virtual void SetFilenames(const vector< wxString > &filenames)
initilize the manager with the given filenames
virtual bool DoTransition(EAction action)
Performs transition if possible and returns true, otherwise the function shall warn the user about th...
virtual bool IsInitialState()
return true if the current state of the loader UI is the first valid state (first step in a wizard-li...
virtual void SetServiceLocator(IServiceLocator *srv_locator)
Sets / unsets Service Locator.
virtual void CleanUI()
CleanUI() is called after the host finished using the manager.
virtual bool IsFinalState()
True if Tool Manager has reached its final state, i.e.
CVcfAssemblySelectionPanel * m_AssemblyPanel
virtual bool IsCompletedState()
Manager goes into "Complete" state when "Finish" button is pressed and all input data is gatherred an...
virtual void SetParentWindow(wxWindow *parent)
virtual bool RecognizeFormat(const wxString &filename)
return true if the given file format is supported by this manager
virtual void GetFilenames(vector< wxString > &filenames) const
get actual filenames that will be opened
virtual IAppTask * GetTask()
Once parameters are gathered and validated this function is called to produce the final Task object t...
vector< CConstRef< objects::CSeq_id > > m_RefSeqIds
CRef< objects::CGC_Assembly > m_GenCollAssm
CVcfSampleSelectionPanel * m_SamplesPanel
map< string, set< string > > m_MappedSeqIds
CVcfRefSequencesPanel * m_RefSequencesPanel
virtual bool CanDo(EAction action)
Indicates whether given transition is possible in the current state.
virtual IExecuteUnit * GetExecuteUnit()
CVcfColumnSelectionPanel * m_ColumnsPanel
virtual wxString GetFormatWildcard() const
return file wildcard for the format (example - "*.txt;*.tab" )
CColumnarVCFLoaderManager()
CColumnarVCFLoaderManager.
virtual const IUIObject & GetDescriptor() const
Returns the object describing this tool (UI meta data).
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
virtual void SetRegistryPath(const string &path)
ICanceled * x_GetICanceled()
string m_Descr
mutex to sync our internals
static void SetLabelByData(objects::CProjectItem &item, objects::CScope *scope=NULL)
Definition: label.cpp:121
virtual void x_SetStatusText(const string &text)
virtual void SetLogEvent(const string &log_event)
Definition: ui_object.cpp:118
virtual const string & GetLabel() const
Definition: ui_object.cpp:124
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
@ eContent
Untagged human-readable accession or the like.
Definition: Seq_id.hpp:605
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#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 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
@ fWithCommas
Use commas as thousands separator.
Definition: ncbistr.hpp:254
static const char label[]
TDescr & SetDescr(void)
Assign a value to Descr data member.
void SetLabel(const TLabel &value)
Assign a value to Label data member.
TData & SetData(void)
Assign a value to Data data member.
TOther & SetOther(void)
Select the variant.
void SetType(const TType &value)
Assign a value to Type data member.
void SetItem(TItem &value)
Assign a value to Item data member.
E_Choice
Choice variants.
list< CRef< CGC_TypedSeqId > > TSeq_id_synonyms
TSrc & SetSrc(void)
Select the variant.
Definition: Annotdesc_.cpp:256
FILE * file
Lightweight interface for getting lines of data with minimal memory copying.
CMD5 - class for computing Message Digest version 5 checksums.
#define wxT(x)
Definition: muParser.cpp:41
constexpr auto sort(_Init &&init)
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
#define nullptr
Definition: ncbimisc.hpp:45
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Definition: njn_matrix.hpp:613
static int filenames
Definition: pcregrep.c:172
#define _ASSERT
Modified on Tue Apr 16 20:15:13 2024 by modify_doxy.py rev. 669887