// complementary foreach(U2Region complementaryRegion, regionsComplementary){ translatedSeq.clear(); U2SequenceImporter importer; importer.startSequence(stateInfo, dbiRef, U2ObjectDbi::ROOT_FOLDER, seqObj->getSequenceName()+ " " + resultName + QString(" %1").arg(currentSeq) + " complementary", false); QByteArray complementarySeq; char* complSeq = NULL; int blockCounter = 0; qint64 end = complementaryRegion.endPos() - 1 - complementaryRegion.length / 3 * 3; for(qint64 i = complementaryRegion.endPos() - 1 ; i > end ;i-=3, blockCounter += 3){ if( (blockCounter % NUM_DB_READ) == 0 ){ importer.addBlock(translatedSeq.constData(), translatedSeq.size(), stateInfo); complementarySeq.clear(); seq.clear(); translatedSeq.clear(); seq = seqObj->getSequenceData(U2Region(qMax(end + 1, static_cast<qint64>(i - NUM_DB_READ + 1)), qMin(static_cast<qint64>(NUM_DB_READ), i - end)), stateInfo); CHECK_OP(stateInfo, ); complementarySeq.reserve(seq.size()); complSeq = complementarySeq.data(); TextUtils::translate(complTT->getOne2OneMapper(), seq, seq.size(), complSeq); TextUtils::reverse(complSeq, seq.size()); blockCounter = 0; } SAFE_POINT(complSeq != NULL, "complSeq is NULL", ); translatedSeq.append(aminoTT->translate3to1(complSeq[blockCounter], complSeq[blockCounter + 1], complSeq[blockCounter + 2])); }
U2SequenceObject * DocumentFormatUtils::addSequenceObject(const U2DbiRef& dbiRef, const QString& name, const QByteArray& seq, bool circular, const QVariantMap& hints, U2OpStatus& os) { U2SequenceImporter importer; const QString folder = hints.value(DocumentFormat::DBI_FOLDER_HINT, U2ObjectDbi::ROOT_FOLDER).toString(); importer.startSequence(dbiRef, folder, name, circular, os); CHECK_OP(os, NULL); importer.addBlock(seq.constData(), seq.length(), os); CHECK_OP(os, NULL); U2Sequence sequence = importer.finalizeSequenceAndValidate(os); TmpDbiObjects dbiObjects(dbiRef, os); dbiObjects.objects << sequence.id; CHECK_OP(os, NULL); U2SequenceObject* so = new U2SequenceObject(name, U2EntityRef(dbiRef, sequence.id)); return so; }