void EnzymesPlugin::sl_onOpenCreateFragmentDialog() { GObjectViewWindow* w = GObjectViewUtils::getActiveObjectViewWindow(); if (w == NULL) { QMessageBox::information(QApplication::activeWindow(), openCreateFragmentDialog->text(), tr("There is no active sequence object.\nTo create fragment open sequence document.")); return; } AnnotatedDNAView* view = qobject_cast<AnnotatedDNAView*>(w->getObjectView()); if (view == NULL) { QMessageBox::information(QApplication::activeWindow(), openCreateFragmentDialog->text(), tr("There is no active sequence object.\nTo create fragment open sequence document.")); return; } U2SequenceObject* dnaObj = view->getSequenceInFocus()->getSequenceObject(); assert(dnaObj != NULL); if (!dnaObj->getAlphabet()->isNucleic()) { QMessageBox::information(QApplication::activeWindow(), openCreateFragmentDialog->text(), tr("The sequence doesn't have nucleic alphabet, it can not be used in cloning.")); return; } QObjectScopedPointer<CreateFragmentDialog> dlg = new CreateFragmentDialog(view->getSequenceInFocus(), QApplication::activeWindow()); dlg->exec(); }
void EnzymesPlugin::sl_onOpenDigestSequenceDialog() { GObjectViewWindow* w = GObjectViewUtils::getActiveObjectViewWindow(); if (w == NULL) { QMessageBox::information(QApplication::activeWindow(), openDigestSequenceDialog->text(), tr("There is no active sequence object.\nTo start partition open sequence document.")); return; } AnnotatedDNAView* view = qobject_cast<AnnotatedDNAView*>(w->getObjectView()); if (view == NULL) { QMessageBox::information(QApplication::activeWindow(), openDigestSequenceDialog->text(), tr("There is no active sequence object.\nTo start partition open sequence document.")); return; } if (!view->getSequenceInFocus()->getSequenceObject()->getAlphabet()->isNucleic()) { QMessageBox::information(QApplication::activeWindow(), openDigestSequenceDialog->text(), tr("Can not digest into fragments non-nucleic sequence.")); return; } QObjectScopedPointer<DigestSequenceDialog> dlg = new DigestSequenceDialog(view->getSequenceInFocus(), QApplication::activeWindow()); dlg->exec(); }
void SecStructPredictViewAction::sl_execute() { QAction *a = dynamic_cast<QAction*>(sender()); GObjectViewAction *viewAction = dynamic_cast<GObjectViewAction*>(a); SAFE_POINT(NULL != viewAction, "NULL action",); AnnotatedDNAView *av = qobject_cast<AnnotatedDNAView*>(viewAction->getObjectView()); SAFE_POINT(NULL != av, "NULL dna view",); SecStructPredictAlgRegistry *sspar = AppContext::getSecStructPredictAlgRegistry(); SAFE_POINT(NULL != sspar, "NULL SecStructPredictAlgRegistry",); if (sspar->getAlgNameList().isEmpty()) { QMessageBox::information(av->getWidget(), tr("Secondary Structure Prediction"), tr("No algorithms for secondary structure prediction are available.\nPlease, load the corresponding plugins.")); return; } ADVSequenceObjectContext *seqCtx = av->getSequenceInFocus(); SAFE_POINT(NULL != seqCtx, "NULL sequence context",); SAFE_POINT(NULL != seqCtx->getAlphabet(), "NULL alphabet",); SAFE_POINT(seqCtx->getAlphabet()->isAmino(), "Wrong alphabet",); QObjectScopedPointer<SecStructDialog> secStructDialog = new SecStructDialog(seqCtx, av->getWidget()); secStructDialog->exec(); }
void EnzymesADVContext::sl_search() { GObjectViewAction* action = qobject_cast<GObjectViewAction*>(sender()); assert(action!=NULL); AnnotatedDNAView* av = qobject_cast<AnnotatedDNAView*>(action->getObjectView()); assert(av!=NULL); ADVSequenceObjectContext* seqCtx = av->getSequenceInFocus(); assert(seqCtx->getAlphabet()->isNucleic()); QObjectScopedPointer<FindEnzymesDialog> d = new FindEnzymesDialog(seqCtx); d->exec(); }
void uHMMPlugin::sl_search() { //to select a sequence //1. check that annotated DNA view is active //2. if not -> check that DNASequence object is selected in project view U2SequenceObject* obj = NULL; MWMDIWindow* w = AppContext::getMainWindow()->getMDIManager()->getActiveWindow(); if (w!=NULL) { GObjectViewWindow* ow = qobject_cast<GObjectViewWindow*>(w); if (ow!=NULL) { GObjectView* ov = ow->getObjectView(); AnnotatedDNAView* av = qobject_cast<AnnotatedDNAView*>(ov); if (av!=NULL) { ADVSequenceObjectContext* seqCtx = av->getSequenceInFocus(); obj = seqCtx->getSequenceObject(); } } } if (obj == NULL) { ProjectView* pv = AppContext::getProjectView(); if (pv!=NULL) { const GObjectSelection* sel = pv->getGObjectSelection(); GObject* o = sel->getSelectedObjects().size() == 1 ? sel->getSelectedObjects().first() : NULL; obj = qobject_cast<U2SequenceObject*>(o); } } QWidget *p = (QWidget*)AppContext::getMainWindow()->getQMainWindow(); if (obj == NULL) { QMessageBox::critical(p, tr("Error"), tr("Error! Select sequence in Project view or open sequence view.")); return; } U2OpStatusImpl os; DNASequence sequence = obj->getWholeSequence(os); CHECK_OP_EXT(os, QMessageBox::critical(QApplication::activeWindow(), L10N::errorTitle(), os.getError()), ); QObjectScopedPointer<HMMSearchDialogController> d = new HMMSearchDialogController(sequence, obj, p); d->exec(); }
void HMMADVContext::sl_search() { GObjectViewAction* action = qobject_cast<GObjectViewAction*>(sender()); assert(action!=NULL); AnnotatedDNAView* av = qobject_cast<AnnotatedDNAView*>(action->getObjectView()); assert(av!=NULL); QWidget *p; if (av->getWidget()){ p = av->getWidget(); }else{ p = (QWidget*)AppContext::getMainWindow()->getQMainWindow(); } ADVSequenceObjectContext* seqCtx = av->getSequenceInFocus(); if(seqCtx == NULL) { QMessageBox::critical(p, tr("Error"), tr("No sequences found")); return; } U2OpStatusImpl os; DNASequence sequence = seqCtx->getSequenceObject()->getWholeSequence(os); CHECK_OP_EXT(os, QMessageBox::critical(QApplication::activeWindow(), L10N::errorTitle(), os.getError()), ); QObjectScopedPointer<HMMSearchDialogController> d = new HMMSearchDialogController(sequence, seqCtx->getSequenceObject(), p); d->exec(); }
void EnzymesADVContext::buildMenu(GObjectView *v, QMenu *m) { AnnotatedDNAView *av = qobject_cast<AnnotatedDNAView *>(v); SAFE_POINT(NULL != av, "Invalid sequence view",); CHECK(av->getSequenceInFocus()->getAlphabet()->isNucleic(),); QMenu *cloningMenu = new QMenu(tr("Cloning"), m); cloningMenu->menuAction()->setObjectName("Cloning"); cloningMenu->addActions(cloningActions); QAction *exportMenuAction = GUIUtils::findAction(m->actions(), ADV_MENU_EXPORT); m->insertMenu(exportMenuAction, cloningMenu); if (!av->getAnnotationsSelection()->getSelection().isEmpty()) { Annotation *a = av->getAnnotationsSelection()->getSelection().first().annotation; const QString annName = a->getName(); const QString groupName = a->getGroup()->getName(); const int annCount = a->getGroup()->getAnnotations().size(); if (annName == PRIMER_ANNOTATION_NAME && groupName.startsWith(PRIMER_ANNOTATION_GROUP_NAME) && 2 == annCount) { QAction *a = findViewAction(v, CREATE_PCR_PRODUCT_ACTION_NAME); SAFE_POINT(NULL != a, "Invalid menu action",); cloningMenu->addAction(a); }