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();
}
Esempio n. 2
0
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();
}