67 #include <wx/artprov.h>
69 #include <wx/imaglist.h>
70 #include <wx/statline.h>
71 #include <wx/spinbutt.h>
72 #include <wx/spinctrl.h>
73 #include <wx/splitter.h>
74 #include <wx/listctrl.h>
75 #include <wx/treectrl.h>
76 #include <wx/notebook.h>
78 #include <wx/toolbar.h>
79 #include <wx/tglbtn.h>
84 #define ID_TEXT_INT 10000
85 #define ID_C_TYPE 10001
86 #define ID_LC_INT 10002
87 #define ID_B_ADD_INT 10003
88 #define ID_B_LAUNCH_INT 10004
89 #define ID_B_HIGHLIGHT_INT 10005
90 #define ID_LB_ANNOT 10006
91 #define ID_B_DELETE_ANNOT 10007
92 #define ID_B_HIGHLIGHT_ANNOT 10008
93 #define ID_B_HIGHLIGHT_OLAP 10009
94 #define ID_B_HIGHLIGHT_NONOLAP_ANNOT 10010
95 #define ID_B_HIGHLIGHT_NONOLAP_INTN 10011
117 m_queryMolecule =
NULL;
118 m_querySequence = querySequence;
119 if (m_querySequence) m_queryMolecule = m_querySequence->identifier;
162 INFOMSG(
"type " << integer <<
" is not a valid Ibis interaction type");
176 string result =
"Unknown";
233 INFOMSG(
"IBIS interaction type " << ibisType <<
" not mapped to a Cdd interaction type");
262 INFOMSG(
"Cdd interaction type " << cddType <<
" not mapped to an IBIS interaction type");
306 }
else if (
location.IsPacked_int()) {
307 CPacked_seqint::Tdata::iterator s, se =
location.SetPacked_int().Set().end();
308 for (s =
location.SetPacked_int().Set().begin(); s!=se; ++s) {
309 from = (**s).SetFrom();
317 ERRORMSG(
"interaction '" <<
m_desc <<
"' has unexpected location type");
321 ERRORMSG(
"interaction '" <<
m_desc <<
"' has out-of-range positions");
344 int intType =
m_seqfeat.GetExt().GetType().GetId();
369 WARNINGMSG(
"IBIS feature data with unexpected type " << intType);
374 CSeq_feat::TExt::TData::const_iterator uoCit = userObjectData.begin();
375 CSeq_feat::TExt::TData::const_iterator uoEnd = userObjectData.end();
376 for (; uoCit != uoEnd; ++uoCit) {
378 if ((*uoCit)->GetLabel().IsStr()) {
379 label = (*uoCit)->GetLabel().GetStr();
381 ERRORMSG(
"IBIS feature data with non-string label is skipped");
385 if ((*uoCit)->GetData().IsInt()) {
386 intValue = (*uoCit)->GetData().GetInt();
388 ERRORMSG(
"IBIS feature data with non-integral type and label '" <<
label <<
"' is skipped");
392 if (
label ==
"mmdbId") {
394 }
else if (
label ==
"sdiId") {
396 }
else if (
label ==
"nMembers") {
398 }
else if (
label ==
"nInterfaceRes") {
400 }
else if (
label ==
"nUniqueChemicals") {
402 }
else if (
label ==
"nUniqueIons") {
404 }
else if (
label ==
"comb_scr") {
406 }
else if (
label ==
"avgIdent") {
407 m_pid = (double) intValue/1000000.0;
408 }
else if (
label ==
"isObserverd") {
411 ERRORMSG(
"IBIS feature data with unexpected label '" <<
label <<
"' is skipped");
419 bool isLocOK =
false;
423 annot->SetDescription(
m_desc);
426 const ncbi::objects::CSeq_loc& loc =
GetLocation(isLocOK);
429 packedInt->Assign(loc.GetPacked_int());
430 annot->SetLocation().SetPacked_int(*packedInt);
444 boilerplateEvidence->SetComment(commentEvid);
445 evidence.push_back(boilerplateEvidence);
458 ERRORMSG(
"error converting interaction '" <<
m_desc <<
"' to an annotation!");
469 if (!
m_seqfeat.GetLocation().IsPacked_int()) {
471 ERRORMSG(
"IBIS feature has unexpected location type");
474 ERRORMSG(
"could not extract IBIS feature location");
490 for (pos = from; pos <= to; ++pos) {
493 }
else if (isOK &&
location.IsPacked_int()) {
494 CPacked_seqint::Tdata::const_iterator s, se =
location.GetPacked_int().Get().end();
495 for (s =
location.GetPacked_int().Get().begin(); s!=se; ++s) {
496 from = (**s).GetFrom();
498 for (pos = from; pos <= to; ++pos) {
516 if (intervals.size() > 0) {
517 from = (
int) intervals.front()->GetFrom();
518 to = (
int) intervals.back()->GetTo();
521 ERRORMSG(
"IBIS feature has no defined intervals");
535 CPacked_seqint::Tdata::const_iterator it = intervals.begin(), itEnd = intervals.end();
538 const CSeq_id& firstId = (*it)->GetId();
543 for (; idsMatch && it != itEnd; ++it) {
544 idsMatch = firstId.
Match((*it)->GetId());
548 if (firstId.
IsGi()) {
549 gi = firstId.
GetGi();
552 ERRORMSG(
"unexpected sequence identifier used for IBIS feature location (expected a GI)");
556 ERRORMSG(
"inconsistent sequence ids used to give IBIS feature location");
560 ERRORMSG(
"IBIS feature has no defined intervals");
570 #define DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(var, id, type) \
572 var = wxDynamicCast(FindWindow(id), type); \
574 ERRORMSG("Can't find window with id " << id); \
578 #define DECLARE_AND_FIND_WINDOW_RETURN_FALSE_ON_ERR(var, id, type) \
580 var = wxDynamicCast(FindWindow(id), type); \
582 ERRORMSG("Can't find window with id " << id); \
595 wxDialog(parent, -1, "IBIS Annotations", wxPoint(400, 100), wxDefaultSize, wxDEFAULT_DIALOG_STYLE),
596 dialogHandle(handle), structureSet(
set), annotSet(
set->GetCDDAnnotSet()), m_images(
NULL)
598 if (annotSet.Empty()) {
604 PopulateInteractionData();
613 if (sbs) sbs->GetStaticBox()->SetLabel(
buf);
621 topSizer->SetSizeHints(
this);
622 SetClientSize(topSizer->GetMinSize());
629 if (vecIbisInteractions.size() > 0) {
631 choiceId = intTypeFilter->FindString(
wxT(
"Protein-Protein"));
632 if (choiceId != wxNOT_FOUND) {
633 intTypeFilter->Delete(choiceId);
639 choiceId = intTypeFilter->FindString(
wxT(
"Protein-NucAcid"));
640 if (choiceId != wxNOT_FOUND) {
641 intTypeFilter->Delete(choiceId);
645 choiceId = intTypeFilter->FindString(
wxT(
"Protein-Chemical"));
646 if (choiceId != wxNOT_FOUND) {
647 intTypeFilter->Delete(choiceId);
651 choiceId = intTypeFilter->FindString(
wxT(
"Protein-Peptide"));
652 if (choiceId != wxNOT_FOUND) {
653 intTypeFilter->Delete(choiceId);
657 choiceId = intTypeFilter->FindString(
wxT(
"Protein-Ion"));
658 if (choiceId != wxNOT_FOUND) {
659 intTypeFilter->Delete(choiceId);
664 intTypeFilter->SetSelection(0);
669 wxIcon infoIcon = wxArtProvider::GetIcon(wxART_INFORMATION);
670 wxIcon warnIcon = wxArtProvider::GetIcon(wxART_WARNING);
671 wxIcon questionIcon = wxArtProvider::GetIcon(wxART_QUESTION);
672 wxIcon bookmarkIcon = wxArtProvider::GetIcon(wxART_ADD_BOOKMARK);
673 wxIcon tickMarkIcon = wxArtProvider::GetIcon(wxART_TICK_MARK);
674 if (tickMarkIcon.Ok()) {
675 m_images =
new wxImageList(16, 16,
true);
676 m_images->Add(infoIcon);
677 m_images->Add(warnIcon);
678 m_images->Add(questionIcon);
679 m_images->Add(bookmarkIcon);
680 m_images->Add(tickMarkIcon);
681 interactions->SetImageList(m_images, wxIMAGE_LIST_SMALL);
685 if (interactions->GetWindowStyleFlag() & wxLC_REPORT) {
687 itemCol.SetText(
wxT(
"Annot Overlap?"));
688 itemCol.SetAlign(wxLIST_FORMAT_LEFT);
689 interactions->InsertColumn(0, itemCol);
691 itemCol.SetText(
wxT(
"Type"));
692 itemCol.SetAlign(wxLIST_FORMAT_LEFT);
693 interactions->InsertColumn(1, itemCol);
695 itemCol.SetText(
wxT(
"Observed?"));
696 itemCol.SetAlign(wxLIST_FORMAT_RIGHT);
697 interactions->InsertColumn(2, itemCol);
699 itemCol.SetText(
wxT(
"Filtered on Web?"));
700 itemCol.SetAlign(wxLIST_FORMAT_RIGHT);
701 interactions->InsertColumn(3, itemCol);
703 itemCol.SetText(
wxT(
"Description"));
704 itemCol.SetAlign(wxLIST_FORMAT_LEFT);
705 interactions->InsertColumn(4, itemCol);
707 itemCol.SetText(
wxT(
"# Res. on Query"));
708 itemCol.SetAlign(wxLIST_FORMAT_CENTER);
709 interactions->InsertColumn(5, itemCol);
711 itemCol.SetText(
wxT(
"Clust. Size"));
712 itemCol.SetAlign(wxLIST_FORMAT_CENTER);
713 interactions->InsertColumn(6, itemCol);
715 itemCol.SetText(
wxT(
"Avg. Clust. %Id"));
716 itemCol.SetAlign(wxLIST_FORMAT_CENTER);
717 interactions->InsertColumn(7, itemCol);
719 itemCol.SetText(
wxT(
"IBIS Score"));
720 itemCol.SetAlign(wxLIST_FORMAT_CENTER);
721 interactions->InsertColumn(8, itemCol);
726 SetupGUIControls(-1, -1);
739 TRACEMSG(
"destroyed IBISAnnotateDialog");
752 return listCtrl.GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
759 long item = listCtrl.GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
762 while ( item != -1 ) {
764 item = listCtrl.GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
801 ERRORMSG(
"Error calling ibis.cgi: from (" <<
query.from <<
") > to (" <<
query.to <<
").");
804 ERRORMSG(
"Error calling ibis.cgi: mmdbId not set.");
807 ERRORMSG(
"Error calling ibis.cgi: molId not set..");
813 host =
"www.ncbi.nlm.nih.gov",
814 path =
"/Structure/ibis/ibis.cgi";
816 argstr <<
"sqat&range=" << (
query.from+1) <<
',' << (
query.to+1) <<
"&mmdbid=" <<
query.mmdbId
817 <<
"&molid=" <<
query.molId
828 INFOMSG(
"try to load IBIS alignment data by mmdb-id from " << host << path <<
'?' << args);
831 ERRORMSG(
"Error getting interaction data from ibis.cgi:\n" << err);
834 ibisSeqAnnot.
Reset();
835 if (
query.pdb.length() > 0) {
838 argstrPdb <<
"sqat&range=" << (
query.from+1) <<
',' << (
query.to+1) <<
"&search=" <<
query.pdb
842 INFOMSG(
"try to load IBIS alignment data by pdb accession from " << host << path <<
'?' << args);
846 ERRORMSG(
"Error getting interaction data by pdb accession from ibis.cgi:\n" << err);
849 ibisSeqAnnot.
Reset();
850 INFOMSG(
" ibis.cgi has no interaction data for MMDB-ID " <<
query.mmdbId <<
", molecule " <<
query.molId <<
" or PDB accession " <<
query.pdb);
852 INFOMSG(
" successfully loaded interaction data from ibis.cgi for PDB accession " <<
query.pdb);
856 INFOMSG(
" ibis.cgi has no interaction data for MMDB-ID " <<
query.mmdbId <<
", molecule " <<
query.molId <<
" (no known PDB accession)");
859 INFOMSG(
" successfully loaded interaction data from ibis.cgi for MMDB-ID " <<
query.mmdbId);
882 ncbi::CRef< ncbi::objects::CSeq_annot > ibisInteractions(
new CSeq_annot);
883 if (ibisInteractions.NotEmpty()) {
911 ibisInteractions.Reset();
912 }
else if (ibisInteractions.NotEmpty()&& ibisInteractions->GetData().IsFtable() && (ibisInteractions->GetData().GetFtable().size() > 0)) {
915 CSeq_annot::TData::TFtable::const_iterator fit = seqfeats.begin(), fend = seqfeats.end();
916 for (; fit != fend; ++fit) {
917 if (fit->NotEmpty()) {
925 ERRORMSG(
"Error: allocation failure before trying to contact ibis.cgi.");
940 for (
unsigned i = 0;
i < num && !
result; ++
i) {
951 if (positions.size() == 0)
return 0;
954 SeqPosSet::const_iterator pcit = positions.begin(), pend = positions.end();
958 while (pcit != pend) {
961 if (pcit != pend && (*pcit ==
last + 1)) {
969 intervals.push_back(interval);
977 return positions.size();
983 int eventId =
event.GetId();
1028 wxString eventText =
event.GetText();
1047 if (ibisInt.
Empty())
return;
1051 buf.Printf(
wxT(
"(%d) %s [%d in cluster (%4.1f %%id); %d residues]"), (
int) ibisInt->GetType(),
1052 ibisInt->GetDesc().c_str(), ibisInt->GetNumMembers(), ibisInt->GetAverageIdentity(), ibisInt->GetNumInterfaceResidues());
1053 itemIndex = listCtrl.InsertItem(vecIndex,
buf, -1);
1054 if (itemIndex >= 0) {
1055 listCtrl.SetItemData(itemIndex, vecIndex);
1061 if (ibisInt.
Empty())
return;
1068 long itemIndex = listCtrl.InsertItem(vecIndex,
"", -1);
1069 if (itemIndex >= 0) {
1070 listCtrl.SetItemData(itemIndex, vecIndex);
1072 listCtrl.SetItem(itemIndex, 1,
buf, -1);
1074 if (ibisInt->IsObserved()) {
1075 listCtrl.SetItem(itemIndex, 2,
"", 3);
1077 if (ibisInt->IsFiltered()) {
1078 listCtrl.SetItem(itemIndex, 3,
"", 2);
1081 buf.Printf(
wxT(
"%s"), ibisInt->GetDesc().c_str());
1082 listCtrl.SetItem(itemIndex, 4,
buf);
1090 buf.Printf(
wxT(
"%d"), (
int) ibisInt->GetPositions().size());
1091 listCtrl.SetItem(itemIndex, 5,
buf);
1093 buf.Printf(
wxT(
"%d"), ibisInt->GetNumMembers());
1094 listCtrl.SetItem(itemIndex, 6,
buf);
1095 buf.Printf(
wxT(
"%4.1f"), ibisInt->GetAverageIdentity());
1096 listCtrl.SetItem(itemIndex, 7,
buf);
1098 buf.Printf(
wxT(
"%4.1f"), (
double) ibisInt->GetScore()/10000.0);
1102 listCtrl.SetItem(itemIndex, 8,
buf);
1109 if (choiceStr ==
wxT(
"All")) {
1112 }
else if (choiceStr.Contains(
wxT(
"Protein-Protein"))) {
1114 }
else if (choiceStr.Contains(
wxT(
"Protein-NucAcid"))) {
1118 }
else if (choiceStr.Contains(
wxT(
"Protein-Chemical"))) {
1120 }
else if (choiceStr.Contains(
wxT(
"Protein-Peptide"))) {
1122 }
else if (choiceStr.Contains(
wxT(
"Protein-Ion"))) {
1134 CPacked_seqint::Tdata::const_iterator s, se;
1136 offset = (zeroBased) ? 0 : 1;
1138 if (annotSeqLoc.
IsInt()) {
1141 for (pos = from; pos <= to; ++pos) {
1142 positions.insert(pos);
1147 from = (**s).GetFrom() +
offset;
1148 to = (**s).GetTo() +
offset;
1149 for (pos = from; pos <= to; ++pos) {
1150 positions.insert(pos);
1159 intersection.clear();
1160 if (set1.empty() || set2.empty())
return 0;
1162 set_intersection(set1.begin(), set1.end(),
1163 set2.begin(), set2.end(),
1164 inserter(intersection, intersection.begin()));
1166 return intersection.size();
1173 if (nInteractions == 0)
return;
1175 SeqPosSet annotPositions, overlapPositions;
1177 vector< SeqPosSet >& overlaps = annotInfo.
overlaps;
1178 CAlign_annot_set::Tdata::const_iterator
a, ae =
annotSet->Get().end();
1181 overlaps.resize(nInteractions);
1184 annotInfo.
ptr = (
void *)
a->GetPointer();
1186 annotPositions.clear();
1187 if (
a->NotEmpty()) {
1190 annotInfo.
nRes = annotPositions.size();
1192 for (
i = 0;
i < nInteractions; ++
i) {
1195 overlaps[
i] = overlapPositions;
1214 SeqPosSet annotPositions, annotPositionOverlaps;
1215 SeqPosSet::iterator setIt, setEnd;
1218 nonOverlaps.clear();
1224 nonOverlaps.insert(annotPositions.begin(), annotPositions.end());
1226 nonOverlaps.insert(interactionPositions.begin(), interactionPositions.end());
1229 setEnd = annotPositionOverlaps.end();
1230 for (setIt = annotPositionOverlaps.begin(); setIt != setEnd; ++setIt) {
1231 nonOverlaps.erase(*setIt);
1237 static const double overlapThreshold = 99.0;
1254 bool readOnly, isIbisAnnot, isFullInteractionAnnotated;
1255 double overlapPercentage;
1256 unsigned int i, ibisIndex, nInteractions, nItems, nOverlaps, nRes, nResIntn;
1257 int selectedVecIndex = -1;
1261 wxString annotDescStr, choiceSelectionStr;
1265 AnnotIbisOverlapMap::iterator olapIt, olapEnd;
1268 choiceSelectionStr = intTypeFilter->GetStringSelection();
1273 olapEnd = overlapMap.end();
1274 for (olapIt = overlapMap.begin(); olapIt != olapEnd; ++olapIt) {
1276 if (olapIt->second.nRes == 0)
continue;
1278 vector< SeqPosSet >& olaps = olapIt->second.overlaps;
1279 for (
i = 0;
i < olaps.size(); ++
i) {
1280 if (olaps[
i].
size() > 0) {
1281 ibisIndexWithOverlap.
insert(
i);
1285 ibisIndexEnd = ibisIndexWithOverlap.
end();
1289 if (selectInteraction >= 0) {
1290 selectedVecIndex = interactions->GetItemData(selectInteraction);
1291 if (selectedVecIndex < 0 || selectedVecIndex >= (
int) nInteractions) {
1292 selectedVecIndex = -1;
1293 selectInteraction = -1;
1295 selectedVecIndex = -1;
1296 selectInteraction = -1;
1302 selectInteraction = -1;
1310 if (selectedVecIndex < 0) {
1320 interactions->Hide();
1323 interactions->DeleteAllItems();
1324 if (interactions->GetWindowStyleFlag() & wxLC_LIST) {
1325 for (
i = 0;
i < nInteractions; ++
i) {
1330 }
else if (interactions->GetWindowStyleFlag() & wxLC_REPORT) {
1332 for (
i = 0;
i < nInteractions; ++
i) {
1346 if (selectedVecIndex >= 0) {
1347 this->SetEvtHandlerEnabled(
false);
1348 nItems = interactions->GetItemCount();
1349 for (
i = 0;
i < nItems; ++
i) {
1350 if ((
int) interactions->GetItemData(
i) == selectedVecIndex) {
1351 selectInteraction =
i;
1352 interactions->SetItemState(
i, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
1356 this->SetEvtHandlerEnabled(
true);
1361 nItems = interactions->GetItemCount();
1362 for (
i = 0;
i < nItems; ++
i) {
1363 ibisIndex = (
unsigned int) interactions->GetItemData(
i);
1364 if (ibisIndexWithOverlap.
find(ibisIndex) != ibisIndexEnd) {
1365 interactions->SetItemImage(
i, 4);
1369 for (
i = 0;
i < (
unsigned int) interactions->GetColumnCount(); ++
i) {
1371 interactions->SetColumnWidth(
i, wxLIST_AUTOSIZE);
1373 interactions->SetColumnWidth(
i, wxLIST_AUTOSIZE_USEHEADER);
1377 interactions->Show();
1379 if (selectInteraction >= 0) {
1380 interactions->EnsureVisible(selectInteraction);
1387 isFullInteractionAnnotated =
false;
1391 if (selectedVecIndex >= 0 && (ibisIndexWithOverlap.
find(selectedVecIndex) != ibisIndexEnd)) {
1393 for (olapIt = overlapMap.begin(); olapIt != olapEnd; ++olapIt) {
1394 nOverlaps = olapIt->second.overlaps[selectedVecIndex].size();
1395 nRes = olapIt->second.nRes;
1396 annotPtr =
reinterpret_cast<CAlign_annot*
>(olapIt->second.ptr);
1397 if (nOverlaps > 0 && annotPtr) {
1399 overlapPercentage = (nRes > 0) ? (100.0*nOverlaps)/((double) nRes) : 0.0;
1400 isFullInteractionAnnotated = (overlapPercentage >= overlapThreshold);
1404 annotDescStr.Printf(
"%s (%d residues; %4.1f%% are overlapped)", annotPtr->
GetDescription().c_str(), nRes, overlapPercentage);
1406 annotDescStr.Printf(
"<no description> (%d residues; %4.1f%% are overlapped)", nRes, overlapPercentage);
1408 annots->Append(annotDescStr, olapIt->second.ptr);
1414 if (annots->GetCount() == 0) {
1420 isIbisAnnot =
false;
1421 if (selectAnnot >= 0) {
1422 annots->SetSelection(selectAnnot);
1423 annotPtr =
reinterpret_cast<CAlign_annot*
>(annots->GetClientData(selectAnnot));
1426 olapIt = overlapMap.find((
unsigned long) annotPtr);
1427 if (selectedVecIndex >= 0 && olapIt != olapEnd) {
1428 nOverlaps = olapIt->second.overlaps[selectedVecIndex].size();
1429 nRes = olapIt->second.nRes;
1433 annots->SetSelection(wxNOT_FOUND);
1445 bAddInt->Enable(selectInteraction >= 0 && !isFullInteractionAnnotated && !readOnly);
1446 bLaunchInt->Enable(selectInteraction >= 0);
1447 bHighlightInt->Enable(selectInteraction >= 0);
1449 bDelAnnot->Enable(selectAnnot >= 0 && isIbisAnnot && !readOnly);
1450 bHighlightAnnot->Enable(selectAnnot >= 0);
1451 bHighlightOlap->Enable(selectAnnot >= 0 && nOverlaps > 0 && (nOverlaps < nRes));
1454 bHighlightNoOlapA->Enable(selectAnnot >= 0 && nRes > 0 && (nOverlaps < nRes));
1455 bHighlightNoOlapI->Enable(selectAnnot >= 0 && nResIntn > 0 && (nOverlaps < nResIntn));
1457 interactions->SetFocus();
1464 bool launchGeneralUrl =
false;
1466 wxString url, pdbQuery;
1469 int index = interactions->GetItemData(selectedItem);
1471 ERRORMSG(
"IBISAnnotateDialog::LaunchIbisWebPage() - error getting IBIS interaction with index " << index);
1487 launchGeneralUrl =
true;
1489 launchGeneralUrl =
true;
1492 if (launchGeneralUrl) {
1499 url.Printf(
"https://www.ncbi.nlm.nih.gov/Structure/ibis/ibis.cgi?search=%s", pdbQuery.c_str());
1502 url.Printf(
"https://www.ncbi.nlm.nih.gov/Structure/ibis/ibis.cgi?id=%d&type=%d&rowid=%d", ibisInt->GetSdiId(), (
int) ibisInt->GetType(), ibisInt->GetRowId());
1506 if (url.length() > 0) {
1509 ERRORMSG(
"IBISAnnotateDialog::LaunchIbisWebPage() - problem building URL for IBIS interaction with index " << index);
1517 bool okay =
true, isLocationOK =
false;
1523 if (interactions->GetItemCount() == 0) {
1525 }
else if (selectedItem < 0) {
1531 int index = interactions->GetItemData(selectedItem);
1533 ERRORMSG(
"IBISAnnotateDialog::HighlightAnnotation() - error getting IBIS interaction with index " << index);
1547 }
else if (
location.IsPacked_int()) {
1548 CPacked_seqint::Tdata::const_iterator s,
1549 se =
location.GetPacked_int().Get().end();
1550 for (s=
location.GetPacked_int().Get().begin(); s!=se; ++s) {
1558 wxMessageBox(
"This interaction specifies master residues outside the aligned blocks;"
1559 " see the message log for details.",
"IBIS Annotation Warning",
1560 wxOK | wxCENTRE | wxICON_WARNING,
this);
1583 if (itemId == -1)
return;
1587 wxString defText = selectedInt->GetDesc().c_str();
1588 wxString descr = wxGetTextFromUser(
1589 "Enter a description for the new annotation:",
"Description", defText);
1590 if (descr.size() == 0)
return;
1594 annot = selectedInt->ToAlignAnnot();
1595 annot->SetDescription(
WX_TO_STD(descr));
1620 if (annots->GetCount() == 0 || annots->GetSelection() < 0)
return;
1623 reinterpret_cast<CAlign_annot*
>(annots->GetClientData(annots->GetSelection()));
1624 if (!selectedAnnot) {
1625 ERRORMSG(
"IBISAnnotateDialog::DeleteAnnotation() - error getting annotation pointer");
1630 int confirm = wxMessageBox(
"This will remove the selected (putatively IBIS-derived) annotation\n"
1631 "and all evidence associated with it.\nIs this correct?",
"Confirm", wxOK | wxCANCEL | wxCENTRE,
this);
1632 if (confirm != wxOK)
return;
1635 CAlign_annot_set::Tdata::iterator
a, ae =
annotSet->Set().end();
1637 if (*
a == selectedAnnot) {
1658 bool highlightResult;
1659 bool idMatchResult =
true;
1662 WARNINGMSG(
"interval Seq-id " << interval.GetId().GetSeqIdString() <<
" does not match master Seq-id");
1663 idMatchResult =
false;
1667 return (idMatchResult && highlightResult);
1676 if (annots->GetCount() == 0 || annots->GetSelection() < 0)
return;
1678 reinterpret_cast<CAlign_annot*
>(annots->GetClientData(annots->GetSelection()));
1679 if (!selectedAnnot) {
1680 ERRORMSG(
"IBISAnnotateDialog::HighlightAnnotation() - error getting annotation pointer");
1691 CPacked_seqint::Tdata::iterator s,
1692 se = selectedAnnot->
SetLocation().SetPacked_int().Set().end();
1693 for (s=selectedAnnot->
SetLocation().SetPacked_int().Set().begin(); s!=se; ++s) {
1704 int index = interactions->GetItemData(selectedItem);
1706 if (selectedItem < 0) {
1709 ERRORMSG(
"IBISAnnotateDialog::HighlightAnnotation() - error getting IBIS interaction " << index <<
" for overlap calculation");
1715 IntervalList::iterator intIt, intEnd;
1722 intEnd = intervals.end();
1723 for (intIt = intervals.begin(); intIt != intEnd; ++intIt) {
1728 ERRORMSG(
"IBISAnnotateDialog::HighlightAnnotation() - invalid event id " << eventId);
1732 wxMessageBox(
"WARNING: this annotation specifies master residues outside the aligned blocks;"
1733 " see the message log for details.",
"Annotation Error",
1734 wxOK | wxCENTRE | wxICON_ERROR,
this);
1747 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
1749 wxFlexGridSizer *item1 =
new wxFlexGridSizer( 1, 0, 0, 0 );
1750 item1->AddGrowableCol( 1 );
1752 wxStaticBox *item3 =
new wxStaticBox( parent, -1,
wxT(
"IBIS Interactions") );
1753 wxStaticBoxSizer *item2 =
new wxStaticBoxSizer( item3, wxVERTICAL );
1756 wxFlexGridSizer *item4 =
new wxFlexGridSizer( 1, 0, 0, 0 );
1758 wxStaticText *item5 =
new wxStaticText( parent,
ID_TEXT_INT,
wxT(
"Interaction Type Filter"), wxDefaultPosition, wxDefaultSize, 0 );
1759 item4->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
1764 wxT(
"Protein-Protein"),
1765 wxT(
"Protein-NucAcid"),
1766 wxT(
"Protein-Chemical"),
1767 wxT(
"Protein-Peptide"),
1770 wxChoice *item6 =
new wxChoice( parent,
ID_C_TYPE, wxDefaultPosition, wxSize(100,-1), 6, strs6, 0 );
1771 item4->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
1773 item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
1775 wxListCtrl *item7 =
new wxListCtrl( parent,
ID_LC_INT, wxDefaultPosition, wxSize(450,150), wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1776 item2->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
1778 wxFlexGridSizer *item8 =
new wxFlexGridSizer( 3, 0, 0 );
1780 wxButton *item9 =
new wxButton( parent,
ID_B_ADD_INT,
wxT(
"Make IBIS Annotation"), wxDefaultPosition, wxDefaultSize, 0 );
1781 item8->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
1783 wxButton *item10 =
new wxButton( parent,
ID_B_LAUNCH_INT,
wxT(
"Launch"), wxDefaultPosition, wxDefaultSize, 0 );
1784 item8->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
1786 wxButton *item11 =
new wxButton( parent,
ID_B_HIGHLIGHT_INT,
wxT(
"Highlight"), wxDefaultPosition, wxDefaultSize, 0 );
1787 item8->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
1789 item2->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
1791 item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
1793 wxStaticBox *item13 =
new wxStaticBox( parent, -1,
wxT(
"Overlapping Annotations") );
1794 wxStaticBoxSizer *item12 =
new wxStaticBoxSizer( item13, wxVERTICAL );
1796 item12->Add( 20, 10, 0, wxALIGN_CENTER|wxALL, 5 );
1802 wxListBox *item14 =
new wxListBox( parent,
ID_LB_ANNOT, wxDefaultPosition, wxSize(275,100), 1, strs14, wxLB_SINGLE );
1803 item12->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 );
1805 wxFlexGridSizer *item15 =
new wxFlexGridSizer( 3, 0, 0 );
1809 wxT(
"IBIS Annotation"),
1810 wxDefaultPosition, wxDefaultSize, 0 );
1811 item15->Add( item16, 0, wxALIGN_CENTER|wxALL, 5 );
1816 wxDefaultPosition, wxDefaultSize, 0 );
1817 item15->Add( item17, 0, wxALIGN_CENTER|wxALL, 5 );
1822 wxDefaultPosition, wxDefaultSize, 0 );
1823 item15->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 );
1825 item12->Add( item15, 0, wxALIGN_CENTER|wxALL, 5 );
1827 wxFlexGridSizer *item19 =
new wxFlexGridSizer( 2, 0, 0 );
1830 wxT(
"Highlight Non-Overlap\n")
1831 wxT(
"of Annotation"),
1832 wxDefaultPosition, wxDefaultSize, 0 );
1833 item19->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 );
1836 wxT(
"Highlight Non-Overlap\n")
1837 wxT(
"of Interaction"),
1838 wxDefaultPosition, wxDefaultSize, 0 );
1839 item19->Add( item21, 0, wxALIGN_CENTER|wxALL, 5 );
1841 item12->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
1843 item1->Add( item12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1845 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
1849 parent->SetSizer( item0 );
1851 item0->SetSizeHints( parent );
User-defined methods of the data storage class.
User-defined methods of the data storage class.
bool GetAsnDataViaHTTPS(const std::string &host, const std::string &path, const std::string &args, ASNClass *asnObject, std::string *err, bool binaryData=true)
wxSizer * SetupIbisAnnotationDialog(wxWindow *parent, bool call_fit=TRUE, bool set_sizer=TRUE)
#define ID_B_HIGHLIGHT_NONOLAP_ANNOT
#define DECLARE_AND_FIND_WINDOW_RETURN_ON_ERR(var, id, type)
bool DoesInteractionMatchChoice(const wxString &choiceStr, IBISInteraction::eIbisInteractionType ibisIntType)
static const string IBIS_EVIDENCE_COMMENT
long GetFirstSelectedListCtrlItemId(const wxListCtrl &listCtrl)
static unsigned int GetSetIntersection(const SeqPosSet &set1, const SeqPosSet &set2, SeqPosSet &intersection)
void GetPositionsForAlignAnnot(const CAlign_annot &annot, SeqPosSet &positions, bool zeroBased)
#define ID_B_HIGHLIGHT_INT
#define ID_B_DELETE_ANNOT
void InsertItemInListView(int vecIndex, const CRef< IBISInteraction > &ibisInt, wxListCtrl &listCtrl)
wxSizer * ibisIntStaticBoxSizer
static bool GetInteractionDataFromIbis(CSeq_annot &ibisSeqAnnot, IbisQuery &query)
unsigned int GetAllSelectedListCtrlItemIds(const wxListCtrl &listCtrl, vector< long > &ids)
void InsertItemInReportView(int vecIndex, const CRef< IBISInteraction > &ibisInt, wxListCtrl &listCtrl)
#define ID_B_HIGHLIGHT_OLAP
#define ID_B_HIGHLIGHT_NONOLAP_INTN
#define ID_B_HIGHLIGHT_ANNOT
std::set< ncbi::TSeqPos > SeqPosSet
const BlockMultipleAlignment * GetCurrentMultipleAlignment(void) const
const Sequence * GetMaster(void) const
bool HighlightAlignedColumnsOfMasterRange(unsigned int from, unsigned int to) const
bool IsAligned(unsigned int row, unsigned int seqIndex) const
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
~IBISAnnotateDialog(void)
void DeleteAnnotation(void)
void HighlightAnnotation(int eventId)
void LaunchIbisWebPage(void)
void OnListCtrlSelection(wxListEvent &event)
void PopulateInteractionData(void)
void OnListBoxSelection(wxCommandEvent &event)
void GetAnnotIbisNonOverlaps(const IBISInteraction &interaction, const ncbi::objects::CAlign_annot &annot, SeqPosSet &nonOverlaps, bool onAnnotation) const
std::list< ncbi::CRef< ncbi::objects::CSeq_interval > > IntervalList
void MakeAnnotationFromInteraction(void)
void GetAnnotIbisOverlaps(AnnotIbisOverlapMap &aioMap) const
IBISAnnotateDialog ** dialogHandle
void HighlightInteraction(void)
void OnButton(wxCommandEvent &event)
std::vector< ncbi::CRef< IBISInteraction > > vecIbisInteractions
void SetupGUIControls(int selectInteraction, int selectAnnot, unsigned int updateFlags=eRemakeListCtrl|eRemakeListBox)
bool HighlightInterval(const ncbi::objects::CSeq_interval &interval)
bool HasInteractionData(void) const
std::map< unsigned long, AlignAnnotInfo > AnnotIbisOverlapMap
StructureSet * structureSet
unsigned int GetIntervalsForSet(const SeqPosSet &positions, IntervalList &intervals)
ncbi::CRef< ncbi::objects::CAlign_annot_set > annotSet
void OnChoice(wxCommandEvent &event)
void OnCloseWindow(wxCloseEvent &event)
static const MoleculeIdentifier * GetQueryMolecule()
IBISInteraction(const ncbi::objects::CSeq_feat &seqfeat)
eIbisInteractionType m_type
bool GetGi(TGi &gi) const
static std::string IbisIntTypeToString(eIbisInteractionType ibisType)
static bool QueryMoleculeHasChain()
static const Sequence * m_querySequence
static const MoleculeIdentifier * m_queryMolecule
static void SetQuerySequence(const Sequence *querySequence)
ncbi::objects::CSeq_feat m_seqfeat
const ncbi::objects::CSeq_loc & GetLocation(bool &isOK) const
static eIbisInteractionType CddIntTypeToIbisIntType(eCddInteractionType cddType)
static const int NOT_ASSIGNED
ncbi::CRef< ncbi::objects::CAlign_annot > ToAlignAnnot(void) const
static bool IsIbisIntType(int integer, eIbisInteractionType *ibisType=NULL)
@ eIbisProteinCombo_DNA_RNA
const SeqPosSet & GetPositions(void) const
bool GetFootprint(int &from, int &to) const
static const TGi GI_NOT_ASSIGNED
static eCddInteractionType IbisIntTypeToCddIntType(eIbisInteractionType ibisType)
bool RemoveAllHighlights(bool postRedraws)
bool MatchesSeqId(const ncbi::objects::CSeq_id &sid) const
static const int VALUE_NOT_SET
bool HasStructure(void) const
std::string ToString(void) const
void FillOutSeqId(ncbi::objects::CSeq_id *sid) const
const MoleculeIdentifier * identifier
unsigned int Length(void) const
static const unsigned int eUserAnnotationData
AlignmentManager * alignmentManager
void SetDataChanged(unsigned int what) const
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
Include a standard set of the NCBI C++ Toolkit most basic headers.
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
static const char location[]
unsigned int TSeqPos
Type for sequence locations and lengths.
bool Match(const CSeq_id &sid2) const
Match() - TRUE if SeqIds are equivalent.
void Reset(void)
Reset reference object.
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
static CTimeFormat GetPredefined(EPredefined fmt, TFlags flags=fDefault)
Get predefined format.
@ eCurrent
Use current time. See also CCurrentTime.
@ eISO8601_DateTimeMin
Y-M-DTh:m (eg 1997-07-16T19:20)
static const char label[]
const TDescription & GetDescription(void) const
Get the Description member data.
list< CRef< CFeature_evidence > > TEvidence
bool IsSetType(void) const
for typing annotated features 0 .
void SetLocation(TLocation &value)
Assign a value to Location data member.
const TLocation & GetLocation(void) const
Get the Location member data.
bool IsSetDescription(void) const
to hold descriptions/names like "Heme binding site" or "catalytic triad" etc., something that should ...
vector< CRef< CUser_field > > TData
void SetTo(TTo value)
Assign a value to To data member.
list< CRef< CSeq_interval > > Tdata
const Tdata & Get(void) const
Get the member data.
void SetId(TId &value)
Assign a value to Id data member.
TFrom GetFrom(void) const
Get the From member data.
void SetFrom(TFrom value)
Assign a value to From data member.
TGi GetGi(void) const
Get the variant data.
bool IsPacked_int(void) const
Check if variant Packed_int is selected.
bool IsGi(void) const
Check if variant Gi is selected.
TTo GetTo(void) const
Get the To member data.
bool IsInt(void) const
Check if variant Int is selected.
const TInt & GetInt(void) const
Get the variant data.
const TPacked_int & GetPacked_int(void) const
Get the variant data.
virtual void Reset(void)
Reset the whole object.
const TFtable & GetFtable(void) const
Get the variant data.
list< CRef< CSeq_feat > > TFtable
bool IsFtable(void) const
Check if variant Ftable is selected.
const TData & GetData(void) const
Get the Data member data.
unsigned int
A callback function used to compare two keys in a database.
Messenger * GlobalMessenger(void)
double value_type
The numeric datatype used by the parser.
const struct ncbi::grid::netcache::search::fields::SIZE size
#define TRUE
bool replacment for C indicating true.
std::vector< SeqPosSet > overlaps
string ToString(const wxRect &rc)