QStringList GTUtilsMSAEditorSequenceArea::getNameList(HI::GUITestOpStatus &os) {

    QMainWindow* mw = AppContext::getMainWindow()->getQMainWindow();
    MSAEditor* editor = mw->findChild<MSAEditor*>();
    CHECK_SET_ERR_RESULT(editor != NULL, "MsaEditor not found", QStringList());

    QStringList result = editor->getMSAObject()->getMAlignment().getRowNames();

    return result;
}
Beispiel #2
0
void DNAStatMSAEditorContext::buildMenu(GObjectView* v, QMenu* m) {
    MSAEditor* msaed = qobject_cast<MSAEditor*>(v);
    if (msaed != NULL && !msaed->getMaObject())
        return;

    QList<GObjectViewAction *> actions = getViewActions(v);
    QMenu* statMenu = GUIUtils::findSubMenu(m, MSAE_MENU_STATISTICS);
    SAFE_POINT(statMenu != NULL, "statMenu", );
    foreach(GObjectViewAction* a, actions) {
        statMenu->addAction(a);
    }
Beispiel #3
0
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);
}
Beispiel #4
0
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(), );
    }
}
Beispiel #5
0
void HMMMSAEditorContext::buildMenu(GObjectView* v, QMenu* m) {
    MSAEditor* msaed = qobject_cast<MSAEditor*>(v);
    assert( NULL != msaed && NULL != m );
    if (msaed->getMSAObject() == NULL)
        return;

    QList<GObjectViewAction*> list = getViewActions(v);
    assert(list.size()==1);
    GObjectViewAction* a = list.first();
    QMenu* aMenu = GUIUtils::findSubMenu(m, MSAE_MENU_ADVANCED);
    SAFE_POINT(aMenu != NULL, "aMenu", );
    aMenu->addAction(a);
}
bool GTUtilsMSAEditorSequenceArea::isSequenceSelected(HI::GUITestOpStatus &os, const QString &seqName) {
    MSAEditorSequenceArea *msaEditArea = qobject_cast<MSAEditorSequenceArea*>
            (GTWidget::findWidget(os, "msa_editor_sequence_area"));
    CHECK_SET_ERR_RESULT(msaEditArea != NULL, "MsaEditorSequenceArea not found", false);

    QMainWindow* mw = AppContext::getMainWindow()->getQMainWindow();
    MSAEditor* editor = mw->findChild<MSAEditor*>();
    CHECK_SET_ERR_RESULT(editor != NULL, "MsaEditor not found", false);
//Seq names are drawn on widget, so this hack is needed
    U2Region selectedRowsRegion = msaEditArea->getSelectedRows();
    QStringList selectedRowNames;
    for(int x = selectedRowsRegion.startPos; x < selectedRowsRegion.endPos(); x++)
        selectedRowNames.append(editor->getMSAObject()->getRow(x).getName());

    if (selectedRowNames.contains(seqName)) {
        return true;
    }
    return false;
}
QStringList GTUtilsMSAEditorSequenceArea::getVisibleNames(HI::GUITestOpStatus &os){
    Q_UNUSED(os);
    QMainWindow* mw = AppContext::getMainWindow()->getQMainWindow();
    MSAEditor* editor = mw->findChild<MSAEditor*>();
    CHECK_SET_ERR_RESULT(editor != NULL, "MsaEditor not found", QStringList());

    MSAEditorSequenceArea* seqArea = editor->getUI()->getSequenceArea();
    CHECK_SET_ERR_RESULT(NULL != seqArea, "MSA Editor sequence area is NULL", QStringList());

    int startSeq = seqArea->getFirstVisibleSequence();
    int lastSeq = seqArea->getLastVisibleSequence(true);
    QVector<U2Region> rows;
    editor->getUI()->getCollapseModel()->getVisibleRows(startSeq, lastSeq, rows);

    QStringList visiableRowNames;
    foreach(U2Region region, rows){
        for(int x = region.startPos; x < region.endPos(); x++)
            visiableRowNames.append(editor->getMSAObject()->getRow(x).getName());
    }

    return visiableRowNames;
}
Beispiel #8
0
void uHMMPlugin::sl_build() {
    MAlignment ma;

    //try to find alignment check that MSA Editor is active
    QString profileName;
    MWMDIWindow* w = AppContext::getMainWindow()->getMDIManager()->getActiveWindow();
    if (w!=NULL) {
        GObjectViewWindow* ow = qobject_cast<GObjectViewWindow*>(w);
        if (ow!=NULL) {
            GObjectView* ov = ow->getObjectView();
            MSAEditor* av = qobject_cast<MSAEditor*>(ov);
            if (av!=NULL) {
                MAlignmentObject* maObj = av->getMSAObject();
                if (maObj!=NULL) {
                    ma = maObj->getMAlignment();
                    profileName = maObj->getGObjectName() == MA_OBJECT_NAME ? maObj->getDocument()->getName() : maObj->getGObjectName();
                }
            }
        }
    }
    QWidget *p = (QWidget*)AppContext::getMainWindow()->getQMainWindow();
    QObjectScopedPointer<HMMBuildDialogController> d = new HMMBuildDialogController(profileName, ma, p);
    d->exec();
}