76 SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
77 wxPanel::Create( parent,
id, pos,
size, style );
82 GetSizer()->SetSizeHints(
this);
118 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxVERTICAL);
119 itemPanel1->SetSizer(itemBoxSizer2);
121 wxStaticText* itemStaticText3 =
new wxStaticText( itemPanel1, wxID_STATIC,
_(
"Create Features or Locations from Table Columns"), wxDefaultPosition, wxDefaultSize, 0 );
122 itemStaticText3->SetFont(wxFont(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL,
false,
wxT(
"Tahoma")));
123 itemBoxSizer2->Add(itemStaticText3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
125 wxBoxSizer* itemBoxSizer4 =
new wxBoxSizer(wxVERTICAL);
126 itemBoxSizer2->Add(itemBoxSizer4, 0, wxALIGN_LEFT|wxALL, 5);
128 wxButton* itemButton5 =
new wxButton( itemPanel1,
ID_SAVEIMPORTPARMS,
_(
"Save Import Parameters..."), wxDefaultPosition, wxDefaultSize, 0 );
129 itemBoxSizer4->Add(itemButton5, 0, wxALIGN_LEFT|wxALL, 5);
131 wxStaticBox* itemStaticBoxSizer6Static =
new wxStaticBox(itemPanel1,
wxID_ANY,
_(
"Choose to create locations, features, or keep the table as is, then click \"Next\""));
132 wxStaticBoxSizer* itemStaticBoxSizer6 =
new wxStaticBoxSizer(itemStaticBoxSizer6Static, wxHORIZONTAL);
133 itemBoxSizer4->Add(itemStaticBoxSizer6, 1, wxGROW|wxALL, 5);
135 wxStaticBox* itemStaticBoxSizer7Static =
new wxStaticBox(itemStaticBoxSizer6->GetStaticBox(),
wxID_ANY,
_(
"Transformation Type"));
136 wxStaticBoxSizer* itemStaticBoxSizer7 =
new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL);
137 itemStaticBoxSizer6->Add(itemStaticBoxSizer7, 0, wxALIGN_TOP|wxALL, 5);
141 m_ConvertToFeatures->SetHelpText(
_(
"Add and update fields needed to view rows as region features."));
143 m_ConvertToFeatures->SetToolTip(
_(
"Add and update fields needed to view rows as region features."));
148 m_CreateLocations->SetHelpText(
_(
"Add location fields to the table derived from the original table data. Open the table in the Generic Table View."));
150 m_CreateLocations->SetToolTip(
_(
"Add location fields to the table derived from the original table data. Open the table in the Generic Table View."));
153 m_ConvertToSnips =
new wxRadioButton( itemStaticBoxSizer7->GetStaticBox(),
ID_CONVERTTOSNP,
_(
"Create SNP Variation Features"), wxDefaultPosition, wxDefaultSize, 0 );
155 m_ConvertToSnips->SetHelpText(
_(
"Add and update fields needed to view rows as snps (variations)."));
157 m_ConvertToSnips->SetToolTip(
_(
"Add and update fields needed to view rows as snps (variations)."));
164 m_XformInfo =
new wxStaticText( itemStaticBoxSizer6->GetStaticBox(), wxID_STATIC,
_(
" \"\n\n\n\n\n \"\n "), wxDefaultPosition, wxSize(360, -1), wxALIGN_LEFT|wxST_NO_AUTORESIZE );
165 itemStaticBoxSizer6->Add(
m_XformInfo, 1, wxGROW|wxALL, 10);
167 wxStaticBox* itemStaticBoxSizer13Static =
new wxStaticBox(itemPanel1,
wxID_ANY,
_(
"Table Data"));
168 wxStaticBoxSizer* itemStaticBoxSizer13 =
new wxStaticBoxSizer(itemStaticBoxSizer13Static, wxHORIZONTAL);
169 itemBoxSizer2->Add(itemStaticBoxSizer13, 1, wxGROW|wxLEFT, 5);
171 wxPanel* itemPanel14 =
new wxPanel( itemStaticBoxSizer13->GetStaticBox(),
ID_TABLEXFORMPANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
172 itemStaticBoxSizer13->Add(itemPanel14, 1, wxGROW|wxTOP, 5);
174 wxBoxSizer* itemBoxSizer15 =
new wxBoxSizer(wxHORIZONTAL);
175 itemPanel14->SetSizer(itemBoxSizer15);
185 bool res = wxPanel::Show(show);
190 this->GetParent()->Layout();
195 table_data.
Reset(CreateObjectInterface<ITableData>(so,
NULL));
218 vector<CTableAnnotDataSource::STableLocation> locations =
224 if (locations.size() == 0) {
225 ERR_POST(
Info <<
"Table Import - Unable to create locations: " <<
msg);
226 errMsg =
msg +
string(
" - Unable to create locations");
230 bool success =
false;
231 for (
size_t i = 0;
i < locations.size(); ++
i) {
237 if (!locations[
i].m_IsRsid)
250 ERR_POST(
Info <<
"Table Import - Added location using columns: ");
254 errMsg =
"Table Import - Error adding location to table";
255 ERR_POST(
Info <<
"Table Import - Error adding location to table using columns: ");
268 vector<CTableAnnotDataSource::STableLocation> locations =
276 if (locations.size() > 1) {
277 ERR_POST(
Info <<
"Table Import - Unable to create features: more than 1 location found");
278 errMsg =
"Unable to create features - table has more than 1 location per row";
282 else if (locations.size() == 0) {
284 errMsg =
msg +
string(
" - Unable to create features");
287 else if (create_snps &&
288 (locations[0].m_IsRsid ==
false || locations[0].m_GenotypeCol == -1)) {
289 ERR_POST(
Info <<
"Table Import - Unable to create SNiPs: table must have an RSID and Genotype column specified");
290 errMsg =
"Unable to create SNiPs: table must have an RSID and Genotype column specified";
295 bool success =
false;
301 if (!locations[0].m_IsRsid)
312 ERR_POST(
Info <<
"Table Import - Transformed into feature table using columns: ");
316 errMsg =
"Table Import - Error transforming into feature table";
317 ERR_POST(
Info <<
"Table Import - Error transforming into feature table using columns: ");
337 wxT(
"Adding locations..."))) {
343 wxMessageBox(errMsg);
352 wxT(
"Creating features..."))) {
358 wxMessageBox(errMsg);
367 wxT(
"Creating features..."))) {
373 wxMessageBox(errMsg);
447 vector<CTableAnnotDataSource::STableLocation> locations =
451 if (locations.size() == 0) {
452 wxMessageBox(
msg +
" - Unable to create locations");
461 vector<CTableAnnotDataSource::STableLocation> locations =
466 if (locations.size() > 1) {
467 wxMessageBox(
"Unable to create features - table has more than 1 location per row");
470 else if (locations.size() == 0) {
471 wxMessageBox(
msg +
" - Unable to create features");
480 vector<CTableAnnotDataSource::STableLocation> locations =
485 if (locations.size() > 1) {
486 wxMessageBox(
"Unable to create features - table has more than 1 location per row");
489 else if (locations.size() == 0) {
490 wxMessageBox(
msg +
" - Unable to create features");
492 else if (locations[0].m_IsRsid ==
false || locations[0].m_GenotypeCol == -1) {
493 wxMessageBox(
"Unable to create SNP features from table - table must have an RSID and Genotype column specified");
508 m_XformInfo->SetLabel(
"Save the table with no changes");
512 "Convert current table into a table of features \
513 that can be displayed in the Graphical Sequence View by enabling \
514 \"Other Features\" with sub-track \"region\".");
518 "Add location column(s) to the table based on existing \
519 ID and position fields. Double-click on locations in the Generic \
520 Table View to open them in their own default view. Generic Table View \
521 also broadcasts the locations which can be seen in Selection Inspector.");
525 "Convert current table into a table of SNP features \
526 that can be displayed in the Graphical Sequence View by enabling \
527 \"Other Features\" with sub-track \"region\".");
541 wxFileDialog dlg(
this,
wxT(
"Select a file"),
wxT(
""),
wxT(
""),
544 wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
546 if (dlg.ShowModal() != wxID_OK)
551 wxMessageBox(
"Error opening selected file: " + dlg.GetPath(),
"File Error");
555 string transformation_type =
"none";
557 transformation_type =
"seqlocs";
559 transformation_type =
"features";
564 user_object.
SetType().SetStr() =
"table load parameters";
565 user_object.
AddField(
"conversion-type", transformation_type);
std::invoke_result< _Fty, ICanceled & >::type GUI_AsyncExec(_Fty &&_Fnarg, const wxString &msg=wxT("Accessing network..."))
static wxString GetDialogFilter(EFileType fileType)
static CGuiRegistry & GetInstance()
access the application-wide singleton
CRegistryReadView GetReadView(const string §ion) const
get a read-only view at a particular level.
class CRegistryReadView provides a nested hierarchical view at a particular key.
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
bool AddSeqLoc(const STableLocation &fc, int loc_number, ICanceled *cancel=NULL)
Add a location to the table based on the specified columns.
CRef< CSeq_annot > GetContainer()
vector< STableLocation > FindLocations(string &msg, bool strand_required)
Find colums that can be combined to form locations based on column info If no locations are found,...
bool CreateSnps(const STableLocation &fc, ICanceled *cancel=NULL)
Create snips (features that show variations) for each row.
bool CreateSnpFeature(const STableLocation &fc, ICanceled *cancel=NULL)
Create a region feature for each snp using specified snp (rsid) column.
bool AddSnpSeqLoc(const STableLocation &fc, int loc_number, ICanceled *cancel=NULL)
Add a location to the table using the rsid (snp/variation) ids location from the snp db.
bool CreateFeature(const STableLocation &fc, ICanceled *cancel=NULL)
Create a feature using specified columns.
void InitDataSource(ITableData &table_data)
Set/update data source.
void ExportTableParms(CUser_object &user_object)
Export table load parameters in ASN user-data format.
CUser_object & AddField(const string &label, const string &value, EParseField parse=eParse_String)
add a data field to the user object that holds a given value
Interface for testing cancellation request in a long lasting operation.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
const string & GetMsg(void) const
Get message string.
void Info(CExceptionArgs_Base &args)
#define MSerial_AsnText
I/O stream manipulators –.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
virtual bool IsCanceled(void) const =0
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
void SetType(TType &value)
Assign a value to Type data member.
const struct ncbi::grid::netcache::search::fields::SIZE size
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
wxString ToWxString(const string &s)