本文整理汇总了C++中U2OpStatus::setProgress方法的典型用法代码示例。如果您正苦于以下问题:C++ U2OpStatus::setProgress方法的具体用法?C++ U2OpStatus::setProgress怎么用?C++ U2OpStatus::setProgress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类U2OpStatus
的用法示例。
在下文中一共展示了U2OpStatus::setProgress方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readBuff
void PDBFormat::PDBParser::parseBioStruct3D(BioStruct3D& biostruct, U2OpStatus& ti) {
QByteArray readBuff(DocumentFormat::READ_BUFF_SIZE + 1, 0);
char* buf = readBuff.data();
qint64 len = 0;
bool firstCompndLine = true;
while (!ti.isCoR()) {
bool lineOk = true;
len = io->readUntil(buf, DocumentFormat::READ_BUFF_SIZE, TextUtils::LINE_BREAKS, IOAdapter::Term_Include, &lineOk);
if (len == 0) {
break;
}
// there could be no terminator if this is end of file, so we have to check for this
if (!lineOk && !io->isEof()) {
ti.setError(U2::PDBFormat::tr("Line is too long"));
return;
}
currentPDBLine = QString(QByteArray(buf, len));
ti.setProgress(io->getProgress() * 0.8);
if (currentPDBLine.startsWith("HEADER")) {
parseHeader(biostruct, ti);
continue;
}
if (currentPDBLine.startsWith("COMPND")) {
parseMacromolecularContent(firstCompndLine, ti);
firstCompndLine = false;
continue;
}
if (currentPDBLine.startsWith("SEQRES")) {
parseSequence(biostruct, ti);
continue;
}
if (currentPDBLine.startsWith("HELIX ") || currentPDBLine.startsWith("SHEET ")
|| currentPDBLine.startsWith("TURN ")) {
parseSecondaryStructure(biostruct, ti);
continue;
}
if (currentPDBLine.startsWith("ATOM ") || currentPDBLine.startsWith("HETATM")) {
parseAtom(biostruct, ti);
continue;
}
if (currentPDBLine.startsWith("TER")) {
++currentChainIndex;
continue;
}
if (currentPDBLine.startsWith("SPLIT ")) {
parseSplitSection(ti);
continue;
}
if (currentPDBLine.startsWith("MODEL")) {
currentChainIndex = 1;
parseModel(biostruct, ti);
continue;
}
if (currentPDBLine.startsWith("ENDMDL")) {
flagMultipleModels = true;
++currentModelIndex;
continue;
}
}
CHECK_OP(ti,);
if (!flagAtomRecordPresent) {
ti.setError(U2::PDBFormat::tr("Some mandatory records are absent"));
}
updateSecStructChainIndexes(biostruct);
}
示例2: load
static void load(IOAdapter* io, const U2DbiRef& dbiRef, QList<GObject*>& objects, const QVariantMap& fs, U2OpStatus& os) {
DbiOperationsBlock opBlock(dbiRef, os);
CHECK_OP(os, );
Q_UNUSED(opBlock);
U2SequenceImporter seqImporter(fs, true);
const QString folder = fs.value(DocumentFormat::DBI_FOLDER_HINT, U2ObjectDbi::ROOT_FOLDER).toString();
QByteArray readBuffer(DocumentFormat::READ_BUFF_SIZE, '\0');
char* buff = readBuffer.data();
QBitArray ALPHAS = TextUtils::ALPHA_NUMS;
ALPHAS['-'] = true;
QByteArray seq;
QString seqName(io->getURL().baseFileName());
//reading sequence
QBuffer writer(&seq);
writer.open(QIODevice::WriteOnly);
TmpDbiObjects dbiObjects(dbiRef, os);
bool ok = true;
int len = 0;
bool isStarted = false;
int sequenceCounter = 0;
bool terminatorFound = false;
bool isSplit = fs.value((DocumentReadingMode_SequenceAsSeparateHint), false).toBool();
while (ok && !io->isEof()) {
len = io->readLine(buff, DocumentFormat::READ_BUFF_SIZE, &terminatorFound);
if (len <= 0){
continue;
}
seq.clear();
bool isSeek = writer.seek(0);
assert(isSeek); Q_UNUSED(isSeek);
if (os.isCoR()) {
break;
}
for (int i=0; i<len && ok; i++) {
char c = buff[i];
if (ALPHAS[(uchar)c]) {
ok = writer.putChar(c);
}
}
if(seq.size()>0 && isStarted == false ){
QString name = sequenceCounter == 0 ? seqName : seqName + QString("_%1").arg(sequenceCounter);
isStarted = true;
seqImporter.startSequence(dbiRef, folder, name, false, os);
}
if(isStarted){
seqImporter.addBlock(seq.data(),seq.size(),os);
}
if (seq.size()>0 && isStarted && terminatorFound && isSplit){
finishSequence(objects, io, os, dbiRef, fs, dbiObjects, seqImporter);
sequenceCounter++;
isStarted = false;
}
if (os.isCoR()) {
break;
}
os.setProgress(io->getProgress());
}
writer.close();
CHECK_OP(os, );
if (sequenceCounter == 0){
CHECK_EXT(isStarted == true, os.setError(RawDNASequenceFormat::tr("Sequence is empty")), );
}
示例3: load
//.........这里部分代码省略.........
if(sequenceName.isEmpty()){
sequenceName = "Sequence";
}
if ((merge == false) || (seqNumber == 0)) {
QString objName = sequenceName;
if (settingsMakeUniqueName) {
objName = (merge) ? "Sequence" : TextUtils::variate(sequenceName, "_", uniqueNames);
objName.squeeze();
uniqueNames.insert(objName);
}
seqImporter.startSequence(dbiRef, folder, objName, false, os);
CHECK_OP_BREAK(os);
}
//read sequence
if (merge && sequence.length() > 0) {
seqImporter.addDefaultSymbolsBlock(gapSize,os);
sequenceStart += sequence.length();
sequenceStart+=gapSize;
CHECK_OP_BREAK(os);
}
sequence.clear();
readSequence(os, io, sequence);
MemoryLocker lSequence(os, qCeil(sequence.size()/(1000*1000)));
CHECK_OP_BREAK(os);
Q_UNUSED(lSequence);
seqImporter.addBlock(sequence.data(),sequence.length(),os);
CHECK_OP_BREAK(os);
QString qualSequenceName = readSequenceName(os, io, '+');
if (!qualSequenceName.isEmpty()) {
static const QString err = U2::FastqFormat::tr("Not a valid FASTQ file: %1, sequence name differs from quality scores name: %2 and %3");
CHECK_EXT_BREAK(sequenceName == qualSequenceName,
os.setError(err.arg(docUrl.getURLString()).arg(sequenceName).arg(qualSequenceName)));
}
// read qualities
qualityScores.clear();
readQuality(os, io, qualityScores, sequence.size());
CHECK_OP_BREAK(os);
static const QString err = U2::FastqFormat::tr("Not a valid FASTQ file: %1. Bad quality scores: inconsistent size.").arg(docUrl.getURLString());
CHECK_EXT_BREAK(sequence.length() == qualityScores.length(), os.setError(err));
seqNumber++;
progressUpNum++;
if (merge) {
headers.append(sequenceName);
mergedMapping.append(U2Region(sequenceStart, sequence.length() ));
}
else {
if (objectsCountLimit > 0 && objects.size() >= objectsCountLimit) {
os.setError(FastqFormat::tr("File \"%1\" contains too many sequences to be displayed. "
"However, you can process these data using instruments from the menu <i>Tools -> NGS data analysis</i> "
"or pipelines built with Workflow Designer.")
.arg(io->getURL().getURLString()));
break;
}
U2Sequence u2seq = seqImporter.finalizeSequenceAndValidate(os);
CHECK_OP_BREAK(os);
sequenceRef = GObjectReference(io->getURL().getURLString(), u2seq.visualName, GObjectTypes::SEQUENCE, U2EntityRef(dbiRef, u2seq.id));
U2SequenceObject* seqObj = new U2SequenceObject(u2seq.visualName, U2EntityRef(dbiRef, u2seq.id));
CHECK_EXT_BREAK(seqObj != NULL, os.setError("U2SequenceObject is NULL"));
seqObj->setQuality(DNAQuality(qualityScores));
objects << seqObj;
U1AnnotationUtils::addAnnotations(objects, seqImporter.getCaseAnnotations(), sequenceRef, NULL, hints);
}
if (PROGRESS_UPDATE_STEP == progressUpNum) {
progressUpNum = 0;
os.setProgress(io->getProgress());
}
}
CHECK_OP_EXT(os, qDeleteAll(objects); objects.clear(), );
bool emptyObjects = objects.isEmpty();
CHECK_EXT(!emptyObjects || merge, os.setError(Document::tr("Document is empty.")), );
SAFE_POINT(headers.size() == mergedMapping.size(), "headers <-> regions mapping failed!", );
if (!merge) {
return;
}
U2Sequence u2seq = seqImporter.finalizeSequenceAndValidate(os);
CHECK_OP(os,);
sequenceRef = GObjectReference(io->getURL().getURLString(), u2seq.visualName, GObjectTypes::SEQUENCE, U2EntityRef(dbiRef, u2seq.id));
U1AnnotationUtils::addAnnotations(objects, seqImporter.getCaseAnnotations(), sequenceRef, NULL, hints);
objects << new U2SequenceObject(u2seq.visualName, U2EntityRef(dbiRef, u2seq.id));
objects << DocumentFormatUtils::addAnnotationsForMergedU2Sequence(sequenceRef, dbiRef, headers, mergedMapping, hints);
if (headers.size() > 1) {
writeLockReason = DocumentFormat::MERGED_SEQ_LOCK;
}
}
示例4: load
//.........这里部分代码省略.........
}
if (sequenceNumber >= 1 && merge) {
seqImporter.addDefaultSymbolsBlock(gapSize, os);
sequenceStart += gapSize;
CHECK_OP_BREAK(os);
}
int sequenceLen = 0;
while (!os.isCoR()) {
do {
len = io->readLine(buff, DocumentFormat::READ_BUFF_SIZE);
CHECK_EXT(!io->hasError(), os.setError(io->errorString()), );
} while (len <= 0 && !io->isEof());
CHECK_EXT(!io->hasError(), os.setError(io->errorString()), );
if (len <= 0 && io->isEof()) {
break;
}
CHECK_EXT(!io->hasError(), os.setError(io->errorString()), );
buff[len] = 0;
if(buff[0] != fastaCommentStartChar && buff[0] != FastaFormat::FASTA_HEADER_START_SYMBOL){
len = TextUtils::remove(buff, len, TextUtils::WHITES);
if(len > 0){
seqImporter.addBlock(buff, len, os);
sequenceLen += len;
}
}else if( buff[0] == FastaFormat::FASTA_HEADER_START_SYMBOL){
headerReaded = true;
break;
}
CHECK_OP_BREAK(os);
os.setProgress(io->getProgress());
}
if (merge) {
memoryLocker.tryAcquire(headerLine.size());
CHECK_OP_BREAK(os);
headers.append(headerLine);
mergedMapping.append(U2Region(sequenceStart, sequenceLen));
} else {
if (objectsCountLimit > 0 && objects.size() >= objectsCountLimit) {
os.setError(FastaFormat::tr("File \"%1\" contains too many sequences to be displayed. "
"However, you can process these data using instruments from the menu <i>Tools -> NGS data analysis</i> "
"or pipelines built with Workflow Designer.")
.arg(io->getURL().getURLString()));
break;
}
memoryLocker.tryAcquire(800);
CHECK_OP_BREAK(os);
U2Sequence seq = seqImporter.finalizeSequenceAndValidate(os);
if (os.hasError() && os.getError() == U2SequenceImporter::EMPTY_SEQUENCE_ERROR) {
os.setError("");
emptySeqNames << headerLine;
continue;
}
sequenceRef.entityRef = U2EntityRef(dbiRef, seq.id);
//TODO parse header
U2StringAttribute attr(seq.id, DNAInfo::FASTA_HDR, headerLine);
con.dbi->getAttributeDbi()->createStringAttribute(attr, os);
CHECK_OP_BREAK(os);
objects << new U2SequenceObject(seq.visualName, U2EntityRef(dbiRef, seq.id));
CHECK_OP_BREAK(os);