45 #include <wx/msgdlg.h>
59 for (
size_t i = 0;
i < msg_listener.
Count(); ++
i) {
64 message += (
"Hyphens in the update sequence have been ignored.\n");
71 message += (
"Invalid character was found (and ignored):");
86 bool input_ok =
false;
128 if (count_bioseqs > 1) {
129 string msg(
"You selected update single sequence but the update file contains "
130 +
NStr::UIntToString(count_bioseqs) +
" bioseqs. Do you want to continue and use the first record only?");
135 if (!warn_message.empty()) {
150 if (!input_ok)
return;
168 if (!input_ok)
return;
182 if (count_bioseqs > 1) {
183 string msg(
"You selected update single sequence but the update file contains "
184 +
NStr::UIntToString(count_bioseqs) +
" bioseqs. Do you want to continue and use the first record only?");
189 warn_message.clear();
193 }
while (res ==
eNo);
195 if (!warn_message.empty()) {
212 string msg(
"You are about to update a delta sequence with a raw sequence, which\n will convert the delta sequence to raw. Do you want to continue?");
218 string msg(
"The update sequence is a delta sequence with far pointers. Do you want to continue?");
228 if (dlg.ShowModal() == wxID_OK) {
240 if (!citsub_msg.empty()) {
253 if (!report.empty()) {
255 reportdlg->SetTitle(
"Update Sequence Log");
257 reportdlg->Show(
true);
275 bool input_ok =
false;
315 int retcode = dlg.ShowModal();
316 if (retcode == wxOK || retcode == wxCLOSE) {
319 cmdProcessor->
Execute(update_cmd);
324 report->SetTitle(
"Update Sequence Log");
343 string invalidRes_msg;
344 string duplicateids_msg;
346 for (
size_t i = 0;
i < msg_listener.
Count(); ++
i) {
355 if (!hyphens_msg.empty()) {
358 hyphens_msg += line_err.
SeqId();
366 if (!invalidRes_msg.empty()) {
367 invalidRes_msg +=
"\n";
369 invalidRes_msg += line_err.
SeqId();
370 invalidRes_msg +=
msg.substr(pos + 2,
NPOS);
375 if (
msg.find(
"Seq-id") !=
NPOS &&
msg.find(
"is a duplicate") !=
NPOS) {
376 if (duplicateids_msg.find(line_err.
SeqId()) ==
NPOS) {
377 if (!duplicateids_msg.empty()) {
378 duplicateids_msg +=
"\n";
380 duplicateids_msg += line_err.
SeqId();
387 if (!hyphens_msg.empty()) {
388 message +=
"Hyphens have been ignored in the following update sequences:\n";
389 message += hyphens_msg;
392 if (!invalidRes_msg.empty()) {
393 if (!message.empty()) {
396 message +=
"Invalid residues were found and ignored in the following update sequences:\n";
397 message += invalidRes_msg;
400 if (!message.empty()) {
404 if (!duplicateids_msg.empty()) {
405 duplicateids_msg =
"Duplicate sequence ids were found in the update sequence file:\n" + duplicateids_msg;
407 reportdlg->SetTitle(
"Duplicate seq-ids");
409 reportdlg->Show(
true);
bool IsGeneralIdProtPresent(objects::CSeq_entry_Handle tse)
void SetText(const wxString &text)
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Sequence update exception class.
void UpdateSingleSequence_Ext(IWorkbench *workbench, const objects::CSeq_entry_Handle &tse, ICommandProccessor *cmdProcessor) const
void x_LaunchSingleUpdateSequence(CUpdateSeq_Input &updseq_in, SUpdateSeqParams ¶ms, const objects::CSeq_entry_Handle &tse, ICommandProccessor *cmdProcessor) const
void UpdateMultipleSequences(IWorkbench *workbench, const objects::CSeq_entry_Handle &tse, ICommandProccessor *cmdProcessor)
void UpdateSingleSequence(IWorkbench *workbench, const objects::CSeq_entry_Handle &tse, ICommandProccessor *cmdProcessor) const
void x_GetSeqsWithIgnoredResidues(objects::ILineErrorListener &msg_listener)
Class responsible for executing the sequence update for one old-update sequence pair.
string GetRevCompReport() const
const string & GetCitSubMessage() const
void GetNotImportedFeatsReport(CNcbiOstream &out) const
CRef< CCmdComposite > Update(bool create_general_only)
Main function responsible to update the old sequence with the update sequence.
const string & GetRevCompReport() const
void SetData(const SUpdateSeqParams ¶ms)
SUpdateSeqParams GetData() const
Undo/Redo interface for editing operations.
virtual void Execute(IEditCommand *command, wxWindow *window=0)=0
virtual size_t Count() const =0
virtual const ILineError & GetError(size_t) const =0
0-based error retrieval.
@ eProblem_InvalidResidue
@ eProblem_IgnoredResidue
@ eProblem_GeneralParsingError
virtual EProblem Problem(void) const =0
virtual const string & SeqId(void) const =0
virtual const string & ErrorMessage() const
virtual EDiagSev GetSeverity(void) const
IWorkbench is the central interface in the application framework.
Stores parameters regarding the type of sequence update, on how to handle existing features and on ho...
ESequenceUpdateType m_SeqUpdateOption
bool AreUpdateParamsValid(void)
@ eSeqUpdateReplace
do not change the old sequence
#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...
@ eDiag_Warning
Warning message.
void Error(CExceptionArgs_Base &args)
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
EDialogReturnValue NcbiInfoBox(const string &message, const string &title="Info")
specialized Message Box function for reporting general information messages
void NcbiWarningBox(const string &message, const string &title="Warning")
specialized Message Box function for reporting non-critical errors
EDialogReturnValue NcbiMessageBox(const string &message, TDialogType type=eDialog_Ok, EDialogIcon icon=eIcon_Exclamation, const string &title="Error", EDialogTextMode text_mode=eRaw)
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
bool IsSetInst_Repr(void) const
TInst_Repr GetInst_Repr(void) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
bool IsOssEmpty(CNcbiOstrstream &oss)
NCBI_NS_STD::string::size_type SIZE_TYPE
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
@ eRepr_raw
continuous sequence
EDialogReturnValue
enumerated return values for dialog boxes, starting from 1 to undermine attempts to cast it "bool"
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static string s_WarnAboutIgnoredResidues(ILineErrorListener &msg_listener)
wxString ToWxString(const string &s)