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); }