40 #include <wx/msgdlg.h>
46 IMPLEMENT_DYNAMIC_CLASS(
CBulkGene, wxDialog )
63 wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style )
78 wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style )
79 : m_FeatHandles(feat_handles)
87 bool CBulkGene::Create( wxWindow* parent, wxWindowID
id,
const wxString& caption,
const wxPoint& pos,
const wxSize&
size,
long style )
89 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
90 SetLayoutAdaptationMode(wxDIALOG_ADAPTATION_MODE_ENABLED);
91 wxDialog::Create( parent,
id, caption, pos,
size, style );
96 GetSizer()->SetSizeHints(
this);
122 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
123 itemDialog1->SetSizer(itemBoxSizer2);
125 wxBoxSizer* itemBoxSizer3 =
new wxBoxSizer(wxHORIZONTAL);
126 itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
128 wxArrayString itemChoiceStrings, itemChoiceStringsWritable;
132 wxMessageBox(
wxT(
"No Gene records found"),
wxT(
"Error"), wxOK | wxICON_ERROR);
137 if (values_table->GetNum_rows() < 1)
139 wxMessageBox(
wxT(
"No Gene records found"),
wxT(
"Error"), wxOK | wxICON_ERROR);
145 itemBoxSizer3->Add(
m_GridPanel, 0, wxALIGN_TOP|wxALL, 5);
148 m_Grid->SetTable(gridAdapter,
true);
149 m_Grid->AutoSizeColumns();
150 int l_height =
m_Grid->GetColLabelSize();
151 m_Grid->SetColLabelSize( 2 * l_height );
159 if ((*it)->IsSetHeader() && (*it)->GetHeader().IsSetTitle() )
161 string title = (*it)->GetHeader().GetTitle();
164 itemChoiceStrings.Add(wxString(title));
166 itemChoiceStringsWritable.Add(wxString(title));
175 if (glyph_col >= 0 && glyph_col+1 <
m_Grid->GetNumberCols())
183 itemBoxSizer2->Add(itemStringConstraintPanel, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|
wxFIXED_MINSIZE, 0);
188 wxBoxSizer* itemBoxSizer13 =
new wxBoxSizer(wxHORIZONTAL);
189 itemBoxSizer2->Add(itemBoxSizer13, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
191 wxButton* itemButton14 =
new wxButton( itemDialog1, wxID_OK,
_(
"Accept"), wxDefaultPosition, wxDefaultSize, 0 );
192 itemBoxSizer13->Add(itemButton14, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
194 wxButton* itemButton15 =
new wxButton( itemDialog1, wxID_CANCEL,
_(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
195 itemBoxSizer13->Add(itemButton15, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
202 id_col->SetHeader().SetField_id(objects::CSeqTable_column_info::eField_id_location_id);
206 expand_col->SetHeader().SetTitle(
"");
207 expand_col->SetHeader().SetField_name(
"expand");
208 expand_col->SetData().SetString();
211 locus_col->SetHeader().SetTitle(
"locus");
212 locus_col->SetHeader().SetField_name(
"locus");
213 locus_col->SetData().SetString();
216 locus_tag_col->SetHeader().SetTitle(
"locus_tag");
217 locus_tag_col->SetHeader().SetField_name(
"locus_tag");
218 locus_tag_col->SetData().SetString();
221 desc_col->SetHeader().SetTitle(
"description");
222 desc_col->SetHeader().SetField_name(
"description");
223 desc_col->SetData().SetString();
226 loc_col->SetHeader().SetTitle(
"location");
227 loc_col->SetHeader().SetField_name(
"location");
228 loc_col->SetData().SetString();
231 comment_col->SetHeader().SetTitle(
"comment");
232 comment_col->SetHeader().SetField_name(
"comment");
233 comment_col->SetData().SetString();
236 allele_col->SetHeader().SetTitle(
"allele");
237 allele_col->SetHeader().SetField_name(
"allele");
238 allele_col->SetData().SetString();
241 synonym_col->SetHeader().SetTitle(
"synonym");
242 synonym_col->SetHeader().SetField_name(
"synonym");
243 synonym_col->SetData().SetString();
247 bogus_col->SetHeader().SetTitle(
"");
248 bogus_col->SetHeader().SetField_name(
"");
249 bogus_col->SetData().SetString();
252 table->SetColumns().push_back(id_col);
253 table->SetColumns().push_back(expand_col);
254 table->SetColumns().push_back(locus_col);
255 table->SetColumns().push_back(locus_tag_col);
256 table->SetColumns().push_back(desc_col);
257 table->SetColumns().push_back(loc_col);
267 table->SetColumns().push_back(comment_col);
268 table->SetColumns().push_back(allele_col);
269 table->SetColumns().push_back(synonym_col);
270 table->SetColumns().push_back(bogus_col);
276 string locus,locus_tag,desc,loc,comment, allele, synonym;
278 const CSeq_feat &feat = *
fi->GetOriginalSeq_feat();
296 id_col->SetData().SetId().push_back(
id);
297 expand_col->SetData().SetString().push_back(
"");
298 locus_col->SetData().SetString().push_back(locus);
299 locus_tag_col->SetData().SetString().push_back(locus_tag);
300 desc_col->SetData().SetString().push_back(desc);
301 loc_col->SetData().SetString().push_back(loc);
304 comment_col->SetData().SetString().push_back(comment);
305 allele_col->SetData().SetString().push_back(allele);
306 synonym_col->SetData().SetString().push_back(synonym);
307 bogus_col->SetData().SetString().push_back(
"");
326 const CSeq_feat &feat = *
fi->GetOriginalSeq_feat();
329 string locus,locus_tag,desc,loc,comment, allele, synonym;
330 bool modified =
false;
350 if (row < values_table->GetColumn(
"locus").GetData().GetString().
size())
354 if (new_locus != locus)
356 if (new_locus.empty())
357 new_feat->
SetData().SetGene().ResetLocus();
359 new_feat->
SetData().SetGene().SetLocus(new_locus);
363 string new_locus_tag;
366 if (row < values_table->GetColumn(
"locus_tag").GetData().GetString().
size())
370 if (new_locus_tag != locus_tag)
372 if (new_locus_tag.empty())
373 new_feat->
SetData().SetGene().ResetLocus_tag();
375 new_feat->
SetData().SetGene().SetLocus_tag(new_locus_tag);
383 if (row < values_table->GetColumn(
"description").GetData().GetString().
size())
387 if (new_desc != desc)
389 if (new_desc.empty())
390 new_feat->
SetData().SetGene().ResetDesc();
392 new_feat->
SetData().SetGene().SetDesc() = new_desc;
399 if (row < values_table->GetColumn(
"comment").GetData().GetString().
size())
403 if (new_comment != comment)
405 if (new_comment.empty())
415 if (row < values_table->GetColumn(
"allele").GetData().GetString().
size())
418 if (new_allele != allele)
420 new_feat->
SetData().SetGene().ResetAllele();
421 if (!new_allele.empty())
422 new_feat->
SetData().SetGene().SetAllele(new_allele);
429 if (row < values_table->GetColumn(
"synonym").GetData().GetString().
size())
432 if (new_synonym != synonym)
434 new_feat->
SetData().SetGene().ResetSyn();
435 vector<string> new_values;
437 for (
const auto&
val : new_values)
439 new_feat->
SetData().SetGene().SetSyn().push_back(
val);
444 string partial_start_val = partial_start_feat_col->
GetFromFeat(feat);
445 string new_partial_start_val;
452 if (new_partial_start_val != partial_start_val)
454 if (new_partial_start_val.empty())
461 string partial_stop_val = partial_stop_feat_col->
GetFromFeat(feat);
462 string new_partial_stop_val;
465 if (row < values_table->GetColumn(
kPartialStop).GetData().GetString().
size())
469 if (new_partial_stop_val != partial_stop_val)
471 if (new_partial_stop_val.empty())
497 return "Invalid operation in Bulk Gene Edit";
557 wxMessageDialog dlg(
this,
_(
"Discard modifications?"),
_(
"Attention"),wxOK|wxCANCEL|wxCENTRE);
558 if (dlg.ShowModal() == wxID_OK)
USING_SCOPE(ncbi::objects)
void CreateControls()
Creates the controls and sizers.
void OnClickOk(wxCommandEvent &event)
CSeqTableGridPanel * m_GridPanel
wxBitmap GetBitmapResource(const wxString &name)
virtual const CObject * RowToScopedObjects(int row, TConstScopedObjects &objects, CBioseq_Handle &bsh)
static bool ShowToolTips()
Should we show tooltips?
bool Create(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &caption=_("Gene Editing"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxTAB_TRAVERSAL)
Creation.
CRef< objects::CSeq_table > GetChoices(CRef< objects::CSeq_table > values_table)
void Init()
Initialises member variables.
CApplyEditconvertPanel * m_AecrPanel
bool IsReadOnlyColumn(string column_name)
CRef< CCmdComposite > GetCommandFromValuesTable(CRef< objects::CSeq_table >)
CRef< CCmdComposite > GetCommand()
wxIcon GetIconResource(const wxString &name)
Retrieves icon resources.
CRef< objects::CSeq_table > GetValuesTableFromSeqEntry()
vector< CSeq_feat_Handle > m_FeatHandles
void OnClickCancel(wxCommandEvent &event)
static CRef< CFeatureSeqTableColumnBase > Create(const string &sTitle, objects::CSeqFeatData::ESubtype subtype=objects::CSeqFeatData::eSubtype_any)
virtual void ClearInFeature(objects::CSeq_feat &in_out_feat)
virtual string GetFromFeat(const objects::CSeq_feat &in_out_feat)
virtual bool AddToFeature(objects::CSeq_feat &in_out_feat, const string &newValue, objects::edit::EExistingText existing_text)
CConstRef< objects::CSeq_submit > m_SeqSubmit
Seq-loc and seq-align mapper exceptions.
void MakeColumnReadOnly(int pos, bool val=true)
void SetColumnSizesAndChoices()
void InitColumnCollapse(int col)
CRef< objects::CSeq_table > GetValuesTable()
namespace ncbi::objects::
const CSeqTable_column & GetColumn(CTempString column_name) const
IWorkbench is the central interface in the application framework.
const string kPartialStart
const string kPartialStop
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.
vector< SConstScopedObject > TConstScopedObjects
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
void GetLabel(string *label) const
Appends a label suitable for display (e.g., error messages) label must point to an existing string ob...
TBioseqCore GetBioseqCore(void) const
Get bioseq core structure.
CConstRef< CSeq_entry > GetCompleteSeq_entry(void) const
Complete and get const reference to the seq-entry.
CScope & GetScope(void) const
Get scope this handle belongs to.
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
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 string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
bool IsSetSyn(void) const
synonyms for locus Check if a value has been assigned to Syn data member.
const TSyn & GetSyn(void) const
Get the Syn member data.
const TDesc & GetDesc(void) const
Get the Desc member data.
bool IsSetLocus_tag(void) const
systematic gene name (e.g., MI0001, ORF0069) Check if a value has been assigned to Locus_tag data mem...
bool IsSetLocus(void) const
Official gene symbol Check if a value has been assigned to Locus data member.
bool IsSetDesc(void) const
descriptive name Check if a value has been assigned to Desc data member.
bool IsSetAllele(void) const
Official allele designation Check if a value has been assigned to Allele data member.
const TLocus_tag & GetLocus_tag(void) const
Get the Locus_tag member data.
const TLocus & GetLocus(void) const
Get the Locus member data.
const TAllele & GetAllele(void) const
Get the Allele member data.
void SetHeader(THeader &value)
Assign a value to Header data member.
vector< CRef< CSeqTable_column > > TColumns
const TString & GetString(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
bool IsSetComment(void) const
Check if a value has been assigned to Comment data member.
void SetComment(const TComment &value)
Assign a value to Comment data member.
const TLocation & GetLocation(void) const
Get the Location member data.
const TData & GetData(void) const
Get the Data member data.
void SetData(TData &value)
Assign a value to Data data member.
void ResetComment(void)
Reset Comment data member.
const TComment & GetComment(void) const
Get the Comment member data.
const TGene & GetGene(void) const
Get the variant data.
bool IsSetLocation(void) const
feature made from Check if a value has been assigned to Location data member.
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
const struct ncbi::grid::netcache::search::fields::SIZE size
CRef< CSeqTable_column > AddStringColumnToTable(CRef< CSeq_table > table, string label)
void AddValueToColumn(CRef< CSeqTable_column > column, string value, size_t row, edit::EExistingText existing_text=edit::eExistingText_replace_old)
#define row(bind, expected)
@ eExistingText_replace_old