예제 #1
0
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);
    }
}
예제 #2
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();
}
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);
}
예제 #4
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();
}
예제 #5
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();
}
예제 #6
0
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());
    }
예제 #7
0
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);
}
예제 #8
0
void DnaAssemblySupport::sl_showBuildIndexDialog()
{
    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<BuildIndexDialog> dlg = new BuildIndexDialog(registry, QApplication::activeWindow());
    dlg->exec();
    CHECK(!dlg.isNull(), );

    if (QDialog::Accepted == dlg->result()) {
        DnaAssemblyToRefTaskSettings s;
        s.refSeqUrl = dlg->getRefSeqUrl();
        s.algName = dlg->getAlgorithmName();
        s.resultFileName = dlg->getIndexFileName();
        s.indexFileName = dlg->getIndexFileName();
        s.setCustomSettings(dlg->getCustomSettings());
        s.openView = false;
        s.prebuiltIndex = false;
        s.pairedReads = false;
        Task* assemblyTask = new DnaAssemblyTaskWithConversions(s, false, true);
        AppContext::getTaskScheduler()->registerTopLevelTask(assemblyTask);
    }
}
예제 #9
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();
}
예제 #10
0
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();
}
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));
}
예제 #12
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(), );
    }
}
예제 #13
0
void EnzymesPlugin::sl_onOpenConstructMoleculeDialog() {
    Project* p = AppContext::getProject();
    if (p == NULL) {
        QMessageBox::information(QApplication::activeWindow(), openConstructMoleculeDialog->text(),
            tr("There is no active project.\nTo start ligation create a project or open an existing."));
        return;
    }

    QList<DNAFragment> fragments = DNAFragment::findAvailableFragments();

    QObjectScopedPointer<ConstructMoleculeDialog> dlg = new ConstructMoleculeDialog(fragments, QApplication::activeWindow());
    dlg->exec();
}
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);
                }
            }
        }
    }
예제 #15
0
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);
    }
}
예제 #16
0
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();
    }
}
예제 #17
0
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);
}
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 );
}
예제 #21
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();
}
예제 #22
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();
}
예제 #23
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();
}
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 );

}
예제 #25
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);
    }
}
예제 #26
0
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();
    }
예제 #27
0
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());
    }
}
예제 #28
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);
    }
}
예제 #29
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()) {
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);
}