• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ U2SequenceObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中U2SequenceObject的典型用法代码示例。如果您正苦于以下问题:C++ U2SequenceObject类的具体用法?C++ U2SequenceObject怎么用?C++ U2SequenceObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了U2SequenceObject类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: report

Task::ReportResult GTest_DNASequenceQualityScores::report() {

    GObject *obj = getContext<GObject>(this, objContextName);
    if(obj==NULL){
        stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
        return ReportResult_Finished;
    }

    U2SequenceObject * mySequence = qobject_cast<U2SequenceObject*>(obj);
    if(mySequence==NULL){
        stateInfo.setError(QString("Can't cast to sequence from: %1").arg(obj->getGObjectName()));
        return ReportResult_Finished;
    }

    const DNAQuality& quality = mySequence->getQuality();
    if (quality.isEmpty()) {
        stateInfo.setError("Sequence doesn't have quality scores");
        return ReportResult_Finished;
    }

    if (quality.qualCodes != qualityScores) {
        stateInfo.setError( QString("Quality scores are not valid! The score is %1, expected %2").arg(quality.qualCodes.constData()).arg(qualityScores.constData()));
        return ReportResult_Finished;
    }

    return ReportResult_Finished;
}
开发者ID:m-angelov,项目名称:ugene,代码行数:27,代码来源:DNASequenceObjectTests.cpp


示例2: URL

void DotPlotDialog::sl_loadTaskStateChanged(Task* t){
    DotPlotLoadDocumentsTask *loadTask = qobject_cast<DotPlotLoadDocumentsTask*>(t);
    if (!loadTask || !loadTask->isFinished()) {
            if(t->isFinished()){
                if(curURL == ""){
                    return;
                }
                GUrl URL(curURL);
                Project *project = AppContext::getProject();
                SAFE_POINT(project, "project is NULL", );
                Document *doc = project->findDocumentByURL(URL);
                if (!doc || !doc->isLoaded()) {
                    return;
                }
                QList<GObject*> docObjects  = doc->getObjects();
                foreach (GObject* obj, docObjects) {
                    U2SequenceObject* seqObj = qobject_cast<U2SequenceObject*>(obj);
                    if (seqObj != NULL){
                        QString name = seqObj->getGObjectName();
                        xAxisCombo->addItem(name);
                        yAxisCombo->addItem(name);
                        sequences << seqObj;
                    }
                }
                curURL = "";
            }
            return;
    }
开发者ID:ugeneunipro,项目名称:ugene-old,代码行数:28,代码来源:DotPlotDialog.cpp


示例3: tr

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();
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:28,代码来源:EnzymesPlugin.cpp


示例4: run

void EvaluateBaseContentTask::run() {
    if (_obj->getGObjectType() == GObjectTypes::SEQUENCE) {
        U2SequenceObject* dnaObj = qobject_cast<U2SequenceObject*>(_obj);
        alp = dnaObj->getAlphabet();
        DNASequenceGenerator::evaluateBaseContent(dnaObj->getWholeSequence(stateInfo), result);
    } else if (_obj->getGObjectType() == GObjectTypes::MULTIPLE_SEQUENCE_ALIGNMENT) {
        MultipleSequenceAlignmentObject* maObj = qobject_cast<MultipleSequenceAlignmentObject*>(_obj);
        alp = maObj->getAlphabet();
        DNASequenceGenerator::evaluateBaseContent(maObj->getMultipleAlignment(), result);
    } else {
        stateInfo.setError(tr("Base content can be evaluated for sequence or sequence alignment"));
    }
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:13,代码来源:DNASequenceGenerator.cpp


示例5: ma

MAlignment Kalign_Load_Align_Compare_Task::dna_to_ma(QList<GObject*> dnaSeqs) {

    int seqCount = dnaSeqs.count();
    U2SequenceObject *seq = qobject_cast<U2SequenceObject *>(dnaSeqs[0]);
    MAlignment ma("Alignment",seq->getAlphabet());
    for(int i=0; i<seqCount; i++) {
        seq = qobject_cast<U2SequenceObject *>(dnaSeqs[i]);
        if(seq == NULL) {
            stateInfo.setError(  QString("Can't cast GObject to U2SequenceObject") );
            return ma;
        }
        QByteArray seqData = seq->getWholeSequenceData(stateInfo);
        SAFE_POINT_OP(stateInfo, MAlignment());
        ma.addRow(seq->getSequenceName(), seqData, stateInfo);
        SAFE_POINT_OP(stateInfo, MAlignment());
    }
    return ma;
}
开发者ID:ugeneunipro,项目名称:ugene-old,代码行数:18,代码来源:KalignTests.cpp


示例6: prepare

void GTest_SecStructPredictTask::prepare()
{
    U2SequenceObject * mySequence = getContext<U2SequenceObject>(this, seqName);
    if(mySequence==NULL){
        stateInfo.setError( QString("error can't cast to sequence from GObject"));
        return;
    }
    SecStructPredictAlgRegistry* sspr = AppContext::getSecStructPredictAlgRegistry();
    if (!sspr->hadRegistered(algName)) {
        stateInfo.setError( QString(tr("Algorithm named %1 not found")).arg(algName));
        return;
    }
    SecStructPredictTaskFactory* factory = sspr->getAlgorithm(algName);
    QByteArray seqData = mySequence->getWholeSequenceData(stateInfo);
    task = factory->createTaskInstance(seqData);
    CHECK_OP(stateInfo, );
    addSubTask(task);
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:18,代码来源:SecStructPredictTests.cpp


示例7: sl_search

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();
}
开发者ID:ugeneunipro,项目名称:ugene-old,代码行数:40,代码来源:uHMMPlugin.cpp


示例8: assert

void GTest_UHMM3Search::setAndCheckArgs() {
    assert( !stateInfo.hasError() );
    if( hmmFilename.isEmpty() ) {
        stateInfo.setError( "hmm_filename_is_empty" );
        return;
    }
    hmmFilename = env->getVar( "COMMON_DATA_DIR" ) + "/" + hmmFilename;

    if( searchTaskCtxName.isEmpty() ) {
        stateInfo.setError( "task_ctx_name_is_empty" );
        return;
    }

    if( seqDocCtxName.isEmpty() ) {
        stateInfo.setError( "sequence_document_ctx_name_is_empty" );
        return;
    }

    if( UNKNOWN_SEARCH == algo ) {
        stateInfo.setError( "unknown_algorithm_type" );
        return;
    }

    Document* seqDoc = getContext<Document>( this, seqDocCtxName );
    if( NULL == seqDoc ) {
        stateInfo.setError( QString( "context %1 not found" ).arg( seqDocCtxName ) );
        return;
    }
    QList< GObject* > objsList = seqDoc->findGObjectByType( GObjectTypes::SEQUENCE );
    CHECK_EXT(!objsList.isEmpty(),setError("No sequence objects found!"), );
    U2SequenceObject* seqObj = qobject_cast< U2SequenceObject* >( objsList.first() );
    sequence = seqObj->getWholeSequence(stateInfo);
    CHECK_OP(stateInfo, );
    CHECK_EXT(sequence.length() > 0, setError(tr("Sequence is empty")), );

    if( !machinePath.isEmpty() ) {
        machinePath = env->getVar( "COMMON_DATA_DIR" ) + "/" + machinePath;
    }
}
开发者ID:ugeneunipro,项目名称:ugene-old,代码行数:39,代码来源:uhmmer3SearchTests.cpp


示例9: getSequenceContext

void ADVClipboard::copySequenceSelection(bool complement, bool amino) {
    ADVSequenceObjectContext* seqCtx = getSequenceContext();
    if (seqCtx == NULL) {
        QMessageBox::critical(QApplication::activeWindow(), L10N::errorTitle(), "No sequence selected!");
        return;
    }

    QString res;
    QVector<U2Region> regions = seqCtx->getSequenceSelection()->getSelectedRegions();
#ifdef UGENE_X86
    int totalLen = 0;
    foreach (const U2Region& r, regions) {
        totalLen += r.length;
    }
    if (totalLen > MAX_COPY_SIZE_FOR_X86) {
        QMessageBox::critical(QApplication::activeWindow(), L10N::errorTitle(), COPY_FAILED_MESSAGE);
        return;
    }
 #endif

    if (!regions.isEmpty()) {
        U2SequenceObject* seqObj = seqCtx->getSequenceObject();
        DNATranslation* complTT = complement ? seqCtx->getComplementTT() : NULL;
        DNATranslation* aminoTT = amino ? seqCtx->getAminoTT() : NULL;
        U2OpStatus2Log os;
        QList<QByteArray> seqParts = U2SequenceUtils::extractRegions(seqObj->getSequenceRef(), regions, complTT, aminoTT, false, os);
        if (os.hasError()) {
            QMessageBox::critical(QApplication::activeWindow(), L10N::errorTitle(), tr("An error occurred during getting sequence data: %1").arg(os.getError()));
            return;
        }
        if (seqParts.size() == 1) {
            putIntoClipboard(seqParts.first());
            return;
        }
        res = U1SequenceUtils::joinRegions(seqParts);
    }
    putIntoClipboard(res);
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:38,代码来源:ADVClipboard.cpp


示例10: CHECK_OP

U2SequenceObject *importSequence(DNASequence &sequence,
                                 const QString &objName,
                                 QList<GObject*>& objects,
                                 U2SequenceImporter &seqImporter,
                                 const U2DbiRef& dbiRef,
                                 const QString& folder,
                                 U2OpStatus& os)
{
    seqImporter.startSequence(dbiRef, folder, sequence.getName(), sequence.circular, os);
    CHECK_OP(os, NULL);
    seqImporter.addBlock(sequence.seq.constData(), sequence.seq.length(), os);
    CHECK_OP(os, NULL);
    U2Sequence u2seq = seqImporter.finalizeSequenceAndValidate(os);
    TmpDbiObjects dbiObjects(dbiRef, os);
    dbiObjects.objects << u2seq.id;
    CHECK_OP(os, NULL);

    U2SequenceObject *seqObj = new U2SequenceObject(objName, U2EntityRef(dbiRef, u2seq.id));
    seqObj->setSequenceInfo(sequence.info);
    objects << seqObj;

    return seqObj;
}
开发者ID:neuroidss,项目名称:ugene,代码行数:23,代码来源:GFFFormat.cpp


示例11: sl_minLenHeuristics

void DotPlotDialog::sl_minLenHeuristics() {
    identityBox->setValue(100);

    // formula used here: nVariations / lenVariations = wantedResCount (==1000)
    // where nVariations == area size
    // lenVariations = 4^len where len is result
    // so we have len = ln(nVariations/wantedResCount)/ln(4)

    int xIdx = xAxisCombo->currentIndex();
    int yIdx = yAxisCombo->currentIndex();

    U2SequenceObject *objX = sequences.at(xIdx);
    U2SequenceObject *objY = sequences.at(yIdx);

    qint64 xSeqLen = objX->getSequenceLength();
    qint64 ySeqLen = objY->getSequenceLength();

    double nVariations = xSeqLen*ySeqLen;
    double resCount = 1000;
    double len = log(nVariations / resCount) / log(double(4));

    minLenBox->setValue((int)len);
}
开发者ID:ugeneunipro,项目名称:ugene-old,代码行数:23,代码来源:DotPlotDialog.cpp


示例12: rezult

Task::ReportResult GTest_DNATranslation3to1Test::report() {
    GObject *obj = getContext<GObject>(this, objContextName);
    if (obj==NULL){
        stateInfo.setError(QString("wrong value: %1").arg(OBJ_ATTR));
        return ReportResult_Finished;
    }

    U2SequenceObject * mySequence = qobject_cast<U2SequenceObject*>(obj);
    if(mySequence==NULL){
        stateInfo.setError(QString("error can't cast to sequence from: %1").arg(obj->getGObjectName()));
        return ReportResult_Finished;
    }
    if(!(mySequence->getAlphabet()->isNucleic())){
        stateInfo.setError(QString("error Alphabet is not Nucleic: %1").arg(mySequence->getAlphabet()->getId()));
        return ReportResult_Finished;
    }

    DNATranslation* aminoTransl = 0;

    DNATranslationRegistry* tr = AppContext::getDNATranslationRegistry();

    QList<DNATranslation*> aminoTs = tr->lookupTranslation(mySequence->getAlphabet(), DNATranslationType_NUCL_2_AMINO);
    if (!aminoTs.empty()) {
        aminoTransl = tr->getStandardGeneticCodeTranslation(mySequence->getAlphabet());
    }
    int tempValue;
    if(strTo == -1){
        tempValue=-1;
    } else{
        tempValue=(strTo-strFrom+1);
    }
    QByteArray myByteArray = mySequence->getSequenceData(U2Region(strFrom,tempValue));
    QByteArray rezult(myByteArray.length() / 3, 0);
    int n = aminoTransl->translate(myByteArray, myByteArray.length(), rezult.data(), rezult.length());
    assert(n == rezult.length()); Q_UNUSED(n);

    if(rezult != stringValue.toLatin1()){
        stateInfo.setError(QString("translated sequence not matched: %1, expected %2 ").arg(rezult.data()).arg(stringValue));
        return ReportResult_Finished;
    }
    return ReportResult_Finished;
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:42,代码来源:DNATranslationImplTests.cpp


示例13: filterAcceptsObject

bool SequenceAccFilterTask::filterAcceptsObject(GObject *obj) {
    U2SequenceObject *seqObject = qobject_cast<U2SequenceObject *>(obj);
    CHECK(NULL != seqObject, false);
    return settings.nameFilterAcceptsString(seqObject->getSequenceInfo()[DNAInfo::ACCESSION].toString());
}
开发者ID:m-angelov,项目名称:ugene,代码行数:5,代码来源:SequenceAccFilterTask.cpp


示例14: QString

void GTest_uHMMERSearch::prepare() {
    Document* doc = getContext<Document>(this, seqDocCtxName);
    if (doc == NULL) {
        stateInfo.setError(  QString("context not found %1").arg(seqDocCtxName) );
        return;
    }


    QList<GObject*> list = doc->findGObjectByType(GObjectTypes::SEQUENCE);
    if (list.size() == 0) {
        stateInfo.setError(  QString("container of object with type \"%1\" is empty").arg(GObjectTypes::SEQUENCE) );
        return;
    }

    GObject *obj = list.first();
    if(obj==NULL){
        stateInfo.setError(  QString("object with type \"%1\" not found").arg(GObjectTypes::SEQUENCE) );
        return;
    }
    assert(obj!=NULL);
    U2SequenceObject * mySequence = qobject_cast<U2SequenceObject*>(obj);
    if(mySequence==NULL){
        stateInfo.setError(  QString("error can't cast to sequence from GObject") );
        return;
    }

    UHMMSearchSettings s;
    if (expertOptions){
        s.globE = evalueCutoff;
        s.eValueNSeqs = number_of_seq;
        s.domE = domEvalueCutoff;
        s.domT = minScoreCutoff;
    }
    QString env_algo = env->getVar(ENV_HMMSEARCH_ALGORITHM_NAME);
    if( !env_algo.isEmpty() ) {
        if( ENV_HMMSEARCH_ALGORITHM_SSE == env_algo ) {
#if !defined(HMMER_BUILD_WITH_SSE2)
            stateInfo.setError( QString("SSE2 was not enabled in this build") );
            return;
#endif
            s.alg = HMMSearchAlgo_SSEOptimized;
        } else if( ENV_HMMSEARCH_ALGORITHM_CELL == env_algo ) {
#if !defined UGENE_CELL
            stateInfo.setError( QString("HMMER-Cell was not enabled in this build") );
            return;
#endif
            s.alg = HMMSearchAlgo_CellOptimized;
        } else {
            stateInfo.setError( QString("unknown hmmsearch algorithm is selected") );
            return;
        }
    }
    if(customHmmSearchChunk) {
        s.searchChunkSize = hmmSearchChunk;
    }
    QString annotationName = "hmm_signal";
    QString url = env->getVar("TEMP_DATA_DIR")+"/uhmmsearch/"+resultDocName;
    IOAdapterFactory* iof = AppContext::getIOAdapterRegistry()->getIOAdapterFactoryById(IOAdapterUtils::url2io(url));
    DocumentFormat* df = AppContext::getDocumentFormatRegistry()->getFormatById(BaseDocumentFormats::PLAIN_GENBANK);
    assert(aDoc == NULL);
    aDoc = df->createNewLoadedDocument(iof, url, stateInfo);
    CHECK_OP(stateInfo, );
    AnnotationTableObject *ao = new AnnotationTableObject( "Annotations", aDoc->getDbiRef( ) );
    aDoc->addObject(ao);
    DNASequence dnaSequence = mySequence->getWholeSequence(stateInfo);
    CHECK_OP(stateInfo, );
    searchTask = new HMMSearchToAnnotationsTask(env->getVar("COMMON_DATA_DIR")+"/"+hmmFileName, dnaSequence, ao, annotationName, "", U2FeatureTypes::MiscSignal, annotationName, s);
    addSubTask(searchTask);
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:69,代码来源:uhmmerTests.cpp


示例15: 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;
    }
}
开发者ID:neuroidss,项目名称:ugene,代码行数:101,代码来源:FastqFormat.cpp


示例16: SAFE_POINT

QString AssemblyBrowser::tryAddObject(GObject * obj) {
    Document * objDoc = obj->getDocument();
    SAFE_POINT(NULL != objDoc, "", tr("Internal error: only object with document can be added to browser"));

    if (GObjectTypes::SEQUENCE == obj->getGObjectType()) {
        U2SequenceObject * seqObj = qobject_cast<U2SequenceObject*>(obj);
        CHECK(NULL != seqObj, tr("Internal error: broken sequence object"));
        SAFE_POINT(NULL != objDoc->getDocumentFormat(), "", tr("Internal error: empty document format"));

        U2OpStatus2Log os;
        qint64 seqLen = seqObj->getSequenceLength();
        QStringList errs;
        qint64 modelLen = model->getModelLength(os);
        if (seqLen != modelLen) {
            errs << tr("The lengths of the sequence and assembly are different.");
        }
        if (seqObj->getGObjectName() != gobject->getGObjectName()) {
            errs << tr("The sequence and assembly names are different.");
        }

        // commented: waiting for fix
        //QByteArray refMd5 = model->getReferenceMd5();
        //if(!refMd5.isEmpty()) {
        //    //QByteArray data = QString(seqObj->getSequence()).remove("-").toUpper().toUtf8();
        //    QByteArray data = QString(seqObj->getSequence()).toUpper().toUtf8();
        //    QByteArray seqObjMd5 = QCryptographicHash::hash(data, QCryptographicHash::Md5).toHex();
        //    if(seqObjMd5 != refMd5) {
        //        errs << tr("- Reference MD5 not match with MD5 written in assembly");
        //    }
        //}

        bool setRef = !isAssemblyObjectLocked(true) && !model->isLoadingReference();
        setRef &= model->checkPermissions(QFile::WriteUser, setRef);
        if(!errs.isEmpty() && setRef) {
            const NotificationStack *notificationStack = AppContext::getMainWindow()->getNotificationStack();
            const QString message = tr("It seems that sequence \"%1\", set as reference to assembly \"%2\", does not match it.").arg(seqObj->getGObjectName()).arg(gobject->getGObjectName())
                + "\n- " + errs.join("\n- ");
            notificationStack->addNotification(message, Warning_Not);
        }
        if(setRef) {
            model->setReference(seqObj);

            U2Assembly assembly = model->getAssembly();
            U2DataId refId;
            QString folder;
            const QStringList folders = model->getDbiConnection().dbi->getObjectDbi()->getObjectFolders(assembly.id, os);
            if (folders.isEmpty() || os.isCoR()) {
                folder = U2ObjectDbi::ROOT_FOLDER;
            } else {
                folder = folders.first();
            }

            if (seqObj->getEntityRef().dbiRef == model->getDbiConnection().dbi->getDbiRef()) {
                refId = seqObj->getEntityRef().entityId;
            } else {
                U2CrossDatabaseReferenceDbi * crossDbi = model->getDbiConnection().dbi->getCrossDatabaseReferenceDbi();
                U2CrossDatabaseReference crossDbRef;
                // Cannot simply use seqObj->getSequenceRef(), since it points to a temporary dbi
                // TODO: make similar method seqObj->getPersistentSequenctRef()
                crossDbRef.dataRef.dbiRef.dbiId = objDoc->getURLString();
                crossDbRef.dataRef.dbiRef.dbiFactoryId = "document";
                crossDbRef.dataRef.entityId = seqObj->getGObjectName().toUtf8();
                crossDbRef.visualName = "cross_database_reference: " + seqObj->getGObjectName();
                crossDbRef.dataRef.version = 1;
                crossDbi->createCrossReference(crossDbRef, folder, os);
                LOG_OP(os);
                refId = crossDbRef.id;
                addObjectToView(obj);
            }
            model->associateWithReference(refId);
        }
    } else if (GObjectTypes::VARIANT_TRACK == obj->getGObjectType()) {
        VariantTrackObject *trackObj = qobject_cast<VariantTrackObject*>(obj);
        CHECK(NULL != trackObj, tr("Internal error: broken variant track object"));

        model->addTrackObject(trackObj);
        addObjectToView(obj);
        connect(model.data(), SIGNAL(si_trackRemoved(VariantTrackObject *)), SLOT(sl_trackRemoved(VariantTrackObject *)));
    } else {
开发者ID:m-angelov,项目名称:ugene,代码行数:79,代码来源:AssemblyBrowser.cpp



注:本文中的U2SequenceObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ U3DDataBlockWriter类代码示例发布时间:2022-05-31
下一篇:
C++ U2Region类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap