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 EnzymesADVContext::initViewContext(GObjectView* view) { AnnotatedDNAView* av = qobject_cast<AnnotatedDNAView*>(view); ADVGlobalAction* a = new ADVGlobalAction(av, QIcon(":enzymes/images/enzymes.png"), tr("Find restriction sites..."), 50); a->setObjectName("Find restriction sites"); a->addAlphabetFilter(DNAAlphabet_NUCL); connect(a, SIGNAL(triggered()), SLOT(sl_search())); GObjectViewAction *createPCRProductAction = new GObjectViewAction(av, av, tr("Create PCR product...")); createPCRProductAction->setObjectName(CREATE_PCR_PRODUCT_ACTION_NAME); connect(createPCRProductAction, SIGNAL(triggered()), SLOT(sl_createPCRProduct())); addViewAction(createPCRProductAction); }
void HMMMSAEditorContext::initViewContext(GObjectView* view) { MSAEditor* msaed = qobject_cast<MSAEditor*>(view); assert(msaed!=NULL); if (msaed->getMSAObject() == NULL) return; GObjectViewAction* a = new GObjectViewAction(this, view, tr("Build HMMER2 profile")); a->setObjectName("Build HMMER2 profile"); a->setIcon(QIcon(":/hmm2/images/hmmer_16.png")); connect(a, SIGNAL(triggered()), SLOT(sl_build())); addViewAction(a); }
void HMMMSAEditorContext::sl_build() { GObjectViewAction* action = qobject_cast<GObjectViewAction*>(sender()); assert(action!=NULL); MSAEditor* ed = qobject_cast<MSAEditor*>(action->getObjectView()); assert(ed!=NULL); MAlignmentObject* obj = ed->getMSAObject(); if (obj) { QString profileName = obj->getGObjectName() == MA_OBJECT_NAME ? obj->getDocument()->getName() : obj->getGObjectName(); QObjectScopedPointer<HMMBuildDialogController> d = new HMMBuildDialogController(profileName, obj->getMAlignment()); d->exec(); CHECK(!d.isNull(), ); } }
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(); }