57 #include <wx/msgdlg.h>
58 #include <wx/filedlg.h>
59 #include <wx/filename.h>
90 wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style )
91 : m_TopSeqEntry(seh), m_CmdProcessor(cmdProcessor), m_all_records(all_records)
107 size_t num_processed;
108 vector<string> unprocessed_ids;
110 bool use_dev_server(
false);
111 bool compare_structured_comments(
false);
117 for (
auto diff : diff_vec)
119 string seq_id = diff->GetSequenceId();
120 string field = diff->GetFieldName();
121 string source = diff->GetSrcVal();
122 string sample = diff->GetPureSampleVal();
123 string sample_id = diff->GetBioSample();
126 tie(set_source, set_sample) =
m_DiffVec[{sample_id, field}][seq_id];
130 set_sample.
insert(sample);
131 m_DiffVec[{sample_id, field}][seq_id] = make_pair(set_source, set_sample);
136 vector<CRef <CSeq_id> > id_list;
145 id_list.push_back(ic);
153 id->GetLabel(&
label);
164 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
165 wxFrame::Create( parent,
id, caption, pos,
size, style );
166 wxVisualAttributes attr = wxPanel::GetClassDefaultAttributes();
167 if (attr.colBg != wxNullColour) {
168 SetOwnBackgroundColour(attr.colBg);
173 GetSizer()->SetSizeHints(
this);
209 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
210 itemDialog1->SetSizer(itemBoxSizer2);
213 itemBoxSizer2->Add(
m_GridPanelSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
217 wxMessageBox(
wxT(
"No differences found for resolved Biosample IDs"),
wxT(
"Info"), wxOK);
224 wxMessageBox(
wxT(
"No differences found for resolved Biosample IDs"),
wxT(
"Info"), wxOK);
229 wxArrayString itemChoiceStrings, itemChoiceStringsWritable;
235 if ((*it)->IsSetHeader() && (*it)->GetHeader().IsSetTitle() )
237 string title = (*it)->GetHeader().GetTitle();
240 itemChoiceStrings.Add(wxString(title));
242 itemChoiceStringsWritable.Add(wxString(title));
249 wxBoxSizer* itemBoxSizer16 =
new wxBoxSizer(wxHORIZONTAL);
250 itemBoxSizer2->Add(itemBoxSizer16, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
252 wxButton* itemButton24 =
new wxButton( itemDialog1,
ID_ADD_TO_SOURCE,
_(
"+<<"), wxDefaultPosition, wxDefaultSize, 0 );
253 itemBoxSizer16->Add(itemButton24, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
255 itemButton24->SetToolTip(
_(
"Append to BioSource values"));
257 wxButton* itemButton17 =
new wxButton( itemDialog1,
ID_COPY_TO_SOURCE,
_(
"<<"), wxDefaultPosition, wxDefaultSize, 0 );
258 itemBoxSizer16->Add(itemButton17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
260 itemButton17->SetToolTip(
_(
"Overwrite BioSource values"));
262 wxButton* itemButton18 =
new wxButton( itemDialog1,
ID_SYNC,
_(
"sync"), wxDefaultPosition, wxDefaultSize, 0 );
263 itemBoxSizer16->Add(itemButton18, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
265 itemButton18->SetToolTip(
_(
"Fill the blanks in either BioSample or BioSource values"));
267 wxButton* itemButton19 =
new wxButton( itemDialog1,
ID_COPY_TO_SAMPLE,
_(
">>"), wxDefaultPosition, wxDefaultSize, 0 );
268 itemBoxSizer16->Add(itemButton19, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
270 itemButton19->SetToolTip(
_(
"Overwrite BioSample values"));
272 wxButton* itemButton25 =
new wxButton( itemDialog1,
ID_ADD_TO_SAMPLE,
_(
">>+"), wxDefaultPosition, wxDefaultSize, 0 );
273 itemBoxSizer16->Add(itemButton25, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
275 itemButton25->SetToolTip(
_(
"Append to BioSample values"));
277 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxHORIZONTAL);
278 itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
283 wxBoxSizer* itemBoxSizer5 =
new wxBoxSizer(wxHORIZONTAL);
284 itemBoxSizer2->Add(itemBoxSizer5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
289 wxBoxSizer* itemBoxSizer13 =
new wxBoxSizer(wxHORIZONTAL);
290 itemBoxSizer2->Add(itemBoxSizer13, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
292 wxButton* itemButton14 =
new wxButton( itemDialog1,
ID_UPDATE_BIOSOURCE,
_(
"Update BioSource"), wxDefaultPosition, wxDefaultSize, 0 );
293 itemBoxSizer13->Add(itemButton14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
295 wxButton* itemButton20 =
new wxButton( itemDialog1,
ID_CREATE_BIOSAMPLE,
_(
"Create Biosample Update"), wxDefaultPosition, wxDefaultSize, 0 );
296 itemBoxSizer13->Add(itemButton20, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
298 wxButton* itemButton21 =
new wxButton( itemDialog1,
ID_MAKE_REPORT,
_(
"Make Report"), wxDefaultPosition, wxDefaultSize, 0 );
299 itemBoxSizer13->Add(itemButton21, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
302 itemBoxSizer13->Add(
m_RefreshButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
305 wxButton* itemButton23 =
new wxButton(itemDialog1,
ID_APIKEY_BIOSAMPLE,
_(
"Get BioSample API Key"), wxDefaultPosition, wxDefaultSize, 0);
306 itemBoxSizer13->Add(itemButton23, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
308 wxButton* itemButton15 =
new wxButton( itemDialog1, wxID_CANCEL,
_(
"Close"), wxDefaultPosition, wxDefaultSize, 0 );
309 itemBoxSizer13->Add(itemButton15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
322 m_Grid->SetTable(gridAdapter,
true);
323 m_Grid->AutoSizeColumns();
324 int l_height =
m_Grid->GetColLabelSize();
325 m_Grid->SetColLabelSize( 2 * l_height );
332 if ((*it)->IsSetHeader() && (*it)->GetHeader().IsSetTitle() )
334 string title = (*it)->GetHeader().GetTitle();
342 if (glyph_col >= 0 && glyph_col+1 <
m_Grid->GetNumberCols())
358 expand_col->
SetHeader().SetField_name(
"expand");
359 expand_col->
SetData().SetString();
363 name_col->
SetHeader().SetField_name(
"field");
364 name_col->
SetData().SetString();
367 source_col->
SetHeader().SetTitle(
"Source");
368 source_col->
SetHeader().SetField_name(
"source");
369 source_col->
SetData().SetString();
372 sample_col->
SetHeader().SetTitle(
"Sample");
373 sample_col->
SetHeader().SetField_name(
"Sample");
374 sample_col->
SetData().SetString();
377 sample_id_col->
SetHeader().SetTitle(
"Biosample Id");
378 sample_id_col->
SetHeader().SetField_name(
"biosample_id");
379 sample_id_col->
SetData().SetString();
383 table->SetColumns().push_back(expand_col);
384 table->SetColumns().push_back(name_col);
385 table->SetColumns().push_back(source_col);
386 table->SetColumns().push_back(sample_col);
387 table->SetColumns().push_back(sample_id_col);
396 string field, sample_id;
397 tie(sample_id, field) = diff.first;
398 for (
const auto &row : diff.second)
400 string seq_id = row.first;
402 tie(set_source, set_sample) = row.second;
411 id->Assign(*
m_ids[seq_id]);
418 m_id_col->SetData().SetId().push_back(
id);
419 expand_col->
SetData().SetString().push_back(
"");
420 name_col->
SetData().SetString().push_back(field);
422 sample_col->
SetData().SetString().push_back(sample);
423 sample_id_col->
SetData().SetString().push_back(sample_id);
441 auto num_rows =
m_Grid->GetNumberRows();
442 for (
auto row = 0; row < num_rows; ++row)
447 values[bsh][field] =
value;
459 new_desc->
Assign(*src_desc_ci);
464 string field =
fi->first;
475 biosource.
SetOrg().ResetTaxname();
479 biosource.
SetOrg().SetOrgname().ResetName();
486 biosource.
SetOrg().SetTaxId(taxid);
498 for (
const auto &v : vals)
505 mod->SetSubtype(subtype);
507 biosource.
SetOrg().SetOrgname().SetMod().push_back(
mod);
515 catch (
const exception&)
525 for (
const auto &v : vals)
543 catch (
const exception&)
550 wxMessageBox(
wxT(
"Unknown field name ") + wxString(field),
wxT(
"Error"), wxOK);
569 return "Invalid operation in Compare with Biosample";
613 wxMessageDialog dlg(
this,
_(
"Discard modifications?"),
_(
"Attention"),wxOK|wxCANCEL|wxCENTRE);
614 if (dlg.ShowModal() == wxID_OK)
626 if (!
m_Grid->IsSelection())
630 wxArrayInt wx_selected =
m_Grid->GetSelectedRows();
631 if (wx_selected.IsEmpty())
633 if (
m_Grid->GetSelectionBlockTopLeft().size() == 1 &&
m_Grid->GetSelectionBlockTopLeft().size() ==
m_Grid->GetSelectionBlockBottomRight().size())
635 int top_row =
m_Grid->GetSelectionBlockTopLeft()[0].GetRow();
636 int bot_row =
m_Grid->GetSelectionBlockBottomRight()[0].GetRow();
637 for (
int i = top_row;
i <= bot_row;
i++)
645 for (
unsigned int i = 0;
i < wx_selected.GetCount();
i++)
647 selected.insert(wx_selected.Item(
i));
658 std::set<int> selected;
660 if (selected.empty())
662 wxMessageBox(
wxT(
"Nothing selected"),
wxT(
"Info"), wxOK);
669 for (std::set<int>::const_iterator
i = selected.begin();
i != selected.end(); ++
i)
675 if (sample_value.IsEmpty() && !source_value.IsEmpty())
682 if (!sample_value.IsEmpty() && source_value.IsEmpty())
700 std::set<int> selected;
702 if (selected.empty())
704 wxMessageBox(
wxT(
"Nothing selected"),
wxT(
"Info"), wxOK);
711 for (std::set<int>::const_iterator
i = selected.begin();
i != selected.end(); ++
i)
717 if (!sample_value.IsEmpty() && source_value != sample_value)
735 std::set<int> selected;
737 if (selected.empty())
739 wxMessageBox(
wxT(
"Nothing selected"),
wxT(
"Info"), wxOK);
746 for (std::set<int>::const_iterator
i = selected.begin();
i != selected.end(); ++
i)
752 if (sample_value != source_value && !source_value.IsEmpty())
771 std::set<int> selected;
773 if (selected.empty())
775 wxMessageBox(
wxT(
"Nothing selected"),
wxT(
"Info"), wxOK);
782 for (std::set<int>::const_iterator
i = selected.begin();
i != selected.end(); ++
i)
789 if (!sample_value.IsEmpty() && source_value != sample_value && field !=
_(
"Organism Name") && field !=
_(
"Tax ID"))
791 list<string> old_vals;
793 list<string> new_vals;
795 set<string> vals(old_vals.begin(), old_vals.end());
796 vals.
insert(new_vals.begin(), new_vals.end());
798 if (new_val != source_value)
817 std::set<int> selected;
819 if (selected.empty())
821 wxMessageBox(
wxT(
"Nothing selected"),
wxT(
"Info"), wxOK);
828 for (std::set<int>::const_iterator
i = selected.begin();
i != selected.end(); ++
i)
835 if (sample_value != source_value && !source_value.IsEmpty() && field !=
_(
"Organism Name") && field !=
_(
"Tax ID"))
837 list<string> old_vals;
839 list<string> new_vals;
841 set<string> vals(old_vals.begin(), old_vals.end());
842 vals.
insert(new_vals.begin(), new_vals.end());
844 if (new_val != sample_value)
862 msg <<
"Seq-id\tField\tSource\tSample\tBiosample Id\n";
865 string field, sample_id;
866 tie(sample_id, field) = diff.first;
867 for (
const auto &row : diff.second)
869 string seq_id = row.first;
871 tie(set_source, set_sample) = row.second;
876 msg << seq_id <<
"\t"<<field<<
"\t"<<
source<<
"\t"<<sample<<
"\t"<<sample_id<<
"\n";
881 report->SetTitle(
wxT(
"Compare with Biosample Report"));
887 static const char*
kRegPath =
"Dialogs.Edit.CompareWithBiosample";
919 wxMessageBox(
wxT(
"Current BioSample API key is empty. Please specify a new one."),
wxT(
"Error"), wxOK);
930 auto num_rows =
m_Grid->GetNumberRows();
931 for (
auto row = 0; row < num_rows; ++row)
933 string seq_id_str =
m_id_col->GetData().GetId()[row]->GetSeqIdString();
937 list<string> sample_list;
940 new_values[pair<string, string>(sample_id, field)] = sample_list;
947 unordered_map<string, map<string, vector<string> > > delete_value, add_value;
949 unordered_map<string, string> change_organism;
952 string field, sample_id;
953 tie(sample_id, field) = diff.first;
954 list<string> new_sample;
955 if (new_values.
find(diff.first) != new_values.
end())
956 new_sample = new_values[diff.first];
959 tie(set_source, old_sample) = diff.second.
begin()->second;
964 vector<string> deleted_values;
965 set_difference(old_sample.
begin(), old_sample.
end(), new_sample.begin(), new_sample.end(), inserter(deleted_values, deleted_values.end()));
967 vector<string> added_values;
968 set_difference(new_sample.begin(), new_sample.end(), old_sample.
begin(), old_sample.
end(), inserter(added_values, added_values.end()));
970 if (field ==
"Organism Name")
972 if (added_values.size() == 1 && deleted_values.size() == 1)
974 change_organism[sample_id] = added_values.front();
979 if (!deleted_values.empty())
981 delete_value[sample_id][field] = deleted_values;
985 if (!added_values.empty())
987 add_value[sample_id][field] = added_values;
991 for (
const auto &diff : new_values)
993 string field, sample_id;
994 tie(sample_id, field) = diff.first;
995 vector<string> new_sample(diff.second.begin(), diff.second.end());
1002 if (new_sample.empty())
1008 add_value[sample_id][field] = new_sample;
1013 string sUrl =
"https://api-int.ncbi.nlm.nih.gov/biosample/update/";
1014 string sContentType =
"application/json; charset=utf-8";
1016 auto sample_id_it = ids.
begin();
1017 while (sample_id_it != ids.
end())
1023 for (; sample_id_it != ids.
end() && count <
chunk_size; ++sample_id_it)
1025 auto sample_id = *sample_id_it;
1027 obj1.
insert(
"samples", sample_id);
1028 if (!delete_value[sample_id].
empty())
1031 for (
const auto &kv : delete_value[sample_id])
1033 const string &field = kv.first;
1034 for (
const auto &v : kv.second)
1037 obj2.
insert(
"name", field);
1038 obj2.
insert(
"old_value", v);
1043 if ( !change_organism[sample_id].
empty())
1047 chg_org.
insert(
"new_value", change_organism[sample_id]);
1050 if (!add_value[sample_id].
empty())
1053 for (
const auto &kv : add_value[sample_id])
1055 const string &field = kv.first;
1056 for (
const auto &v : kv.second)
1059 obj2.
insert(
"name", field);
1060 obj2.
insert(
"new_value", v);
1079 string err = ss.str();
1081 err =
"Unable to connect - server down?";
1082 wxMessageBox(wxString(err),
wxT(
"Error"), wxOK);
1088 bool has_error =
false;
1091 wxMessageBox(
wxT(
"Current BioSample API key was not recognized. Please specify a new one."),
wxT(
"Error"), wxOK);
1101 if (!msg.IsEmpty()) {
1103 report->SetTitle(
wxT(
"Biosample Update Report"));
1110 wxWindow *win = FindWindowByLabel(
wxT(
"Biosample Update Report"),
this);
1129 if (dlg.ShowModal() == wxID_OK) {
1161 wxMessageBox(
wxT(
"No differences found for resolved Biosample IDs"),
wxT(
"Info"), wxOK);
1168 wxMessageBox(
wxT(
"No differences found for resolved Biosample IDs"),
wxT(
"Info"), wxOK);
1187 wxWindow *win = FindWindowByLabel(
wxT(
"Biosample Update Report"),
this);
1219 auto error_it = obj.
find(
"has_error");
1221 auto msg_it = obj.
find(
"messages");
1222 if (msg_it != obj.
end() && msg_it->
value.
IsArray() && !msg_it->value.GetArray().empty()) {
1224 for (
const auto& resp_it : messages) {
1225 if (resp_it.IsObject()) {
1226 const auto& resp_obj = resp_it.
GetObject();
1227 auto level_it = resp_obj.
find(
"level");
1228 auto message_it = resp_obj.find(
"message");
1229 if ((level_it != resp_obj.end()) &&
1230 (message_it != resp_obj.end()) &&
1231 (level_it->value.GetValue().GetString() ==
"error") &&
1245 unordered_map<string, vector<string> > messages;
1249 if (obj2.
find(
"level") != obj2.
end() && obj2.
find(
"message") != obj2.
end())
1253 messages[level].push_back(msg);
1258 it = obj.
find(
"validation_report");
1264 string name(it2->name);
1268 if (obj2.
find(
"message") == obj2.
end())
1273 string validation_msg;
1274 if (obj2.
find(
"type") != obj2.
end())
1277 if (
type ==
"attribute_error" && obj2.
find(
"attribute_name") != obj2.
end())
1280 validation_msg +=
" " + attribute_name;
1281 if (obj2.
find(
"attribute_value") != obj2.
end())
1284 if (!attribute_value.empty())
1285 validation_msg +=
":" + attribute_value;
1291 bool is_warning =
false;
1292 if (obj2.
find(
"is_warning") != obj2.
end())
1294 if (obj2.
find(
"name") != obj2.
end())
1297 msg +=
" (" + short_name +
")";
1298 if (short_name ==
"taxonomy_error_warning" || short_name ==
"tax_consult_warning" || short_name ==
"taxonomy_service_failure_warning")
1300 wxMessageBox(wxString(msg),
wxT(
"Taxonomy Consult Warning"), wxOK);
1304 validation_warning[msg][name] = validation_msg;
1306 validation_error[msg][name] = validation_msg;
1309 for (
const auto &m : validation_error)
1311 messages[
"error"].push_back(m.first);
1312 for (
const auto &name : m.second)
1314 string str = name.first;
1315 if (!name.second.empty())
1316 str +=
" - " + name.second;
1317 messages[
"error"].push_back(
str);
1320 for (
const auto &m : validation_warning)
1322 messages[
"warning"].push_back(m.first);
1323 for (
const auto &name : m.second)
1325 string str = name.first;
1326 if (!name.second.empty())
1327 str +=
" - " + name.second;
1328 messages[
"warning"].push_back(
str);
1333 if (messages.empty())
1336 if (!messages[
"error"].
empty())
1338 report <<
"Error:\n";
1339 for (
const auto &m : messages[
"error"])
1340 report << m <<
"\n";
1343 if (!messages[
"warning"].
empty())
1345 report <<
"Warning:\n";
1346 for (
const auto &m : messages[
"warning"])
1347 report << m <<
"\n";
1350 if (!messages[
"info"].
empty())
1352 report <<
"Info:\n";
1353 for (
const auto &m : messages[
"info"])
1354 report << m <<
"\n";
1385 Create(parent,
id, caption, pos,
size, style);
1391 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
1392 wxDialog::Create(parent,
id, caption, pos,
size, style);
1397 GetSizer()->SetSizeHints(
this);
1413 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
1414 itemDialog1->SetSizer(itemBoxSizer2);
1416 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxHORIZONTAL);
1417 itemBoxSizer2->Add(itemBoxSizer4, 0, wxEXPAND | wxALL, 0);
1420 itemBoxSizer4->Add(
m_Filename, 1, wxALIGN_LEFT | wxALL, 5);
1422 wxButton* itemButton5 =
new wxBitmapButton(itemDialog1,
wxID_ANY, wxArtProvider::GetBitmap(
wxT(
"menu::open")), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW);
1423 itemButton5->SetToolTip(
wxT(
"Choose a file..."));
1424 itemBoxSizer4->Add(itemButton5, 0, wxALIGN_CENTER_VERTICAL | wxTOP |wxBOTTOM | wxRIGHT, 5);
1428 wxBoxSizer* itemBoxSizer6 =
new wxBoxSizer(wxHORIZONTAL);
1429 itemBoxSizer2->Add(itemBoxSizer6, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
1431 wxButton* itemButton7 =
new wxButton(itemDialog1, wxID_OK,
_(
"OK"), wxDefaultPosition, wxDefaultSize, 0);
1432 itemBoxSizer6->Add(itemButton7, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1434 wxButton* itemButton8 =
new wxButton(itemDialog1, wxID_CANCEL,
_(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0);
1435 itemBoxSizer6->Add(itemButton8, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
1440 wxFileDialog dlg(
this,
wxT(
"Select file"), wxEmptyString, wxEmptyString,
_(
"All files (*.*)|*.*"), wxFD_OPEN | wxFD_FILE_MUST_EXIST);
1442 if (dlg.ShowModal() == wxID_OK) {
1472 return wxNullBitmap;
vector< CRef< CBiosampleFieldDiff > > TBiosampleFieldDiffList
map< string, CRef< CSeq_descr > > TBioSamples
TBiosampleFieldDiffList GetBioseqDiffs(CBioseq_Handle bh, const string &biosample_accession, size_t &num_processed, vector< string > &unprocessed_ids, bool use_dev_server=false, bool compare_structured_comments=false, const string &expected_prefix="", TBioSamples *cache=NULL)
static bool IsStopWord(const string &value)
bool RemoveOrgMod(int subtype)
bool RemoveSubSource(int subtype)
void AddCommand(IEditCommand &command)
void SetButton(wxButton *button)
void OnAddToSample(wxCommandEvent &event)
void OnAddToSource(wxCommandEvent &event)
CRef< objects::CSeq_table > GetChoices(CRef< objects::CSeq_table > values_table)
CStringConstraintSelect * m_StringConstraintPanel
void OnSyncButtonClick(wxCommandEvent &event)
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Compare with Biosample"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxCLOSE_BOX|wxCAPTION|wxCLIP_CHILDREN)
Creation.
ICommandProccessor * m_CmdProcessor
void CreateBiosampleUpdateWebService(wxCommandEvent &event)
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
CRef< objects::CSeq_table > GetValuesTableFromSeqEntry()
CRef< objects::CSeqTable_column > m_id_col
void OnRefresh(wxCommandEvent &event)
void OnClickCancel(wxCommandEvent &event)
void x_AddTablePanel(CRef< objects::CSeq_table > values_table)
map< pair< string, string >, unordered_map< string, pair< set< string >, set< string > > > > m_DiffVec
~CCompareWithBiosample()
Destructor.
void Init()
Initialises member variables.
CSeqTableGridPanel * m_GridPanel
void OnCopyToSourceButtonClick(wxCommandEvent &event)
void OnNewAPIKey(wxCommandEvent &event)
wxButton * m_RefreshButton
map< string, CConstRef< CSeq_id > > m_ids
wxBoxSizer * m_GridPanelSizer
wxString x_ReportBiosampleUpdate(const string &str, bool &has_error)
CSeq_entry_Handle m_TopSeqEntry
bool IsReadOnlyColumn(string column_name)
void GetSelectedRows(std::set< int > &selected)
biosample_util::TBioSamples m_Cache
void CreateControls()
Creates the controls and sizers.
void OnCopyToSampleButtonClick(wxCommandEvent &event)
void x_ReadBioSampleApiKey()
CApplyEditconvertPanel * m_AecrPanel
CCompareWithBiosample()
Constructors.
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
void MakeReport(wxCommandEvent &event)
void SaveSettings() const
void OnClickOk(wxCommandEvent &event)
static bool ShowToolTips()
Should we show tooltips?
void OnOpenFile(wxCommandEvent &event)
string GetFilename() const
wxBitmap GetBitmapResource(const wxString &name)
Retrieves bitmap resources.
CFileLocDialog()
Constructors.
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
static bool ShowToolTips()
Should we show tooltips?
void CreateControls()
Creates the controls and sizers.
void Init()
Initialises member variables.
bool Create(wxWindow *parent, wxWindowID id=13000, const wxString &caption=_("Select File with BioSample API Key"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(400, 300), long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
void SetText(const wxString &text)
CRegistryWriteView GetWriteView(const string §ion)
get a read-write view at a particular level.
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
int GetInt(const string &key, int default_val=0) const
retrieve values by section and key.
CJson_Object push_back_object(void)
Add object type element to the end of the array.
Random-access iterator to access const JSON array element.
const_iterator begin(void) const
Return a random-access iterator to the first element in the array.
bool empty(void) const
Test if the array is empty.
const_iterator end(void) const
Return a random-access iterator that points just beyond the end of the array.
bool IsObject(void) const
CJson_ConstObject GetObject(void) const
Get JSON object contents of the node.
CJson_ConstArray GetArray(void) const
Get JSON array contents of the node.
std::string ToString(TJson_Write_Flags flags=fJson_Write_IndentWithSpace, unsigned int indent_char_count=4) const
Convert the contents of the node into string.
CJson_ConstValue GetValue(void) const
Get JSON value contents of the node.
Bidirectional iterator to access const JSON object element.
const CJson_ConstNode value
bool empty(void) const
Test if the object is empty.
const_iterator find(const CJson_Node::TKeyType &name) const
Return an iterator that points to the location of the element.
const_iterator begin(void) const
Return an iterator that points to the first element in the object.
const_iterator end(void) const
Return an iterator that points to the location after the last element.
bool GetBool(void) const
Get primitive value data.
TStringType GetString(void) const
bool ParseString(const TStringType &v)
Read JSON data from a UTF8 string.
bool ReadSucceeded(void) const
Test if the most recent read was successful.
CJson_Object SetObject(void)
Get JSON object contents of the node.
CJson_Array insert_array(const CJson_Node::TKeyType &name)
Insert array type element into the object.
void insert(const CJson_Node::TKeyType &name)
Insert null element into the object.
CJson_Object insert_object(const CJson_Node::TKeyType &name)
Insert object type element into the object.
@OrgMod.hpp User-defined methods of the data storage class.
static TSubtype GetSubtypeValue(const string &str, EVocabulary vocabulary=eVocabulary_raw)
class CRegistryReadView provides a nested hierarchical view at a particular key.
string GetString(const string &key, const string &default_val=kEmptyStr) const
void Set(const string &key, int val)
access a named key at this level, with no recursion
void MakeColumnReadOnly(int pos, bool val=true)
void CollapseByCol(int col)
int GetCollapseColAndExpand(void)
void InitColumnCollapse(int col)
static TSubtype GetSubtypeValue(const string &str, EVocabulary vocabulary=eVocabulary_raw)
Undo/Redo interface for editing operations.
virtual void Execute(IEditCommand *command, wxWindow *window=0)=0
const_iterator begin() const
const_iterator end() const
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator end() const
static const int chunk_size
static const char * kRegPath
static const char * kApiKeyPath
#define ID_COPY_TO_SAMPLE
#define ID_CREATE_BIOSAMPLE
#define ID_UPDATE_BIOSOURCE
#define ID_FILELOCTEXTCTRL
#define ID_REFRESH_BIOSAMPLE
#define ID_COPY_TO_SOURCE
#define ID_APIKEY_BIOSAMPLE
const char * kSequenceIdColLabel
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
CNcbiIstream & ContentStream(void) const
Get input stream.
int GetStatusCode(void) const
Get response status code.
void SetValue(CHeaderNameConverter name, CTempString value)
Remove all existing values with the name, set the new value.
CNcbiIstream & ErrorStream(void) const
Get input stream containing error message (e.g.
CHttpResponse g_HttpPost(const CUrl &url, CTempString data, const CHttpParam ¶m=CHttpParam())
Shortcut for POST request.
static int BestRank(const CRef< CSeq_id > &id)
@ fParse_Default
By default in ParseIDs and IsValid, allow raw parsable non-numeric accessions and plausible local acc...
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
vector< CSeq_id_Handle > TId
CScope & GetScope(void) const
Get scope this handle belongs to.
CSeq_entry_Handle GetSeq_entry_Handle(void) const
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
bool NcbiStreamCopy(CNcbiOstream &os, CNcbiIstream &is)
Copy the entire contents of stream "is" to stream "os".
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
@ fConvErr_NoThrow
Do not throw an exception on error.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
@ eNocase
Case insensitive compare.
C::value_type FindBestChoice(const C &container, F score_func)
Find the best choice (lowest score) for values in a container.
static const char label[]
void SetSubtype(TSubtype value)
Assign a value to Subtype data member.
const TOrg & GetOrg(void) const
Get the Org member data.
void SetOrg(TOrg &value)
Assign a value to Org data member.
void SetName(const TName &value)
Assign a value to Name data member.
TSubtype & SetSubtype(void)
Assign a value to Subtype data member.
bool IsSetOrgname(void) const
Check if a value has been assigned to Orgname data member.
bool IsSetName(void) const
Check if a value has been assigned to Name data member.
const TOrgname & GetOrgname(void) const
Get the Orgname member data.
const TColumns & GetColumns(void) const
Get the Columns member data.
void SetHeader(THeader &value)
Assign a value to Header data member.
vector< CRef< CSeqTable_column > > TColumns
void SetData(TData &value)
Assign a value to Data data member.
TNum_rows GetNum_rows(void) const
Get the Num_rows member data.
@ eField_id_location_id
location Seq-id
bool IsGenbank(void) const
Check if variant Genbank is selected.
TSource & SetSource(void)
Select the variant.
@ e_Source
source of materials, includes Org-ref
@ eMol_na
just a nucleic acid
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
void ReportUsage(const wxString &dialog_name)
Report opening & accepting events in the editing package.
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
const CharType(& source)[N]
static const char * str(char *buf, int n)
wxString GetAbsolutePath(const wxString &localpath)
string ToStdString(const wxString &s)