Document* ClustalWAlnFormat::loadDocument(IOAdapter* io, const U2DbiRef& dbiRef, const QVariantMap& fs, U2OpStatus& os) { QList<GObject*> objects; load(io, dbiRef, objects, fs, os); CHECK_OP_EXT(os, qDeleteAll(objects), NULL); assert(objects.size() == 1); return new Document(this, io->getFactory(), io->getURL(), dbiRef, objects, fs); }
Document* FastqFormat::loadTextDocument(IOAdapter* io, const U2DbiRef& dbiRef, const QVariantMap& _hints, U2OpStatus& os) { CHECK_EXT(io != NULL && io->isOpen(), os.setError(L10N::badArgument("IO adapter")), NULL); QVariantMap hints = _hints; QList<GObject*> objects; QMap<QString, QString> skippedLines; int gapSize = qBound(-1, DocumentFormatUtils::getMergeGap(_hints), 1000*1000); int predictedSize = qMax(100*1000, DocumentFormatUtils::getMergedSize(hints, gapSize==-1 ? 0 : io->left())); QString lockReason; load(io, dbiRef, _hints, objects, os, gapSize, predictedSize, lockReason, skippedLines); if (skippedLines.size() > 0){ QMapIterator<QString, QString> i(skippedLines); QStringList errors; while (i.hasNext()) { i.next(); QString msg = i.key() + ": " + i.value(); if (objects.length() > 0){ os.addWarning(msg); }else{ errors.append(msg); } } if (errors.length() > 0){ os.setError(errors.join("\n")); } } CHECK_OP_EXT(os, qDeleteAll(objects), NULL); DocumentFormatUtils::updateFormatHints(objects, hints); Document* doc = new Document(this, io->getFactory(), io->getURL(), dbiRef, objects, hints, lockReason); return doc; }
Document* FpkmTrackingFormat::loadDocument(IOAdapter* io, const U2DbiRef& dbiRef, const QVariantMap& hints, U2OpStatus& os) { CHECK_EXT(io != NULL && io->isOpen(), os.setError(L10N::badArgument("IO adapter")), NULL); QList<GObject*> objects; load(io, objects, dbiRef, hints, os); CHECK_OP_EXT(os, qDeleteAll(objects), NULL); Document* doc = new Document(this, io->getFactory(), io->getURL(), dbiRef, objects); return doc; }
Task* CallVariantsWorker::tick() { U2OpStatus2Log os; //put variant tracks while (!cache.isEmpty()) { output->put(cache.takeFirst()); } checkState(os); CHECK_OP_EXT(os, setDone(), NULL); //take assemblies from one dataset if (assemblyPort->hasMessage() && settings.assemblyUrls.isEmpty()) { takeAssembly(os); CHECK_OP_EXT(os, processError(os), NULL); } else if (settings.assemblyUrls.isEmpty() && !assemblyUrls.isEmpty()) { settings.assemblyUrls = assemblyUrls; assemblyUrls.clear(); } //take reference sequence if (refSeqPort->hasMessage() && settings.refSeqUrl.isEmpty()) { takeReference(os); CHECK_OP_EXT(os, processError(os), NULL); } //do if (cache.isEmpty() && !settings.refSeqUrl.isEmpty() && !settings.assemblyUrls.isEmpty()) { settings.variationsUrl = GUrlUtils::rollFileName(getValue<QString>(OUT_URL), "_", QSet<QString>()); CallVariantsTask* t = new CallVariantsTask(settings, context->getDataStorage()); t->addListeners(createLogListeners(3)); connect(t, SIGNAL(si_stateChanged()), SLOT(sl_taskFinished())); settings.assemblyUrls.clear(); settings.refSeqUrl.clear(); return t; } return NULL; }
Document* FastaFormat::loadTextDocument(IOAdapter* io, const U2DbiRef& dbiRef, const QVariantMap& fs, U2OpStatus& os) { CHECK_EXT(io!=NULL && io->isOpen(), os.setError(L10N::badArgument("IO adapter")), NULL); QList<GObject*> objects; int gapSize = qBound(-1, DocumentFormatUtils::getMergeGap(fs), 1000 * 1000); QString lockReason; load(io, dbiRef, fs, objects, gapSize, lockReason, os); CHECK_OP_EXT(os, qDeleteAll(objects), NULL); Document* doc = new Document(this, io->getFactory(), io->getURL(), dbiRef, objects, fs, lockReason); return doc; }
Document* DatabaseConnectionFormat::loadDocument(IOAdapter* io, const U2DbiRef&, const QVariantMap& hints, U2OpStatus& os) { DatabaseConnectionAdapter* databaseConnectionAdapter = qobject_cast<DatabaseConnectionAdapter*>(io); SAFE_POINT(NULL != databaseConnectionAdapter, QString("Can't use current IOAdapter: %1").arg(io->getAdapterName()), NULL); U2Dbi* dbi = databaseConnectionAdapter->getConnection().dbi; SAFE_POINT(NULL != dbi, "NULL dbi", NULL); QList<GObject*> objects = getObjects(dbi, os); CHECK_OP_EXT(os, qDeleteAll(objects), NULL); const QString modLockDesc = dbi->getFeatures().contains(U2DbiFeature_GlobalReadOnly) ? DocumentFormat::tr("You have no permissions to modify the content of this database") : QString(); Document* resultDocument = new Document(this, io->getFactory(), io->getURL(), dbi->getDbiRef(), objects, hints, modLockDesc); resultDocument->setDocumentOwnsDbiResources(false); return resultDocument; }
Document* FastqFormat::loadDocument(IOAdapter* io, const U2DbiRef& dbiRef, const QVariantMap& _hints, U2OpStatus& os) { CHECK_EXT(io != NULL && io->isOpen(), os.setError(L10N::badArgument("IO adapter")), NULL); QVariantMap hints = _hints; QList<GObject*> objects; int gapSize = qBound(-1, DocumentFormatUtils::getMergeGap(_hints), 1000*1000); int predictedSize = qMax(100*1000, DocumentFormatUtils::getMergedSize(hints, gapSize==-1 ? 0 : io->left())); QString lockReason; load(io, dbiRef, _hints, io->getURL(), objects, os, gapSize, predictedSize, lockReason); CHECK_OP_EXT(os, qDeleteAll(objects), NULL); DocumentFormatUtils::updateFormatHints(objects, hints); Document* doc = new Document(this, io->getFactory(), io->getURL(), dbiRef, objects, hints, lockReason ); return doc; }
Document* DbiDocumentFormat::loadDocument(IOAdapter* io, const U2DbiRef& dstDbiRef, const QVariantMap& fs, U2OpStatus& os){ //1. open db //2. read all objects //3. if there is a DEEP_COPY_OBJECT hint, all objects are cloned to the db defined by dstDbiRef //3. close db QString url = io->getURL().getURLString(); U2DbiRef srcDbiRef(id, url); DbiConnection handle(srcDbiRef, true, os); CHECK_OP(os, NULL); U2ObjectDbi* odbi = handle.dbi->getObjectDbi(); QList<U2DataId> objectIds = odbi->getObjects(U2ObjectDbi::ROOT_FOLDER, 0, U2DbiOptions::U2_DBI_NO_LIMIT, os); CHECK_OP(os, NULL); QList<GObject*> objects; U2EntityRef ref; ref.dbiRef = srcDbiRef; objects << prepareObjects(handle, objectIds); if (fs.value(DEEP_COPY_OBJECT, false).toBool()) { QList<GObject *> clonedObjects = cloneObjects(objects, dstDbiRef, fs, os); qDeleteAll(objects); CHECK_OP_EXT(os, qDeleteAll(clonedObjects), NULL); objects = clonedObjects; } else { renameObjectsIfNamesEqual(objects); } QString lockReason = handle.dbi->isReadOnly() ? "The database is read-only" : ""; Document* d = new Document(this, io->getFactory(), io->getURL(), dstDbiRef, objects, fs, lockReason); d->setDocumentOwnsDbiResources(false); d->setModificationTrack(false); return d; }