Beispiel #1
0
void DnaAssemblySupport::sl_showDnaAssemblyDialog()
{
    DnaAssemblyAlgRegistry* registry = AppContext::getDnaAssemblyAlgRegistry();
    if (registry->getRegisteredAlgorithmIds().isEmpty()) {
        QMessageBox::information(QApplication::activeWindow(), tr("DNA Assembly"),
            tr("There are no algorithms for DNA assembly available.\nPlease, check your plugin list.") );
        return;
    }

    QObjectScopedPointer<DnaAssemblyDialog> dlg = new DnaAssemblyDialog(QApplication::activeWindow());
    dlg->exec();
    CHECK(!dlg.isNull(), );

    if (QDialog::Accepted == dlg->result()) {
        DnaAssemblyToRefTaskSettings s;
        s.samOutput = dlg->isSamOutput();
        s.refSeqUrl = dlg->getRefSeqUrl();
        s.algName = dlg->getAlgorithmName();
        s.resultFileName = dlg->getResultFileName();
        s.setCustomSettings(dlg->getCustomSettings());
        s.shortReadSets = dlg->getShortReadSets();
        s.pairedReads = dlg->isPaired();
        s.openView = true;
        s.prebuiltIndex = dlg->isPrebuiltIndex();
        Task* assemblyTask = new DnaAssemblyTaskWithConversions(s, true);
        AppContext::getTaskScheduler()->registerTopLevelTask(assemblyTask);
    }
}
void SharedConnectionsDialog::sl_editClicked() {
    const QString dbiUrl = ui->lwConnections->currentItem()->data(UrlRole).toString();
    const QString userName = ui->lwConnections->currentItem()->data(LoginRole).toString();
    const QString connectionName = ui->lwConnections->currentItem()->text();

    QObjectScopedPointer<EditConnectionDialog> editDialog = new EditConnectionDialog(this, dbiUrl, userName, connectionName);
    editDialog->setReadOnly(U2DbiUtils::PUBLIC_DATABASE_URL == U2DbiUtils::createFullDbiUrl(userName, dbiUrl));
    const int dialogResult = editDialog->exec();
    CHECK(!editDialog.isNull(), );

    if (QDialog::Accepted == dialogResult) {
        QListWidgetItem* item = ui->lwConnections->currentItem();
        const QString login = editDialog->getUserName();
        const QString shortDbUrl = editDialog->getShortDbiUrl();

        checkDbConnectionDuplicate(shortDbUrl, login, item->data(Qt::DisplayRole).toString());

        if (connectionName != editDialog->getName()) {
            removeRecentConnection(item);
        }

        item->setText(editDialog->getName());
        item->setData(UrlRole, shortDbUrl);
        item->setData(LoginRole, login);

        connectionTasks.remove(item);
        findUpgradeTasks();

        saveRecentConnection(item);
        updateState();
    }
}
void CollocationsDialogController::sl_saveClicked() {
    assert(resultsList->count() > 0);

    CreateAnnotationModel m;
    m.sequenceObjectRef = ctx->getSequenceGObject();
    m.hideLocation = true;
    m.useAminoAnnotationTypes = ctx->getAlphabet()->isAmino();
    m.sequenceLen = ctx->getSequenceObject()->getSequenceLength();

    QObjectScopedPointer<CreateAnnotationDialog> d = new CreateAnnotationDialog(this, m);
    const int rc = d->exec();
    CHECK(!d.isNull(), );

    if (rc != QDialog::Accepted) {
        return;
    }
    QList<SharedAnnotationData> list;
    for (int i=0, n = resultsList->count(); i<n; ++i) {
        CDCResultItem* item = static_cast<CDCResultItem*>(resultsList->item(i));
        SharedAnnotationData data = m.data;
        data->location->regions.append(item->r);
        data->setStrand(U2Strand::Direct);
        U1AnnotationUtils::addDescriptionQualifier(data, m.description);
        list.append(data);
    }

    ADVCreateAnnotationsTask* t = new ADVCreateAnnotationsTask(ctx->getAnnotatedDNAView(), m.getAnnotationObject(), m.groupName, list);
    AppContext::getTaskScheduler()->registerTopLevelTask(t);
}
void EditMarkerGroupDialog::sl_onEditButtonClicked() {
    QItemSelectionModel *m = table->selectionModel();
    QModelIndexList selected = m->selectedRows();
    if (1 != selected.size()) {
        return;
    }

    QMap<QString, QString>::iterator i = marker->getValues().begin();
    i += selected.first().row();
    QVariantList values;
    MarkerUtils::stringToValue(MarkerTypes::getDataTypeById(marker->getType()),marker->getValues().key(*i), values);
    QObjectScopedPointer<EditMarkerDialog> dlg = new EditMarkerDialog(false, marker->getType(), *i, values, this);

    const int dialogResult = dlg->exec();
    CHECK(!dlg.isNull(), );

    if (QDialog::Accepted == dialogResult) {
        QString newValueString;
        QString newName = dlg->getName();

        MarkerUtils::valueToString(MarkerTypes::getDataTypeById(marker->getType()), dlg->getValues(), newValueString);
        markerModel->removeRows(selected.first().row(), 1, selected.first());
        markerModel->addMarker(newValueString, newName);
    }
}
void PrimerGroupBox::sl_browse() {
    QObjectScopedPointer<PrimerLibrarySelector> dlg = new PrimerLibrarySelector(AppContext::getMainWindow()->getQMainWindow());
    dlg->exec();
    CHECK(!dlg.isNull(), );
    CHECK(QDialog::Accepted == dlg->result(), );
    Primer result = dlg->getResult();
    primerEdit->setInvalidatedText(result.sequence);
}
void TrimmomaticPropertyWidget::sl_showDialog() {
    QObjectScopedPointer<TrimmomaticPropertyDialog> dialog
                            (new TrimmomaticPropertyDialog(lineEdit->text(), this));
    if (QDialog::Accepted == dialog->exec()) {
        CHECK(!dialog.isNull(), );
        lineEdit->setText(dialog->getValue());
        emit si_valueChanged(value());
    }
Beispiel #7
0
void DnaAssemblySupport::sl_showConvertToSamDialog() {
    QObjectScopedPointer<ConvertAssemblyToSamDialog> dlg = new ConvertAssemblyToSamDialog(QApplication::activeWindow());
    dlg->exec();
    CHECK(!dlg.isNull(), );

    if (QDialog::Accepted == dlg->result()) {
        Task *convertTask = new ConvertAssemblyToSamTask(dlg->getDbFileUrl(), dlg->getSamFileUrl());
        AppContext::getTaskScheduler()->registerTopLevelTask(convertTask);
    }
}
void ImportAnnotationsFromCSVDialog::configureColumn(int column) {
    assert(column >= 0 && column < columnsConfig.size());

    const ColumnConfig& config = columnsConfig.at(column);
    QObjectScopedPointer<CSVColumnConfigurationDialog> d = new CSVColumnConfigurationDialog(this, config);
    int rc = d->exec(); // TODO: set dialog position close to the header item
    CHECK(!d.isNull(), );
    if (rc == QDialog::Accepted) {
        columnsConfig[column] = d->config;
    }
    previewTable->horizontalHeaderItem(column)->setText(getHeaderItemText(column));
}
void DotPlotDialog::sl_invertedColorButton() {
    QObjectScopedPointer<QColorDialog> d = new QColorDialog(invertedColor, this);
    d->exec();
    CHECK(!d.isNull(), );

    if (QDialog::Accepted == d->result()) {
        invertedColor = d->selectedColor();
        invertedCheckBox->setChecked(true);
    }

    updateColors();
}
Beispiel #10
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(), );
    }
}
bool CreatePhyTreeDialogController::checkLicense() {
    if (settings.algorithmId == "PHYLIP Neighbor Joining") { // This is a bad hack :(
        QList<Plugin *> plugins = AppContext::getPluginSupport()->getPlugins();
        foreach (Plugin *plugin, plugins) {
            if (plugin->getName() == "PHYLIP") {
                if (!plugin->isLicenseAccepted()) {
                    QObjectScopedPointer<LicenseDialog> licenseDialog = new LicenseDialog(plugin);
                    const int ret = licenseDialog->exec();
                    CHECK(!licenseDialog.isNull(), false);
                    return (ret == QDialog::Accepted);
                }
            }
        }
    }
void SharedConnectionsDialog::sl_addClicked() {
    QObjectScopedPointer<EditConnectionDialog> editDialog = new EditConnectionDialog(this);
    const int dialogResult = editDialog->exec();
    CHECK(!editDialog.isNull(), );

    if (QDialog::Accepted == dialogResult) {
        checkDbConnectionDuplicate(editDialog->getShortDbiUrl(), editDialog->getUserName());
        QListWidgetItem* item = insertConnection(editDialog->getName(), editDialog->getShortDbiUrl(), editDialog->getUserName());
        CHECK(NULL != item, );
        ui->lwConnections->setCurrentItem(item);
        saveRecentConnection(item);
        findUpgradeTasks();
        updateState();
    }
void EditMarkerGroupDialog::sl_onAddButtonClicked() {
    QObjectScopedPointer<EditMarkerDialog> dlg = new EditMarkerDialog(true, marker->getType(), "", QVariantList(), this);

    const int dialogResult = dlg->exec();
    CHECK(!dlg.isNull(), );

    if (QDialog::Accepted == dialogResult) {
        QString valueString;
        QString name = dlg->getName();

        MarkerUtils::valueToString(MarkerTypes::getDataTypeById(marker->getType()), dlg->getValues(), valueString);
        markerModel->addMarker(valueString, name);
    }
}
void AddNewDocumentDialogController::run(QWidget* p, AddNewDocumentDialogModel& m, const DocumentFormatConstraints& c) {
    Project* proj = AppContext::getProject();
    if (proj->isStateLocked()) {
        QMessageBox::critical(NULL, L10N::errorTitle(), AddNewDocumentDialogImpl::tr("Project is locked"));
        m.successful = false;
        return;
    }

    QObjectScopedPointer<AddNewDocumentDialogImpl> d = new AddNewDocumentDialogImpl(p, m, c);
    d->exec();
    CHECK(!d.isNull(), );

    m = d->model;
    assert(proj->findDocumentByURL(m.url) == NULL);
}
void MSAOverviewContextMenu::sl_colorActionTriggered() {
    QObjectScopedPointer<QColorDialog> colorDialog = new QColorDialog(graphOverview->getCurrentColor(), this);
#ifdef Q_OS_MAC
    if (qgetenv("UGENE_GUI_TEST").toInt() == 1 && qgetenv("UGENE_USE_NATIVE_DIALOGS").toInt() == 0) {
        colorDialog->setOption(QColorDialog::DontUseNativeDialog);
    }
#endif

    colorDialog->exec();
    CHECK(!colorDialog.isNull(), );

    if (QDialog::Accepted == colorDialog->result()) {
        emit si_colorSelected(colorDialog->selectedColor());
    }
}
bool CreatePhyTreeDialogController::checkMemory() {
    SAFE_POINT(NULL != settingsWidget, "Settings widget is NULL", false);

    QString msg;
    const bool memCheckOk = settingsWidget->checkMemoryEstimation(msg, msa, settings);

    if (!memCheckOk) {
        QObjectScopedPointer<QMessageBox> mb = new QMessageBox(QMessageBox::Warning, tr("Warning"), msg, QMessageBox::Ok|QMessageBox::Cancel, this);
        mb->exec();
        CHECK(!mb.isNull(), false);

        return (mb->result() == QMessageBox::Ok);
    }

    return true;
}
RemoteMachineSettingsPtr RemoteMachineMonitorDialogController::selectRemoteMachine(
    RemoteMachineMonitor* monitor, bool runTaskMode /* = false */ )
{
    QObjectScopedPointer<RemoteMachineMonitorDialogImpl> dlg = new RemoteMachineMonitorDialogImpl(QApplication::activeWindow(), monitor, runTaskMode);
    const int ret = dlg->exec();
    CHECK(!dlg.isNull(), RemoteMachineSettingsPtr());

    if(ret == QDialog::Rejected) {
        return RemoteMachineSettingsPtr();
    }
    assert(ret == QDialog::Accepted);

    RemoteMachineSettingsPtr rms = dlg->getSelectedMachine();
    if (runTaskMode && !rms) {
        QMessageBox::critical(QApplication::activeWindow(),
            RemoteMachineMonitorDialogImpl::tr("Selecting machines error!"),
            RemoteMachineMonitorDialogImpl::tr("You didn't select a machine to run remote task!"));
    }
    return rms;
}
void RemoteMachineMonitorDialogImpl::sl_modifyPushButtonClicked() {
    assert( 1 == topLevelItemsSelectedNum() );
    int row = getSelectedTopLevelRow();
    assert( 0 <= row && row < machinesItemsByOrder.size() );

    QObjectScopedPointer<RemoteMachineSettingsDialog> settingsDlg = new RemoteMachineSettingsDialog(this, machinesItemsByOrder.at(row).settings);
    const int rc = settingsDlg->exec();
    CHECK(!settingsDlg.isNull(), );

    if( QDialog::Rejected == rc ) {
        return;
    }

    RemoteMachineSettingsPtr newMachine = settingsDlg->getMachineSettings();
    if( NULL == newMachine ) {
        return;
    }

    removeDialogItemAt( row );
    addMachineSettings( newMachine, true );
}
Beispiel #19
0
void BAMImporterTask::initPrepareToImportTask() {
    GUrl srcUrl = loadInfoTask->getSourceUrl();

    isSqliteDbTransit = hintedDbiRef.isValid() && SQLITE_DBI_ID != hintedDbiRef.dbiFactoryId;
    if (!isSqliteDbTransit) {
        localDbiRef = U2DbiRef(SQLITE_DBI_ID, srcUrl.dirPath() + QDir::separator() + srcUrl.fileName() + ".ugenedb");
    } else {
        const QString tmpDir = AppContext::getAppSettings()->getUserAppsSettings()->getCurrentProcessTemporaryDirPath("assembly_conversion") + QDir::separator();
        QDir().mkpath(tmpDir);

        const QString pattern = tmpDir + "XXXXXX.ugenedb";
        QTemporaryFile *tempLocalDb = new QTemporaryFile(pattern, this);

        tempLocalDb->open();
        const QString filePath = tempLocalDb->fileName();
        tempLocalDb->close();

        SAFE_POINT_EXT(QFile::exists(filePath), setError(tr("Can't create a temporary database")), );

        localDbiRef = U2DbiRef(SQLITE_DBI_ID, filePath);
    }

    QString refUrl;
    bool convert = true;
    if (useGui) {
        QObjectScopedPointer<ConvertToSQLiteDialog> convertDialog = new ConvertToSQLiteDialog(loadInfoTask->getSourceUrl(), loadInfoTask->getInfo(), loadInfoTask->isSam());
        convertDialog->hideAddToProjectOption();
        const int rc = convertDialog->exec();
        CHECK_EXT(!convertDialog.isNull(), setError("NULL dialog"), );

        if (rc == QDialog::Accepted) {
            localDbiRef = U2DbiRef(SQLITE_DBI_ID, convertDialog->getDestinationUrl().getURLString());
            refUrl = convertDialog->getReferenceUrl();

        } else {
            convert = false;
            stateInfo.setCanceled(true);
        }
    } else if (loadInfoTask->isSam() && loadInfoTask->getInfo().getHeader().getReferences().isEmpty()) {
Beispiel #20
0
void DnaAssemblySupport::sl_showGenomeAssemblyDialog() {
    GenomeAssemblyAlgRegistry* registry = AppContext::getGenomeAssemblyAlgRegistry();
    if (registry->getRegisteredAlgorithmIds().isEmpty()) {
        QMessageBox::information(QApplication::activeWindow(), tr("Genome Assembly"),
            tr("There are no algorithms for genome assembly available.\nPlease, check external tools in the settings.") );
        return;
    }

    QObjectScopedPointer<GenomeAssemblyDialog> dlg = new GenomeAssemblyDialog(QApplication::activeWindow());
    dlg->exec();
    CHECK(!dlg.isNull(), );

    if (QDialog::Accepted == dlg->result()) {
        GenomeAssemblyTaskSettings s;
        s.algName = dlg->getAlgorithmName();
        s.outDir = dlg->getOutDir();
        s.setCustomSettings(dlg->getCustomSettings());
        s.reads = dlg->getReads();
        s.openView = true;
        Task* assemblyTask = new GenomeAssemblyMultiTask(s);
        AppContext::getTaskScheduler()->registerTopLevelTask(assemblyTask);
    }
}
void ImportAnnotationsFromCSVDialog::sl_scriptSeparatorClicked() {
    if (parsingScript.isEmpty()) {
        lastUsedSeparator = separatorEdit->text();
    }
    QObjectScopedPointer<ScriptEditorDialog> d = new ScriptEditorDialog(this, scriptHeader);
    if (!parsingScript.isEmpty()) {
        d->setScriptText(parsingScript);
    } else { //set sample script
        QString l1 = "var firstColumn = ["+ReadCSVAsAnnotationsTask::LINE_NUM_VAR+"];\n";
        QString l2 = "var otherColumns = "+ReadCSVAsAnnotationsTask::LINE_VAR+".split(\" \");\n";
        QString l3 = "result =firstColumn.concat(otherColumns);";
        d->setScriptText(l1 + l2 + l3);
    }

    const int rc = d->exec();
    CHECK(!d.isNull(), );

    if (rc != QDialog::Accepted) {
        return;
    }
    parsingScript = d->getScriptText();
    separatorEdit->setText(lastUsedSeparator);
}
void RemoteMachineMonitorDialogImpl::sl_addPushButtonClicked() {

    QList< ProtocolInfo* > protoInfos = AppContext::getProtocolInfoRegistry()->getProtocolInfos();
    if (protoInfos.size() < 1) {
        QMessageBox::information(this, tr("Add remote macnine"), tr("No protocols for distributed computing are found.\nPlease check your plugin list."));
        return;
    }

    QObjectScopedPointer<RemoteMachineSettingsDialog> settingsDlg = new RemoteMachineSettingsDialog(this);
    const int rc = settingsDlg->exec();
    CHECK(!settingsDlg.isNull(), );

    if( QDialog::Rejected == rc ) {
        return;
    }
    assert( QDialog::Accepted == rc );

    RemoteMachineSettingsPtr newMachine = settingsDlg->getMachineSettings();
    if( NULL == newMachine ) {
        return;
    }
    addMachineSettings( newMachine, true );

}
void SendSelectionDialog::sl_OK() {
    QString error = ca_c->validate();
    if (!error.isEmpty()) {
        QMessageBox::critical(NULL, tr("Error"), error);
        return;
    }
    retries = retrySpinBox->value();
    db = dataBase->currentText();
    if(db!="cdd") {
        requestParameters = "CMD=Put";
        addParametr(requestParameters,ReqParams::program,db);

        double eValue = evalueSpinBox->value();
        if(shortSequenceCheckBox->isChecked())
            eValue = 1000;
        addParametr(requestParameters,ReqParams::expect,eValue);

        if(false == entrezQueryEdit->text().isEmpty())
            addParametr(requestParameters, ReqParams::entrezQuery, entrezQueryEdit->text());

        int maxHit = quantitySpinBox->value();
        addParametr(requestParameters,ReqParams::hits,maxHit);

        if(megablastCheckBox->isChecked()) {
            addParametr(requestParameters,ReqParams::megablast,"true");
        }

        addParametr(requestParameters,ReqParams::database,dbComboBox->currentText().split(" ").last());

        QString filter="";
        if(lowComplexityFilterCheckBox->isChecked()&&!shortSequenceCheckBox->isChecked()) {
            filter.append("L");
        }
        if(repeatsCheckBox->isChecked()) {
            filter.append("R");
        }
        if(lookupMaskCheckBox->isChecked()) {
            filter.append("m");
        }
        if(!filter.isEmpty()) {
            addParametr(requestParameters,ReqParams::filter,filter);
        }

        addParametr(requestParameters,ReqParams::gapCost,costsComboBox->currentText());
        if(db == "blastn"){
            addParametr(requestParameters,ReqParams::matchScore,scoresComboBox->currentText().split(" ").first());
            addParametr(requestParameters,ReqParams::mismatchScore,scoresComboBox->currentText().split(" ").last());
        }

        if(shortSequenceCheckBox->isChecked()) {
            QString wordSize = wordSizeComboBox->currentText().toInt()>7 ? "7" : wordSizeComboBox->currentText();
            addParametr(requestParameters,ReqParams::wordSize, wordSize);
        }
        else {
            addParametr(requestParameters,ReqParams::wordSize,wordSizeComboBox->currentText());
        }

        if(lowerCaseCheckBox->isChecked()) {
            addParametr(requestParameters,ReqParams::lowCaseMask,"yes");
        }

        if(db=="blastp") {
            if(!isAminoSeq) {
                translateToAmino = true;
            }

            addParametr(requestParameters,ReqParams::matrix,matrixComboBox->currentText());
            addParametr(requestParameters,ReqParams::service,serviceComboBox->currentText());
            if(serviceComboBox->currentText()=="phi") {
                addParametr(requestParameters,ReqParams::phiPattern,phiPatternEdit->text());
            }
        }
    }

    else { //CDD
        requestParameters = "CMD=Put";
        db = "blastp";
        addParametr(requestParameters,ReqParams::program, db);

        addParametr(requestParameters,ReqParams::expect, evalueSpinBox->value());

        addParametr(requestParameters,ReqParams::hits,quantitySpinBox->value());

        QString dbName = dbComboBox->currentText().split(" ").last();
        addParametr(requestParameters,ReqParams::database, dbName.toLower());
        addParametr(requestParameters,ReqParams::service, "rpsblast");
    }

    if(translateToAmino) {
        QObjectScopedPointer<QMessageBox> msg = new QMessageBox(this);
        msg->setText(tr("You chose to search nucleotide sequence in protein database. This sequence will be converted into 6 sequences(3 translations for both strands)."
            "Therefore this search may take some time. Continue?"));
        msg->setWindowTitle(windowTitle());
        msg->setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
        msg->setDefaultButton(QMessageBox::Yes);
        msg->exec();
        CHECK(!msg.isNull(), );

        if (msg->result() == QMessageBox::Cancel) {
            return;
        }
    }

    int filterResults = 0;
    filterResults |= (int)accessionCheckBox->isChecked();
    filterResults |= (int)defCheckBox->isChecked() << 1;
    filterResults |= (int)idCheckBox->isChecked() << 2;
    cfg.filterResult = filterResults;
    cfg.useEval = evalueRadioButton->isChecked();
    cfg.retries = retrySpinBox->value();
    cfg.params = requestParameters;
    cfg.dbChoosen = db;

    saveSettings();
    accept();
}