本文整理汇总了C++中U2OpStatus类的典型用法代码示例。如果您正苦于以下问题:C++ U2OpStatus类的具体用法?C++ U2OpStatus怎么用?C++ U2OpStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了U2OpStatus类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: readQuality
static void readQuality(U2OpStatus& os, IOAdapter *io, QByteArray &sequence, int count) {
QByteArray buffArray(DocumentFormat::READ_BUFF_SIZE + 1, 0);
char* buff = buffArray.data();
// reading quality sequence, ignoring whitespace at the beginning and the end of lines
int readed = 0;
while (!io->isEof() && (readed < count)) {
bool eolnFound = false;
int readedCount = io->readUntil(buff, DocumentFormat::READ_BUFF_SIZE, TextUtils::LINE_BREAKS, IOAdapter::Term_Include, &eolnFound);
CHECK_EXT(!io->hasError(), os.setError(io->errorString()), );
CHECK_EXT(readedCount >= 0, os.setError(U2::FastqFormat::tr("Error while reading sequence")),);
QByteArray trimmed = QByteArray(buffArray.data(), readedCount);
trimmed = trimmed.trimmed();
int qualitySize = sequence.size() + trimmed.size();
if (eolnFound && (qualitySize > count)) { // read quality sequence name line, reverting back
io->skip(-readedCount);
if (io->hasError()) {
os.setError(io->errorString());
}
return;
}
sequence.append(trimmed);
CHECK_OP(os,);
}
if (io->hasError()) {
os.setError(io->errorString());
}
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:33,代码来源:FastqFormat.cpp
示例2: getRow
U2MsaRow MysqlMsaDbi::getRow(const U2DataId& msaId, qint64 rowId, U2OpStatus& os) {
U2MsaRow res;
MysqlTransaction t(db, os);
Q_UNUSED(t);
static const QString rowString = "SELECT sequence, gstart, gend, length FROM MsaRow WHERE msa = :msa AND rowId = :rowId";
U2SqlQuery q(rowString, db, os);
q.bindDataId(":msa", msaId);
q.bindInt64(":rowId", rowId);
if (q.step()) {
res.rowId = rowId;
res.sequenceId = q.getDataId(0, U2Type::Sequence);
res.gstart = q.getInt64(1);
res.gend = q.getInt64(2);
res.length = q.getInt64(3);
q.ensureDone();
} else if (!os.hasError()) {
os.setError(U2DbiL10n::tr("Msa row not found"));
return res;
}
static const QString gapString = "SELECT gapStart, gapEnd FROM MsaRowGap WHERE msa = :msa AND rowId = :rowId ORDER BY gapStart";
U2SqlQuery gapQ(gapString, db, os);
gapQ.bindDataId(":msa", msaId);
gapQ.bindInt64(":rowId", rowId);
while (gapQ.step()) {
U2MsaGap gap;
gap.offset = gapQ.getInt64(0);
gap.gap = gapQ.getInt64(1) - gap.offset;
res.gaps.append(gap);
}
return res;
}
开发者ID:m-angelov,项目名称:ugene,代码行数:34,代码来源:MysqlMsaDbi.cpp
示例3: getModelHeight
qint64 AssemblyModel::getModelHeight(U2OpStatus & os) {
if(NO_VAL == cachedModelHeight) {
U2AttributeDbi * attributeDbi = dbiHandle.dbi->getAttributeDbi();
if(attributeDbi != NULL) {
U2IntegerAttribute attr = U2AttributeUtils::findIntegerAttribute(attributeDbi, assembly.id, U2BaseAttributeName::max_prow, os);
LOG_OP(os);
if(attr.hasValidId()) {
if(attr.version == assembly.version) {
cachedModelHeight = attr.value;
} else if(checkPermissions(QFile::WriteUser,false)) {
U2AttributeUtils::removeAttribute(attributeDbi, attr.id, os);
LOG_OP(os);
}
}
}
if(cachedModelHeight == NO_VAL) {
// if could not get value from attribute, recompute the value...
cachedModelHeight = assemblyDbi->getMaxPackedRow(assembly.id, U2Region(0, getModelLength(os)), os);
LOG_OP(os);
if(! os.isCoR()) {
// ...and store it in a new attribure
U2IntegerAttribute attr;
U2AttributeUtils::init(attr, assembly, U2BaseAttributeName::max_prow);
attr.value = cachedModelHeight;
attributeDbi->createIntegerAttribute(attr, os);
}
}
if(cachedModelHeight == NO_VAL){
os.setError("Can't get model height, database is corrupted");
LOG_OP(os);
}
}
return cachedModelHeight;
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:34,代码来源:AssemblyModel.cpp
示例4: id
UdrRecord::UdrRecord(const UdrRecordId &id, const QList<UdrValue> &data, U2OpStatus &os)
: id(id), data(data)
{
UdrSchemaRegistry *udrRegistry = AppContext::getUdrSchemaRegistry();
SAFE_POINT_EXT(NULL != udrRegistry, os.setError("NULL UDR registry"), );
schema = udrRegistry->getSchemaById(id.getSchemaId());
SAFE_POINT_EXT(NULL != schema, os.setError("Unknown schema id: " + QString(id.getSchemaId())), );
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:8,代码来源:UdrRecord.cpp
示例5: os
Peak2GeneFormatLoader::Peak2GeneFormatLoader(U2OpStatus &os, IOAdapter *ioAdapter) :
os(os),
ioAdapter(ioAdapter),
skipLine(false),
currentLineNumber(0)
{
CHECK_EXT(NULL != ioAdapter, os.setError(L10N::nullPointerError("IO adapter")), );
CHECK_EXT(ioAdapter->isOpen(), os.setError(L10N::errorReadingFile(ioAdapter->getURL())), );
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:9,代码来源:Peak2GeneFormatLoader.cpp
示例6: errorLoggingBreak
static bool errorLoggingBreak(U2OpStatus& os, QMap<QString, QString>& skippedLines, const QString& seqName){
if (os.isCoR()){
if (skippedLines.size() < SKIPPED_LINES_ERRORS_LIMIT){
skippedLines.insert(seqName, os.getError());
}
return true;
}
return false;
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:9,代码来源:FastqFormat.cpp
示例7: getValidClickedActionId
int SampleActionsManager::getValidClickedActionId(U2OpStatus &os) const {
QAction *a = qobject_cast<QAction*>(sender());
CHECK_EXT(NULL != a, os.setError(L10N::internalError("Unexpected method call")), -1);
bool ok = false;
int id = a->property(ID_PROPERTY).toInt(&ok);
CHECK_EXT(ok, os.setError(L10N::internalError("Wrong action ID")), -1);
CHECK_EXT(id >=0 && id < actions.size(), os.setError(L10N::internalError("Out of range action ID")), -1);
return id;
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:11,代码来源:SampleActionsManager.cpp
示例8: checkType
bool UdrValue::checkType(UdrSchema::DataType askedDataType, U2OpStatus &os) const {
if (isNull) {
os.setError("NULL value");
return false;
}
if (dataType != askedDataType) {
os.setError("Type mismatch");
return false;
}
return true;
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:11,代码来源:UdrRecord.cpp
示例9: defineSettings
CreateSubalignmentSettings FormatsMsaClipboardTask::defineSettings(const QStringList& names, const U2Region &window, const DocumentFormatId &formatId, U2OpStatus& os){
//Create temporal document for the workflow run task
const AppSettings* appSettings = AppContext::getAppSettings();
SAFE_POINT_EXT(NULL != appSettings, os.setError(tr("Invalid applications settings detected")), CreateSubalignmentSettings());
UserAppsSettings* usersSettings = appSettings->getUserAppsSettings();
SAFE_POINT_EXT(NULL != usersSettings, os.setError(tr("Invalid users applications settings detected")), CreateSubalignmentSettings());
const QString tmpDirPath = usersSettings->getCurrentProcessTemporaryDirPath();
GUrl path = GUrlUtils::prepareTmpFileLocation(tmpDirPath, "clipboard", "tmp", os);
return CreateSubalignmentSettings(window, names, path, true, false, formatId);
}
开发者ID:neuroidss,项目名称:ugene,代码行数:12,代码来源:SubalignmentToClipboardTask.cpp
示例10: getMsaAlphabet
U2AlphabetId MysqlMsaDbi::getMsaAlphabet(const U2DataId& msaId, U2OpStatus& os) {
QString alphabetName;
U2SqlQuery q("SELECT alphabet FROM Msa WHERE object = :object", db, os);
q.bindDataId(":object", msaId);
if (q.step()) {
alphabetName = q.getString(0);
q.ensureDone();
} else if (!os.hasError()) {
os.setError(U2DbiL10n::tr("Msa object not found"));
}
return U2AlphabetId(alphabetName);
}
开发者ID:m-angelov,项目名称:ugene,代码行数:13,代码来源:MysqlMsaDbi.cpp
示例11: getNumOfRows
qint64 MysqlMsaDbi::getNumOfRows(const U2DataId& msaId, U2OpStatus& os) {
qint64 res = 0;
static const QString queryString = "SELECT numOfRows FROM Msa WHERE object = :object";
U2SqlQuery q(queryString, db, os);
q.bindDataId(":object", msaId);
if (q.step()) {
res = q.getInt64(0);
q.ensureDone();
} else if (!os.hasError()) {
os.setError(U2DbiL10n::tr("Msa object not found"));
}
return res;
}
开发者ID:m-angelov,项目名称:ugene,代码行数:15,代码来源:MysqlMsaDbi.cpp
示例12: read
int SQLiteBlobInputStream::read(char *buffer, int length, U2OpStatus &os) {
SAFE_POINT_EXT(NULL != handle, os.setError("blob handle is not opened"), 0);
int targetLength = (offset + length < size) ? length : (size - offset);
if (0 == targetLength) {
return -1;
}
int status = sqlite3_blob_read(handle, (void*)buffer, targetLength, offset);
if (SQLITE_OK != status) {
os.setError(QObject::tr("Can not read data. The database is closed or the data were changed."));
return 0;
}
offset += targetLength;
return targetLength;
}
开发者ID:m-angelov,项目名称:ugene,代码行数:15,代码来源:SQLiteBlobInputStream.cpp
示例13: getSequenceData
QByteArray SQLiteSequenceDbi::getSequenceData(const U2DataId& sequenceId, const U2Region& region, U2OpStatus& os) {
try {
QByteArray res;
if (0 == region.length) {
return res;
} else if (U2_REGION_MAX != region) {
res.reserve(region.length);
}
// Get all chunks that intersect the region
SQLiteReadQuery q("SELECT sstart, send, data FROM SequenceData WHERE sequence = ?1 "
"AND (send >= ?2 AND sstart < ?3) ORDER BY sstart", db, os);
q.bindDataId(1, sequenceId);
q.bindInt64(2, region.startPos);
q.bindInt64(3, region.endPos());
qint64 pos = region.startPos;
qint64 regionLengthToRead = region.length;
while (q.step()) {
qint64 sstart = q.getInt64(0);
qint64 send = q.getInt64(1);
qint64 length = send - sstart;
QByteArray data = q.getBlob(2);
int copyStart = pos - sstart;
int copyLength = static_cast<int>(qMin(regionLengthToRead, length - copyStart));
res.append(data.constData() + copyStart, copyLength);
pos += copyLength;
regionLengthToRead -= copyLength;
SAFE_POINT_EXT(regionLengthToRead >= 0,
os.setError("An error occurred during reading sequence data from dbi."),
QByteArray());
}
return res;
} catch (const std::bad_alloc &) {
#ifdef UGENE_X86
os.setError("UGENE ran out of memory during the sequence processing. "
"The 32-bit UGENE version has a restriction on its memory consumption. Try using the 64-bit version instead.");
#else
os.setError("Out of memory during the sequence processing.");
#endif
return QByteArray();
} catch (...) {
os.setError("Internal error occurred during the sequence processing.");
coreLog.error("An exception was thrown during reading sequence data from dbi.");
return QByteArray();
}
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:48,代码来源:SQLiteSequenceDbi.cpp
示例14: toByteArray
QByteArray MultipleSequenceAlignmentRowData::toByteArray(U2OpStatus &os, qint64 length) const {
if (length < getCoreEnd()) {
coreLog.trace("Incorrect length was passed to MultipleSequenceAlignmentRowData::toByteArray");
os.setError("Failed to get row data");
return QByteArray();
}
if (gaps.isEmpty() && sequence.length() == length) {
return sequence.constSequence();
}
QByteArray bytes = joinCharsAndGaps(true, true);
// Append additional gaps, if necessary
if (length > bytes.count()) {
QByteArray gapsBytes;
gapsBytes.fill(U2Msa::GAP_CHAR, length - bytes.count());
bytes.append(gapsBytes);
}
if (length < bytes.count()) {
// cut extra trailing gaps
bytes = bytes.left(length);
}
return bytes;
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:26,代码来源:MultipleSequenceAlignmentRow.cpp
示例15: getVariantTrack
U2VariantTrack MysqlVariantDbi::getVariantTrack(const U2DataId& variantTrackId, U2OpStatus& os) {
U2VariantTrack res;
DBI_TYPE_CHECK(variantTrackId, U2Type::VariantTrack, os, res);
MysqlTransaction t(db, os);
Q_UNUSED(t);
dbi->getMysqlObjectDbi()->getObject(res, variantTrackId, os);
CHECK_OP(os, res);
static const QString queryString = "SELECT sequence, sequenceName, trackType, fileHeader FROM VariantTrack WHERE object = :object";
U2SqlQuery q(queryString, db, os);
q.bindDataId(":object", variantTrackId);
if (q.step()) {
res.sequence = q.getDataId(0, U2Type::Sequence);
res.sequenceName = q.getString(1);
int trackType = q.getInt32(2);
CHECK_EXT(TrackType_FIRST <= trackType && trackType <= TrackType_LAST,
os.setError(U2DbiL10n::tr("Invalid variant track type: %1").arg(trackType)), res);
res.trackType = static_cast<VariantTrackType>(trackType);
res.fileHeader = q.getString(3);
q.ensureDone();
}
return res;
}
开发者ID:m-angelov,项目名称:ugene,代码行数:26,代码来源:MysqlVariantDbi.cpp
示例16: writeHeaderToFile
static void writeHeaderToFile( IOAdapter* io, const QString &sequenceName, U2OpStatus &os ) {
QByteArray block;
block.append( FastaFormat::FASTA_HEADER_START_SYMBOL ).append( sequenceName ).append( '\n' );
if ( io->writeBlock( block ) != block.length( ) ) {
os.setError( L10N::errorWritingFile( io->getURL( ) ) );
}
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:7,代码来源:FastaFormat.cpp
示例17: append
void MultipleSequenceAlignmentRowData::append(const MultipleSequenceAlignmentRowData &anotherRow, int lengthBefore, U2OpStatus &os) {
int rowLength = getRowLengthWithoutTrailing();
if (lengthBefore < rowLength) {
coreLog.trace(QString("Internal error: incorrect length '%1' were passed to MultipleSequenceAlignmentRowData::append,"
"coreEnd is '%2'").arg(lengthBefore).arg(getCoreEnd()));
os.setError("Failed to append one row to another");
return;
}
// Gap between rows
if (lengthBefore > rowLength) {
gaps.append(U2MsaGap(getRowLengthWithoutTrailing(), lengthBefore - getRowLengthWithoutTrailing()));
}
// Merge gaps
QList<U2MsaGap> anotherRowGaps = anotherRow.getGapModel();
for (int i = 0; i < anotherRowGaps.count(); ++i) {
anotherRowGaps[i].offset += lengthBefore;
}
gaps.append(anotherRowGaps);
mergeConsecutiveGaps();
// Merge sequences
DNASequenceUtils::append(sequence, anotherRow.sequence);
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:26,代码来源:MultipleSequenceAlignmentRow.cpp
示例18: t
QList< QList<U2SingleModStep> > SQLiteModDbi::getModSteps(const U2DataId &masterObjId, qint64 version, U2OpStatus &os) {
QList< QList<U2SingleModStep> > steps;
SQLiteTransaction t(db, os);
qint64 userStepId = -1;
SQLiteWriteQuery qGetUserStepId("SELECT id FROM UserModStep WHERE object = ?1 AND version = ?2", db, os);
SAFE_POINT_OP(os, QList< QList<U2SingleModStep> >());
qGetUserStepId.bindDataId(1, masterObjId);
qGetUserStepId.bindInt64(2, version);
if (qGetUserStepId.step()) {
userStepId = qGetUserStepId.getInt64(0);
qGetUserStepId.ensureDone();
}
else if (!os.hasError()) {
os.setError("Failed to find user step ID!");
return steps;
}
SQLiteReadQuery qMultiStepId("SELECT id FROM MultiModStep WHERE userStepId = ?1", db, os);
qMultiStepId.bindInt64(1, userStepId);
SQLiteReadQuery qSingleStep("SELECT id, object, otype, oextra, version, modType, details, multiStepId FROM SingleModStep WHERE multiStepId = ?1", db, os);
while (qMultiStepId.step()) {
qint64 multiStepId = qMultiStepId.getInt64(0);
qSingleStep.reset();
qSingleStep.bindInt64(1, multiStepId);
QList<U2SingleModStep> currentMultiStepSingleSteps;
while (qSingleStep.step()) {
U2SingleModStep step;
step.id = qSingleStep.getInt64(0);
step.objectId = qSingleStep.getDataIdExt(1);
step.version = qSingleStep.getInt64(4);
step.modType = qSingleStep.getInt64(5);
step.details = qSingleStep.getBlob(6);
SAFE_POINT_OP(os, QList< QList<U2SingleModStep> >());
currentMultiStepSingleSteps.append(step);
}
steps.append(currentMultiStepSingleSteps);
}
return steps;
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:47,代码来源:SQLiteModDbi.cpp
示例19: fromString
Predicate Predicate::fromString(const QString &string, U2OpStatus &os) {
QStringList token = string.split("."); // var.value
if (2 != token.size()) {
os.setError(QObject::tr("Can not parse predicate from the string: %1").arg(string));
return Predicate();
}
return Predicate(Variable(token[0]), token[1]);
}
开发者ID:m-angelov,项目名称:ugene,代码行数:8,代码来源:Variable.cpp
示例20: addReads
void RTreeAssemblyAdapter::addReads(U2DbiIterator<U2AssemblyRead>* it, U2AssemblyReadsImportInfo& ii, U2OpStatus& os) {
static QString q1 = "INSERT INTO %1(name, flags, mq, data) VALUES (?1, ?2, ?3, ?4)";
static QString q2 = "INSERT INTO %1(id, gstart, gend, prow1, prow2) VALUES (?1, ?2, ?3, ?4, ?5)";
SQLiteTransaction t(db, os);
SQLiteWriteQuery insertRQ(q1.arg(readsTable), db, os);
SQLiteWriteQuery insertIQ(q2.arg(indexTable), db, os);
while (it->hasNext()) {
U2AssemblyRead read = it->next();
bool dnaExt = false; //TODO
qint64 flags = read->flags;
flags = flags | (dnaExt ? DnaExtAlphabet : 0);
int readLen = read->readSequence.length();
int effectiveReadLength = readLen + U2AssemblyUtils::getCigarExtraLength(read->cigar);
read->effectiveLen = effectiveReadLength;
int hash = qHash(read->name);
insertRQ.reset();
insertRQ.bindInt64(1, hash);
insertRQ.bindInt64(2, flags);
insertRQ.bindInt32(3, read->mappingQuality);
QByteArray packedData = SQLiteAssemblyUtils::packData(SQLiteAssemblyDataMethod_NSCQ, read, os);
insertRQ.bindBlob(4, packedData, false);
insertRQ.insert();
if (os.hasError()) {
break;
}
insertIQ.reset();
insertIQ.bindDataId(1, read->id);
insertIQ.bindInt64(2, read->leftmostPos);
insertIQ.bindInt64(3, read->leftmostPos + read->effectiveLen);
insertIQ.bindInt64(4, read->packedViewRow);
insertIQ.bindInt64(5, read->packedViewRow);
insertIQ.execute();
SQLiteAssemblyUtils::addToCoverage(ii.coverageInfo, read);
ii.nReads++;
//#define U2_SQLITE_CHECK_RTREE_
#ifdef U2_SQLITE_CHECK_RTREE_
// Consistency check. To be removed after all known rtree issues are resolved
qint64 dbId = U2DbiUtils::toDbiId(read->id);
SQLiteQuery cq("SELECT gstart, gend FROM " + indexTable + " WHERE id = " + QString::number(dbId), db, os);
cq.step();
qint64 cstart = cq.getInt64(0);
qint64 cend = cq.getInt64(1);
assert(cstart == read->leftmostPos);
assert(cend == read->leftmostPos + read->effectiveLen);
#endif
}
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:58,代码来源:RTreeAssemblyAdapter.cpp
注:本文中的U2OpStatus类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论