NCBI C++ ToolKit
uncul_tax_tool.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 
2 /* $Id: uncul_tax_tool.hpp 42425 2019-02-21 15:31:49Z asztalos $
3  * ===========================================================================
4  *
5  * PUBLIC DOMAIN NOTICE
6  * National Center for Biotechnology Information
7  *
8  * This software/database is a "United States Government Work" under the
9  * terms of the United States Copyright Act. It was written as part of
10  * the author's official duties as a United States Government employee and
11  * thus cannot be copyrighted. This software/database is freely available
12  * to the public for use. The National Library of Medicine and the U.S.
13  * Government have not placed any restriction on its use or reproduction.
14  *
15  * Although all reasonable efforts have been taken to ensure the accuracy
16  * and reliability of the software and data, the NLM and the U.S.
17  * Government do not and cannot warrant the performance or results that
18  * may be obtained by using this software or data. The NLM and the U.S.
19  * Government disclaim all warranties, express or implied, including
20  * warranties of performance, merchantability or fitness for any particular
21  * purpose.
22  *
23  * Please cite the author in any work or product based on this material.
24  *
25  * ===========================================================================
26  *
27  * Authors: Igor Filippov
28  */
29 
30 #ifndef _UNCUL_TAX_TOOL_H_
31 #define _UNCUL_TAX_TOOL_H_
32 
33 #include <corelib/ncbistd.hpp>
34 
38 
40 
41 #include <wx/frame.h>
42 #include <wx/listctrl.h>
43 #include <wx/msgdlg.h>
44 
46 /*!
47  * Control identifiers
48  */
49 
50 ////@begin control identifiers
51 #define ID_UNCUL_TAX_TOOL 11300
52 #define SYMBOL_UNCUL_TAX_TOOL_STYLE wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL
53 #define SYMBOL_UNCUL_TAX_TOOL_TITLE _("Uncultured Taxonomy Tool")
54 #define SYMBOL_UNCUL_TAX_TOOL_IDNAME ID_UNCUL_TAX_TOOL
55 #define SYMBOL_UNCUL_TAX_TOOL_SIZE wxSize(1400, 840)
56 #define SYMBOL_UNCUL_TAX_TOOL_POSITION wxDefaultPosition
57 ////@end control identifiers
58 #define ID_ADD_SP_UNCUL_TAXTOOL 11301
59 #define ID_ADD_BACTERIUM_UNCUL_TAXTOOL 11302
60 #define ID_APPLY_BTN 11303
61 #define ID_CANCEL_BTN 11304
62 #define ID_REFRESH_BTN 11305
63 #define ID_TRIM_BTN 11306
64 
65 class CUnculTaxTool : public wxFrame
66 {
67  DECLARE_DYNAMIC_CLASS( CUnculTaxTool )
68  DECLARE_EVENT_TABLE()
69 
70 public:
71  /// Constructors
72  CUnculTaxTool();
73  CUnculTaxTool( wxWindow* parent, objects::CSeq_entry_Handle seh, IWorkbench* workbench, wxWindowID id = SYMBOL_UNCUL_TAX_TOOL_IDNAME, const wxString& caption = SYMBOL_UNCUL_TAX_TOOL_TITLE, const wxPoint& pos = SYMBOL_UNCUL_TAX_TOOL_POSITION, const wxSize& size = SYMBOL_UNCUL_TAX_TOOL_SIZE, long style = SYMBOL_UNCUL_TAX_TOOL_STYLE );
74 
75  /// Creation
76  bool Create( wxWindow* parent, wxWindowID id = SYMBOL_UNCUL_TAX_TOOL_IDNAME, const wxString& caption = SYMBOL_UNCUL_TAX_TOOL_TITLE, const wxPoint& pos = SYMBOL_UNCUL_TAX_TOOL_POSITION, const wxSize& size = SYMBOL_UNCUL_TAX_TOOL_SIZE, long style = SYMBOL_UNCUL_TAX_TOOL_STYLE );
77 
78  /// Destructor
80 
81  /// Initialises member variables
82  void Init();
83 
84  /// Creates the controls and sizers
85  void CreateControls();
86 
87  /// Retrieves bitmap resources
88  wxBitmap GetBitmapResource( const wxString& name );
89 
90  /// Retrieves icon resources
91  wxIcon GetIconResource( const wxString& name );
92 
93  /// Should we show tooltips?
94  static bool ShowToolTips();
95 
97 
101  int GetCollapsible() {return 0;}
102  bool IsReadOnlyColumn(string column_name) { if (column_name == "Taxname" || column_name.empty() || column_name == "expand") return true; return false; };
103 
104  void OnAddSp( wxCommandEvent& event );
105  void OnAddBacterium( wxCommandEvent& event );
106  void OnCancel( wxCommandEvent& event );
107  void OnApply( wxCommandEvent& event );
108  void OnRefreshBtn( wxCommandEvent& event );
109  void TrimSuggestions(wxCommandEvent& event );
110 private:
111 
112  void AddBioSource(const objects::CSeq_entry& seq, const objects::CSeqdesc& desc);
113  void GetDesc(const CSeq_entry& se);
114  void FindBioSource(objects::CSeq_entry_Handle tse);
115 
116  bool OkToTaxFix(const string& taxname);
117  void LookupSuggestions(vector<string> &suggestions, vector<bool> &verified);
118  string StandardFixes(const CBioSource &biosource);
119  bool IsSpeciesSpecific(const CBioSource &biosource);
120  string MakeUnculturedName(const string &taxname, const string suffix = "");
121  bool CompareOrgnameLineage(CRef<CT3Reply> reply, const string &lineage);
122  string GetSuggestion(CRef<CT3Reply> reply);
123  string GetRank(CRef<CT3Reply> reply);
124  CRef<CT3Reply> GetReply(const CBioSource &biosource, const string &standard_taxname);
125  bool CheckSuggestedFix(const CBioSource &biosource, string &suggestion);
126  bool IsAmbiguous(CRef<CT3Reply> reply);
127  string TryRankFix(CRef<CT3Reply> reply, unsigned int i, string &name);
128  int GetColumn();
129  void ConvertSpeciesSpecificNote(CBioSource &biosource, const string &new_note);
130  void PreloadCache();
131 
132  objects::CSeq_entry_Handle m_TopSeqEntry;
133 
134  vector<pair<CConstRef<objects::CSeq_entry>, CConstRef<objects::CSeqdesc>>> m_BioSource;
135 
137  wxGrid* m_Grid;
141 
142 
147  };
148 
149  typedef vector<SUnindexedObject> TUnindexedObjects;
151 };
152 
153 
155 
156 #endif
157  // _UNCUL_TAX_TOOL_H_
User-defined methods of the data storage class.
Definition: Seq_entry.hpp:56
void ConvertSpeciesSpecificNote(CBioSource &biosource, const string &new_note)
CRef< CCmdComposite > GetCommandFromValuesTable(CRef< CSeq_table > values_table)
void OnAddSp(wxCommandEvent &event)
vector< pair< CConstRef< objects::CSeq_entry >, CConstRef< objects::CSeqdesc > > > m_BioSource
string MakeUnculturedName(const string &taxname, const string suffix="")
void OnApply(wxCommandEvent &event)
IWorkbench * m_Workbench
void OnCancel(wxCommandEvent &event)
TUnindexedObjects m_UnindexedObjects
CRef< objects::CSeq_table > GetValuesTableFromSeqEntry()
bool CompareOrgnameLineage(CRef< CT3Reply > reply, const string &lineage)
bool CheckSuggestedFix(const CBioSource &biosource, string &suggestion)
void Init()
Initialises member variables.
void OnAddBacterium(wxCommandEvent &event)
CRef< CT3Reply > GetReply(const CBioSource &biosource, const string &standard_taxname)
bool IsReadOnlyColumn(string column_name)
bool OkToTaxFix(const string &taxname)
void GetDesc(const CSeq_entry &se)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
CUnculTaxTool(wxWindow *parent, objects::CSeq_entry_Handle seh, IWorkbench *workbench, wxWindowID id=11300, const wxString &caption=_("Uncultured Taxonomy Tool"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(1400, 840), long style=wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
bool IsAmbiguous(CRef< CT3Reply > reply)
set< unsigned int > m_RemoveNote
set< unsigned int > m_ConvertNote
void CreateControls()
Creates the controls and sizers.
string GetRank(CRef< CT3Reply > reply)
void FindBioSource(objects::CSeq_entry_Handle tse)
CUnculTaxTool()
Constructors.
CRef< CCmdComposite > GetCommand()
string StandardFixes(const CBioSource &biosource)
bool Create(wxWindow *parent, wxWindowID id=11300, const wxString &caption=_("Uncultured Taxonomy Tool"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(1400, 840), long style=wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void AddBioSource(const objects::CSeq_entry &seq, const objects::CSeqdesc &desc)
CRef< objects::CSeq_table > GetChoices(CRef< objects::CSeq_table > values_table)
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void TrimSuggestions(wxCommandEvent &event)
vector< SUnindexedObject > TUnindexedObjects
bool IsSpeciesSpecific(const CBioSource &biosource)
static bool ShowToolTips()
Should we show tooltips?
void LookupSuggestions(vector< string > &suggestions, vector< bool > &verified)
string TryRankFix(CRef< CT3Reply > reply, unsigned int i, string &name)
objects::CSeq_entry_Handle m_TopSeqEntry
~CUnculTaxTool()
Destructor.
map< string, CRef< CT3Reply > > m_ReplyCache
string GetSuggestion(CRef< CT3Reply > reply)
void OnRefreshBtn(wxCommandEvent &event)
CSeqTableGridPanel * m_GridPanel
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
Definition: map.hpp:338
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
int i
const struct ncbi::grid::netcache::search::fields::SIZE size
static const char * suffix[]
Definition: pcregrep.c:408
CConstRef< objects::CBioSource > orig_obj
CConstRef< objects::CBioSource > new_obj
CRef< objects::CBioSource > actual_obj
#define SYMBOL_UNCUL_TAX_TOOL_POSITION
#define SYMBOL_UNCUL_TAX_TOOL_STYLE
#define SYMBOL_UNCUL_TAX_TOOL_IDNAME
#define SYMBOL_UNCUL_TAX_TOOL_SIZE
#define SYMBOL_UNCUL_TAX_TOOL_TITLE
Modified on Fri Jul 12 16:26:06 2024 by modify_doxy.py rev. 669887