289 #include <wx/msgdlg.h>
290 #include <wx/statline.h>
291 #include <wx/clipbrd.h>
293 #include <wx/filedlg.h>
294 #include <wx/display.h>
295 #include <wx/evtloop.h>
297 #include <wx/utils.h>
311 virtual string GetName()
const {
return "Sequence Editing"; }
312 virtual void GetVersion(
size_t& verMajor,
size_t& verMinor,
size_t& verPatch)
const
338 "<std>/etc/macro_scripts/list_of_macros.mql",
339 "<std>/etc/macro_scripts/autofix_gb.mql",
340 "<std>/etc/macro_scripts/autofix_tsa.mql",
341 "<std>/etc/macro_scripts/autofix_wgs.mql",
392 if (!path.IsEmpty()) {
393 filenames.push_back(
string(path.ToUTF8()));
402 macro::CMacroLib& macroLib = macro::CMacroLib::GetInstance();
403 macroLib.ClearLibrary();
404 bool status = macroLib.AppendToLibrary(
filenames);
410 if (!path.IsEmpty()) {
456 const string url =
"https://anonsvn.ncbi.nlm.nih.gov/v1/trunk/c%2B%2B/src/objects/seqfeat/" + fname;
458 const wxChar* kTempFilesDir =
wxT(
"<home>/TempFiles");
461 string path(dir_path.ToUTF8());
466 wxfname.SetPath(dir_path);
467 wxfname.SetFullName(fname);
468 string filePath(wxfname.GetFullPath().ToUTF8());
470 if (!wxfname.FileExists()) {
471 if (!wxFileName::DirExists(dir_path) && !wxFileName::Mkdir(dir_path)) {
472 LOG_POST(
Error <<
"Failed to create directory: '" << dir_path <<
"'");
483 Uint8 existing_fsize = wxfname.GetSize().ToULong();
484 long diff = (long)
abs((
int)(existing_fsize - remote_fsize));
489 istr.unsetf(ios::skipws);
490 long count_lines = count(istream_iterator<char>(istr), istream_iterator<char>(),
'\n');
492 if (diff > 0 && count_lines == diff) {
507 catch (
const exception& e) {
566 void EditPubs( wxCommandEvent& event );
617 void FocusSet( wxCommandEvent& event );
635 void AddCDS( wxCommandEvent& event );
636 void AddRNA( wxCommandEvent& event );
639 void Validate( wxCommandEvent& event );
643 void Oncaller(wxCommandEvent& event);
645 void Mega(wxCommandEvent& event);
653 void ParseText ( wxCommandEvent& event );
664 void BulkEdit ( wxCommandEvent& event );
667 void Autodef ( wxCommandEvent& event );
697 void LabelRna( wxCommandEvent& event );
709 void AddSet ( wxCommandEvent& event );
766 void FindASN1( wxCommandEvent& evt );
871 void Help(wxCommandEvent& evt);
895 void SaveSettings(
const string ®path, wxWindow *dlg)
const;
896 void LoadSettings(
const string ®path, wxWindow *dlg);
913 wxWindow* main_window =
NULL;
1023 const CObject* ptr = it->object.GetPointer();
1026 const CSeq_loc* seqloc =
dynamic_cast<const CSeq_loc*
>(ptr);
1055 }
else if (seqloc) {
1057 if (seqloc->IsWhole()) {
1059 new_id->
Assign(seqloc->GetWhole());
1078 }
else if (bioseq) {
1080 loc->
SetInt().SetId().Assign(*(bioseq->
GetId().front()));
1081 loc->
SetInt().SetFrom(0);
1087 }
else if (seqdesc) {
1099 loc->
SetInt().SetId().Assign(*(bi->
GetId().front().GetSeqId()));
1100 loc->
SetInt().SetFrom(0);
1106 }
else if (pubdesc) {
1111 loc->
SetInt().SetId().Assign(*(bi->
GetId().front().GetSeqId()));
1112 loc->
SetInt().SetFrom(0);
1129 }
else if (bioseqset) {
1134 loc->
SetInt().SetId().Assign(*(bseq.
GetId().front()));
1135 loc->
SetInt().SetFrom(0);
1154 m_IsAa = it->scope->GetBioseqHandle(*loc).IsAa();
1183 if (row_id.
Match(*
id))
1209 catch (
const exception&)
1211 wxMessageBox(
wxT(
"Error while attempting to connect to the ID server, restarting gbench is recommended"),
wxT(
"Error"), wxOK | wxICON_ERROR,
NULL);
1230 event.Enable(
false);
1251 bool ok_for_something =
false;
1256 ok_for_something |=
true;
1260 ok_for_something |=
true;
1263 ok_for_something |=
true;
1277 catch (
const exception&)
1279 wxMessageBox(
wxT(
"Unable to connect to the ID server, restarting gbench is recommended"),
wxT(
"Error"), wxOK | wxICON_ERROR,
NULL);
1290 vector<CUICommand*> commands;
1309 commands.push_back(
new CUICommand(
eCmdRevCompSequences_ext,
"Reverse Complement Sequences by Sequence ID",
"Reverse Complement Sequences from Selected Object",
"RVCS"));
1313 commands.push_back(
new CUICommand(
eCmdMergeBiosources,
"Merge Multiple BioSources On Sequence",
"Merge Multiple BioSources On Sequence",
"MMBS"));
1326 commands.push_back(
new CUICommand(
eCmdTaxFixCleanup,
"Tax_fix/Cleanup",
"Fix Taxonomy and Perform Basic and Extended Cleanup",
"TFCU"));
1360 commands.push_back(
new CUICommand(
eCmdAddTranslExcept,
"Add Translational Exceptions with Comment",
"Add Translational Exceptions with Comment",
"ATEWC"));
1379 commands.push_back(
new CUICommand(
eCmdConvertComment,
"Convert Structured Comment",
"Convert Structured Comment in Selected Object",
"CSCSO"));
1380 commands.push_back(
new CUICommand(
eCmdParseComment,
"Parse Structured Comment",
"Parse Structured Comment in Selected Object",
"PSCSO"));
1410 commands.push_back(
new CUICommand(
eCmdSetTransgSrcDesc,
"Set Transgenic on Source Descriptor",
"Set Transgenic on Source Desc when Source Feat present",
"STOSD"));
1416 commands.push_back(
new CUICommand(
eCmdSplitPrimerSets,
"Split Primer Sets by Position",
"Split Primer Sets by Position for Selected Object",
"SPSBPSO"));
1420 commands.push_back(
new CUICommand(
eCmdCountryFixupCap,
"Country Fixup Fix Capitalization after Colon",
"Country Fixup Fix Capitalization After Colon",
"CFFCAC"));
1421 commands.push_back(
new CUICommand(
eCmdCountryFixupNoCap,
"Country Fixup Do Not Fix Capitalization after Colon",
"Country Fixup Do Not Fix Capitalization After Colon",
"CFDNFCAC"));
1422 commands.push_back(
new CUICommand(
eCmdVectorTrim,
"Vector Search and Trim Tool",
"Vector Search and Trim Tool",
"VSTT"));
1424 commands.push_back(
new CUICommand(
eCmdSelectTarget_ext,
"Select Specific Sequence by Sequence ID",
"Select Specific Sequence by Sequence ID",
"ST"));
1469 commands.push_back(
new CUICommand(
eCmdApplyCGPQual,
"Apply CDS-Gene-Prot-mRNA Qualifier",
"Apply CDS-Gene-Prot-mRNA Qual",
"ACGPQ"));
1470 commands.push_back(
new CUICommand(
eCmdEditCGPQual,
"Edit CDS-Gene-Prot-mRNA Qualifier",
"Edit CDS-Gene-Prot-mRNA Qual",
"ECGPQ"));
1471 commands.push_back(
new CUICommand(
eCmdConvertCGPQual,
"Convert CDS-Gene-Prot-mRNA Qualifier",
"Convert CDS-Gene-Prot-mRNA Qual",
"CCGPQ"));
1472 commands.push_back(
new CUICommand(
eCmdSwapCGPQual,
"Swap CDS-Gene-Prot-mRNA Qualifiers",
"Swap CDS-Gene-Prot-mRNA Qual",
"SCGPQ"));
1473 commands.push_back(
new CUICommand(
eCmdRemoveCGPQual,
"Remove CDS-Gene-Prot-mRNA Qualifier",
"Remove CDS-Gene-Prot-mRNA Qual",
"RCGPQ"));
1509 commands.push_back(
new CUICommand(
eCmdCorrectGenes,
"Correct Genes for CDSs or mRNAs",
"Correct Genes for CDSs or mRNAs",
"CGFCOM"));
1561 commands.push_back(
new CUICommand(
eCmdExtendCDS,
"Extend Coding Region Ends",
"Extend Coding Region Ends",
"ECDSE"));
1562 commands.push_back(
new CUICommand(
eCmdTruncateCDS,
"Truncate Proteins and CDSs at Stops",
"Truncate Proteins and CDSs at Stops",
"TPCDSS"));
1586 commands.push_back(
new CUICommand(
eCmdNormalizeGeneQuals,
"Normalize Gene Quals",
"Copy gene qualifiers in xrefs on coding regions to parent genes",
"NGQ"));
1595 commands.push_back(
new CUICommand(
eCmdTrimNsRich,
"Trim N-rich Sequence Ends",
"Trim N-rich Sequence Ends",
"TNR"));
1604 commands.push_back(
new CUICommand(
eCmdEnableHupId,
"Enable HUP-ID Loader",
"Enable HUP-ID Loader",
"",
"",
"",
"", wxITEM_CHECK));
1631 commands.push_back(
new CUICommand(
eCmdExpandGaps,
"Expand Known Gaps to Include Flanking Ns",
"Expand Known Gaps to Include Flanking Ns",
"EKGFN"));
1635 commands.push_back(
new CUICommand(
eCmdEditSelectedGaps,
"Change Length of Selected Known Length Gaps",
"Change Length of Selected Known Length Gaps",
"CLSKG"));