Example #1
0
QScriptValue ScriptTask::runScript(QScriptEngine* engine, const QMap<QString, QScriptValue>& inputParametersMap, const QString& scriptText, TaskStateInfo& stateInfo) {
    // create new script engine
    QScriptValue result;

    // setup all input params as global vars
    QScriptValue thiz = engine->globalObject();
    foreach(const QString& varName, inputParametersMap.keys()) {
        QScriptValue varVal = inputParametersMap.value(varName);
        thiz.setProperty(varName, varVal);
    }

    // check script syntax
    QScriptSyntaxCheckResult syntaxResult = engine->checkSyntax(scriptText);
    if (syntaxResult.state() != QScriptSyntaxCheckResult::Valid) {
        stateInfo.setError(tr("Script syntax check failed! Line: %1, error: %2").arg(syntaxResult.errorLineNumber()).arg(syntaxResult.errorMessage()));
        return result;
    }

    // run the script
    result = engine->evaluate(scriptText);

    if (engine->hasUncaughtException()) {
        stateInfo.setError(tr("Exception during script execution! Line: %1, error: %2")
                        .arg(engine->uncaughtExceptionLineNumber()).arg(engine->uncaughtExceptionBacktrace().join("\n")));
    }
    return result;
}
void EnzymesSelectorWidget::saveFile(const QString& url) {
    TaskStateInfo ti;
    QString source = AppContext::getSettings()->getValue(EnzymeSettings::DATA_FILE_KEY).toString();

    GTIMER(c1,t1,"FindEnzymesDialog::saveFile [EnzymesIO::writeEnzymes]");

    QSet<QString> enzymes;

    for(int i=0, n = tree->topLevelItemCount(); i<n; i++){
        EnzymeGroupTreeItem* gi = static_cast<EnzymeGroupTreeItem*>(tree->topLevelItem(i));
        for (int j=0, m = gi->childCount(); j < m; j++) {
            EnzymeTreeItem* item = static_cast<EnzymeTreeItem*>(gi->child(j));
            if (item->checkState(0) == Qt::Checked) {
                enzymes.insert(item->enzyme->id);
            }
        }
    }

    EnzymesIO::writeEnzymes(url, source, enzymes, ti);

    if (ti.hasError()) {
        if (isVisible()) {
            QMessageBox::critical(NULL, tr("Error"), ti.getError());
        } else  {
            uiLog.error(ti.getError());
        }
        return;
    }
    if (QMessageBox::question(this, tr("New enzymes database has been saved."),
        tr("Do you want to work with new database?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
            loadFile(url);
    }
}
void EnzymesSelectorWidget::loadFile(const QString& url) {
    TaskStateInfo ti;
    QList<SEnzymeData> enzymes;

    if (!QFileInfo(url).exists()) {
        ti.setError(  tr("File not exists: %1").arg(url) );
    } else {
        GTIMER(c1,t1,"FindEnzymesDialog::loadFile [EnzymesIO::readEnzymes]");
        enzymes = EnzymesIO::readEnzymes(url, ti);
    }
    if (ti.hasError()) {
        if (isVisible()) {
            QMessageBox::critical(NULL, tr("Error"), ti.getError());
        } else  {
            ioLog.error(ti.getError());
        }
        return;
    }
    if (!enzymes.isEmpty()) {
        if (AppContext::getSettings()->getValue(EnzymeSettings::DATA_FILE_KEY).toString() != url) {
            lastSelection.clear();
        }
        AppContext::getSettings()->setValue(EnzymeSettings::DATA_FILE_KEY, url);
    }

    setEnzymesList(enzymes);
}
/* we compare here that every domain of trueResult is included in myResult */
void
GTest_UHMM3SearchCompare::swCompareResults( const QList<UHMM3SWSearchTaskDomainResult>& myR, const UHMM3SearchResult& trueR,
                                            TaskStateInfo& ti, bool compareSeqRegion ) {
    int sz = trueR.domainResList.size();
    int i = 0;
    for( i = 0; i < sz; ++i ) {
        const UHMM3SearchSeqDomainResult & trueDom = trueR.domainResList.at(i);
        if(trueDom.score < 2) {
            continue;
        }
        QList<int> diff = findEqualDomain(myR, trueDom, compareSeqRegion);
        if(!diff.contains(0)) {
            int minPos = 0;
            int min = 1000000;
            for(int j = 0; j < myR.size(); ++j) {
                float d = qAbs(myR.at(j).generalResult.score - trueR.domainResList.at(i).score);
                if( d < min ) {
                    min = d;
                    minPos = j;
                }
            }
            if(!myR.isEmpty()) {
                ti.setError( QString( "Cannot find result #%1: %2, most close result: %3" ).
                    arg(i).
                    arg(seqDomainResult2String(trueR.domainResList.at(i))).
                    arg(seqDomainResult2String(myR.at(minPos).generalResult)));
            } else {
                ti.setError( QString( "Cannot find result #%1: %2" ).
                    arg(i).arg(seqDomainResult2String(trueR.domainResList.at(i))));
            }
            return;
        }
    }
}
Example #5
0
void SArrayIndexSerializer::readArray(QFile &file, char *buff, int *len, int *pos, int *bytes,
    int *lineIdx, quint32 *array, int arrLen, TaskStateInfo& ti) {
        quint32 number = 0;
        int numberLength = 0;
        bool newLine = true; Q_UNUSED(newLine); //used only in assertions
        for (int i = 0; i < arrLen; i++) {
            number = 0;
            numberLength = 0;
            assert(newLine);
            while (1) {
                if (*pos == *len) {
                    ti.progress = (int)(100 *(*bytes/(double)file.size()));
                    *len = file.read(buff, BUFF_SIZE);
                    *bytes += *len;
                    *pos = 0;
                    if (*len <= 0) {
                        break;
                    }
                    if (ti.cancelFlag) {
                        return;
                    }
                }
                char c = buff[*pos];
                if ('\n' == c || 0 == c) {
                    (*pos)++;
                    (*lineIdx)++;
                    newLine = true;
                    break;
                } else if (c >='0'  && c<='9') {
                    number = number*10+(c-'0');
                    (*pos)++;
                    numberLength++;
                    newLine = false;
                } else {
                    ti.setError(QString("Not digit in the number at line %1").arg(*lineIdx));
                    return;
                }
            }

            if (0 == *len && (arrLen - 1) != i) {
                ti.setError("There is not enough array's values it the file-index");
                return;
            }
            if (0 == numberLength) {
                ti.setError(QString("Empty array's value at line %1").arg(*lineIdx-1));
                return;
            }
            array[i] = number;
        }
}
void ImportAnnotationsFromCSVDialog::preview(bool silent) {
    QString fileName = checkInputGroup(silent);
    if (fileName.isEmpty()) {
        return;
    }
    QString text = readFileHeader(fileName, silent);

    previewTable->clear();
    rawPreview->clear();

    rawPreview->setPlainText(text);

    if (!checkSeparators(true)) {
        return;
    }
    CSVParsingConfig parseOptions;
    toParsingConfig(parseOptions);
    if (parseOptions.splitToken.isEmpty() && parseOptions.parsingScript.isEmpty()) {
        return;
    }


    int columnCount = 0;
    TaskStateInfo ti;
    QList<QStringList> lines = ReadCSVAsAnnotationsTask::parseLinesIntoTokens(text, parseOptions, columnCount, ti);
    if (ti.hasError()) {
        QMessageBox::critical(this, L10N::errorTitle(), ti.getError());
        return;
    }
    prepareColumnsConfig(columnCount);
    columnCount = qMax(columnCount, columnsConfig.size());

    previewTable->setRowCount(lines.size());
    previewTable->setColumnCount(columnCount);

    for (int column = 0; column < columnCount; column++) {
        QTableWidgetItem* headerItem = createHeaderItem(column);
        previewTable->setHorizontalHeaderItem(column, headerItem);
    }
    for (int row = 0; row < lines.size(); row++) {
        const QStringList& rowData = lines.at(row);
        for (int column = 0; column < rowData.size(); column ++) {
            QString token = rowData.at(column);
            QTableWidgetItem* item = new QTableWidgetItem(token);
            item->setFlags(Qt::ItemIsEnabled);
            previewTable->setItem(row, column, item);
        }
    }
}
Example #7
0
void KalignAdapter::align(const MultipleSequenceAlignment& ma, MultipleSequenceAlignment& res, TaskStateInfo& ti) {
    if(ti.cancelFlag)  {
        return;
    }
    try {
        alignUnsafe(ma, res, ti);
    } catch (const KalignException &e) {
        if (!ti.cancelFlag) {
            ti.setError(tr("Internal Kalign error: %1").arg(e.str));
        }
    }
}
Example #8
0
  double QScore(const MAlignment& maTest, const MAlignment& maRef, TaskStateInfo& ti) {
    MSA_QScore msaTest, msaRef;
    try {
      convertMAlignment2MSA(msaTest, maTest);
      convertMAlignment2MSA(msaRef, maRef);
      return QScore(&msaTest, &msaRef);
    } catch(const QScoreException &e) {
      ti.setError(QString("QScore throws exception: %1").arg(e.str));
      return 0;
    }

  }
Example #9
0
void setupAlphaAndScore(const DNAAlphabet* al, TaskStateInfo& ti) {
    ALPHA Alpha = convertAlpha(al);
    if (Alpha == ALPHA_Undefined) {
        ti.setError(  U2::MuscleAdapter::tr("Unsupported alphabet: %1").arg(al->getName()) );
        return;
    }
    SetAlpha(Alpha);
    SetPPScore();
    if (ALPHA_DNA == Alpha || ALPHA_RNA == Alpha) {
        SetPPScore(PPSCORE_SPN);
    }
}
Example #10
0
void UHMM3SWSearchTask::onRegion(SequenceWalkerSubtask* t, TaskStateInfo& ti) {
    assert(NULL != t);
    if(stateInfo.hasError() || ti.hasError()) {
        return;
    }

    const char* seq = t->getRegionSequence();
    int seqLen      = t->getRegionSequenceLen();

    UHMM3SearchTaskLocalStorage::createTaskContext(t->getTaskId());
    int wholeSeqSz = t->getGlobalConfig().seqSize;
    wholeSeqSz = t->isAminoTranslated() ? (wholeSeqSz / 3) : wholeSeqSz;
    QList<UHMM3SearchResult > generalResults;
    foreach(const P7_HMM* hmm, hmms){
        UHMM3SearchResult generalRes = UHMM3Search::search(hmm, seq, seqLen, settings.inner, ti, wholeSeqSz);
        generalResults.append(generalRes);
        if(ti.hasError()) {
            UHMM3SearchTaskLocalStorage::freeTaskContext(t->getTaskId());
            return;
        }
    }
bool BreakpointConditionChecker::evaluateCondition(const AttributeScript *conditionContext) {
    Q_ASSERT(NULL != conditionContext);

    QMutexLocker lock(&engineGuard);

    if (NULL == engine || NULL == engine->getWorkflowContext()) {
        return false;
    }
    if (conditionText.isEmpty() || !enabled) {
        return true;
    }

    QMap<QString, QScriptValue> scriptVars;
    foreach (const Descriptor & key, conditionContext->getScriptVars().uniqueKeys()) {
        assert(!key.getId().isEmpty());
        scriptVars[key.getId()] = engine->newVariant(conditionContext->getScriptVars().value(key));
    }
    TaskStateInfo stateInfo;
    QScriptValue evaluationResult = ScriptTask::runScript(engine, scriptVars, conditionText,
        stateInfo);
    if (stateInfo.hasError()) {
        coreLog.error("Breakpoint condition evaluation failed. Error:\n" + stateInfo.getError());
        return false;
    } else if (evaluationResult.isBool()) {
        bool evaluatedResult = evaluationResult.toBool();
        if (HAS_CHANGED == parameter) {
            const bool returningValue = (DEFAULT_CONDITION_EVAL_RESULT == lastConditionEvaluation)
                ? false : (static_cast<bool>(lastConditionEvaluation) != evaluatedResult);
            lastConditionEvaluation = static_cast<int>(evaluatedResult);
            evaluatedResult = returningValue;
        }
        coreLog.trace(QString("Condition of breakpoint is %1").arg(evaluatedResult
            ? "true" : "false"));
        return evaluatedResult;
    } else {
        coreLog.error("Breakpoint condition's evaluation has provided no boolean value");
        return false;
    }
}
Example #12
0
Document* PFMatrixFormat::loadDocument( IOAdapter* io, const U2DbiRef& dbiRef, const QVariantMap& fs, U2OpStatus& os ){
    DbiOperationsBlock opBlock(dbiRef, os);
    CHECK_OP(os, NULL);
    Q_UNUSED(opBlock);

    QList<GObject*> objs;
    IOAdapterFactory* iof = AppContext::getIOAdapterRegistry()->getIOAdapterFactoryById(io->getAdapterId());
    TaskStateInfo siPFM;
    PFMatrix m = WeightMatrixIO::readPFMatrix(iof, io->getURL().getURLString(), siPFM);
    if (siPFM.hasError()) {
        os.setError(tr("The file format is not PFM"));
    } else {
       if (m.getLength() == 0) {
            os.setError(tr("Zero length or corrupted model\nMaybe model data are not enough for selected algorithm"));
        }
    }
    CHECK_OP(os, NULL);

    PFMatrixObject *mObj = PFMatrixObject::createInstance(m, QFileInfo(io->getURL().getURLString()).baseName(), dbiRef, os, fs);
    CHECK_OP(os, NULL);
    objs.append(mObj);
    return new Document(this, io->getFactory(), io->getURL(), dbiRef, objs, fs);
}
Example #13
0
void UHMMCalibrate::calibrate(plan7_s* hmm, const UHMMCalibrateSettings& s, TaskStateInfo& si) {
    
    struct histogram_s *hist;     // a resulting histogram 

    float max = 0;
    main_loop_serial(hmm, s.seed, s.nsample, s.lenmean, s.lensd, s.fixedlen,  &hist, &max, si.cancelFlag, si.progress);
    if (!si.cancelFlag) {
        // Fit an EVD to the observed histogram.
        // The TRUE left-censors and fits only the right slope of the histogram.
        // The 9999. is an arbitrary high number that means we won't trim
        // outliers on the right.

        if (! ExtremeValueFitHistogram(hist, TRUE, 9999.)) {
            si.setError(  "fit failed; num sequences may be set too small?\n" );
        } else {
            hmm->flags |= PLAN7_STATS;
            hmm->mu     = hist->param[EVD_MU];
            hmm->lambda = hist->param[EVD_LAMBDA];
        }
    }
    FreeHistogram(hist);
}
Example #14
0
void setTaskDesc(struct kalign_context* ctx, const char *str ) {
	TaskStateInfo *tsi = (TaskStateInfo*)ctx->ptask_state;
    QString description = QString::fromLatin1(str);
    description.replace('\n', " ");
    tsi->setDescription(description);
}
Example #15
0
QList<UHMMSearchResult> UHMMSearch::search(plan7_s* _hmm, const char* seq, int seqLen, const UHMMSearchSettings& s, TaskStateInfo& si) 
{
    plan7_s * hmm = HMMIO::cloneHMM( _hmm );
    //Set up optional Pfam score thresholds. 
    threshold_s thresh;         // contains all threshold (cutoff) info
    thresh.globE   = s.globE; // use a reasonable Eval threshold
    thresh.globT   = -FLT_MAX;  // but no bit threshold
	thresh.domT    = s.domT;  // no domain bit threshold 
	thresh.domE    = s.domE;   // and no domain Eval threshold
    thresh.autocut = CUT_NONE;  // and no Pfam cutoffs used        
    thresh.Z       = s.eValueNSeqs; // Z not preset; use actual # of seqs 

    int   do_null2      = TRUE;    // TRUE to adjust scores with null model #2 
    int   do_forward    = FALSE;   // TRUE to use Forward() not Viterbi()      
    int   do_xnu        = FALSE;   // TRUE to filter sequences thru XNU        
    QList<UHMMSearchResult> res;   // the results of the method

    //get HMMERTaskLocalData
	HMMERTaskLocalData *tld = getHMMERTaskLocalData();
	alphabet_s *al = &tld->al;
	
    SetAlphabet(hmm->atype);

    P7Logoddsify(hmm, !do_forward); //TODO: clone model to avoid changes in it or make it thread safe??

    if (do_xnu && al->Alphabet_type == hmmNUCLEIC) {
        si.setError( "The HMM is a DNA model, and you can't use the --xnu filter on DNA data" );
        return res;
    }

    /*****************************************************************
    * Set up optional Pfam score thresholds. 
    * Can do this before starting any searches, since we'll only use 1 HMM.
    *****************************************************************/ 

    if (!SetAutocuts(&thresh, hmm)) {
        si.setError(  "HMM did not contain the GA, TC, or NC cutoffs you needed" );
        return res;
    }

    // set up structures for storing output
    histogram_s *histogram  = AllocHistogram(-200, 200, 100);  //keeps full histogram of all scores
    tophit_s   *ghit        = AllocTophits(200);               // per-seq hits: 200=lumpsize
    tophit_s   *dhit        = AllocTophits(200);               // domain hits:  200=lumpsize
    
    int     nseq = 0;         // number of sequences searched   
#ifdef UGENE_CELL
    if( HMMSearchAlgo_CellOptimized == s.alg ) {
        if( hmm->M < MAX_HMM_LENGTH ) {
            main_loop_spe(hmm, seq, seqLen, &thresh, do_forward, do_null2, do_xnu, histogram, ghit, dhit, &nseq, si);
        } else {
            main_loop_serial(hmm, seq, seqLen, &thresh, do_forward, do_null2, do_xnu, histogram, ghit, dhit, &nseq, si);
        }
    } else
#elif defined(HMMER_BUILD_WITH_SSE2)
    if( HMMSearchAlgo_SSEOptimized == s.alg ) {
        main_loop_opt(hmm, seq, seqLen, &thresh, do_forward, do_null2, do_xnu, histogram, ghit, dhit, &nseq, si, sseScoring);
    } else
#endif
    if( HMMSearchAlgo_Conservative == s.alg ) {
        main_loop_serial(hmm, seq, seqLen, &thresh, do_forward, do_null2, do_xnu, histogram, ghit, dhit, &nseq, si);
    }
    else {
        assert( false && "bad hmmsearch algorithm selected" );
    }
    // Process hit lists, produce text output

    // Set the theoretical EVD curve in our histogram using calibration in the HMM, if available. 
    if (hmm->flags & PLAN7_STATS) {
        ExtremeValueSetHistogram(histogram, hmm->mu, hmm->lambda, histogram->lowscore, histogram->highscore, 0);
    }
    if (!thresh.Z) {
        thresh.Z = nseq;       // set Z for good now that we're done
    }

    //report our output 

    FullSortTophits(dhit);

    //int namewidth = MAX(8, TophitsMaxName(ghit)); // max width of sequence name

    // Report domain hits (sorted on E-value)
    for (int i = 0; i < dhit->num && !si.cancelFlag; i++) {
        float   sc;                 // score of an HMM search                
        double  pvalue;             // pvalue of an HMM score
        double  evalue;             // evalue of an HMM score
        char    *name, *desc;       // hit sequence name and description
        double  motherp;            // pvalue of a whole seq HMM score
        float   mothersc;           // score of a whole seq parent of domain 
        int     sqfrom, sqto;       // coordinates in sequence                
        int     sqlen;              // length of seq that was hit
        int     hmmfrom, hmmto;     // coordinate in HMM                      
        int     ndom;               // total # of domains in this seq   
        int     domidx;             // number of this domain 

        GetRankedHit(dhit, i, &pvalue, &sc, &motherp, &mothersc,
                    &name, NULL, &desc,
                    &sqfrom, &sqto, &sqlen,      // seq position info
                    &hmmfrom, &hmmto, NULL,      // HMM position info 
                    &domidx, &ndom,              // domain info
                    NULL);                       // alignment info     

        evalue = pvalue * (double) thresh.Z;
        
        if (motherp * (double) thresh.Z > thresh.globE || mothersc < thresh.globT)  {
            continue;
        } else if (evalue <= thresh.domE && sc >= thresh.domT) {
            // hmm reports results in range [1...N] -> translate it to [0..N)
            res.append(UHMMSearchResult(U2Region(sqfrom-1, sqto-sqfrom+1), sc, evalue));
        }
    }

    //Clean-up and exit.
    FreeHistogram(histogram);
    FreeTophits(ghit);
    FreeTophits(dhit);
	FreePlan7( hmm );
    
    return res;
}
Example #16
0
void SArrayIndexSerializer::deserialize(SArrayIndex *index, const QString &indexFileName, TaskStateInfo& ti) {
    QFile file(indexFileName);
    if (!file.open(QIODevice::ReadOnly)) {
        ti.setError("Can't open file-index");
        return;
    }
    QByteArray data;
    bool eol = false;
    bool intErr = false;
    int lineIdx = 0;

    do {
        data = file.readLine().trimmed();
        lineIdx++;
    } while (data.length() > 0 && '#' == data[0]);

    if (0 == data.length()) {
        ti.setError("Empty parameters' line in the file-index");
        return;
    }
    index->w = getNextInt(data, eol, intErr);
    index->w4 = getNextInt(data, eol, intErr);
    index->wRest = getNextInt(data, eol, intErr);
    index->skipGap = getNextInt(data, eol, intErr);
    index->gapOffset = getNextInt(data, eol, intErr);
    index->arrLen = getNextInt(data, eol, intErr);
    index->seqLen = getNextInt(data, eol, intErr);
    index->bitFilter = getNextInt(data, eol, intErr);
    index->wCharsInMask = getNextInt(data, eol, intErr);
    index->wAfterBits = getNextInt(data, eol, intErr);
    index->l1Step = getNextInt(data, eol, intErr);
    if (eol) {
        ti.setError("Too little amount of parameters in the file-index");
        return;
    }
    index->L1_SIZE = getNextInt(data, eol, intErr);
    if (intErr) {
        ti.setError("Bad integer for some parameter in the file-index");
        return;
    }

    if (index->w <= 0 || index->arrLen <= 0) {
        ti.setError("Negative index's parameters");
        return;
    }

    index->sArray = new quint32[index->arrLen];
    QByteArray readBuffer(BUFF_SIZE, '\0');
    char *buff = readBuffer.data();
    lineIdx++;
    int len = 0;
    int pos = 0;
    int bytes = len;
    readArray(file, buff, &len, &pos, &bytes, &lineIdx, index->sArray, index->arrLen, ti);
    if (ti.cancelFlag || ti.hasError()) {
        file.close();
        return;
    }

    index->bitMask = new quint32[index->arrLen];
    readArray(file, buff, &len, &pos, &bytes, &lineIdx, index->bitMask, index->arrLen, ti);
    if (ti.cancelFlag || ti.hasError()) {
        file.close();
        return;
    }

    index->l1bitMask = new quint32[index->L1_SIZE];
    readArray(file, buff, &len, &pos, &bytes, &lineIdx, index->l1bitMask, index->L1_SIZE, ti);
    file.close();
}
void GTest_UHMM3SearchCompare::generalCompareResults( const UHMM3SearchResult& myRes, const UHMM3SearchResult& trueRes, TaskStateInfo& ti ) {
    const UHMM3SearchCompleteSeqResult& myFull = myRes.fullSeqResult;
    const UHMM3SearchCompleteSeqResult& trueFull = trueRes.fullSeqResult;

    if( myFull.isReported != trueFull.isReported ) {
        ti.setError( QString( "reported_flag_not_matched: %1 and %2" ).arg( myFull.isReported ).arg( trueFull.isReported ) );
        return;
    }

    if( myFull.isReported ) {
        if( !compareNumbers<float>( myFull.bias, trueFull.bias )   ) {
            ti.setError( QString( "full_seq_bias_not_matched: %1 and %2" ).arg( myFull.bias ).arg( trueFull.bias ) );  return;
        }
        if( !compareNumbers<double>( myFull.eval, trueFull.eval )  ) {
            ti.setError( QString( "full_seq_eval_not_matched: %1 and %2" ).arg( myFull.eval ).arg( trueFull.eval ) );  return;
        }
        if( !compareNumbers<float>( myFull.score, trueFull.score ) ) {
            ti.setError( QString( "full_seq_score_not_matched: %1 and %2" ).arg( myFull.score ).arg( trueFull.score ) ); return;
        }
        if( !compareNumbers<float>( myFull.expectedDomainsNum, trueFull.expectedDomainsNum ) ) {
            ti.setError( QString( "full_seq_exp_not_matched: %1 and %2" ).arg( myFull.expectedDomainsNum ).arg( trueFull.expectedDomainsNum ) );
            return;
        }
        if( myFull.reportedDomainsNum != trueFull.reportedDomainsNum ) {
            ti.setError( QString( "full_seq_n_not_matched: %1 and %2" ).arg( myFull.reportedDomainsNum ).arg( trueFull.reportedDomainsNum ) );
            return;
        }
    }

    const QList< UHMM3SearchSeqDomainResult >& myDoms = myRes.domainResList;
    const QList< UHMM3SearchSeqDomainResult >& trueDoms = trueRes.domainResList;
    if( myDoms.size() != trueDoms.size() ) {
        ti.setError( QString( "domain_res_number_not_matched: %1 and %2" ).arg( myDoms.size() ).arg( trueDoms.size() ) );
        return;
    }
    for( int i = 0; i < myDoms.size(); ++i ) {
        UHMM3SearchSeqDomainResult myCurDom = myDoms.at( i );
        UHMM3SearchSeqDomainResult trueCurDom = trueDoms.at( i );
        if( !compareNumbers<double>( myCurDom.acc, trueCurDom.acc ) )   {
            ti.setError( QString( "dom_acc_not_matched: %1 and %2" ).arg( myCurDom.acc ).arg( trueCurDom.acc ) );   return;
        }
        if( !compareNumbers<float>( myCurDom.bias, trueCurDom.bias ) )  {
            ti.setError( QString( "dom_bias_not_matched: %1 and %2" ).arg( myCurDom.bias ).arg( trueCurDom.bias ) );  return;
        }
        if( !compareNumbers<double>( myCurDom.cval, trueCurDom.cval ) )  {
            ti.setError( QString( "dom_cval_not_matched: %1 and %2" ).arg( myCurDom.cval ).arg( trueCurDom.cval ) );  return;
        }
        if( !compareNumbers<double>( myCurDom.ival, trueCurDom.ival ) )  {
            ti.setError( QString( "dom_ival_not_matched: %1 and %2" ).arg( myCurDom.ival ).arg( trueCurDom.ival ) );  return;
        }
        if( !compareNumbers<float>( myCurDom.score, trueCurDom.score ) ) {
            ti.setError( QString( "dom_score_not_matched: %1 and %2" ).arg( myCurDom.score ).arg( trueCurDom.score ) ); return;
        }
        if( myCurDom.envRegion != trueCurDom.envRegion ) {
            ti.setError( QString( "dom_env_region_not_matched: %1---%2 and %3---%4" ).
                arg( myCurDom.envRegion.startPos ).arg( myCurDom.envRegion.length ).arg( trueCurDom.envRegion.startPos ).
                arg( trueCurDom.envRegion.length ) ); return;
        }
        if( myCurDom.queryRegion != trueCurDom.queryRegion ) {
            ti.setError( QString( "dom_hmm_region_not_matched: %1---%2 and %3---%4" ).
                arg( myCurDom.queryRegion.startPos ).arg( myCurDom.queryRegion.length ).arg( trueCurDom.queryRegion.startPos ).
                arg( trueCurDom.queryRegion.length ) ); return;
        }
        if( myCurDom.seqRegion != trueCurDom.seqRegion ) {
            ti.setError( QString( "dom_seq_region_not_matched: %1---%2 and %3---%4" ).
                arg( myCurDom.seqRegion.startPos ).arg( myCurDom.seqRegion.length ).arg( trueCurDom.seqRegion.startPos ).
                arg( trueCurDom.seqRegion.length ) ); return;
        }
        if( myCurDom.isSignificant != trueCurDom.isSignificant ) {
            ti.setError( QString( "dom_sign_not_matched: %1 and %2" ).arg( myCurDom.isSignificant ).arg( trueCurDom.isSignificant ) );
            return;
        }
    }
}