Пример #1
0
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();
}
Пример #2
0
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();
}
Пример #3
0
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();
}
Пример #4
0
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();
}
bool PcrOptionsPanelSavableTab::childValueIsAcceptable(const QString &childId, const QVariant &value) const {
    if (PCR_PRODUCTS_TABLE_NAME == childId) {
        const AdvContextPcrProductPair data = value.value<AdvContextPcrProductPair>();

        AnnotatedDNAView *dnaView = originalWrappedWidget->getDnaView();
        SAFE_POINT(NULL != dnaView, "Invalid sequence view detected", false);

        return dnaView->getSequenceContexts().contains(data.first);
    } else {
        return U2SavableWidget::childValueIsAcceptable(childId, value);
    }
}
Пример #6
0
void ADVGlobalAction::updateState() {
    AnnotatedDNAView* av = qobject_cast<AnnotatedDNAView*>(getObjectView());
    ADVSequenceWidget* w = av->getSequenceWidgetInFocus();
    bool enabled = w!=NULL;
    if (enabled && flags.testFlag(ADVGlobalActionFlag_SingleSequenceOnly) && qobject_cast<ADVSingleSequenceWidget*>(w) == NULL) {
        enabled = false;
    }
    if (enabled && !alphabetFilter.isEmpty()) {
        DNAAlphabetType t = w->getActiveSequenceContext()->getAlphabet()->getType();
        enabled = alphabetFilter.contains(t);
    }
    setEnabled(enabled);
}
Пример #7
0
void ChromaViewContext::sl_showChromatogram() {
    ChromaViewAction* a = qobject_cast<ChromaViewAction*>(sender());
    CHECK(a!=NULL, );
    ADVSingleSequenceWidget* sw = qobject_cast<ADVSingleSequenceWidget*>(a->seqWidget);
    DNAChromatogramObject* chromaObj = findChromaObj(sw);
    CHECK(sw->getSequenceContext(), );
    AnnotatedDNAView *adv = sw->getSequenceContext()->getAnnotatedDNAView();
    CHECK(adv, );
    if (a->isChecked()) {
        CHECK(a->view == NULL, );
        CHECK(chromaObj!=NULL, );
        adv->addObject(chromaObj);
        a->view = new ChromatogramView(sw, sw->getSequenceContext(), sw->getPanGSLView(), chromaObj->getChromatogram());
        sw->addSequenceView(a->view);
    } else {
Пример #8
0
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();
}
Пример #9
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();
}
Пример #10
0
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);
        }