本文整理汇总了C++中U2Region类的典型用法代码示例。如果您正苦于以下问题:C++ U2Region类的具体用法?C++ U2Region怎么用?C++ U2Region使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了U2Region类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: foreach
// 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]));
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:31,代码来源:AminoTranslationWorker.cpp
示例2: getSymbolsPerLine
void DetViewMultiLineRenderer::drawAll(QPainter &p, const QSize &canvasSize, const U2Region &visibleRange) {
int symbolsPerLine = getSymbolsPerLine(canvasSize.width());
U2Region oneLineRegion(visibleRange.startPos, symbolsPerLine);
p.fillRect(QRect(QPoint(0, 0), canvasSize), Qt::white);
// wide the indent between lines if neccessary
extraIndent = 0;
int sequenceLinesCount = visibleRange.length / symbolsPerLine + 1;
if (ctx->getSequenceLength() == visibleRange.length) {
int fullContentH = getOneLineHeight() * sequenceLinesCount;
if (canvasSize.height() > fullContentH && detView->getShift() == 0) {
extraIndent = (canvasSize.height() - fullContentH) / sequenceLinesCount;
}
}
int indentCounter = 0;
do {
// cut the extra space at the end of the sequence
oneLineRegion.length = qMin(visibleRange.endPos() - oneLineRegion.startPos, oneLineRegion.length);
singleLinePainter->drawAll(p,
QSize(canvasSize.width(), getOneLineHeight()),
oneLineRegion);
p.translate(0, getOneLineHeight());
indentCounter += getOneLineHeight();
oneLineRegion.startPos += symbolsPerLine;
} while (oneLineRegion.startPos < visibleRange.endPos());
// move painter back to [0, 0] position
p.translate(0, - indentCounter);
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:35,代码来源:DetViewMultiLineRenderer.cpp
示例3: HelpButton
MultipleRangeSelector::MultipleRangeSelector(QWidget* _parent, const QVector<U2Region>& _regions, int _seqLen, bool _isCircular)
:QDialog(_parent)
,seqLen(_seqLen)
,selectedRanges(_regions)
,isCircular(_isCircular)
{
ui = new Ui_RangeSelectionDialog;
ui->setupUi(this);
new HelpButton(this, ui->buttonBox, "17467548");
ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Go"));
ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
{
ui->startEdit->setValidator(new QIntValidator(1, seqLen, ui->startEdit));
ui->endEdit->setValidator(new QIntValidator(1, seqLen, ui->endEdit));
int w = qMax(((int)log10((double)seqLen))*10, 70);
ui->startEdit->setMinimumWidth(w);
ui->endEdit->setMinimumWidth(w);
if(selectedRanges.isEmpty()){
ui->startEdit->setText(QString::number(1));
ui->endEdit->setText(QString::number(seqLen));
}else{
U2Region firstRegion = selectedRanges.first();
ui->startEdit->setText(QString::number(firstRegion.startPos + 1));
ui->endEdit->setText(QString::number(firstRegion.endPos()));
}
}
{
QString loc;
if (selectedRanges.isEmpty()) {
loc = QString("1..%1").arg(seqLen);
} else {
loc = U1AnnotationUtils::buildLocationString(selectedRanges);
}
ui->multipleRegionEdit->setText(loc);
}
{
ui->minButton->setShortcut(QKeySequence(Qt::ALT | Qt::Key_Z));
ui->maxButton->setShortcut(QKeySequence(Qt::ALT | Qt::Key_X));
connect(ui->miltipleButton, SIGNAL(toggled(bool)), SLOT(sl_multipleButtonToggled(bool)));
connect(ui->startEdit, SIGNAL(returnPressed()), SLOT(sl_returnPressed()));
connect(ui->endEdit, SIGNAL(returnPressed()), SLOT(sl_returnPressed()));
connect(ui->multipleRegionEdit, SIGNAL(returnPressed()), SLOT(sl_returnPressed()));
connect(ui->minButton, SIGNAL(clicked()), SLOT(sl_minButton()));
connect(ui->maxButton, SIGNAL(clicked()), SLOT(sl_maxButton()));
connect(ui->buttonGroup, SIGNAL(buttonClicked ( QAbstractButton * )), SLOT(sl_buttonClicked(QAbstractButton*)));
ui->singleButton->toggle();
sl_buttonClicked(ui->singleButton);
}
}
开发者ID:neuroidss,项目名称:ugene,代码行数:58,代码来源:RangeSelector.cpp
示例4: qMax
void ExtractAnnotatedRegionTask::run() {
QVector<U2Region> safeLocation = inputAnn->getRegions();
U2Region::bound(0, inputSeq.length(), safeLocation);
QList<QByteArray> resParts = U1SequenceUtils::extractRegions(inputSeq.seq, safeLocation, complT, NULL, inputSeq.circular);
if (aminoT == NULL) { // extension does not work for translated annotations
if (cfg.extLeft > 0) {
int annStart = safeLocation.first().startPos;
int preStart = qMax(0, annStart - cfg.extLeft);
int preLen = annStart - preStart;
QByteArray preSeq = inputSeq.seq.mid(preStart, preLen);
resParts.prepend(preSeq);
for (int i = 0; i < safeLocation.size(); ++i) {
safeLocation[i].startPos -= preLen;
safeLocation[i].length += preLen;
}
}
if (cfg.extRight) {
U2Region annRegion = U2Region::containingRegion(safeLocation);
int annEnd = annRegion.endPos();
int postEnd = qMin(inputSeq.length(), annEnd + cfg.extRight);
int postLen = postEnd - annEnd;
QByteArray postSeq = inputSeq.seq.mid(annEnd, postLen);
resParts.append(postSeq);
for (int i = 0; i < safeLocation.size(); ++i) {
safeLocation[i].length += postLen;
}
}
} else {
resParts = U1SequenceUtils::translateRegions(resParts, aminoT, inputAnn->isJoin());
}
foreach (const QByteArray &seq, resParts) {
bool onlyOneIteration = false;
DNASequence s;
s.info[DNAInfo::ID] = inputSeq.getName();
if (!cfg.splitJoined || resParts.size() == 1){
s.seq = resParts.size() == 1 ? resParts.first() : U1SequenceUtils::joinRegions(resParts, cfg.gapLength);
onlyOneIteration = true;
}else{
s.seq = seq;
}
s.alphabet = aminoT ? aminoT->getDstAlphabet() : complT ? complT->getDstAlphabet() : inputSeq.alphabet;
if (aminoT != NULL) {
s.alphabet = aminoT->getDstAlphabet();
}else if (complT != NULL) {
s.alphabet = complT->getDstAlphabet();
}else {
s.alphabet = inputSeq.alphabet;
}
resultedSeqList.append(s);
if (onlyOneIteration){
break;
}
}
开发者ID:m-angelov,项目名称:ugene,代码行数:55,代码来源:ExtractAnnotatedRegionTask.cpp
示例5: U2Region
void McaEditorReferenceArea::keyPressEvent(QKeyEvent *event) {
const int key = event->key();
bool accepted = false;
DNASequenceSelection * const selection = ctx->getSequenceSelection();
U2Region selectedRegion = (NULL != selection && !selection->isEmpty() ? selection->getSelectedRegions().first() : U2Region());
switch(key) {
case Qt::Key_Left:
if (!selectedRegion.isEmpty() && selectedRegion.startPos > 0) {
selectedRegion.startPos--;
ctx->getSequenceSelection()->setSelectedRegions(QVector<U2Region>() << selectedRegion);
ui->getScrollController()->scrollToBase(selectedRegion.startPos, width());
}
case Qt::Key_Up:
accepted = true;
break;
case Qt::Key_Right:
if (!selectedRegion.isEmpty() && selectedRegion.endPos() < ctx->getSequenceLength()) {
selectedRegion.startPos++;
ctx->getSequenceSelection()->setSelectedRegions(QVector<U2Region>() << selectedRegion);
ui->getScrollController()->scrollToBase(selectedRegion.endPos() - 1, width());
}
case Qt::Key_Down:
accepted = true;
break;
case Qt::Key_Home:
ui->getScrollController()->scrollToEnd(ScrollController::Left);
accepted = true;
break;
case Qt::Key_End:
ui->getScrollController()->scrollToEnd(ScrollController::Right);
accepted = true;
break;
case Qt::Key_PageUp:
ui->getScrollController()->scrollPage(ScrollController::Left);
accepted = true;
break;
case Qt::Key_PageDown:
ui->getScrollController()->scrollPage(ScrollController::Right);
accepted = true;
break;
}
if (accepted) {
event->accept();
} else {
PanView::keyPressEvent(event);
}
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:49,代码来源:McaEditorReferenceArea.cpp
示例6: HelpButton
CreateRulerDialogController::CreateRulerDialogController(const QSet<QString>& namesToFilter,
const U2Region& seqRange, int defaultOffset, QWidget* p)
: QDialog(p)
{
setupUi(this);
new HelpButton(this, buttonBox, "19766721");
buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create"));
buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
setMaximumHeight(layout()->minimumSize().height());
filter = namesToFilter;
sampleLabel->setAutoFillBackground(true);
nameEdit->setText(TextUtils::variate(tr("New ruler"), "_", filter));
spinBox->setMinimum(INT_MIN + seqRange.length);
spinBox->setMaximum(INT_MAX);
spinBox->setValue(seqRange.contains(defaultOffset+1) ? defaultOffset + 1 : spinBox->minimum());
color = Qt::darkBlue;
updateColorSample();
connect(colorButton, SIGNAL(clicked()), SLOT(sl_colorButtonClicked()));
setWindowIcon(QIcon(":/ugene/images/ugene_16.png"));
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:29,代码来源:CreateRulerDialogController.cpp
示例7: sequenceStrategyWithMemorize
void DeviationGraphAlgorithm::sequenceStrategyWithMemorize(QVector<float>& res, const QByteArray& seq,
const U2Region& vr, const GSequenceGraphWindowData* d, U2OpStatus &os)
{
int rsize = d->window / d->step;
RollingArray<int> raF(rsize);
RollingArray<int> raS(rsize);
int endPos = vr.endPos();
int globalCountF = 0;
int globalCountS = 0;
int nextI = 0;
int firstValue = vr.startPos + d->window - d->step;
for (int i = vr.startPos; i < endPos; i = nextI) {
CHECK_OP(os, );
nextI = i + d->step;
QPair<int, int> result = matchOnStep(seq, i, nextI);
globalCountF += result.first;
globalCountS += result.second;
raF.push_back_pop_front(result.first);
raS.push_back_pop_front(result.second);
if (i >= firstValue) {
int vF = raF.get(0);
int vS = raS.get(0);
res.append((globalCountF - globalCountS) / qMax(0.001f, (float)(globalCountF + globalCountS)));
globalCountF -= vF;
globalCountS -= vS;
}
}
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:28,代码来源:DeviationGraph.cpp
示例8: CHECK_SET_ERR_RESULT
bool GTUtilsMSAEditorSequenceArea::isSequenceSelected(HI::GUITestOpStatus &os, const QString &seqName) {
MSAEditorSequenceArea *msaEditArea = qobject_cast<MSAEditorSequenceArea*>
(GTWidget::findWidget(os, "msa_editor_sequence_area"));
CHECK_SET_ERR_RESULT(msaEditArea != NULL, "MsaEditorSequenceArea not found", false);
QMainWindow* mw = AppContext::getMainWindow()->getQMainWindow();
MSAEditor* editor = mw->findChild<MSAEditor*>();
CHECK_SET_ERR_RESULT(editor != NULL, "MsaEditor not found", false);
//Seq names are drawn on widget, so this hack is needed
U2Region selectedRowsRegion = msaEditArea->getSelectedRows();
QStringList selectedRowNames;
for(int x = selectedRowsRegion.startPos; x < selectedRowsRegion.endPos(); x++)
selectedRowNames.append(editor->getMSAObject()->getRow(x).getName());
if (selectedRowNames.contains(seqName)) {
return true;
}
return false;
}
开发者ID:m-angelov,项目名称:ugene,代码行数:19,代码来源:GTUtilsMsaEditorSequenceArea.cpp
示例9: countReads
qint64 RTreeAssemblyAdapter::countReads(const U2Region& r, U2OpStatus& os) {
if (r == U2_REGION_MAX) {
return SQLiteReadQuery(QString("SELECT COUNT(*) FROM %1").arg(readsTable), db, os).selectInt64();
}
QString qStr = QString("SELECT COUNT(*) FROM %1 AS i WHERE " + RANGE_CONDITION_CHECK).arg(indexTable);
SQLiteReadQuery q(qStr, db, os);
q.bindInt64(1, r.endPos());
q.bindInt64(2, r.startPos);
return q.selectInt64();
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:10,代码来源:RTreeAssemblyAdapter.cpp
示例10: QString
QString BioStruct3DSubsetEditor::validate() {
if (regionEdit->isEnabled()) {
QString regionText = regionEdit->text();
if (!QRegExp("[0-9]*\\.\\.[0-9]*").exactMatch(regionText)) {
return QString("invalid region spec %1").arg(regionText);
}
BioStruct3DObject *bso = static_cast<BioStruct3DObject*>( objectCombo->itemData(objectCombo->currentIndex()).value<void*>() );
int chainId = chainCombo->itemData(chainCombo->currentIndex()).value<int>();
int length = bso->getBioStruct3D().moleculeMap.value(chainId)->residueMap.size();
U2Region region = getRegion();
if (region.startPos < 0 || region.startPos >= region.endPos() || region.endPos() > length) {
return QString("region values out of range %1..%2 (%3..%4)").arg(region.startPos + 1).arg(region.endPos()).arg(1).arg(length);
}
}
return QString("");
}
开发者ID:m-angelov,项目名称:ugene,代码行数:20,代码来源:BioStruct3DSubsetEditor.cpp
示例11: sl_onSelectionChanged
void McaEditorReferenceArea::sl_onSelectionChanged(LRegionsSelection * /*selection*/, const QVector<U2Region> &addedRegions, const QVector<U2Region> &removedRegions) {
if (addedRegions.size() == 1) {
const U2Region addedRegion = addedRegions.first();
qint64 baseToScrollTo = -1;
if (removedRegions.size() == 1) {
const U2Region removedRegion = removedRegions.first();
if (addedRegion.startPos < removedRegion.startPos && addedRegion.endPos() == removedRegion.endPos()) {
baseToScrollTo = addedRegion.startPos;
} else if (addedRegion.startPos == removedRegion.startPos && addedRegion.endPos() > removedRegion.endPos()) {
baseToScrollTo = addedRegion.endPos() - 1;
} else {
baseToScrollTo = addedRegion.startPos;
}
} else {
baseToScrollTo = addedRegion.startPos;
}
ui->getScrollController()->scrollToBase(static_cast<int>(baseToScrollTo), width());
}
emit si_selectionChanged();
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:20,代码来源:McaEditorReferenceArea.cpp
示例12: assert
QString SWMulAlignSubseqPropTag::expandTag(const QVariant & argument) const {
assert(argument.canConvert<U2Region>());
U2Region subsequence = argument.value<U2Region>();
quint64 tagExpansion = 0;
switch(posType) {
case START:
tagExpansion = subsequence.startPos + 1;
break;
case END:
tagExpansion = subsequence.endPos();
break;
case LENGTH:
tagExpansion = subsequence.length;
break;
default:
assert(0);
}
return QString::number(tagExpansion);
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:21,代码来源:SWMulAlignSubseqPropTag.cpp
示例13: QWidget
WindowStepSelectorWidget::WindowStepSelectorWidget(QWidget* p, const U2Region& winRange, int win, int step) : QWidget(p)
{
assert(win >= step);
windowEdit = new QSpinBox(this);
windowEdit->setRange(winRange.startPos, winRange.endPos());
windowEdit->setValue(win);
windowEdit->setAlignment(Qt::AlignRight);
windowEdit->setObjectName("windowEdit");
stepsPerWindowEdit = new QSpinBox(this);
stepsPerWindowEdit->setRange(1, winRange.endPos());
stepsPerWindowEdit->setValue(win/step);
stepsPerWindowEdit->setAlignment(Qt::AlignRight);
stepsPerWindowEdit->setObjectName("stepsPerWindowEdit");
QFormLayout* l = new QFormLayout(this);
l->addRow(tr("Window:"), windowEdit);
l->addRow(tr("Steps per window:"), stepsPerWindowEdit);
setLayout(l);
}
开发者ID:m-angelov,项目名称:ugene,代码行数:22,代码来源:WindowStepSelectorWidget.cpp
示例14: getSequenceData
QByteArray SQLiteSequenceDbi::getSequenceData(const U2DataId& sequenceId, const U2Region& region, U2OpStatus& os) {
try {
QByteArray res;
if (0 == region.length) {
return res;
} else if (U2_REGION_MAX != region) {
res.reserve(region.length);
}
// Get all chunks that intersect the region
SQLiteReadQuery q("SELECT sstart, send, data FROM SequenceData WHERE sequence = ?1 "
"AND (send >= ?2 AND sstart < ?3) ORDER BY sstart", db, os);
q.bindDataId(1, sequenceId);
q.bindInt64(2, region.startPos);
q.bindInt64(3, region.endPos());
qint64 pos = region.startPos;
qint64 regionLengthToRead = region.length;
while (q.step()) {
qint64 sstart = q.getInt64(0);
qint64 send = q.getInt64(1);
qint64 length = send - sstart;
QByteArray data = q.getBlob(2);
int copyStart = pos - sstart;
int copyLength = static_cast<int>(qMin(regionLengthToRead, length - copyStart));
res.append(data.constData() + copyStart, copyLength);
pos += copyLength;
regionLengthToRead -= copyLength;
SAFE_POINT_EXT(regionLengthToRead >= 0,
os.setError("An error occurred during reading sequence data from dbi."),
QByteArray());
}
return res;
} catch (const std::bad_alloc &) {
#ifdef UGENE_X86
os.setError("UGENE ran out of memory during the sequence processing. "
"The 32-bit UGENE version has a restriction on its memory consumption. Try using the 64-bit version instead.");
#else
os.setError("Out of memory during the sequence processing.");
#endif
return QByteArray();
} catch (...) {
os.setError("Internal error occurred during the sequence processing.");
coreLog.error("An exception was thrown during reading sequence data from dbi.");
return QByteArray();
}
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:48,代码来源:SQLiteSequenceDbi.cpp
示例15: fi
void ExtractAssemblyRegionDialog::sl_regionChanged(const U2Region& newRegion) {
QString filePath = saveController->getSaveFileName();
QFileInfo fi(filePath);
U2Region prevRegion = settings->regionToExtract;
prevRegion.startPos += 1;
prevRegion.length -= 1;
QString stringToReplace = QString::number(prevRegion.startPos) + "_" + QString::number(prevRegion.endPos());
if (fi.baseName().contains(stringToReplace)) {
QString baseName = fi.baseName();
QString newLocation = QString::number(newRegion.startPos + 1) + "_" + QString::number(newRegion.endPos());
baseName.replace(stringToReplace, newLocation);
filePath = fi.dir().path() + "/" + baseName + "." + fi.completeSuffix();
saveController->setPath(filePath);
}
settings->regionToExtract = newRegion;
}
开发者ID:neuroidss,项目名称:ugene,代码行数:17,代码来源:ExtractAssemblyRegionDialog.cpp
示例16: drawContent
bool SequenceAreaRenderer::drawContent(QPainter &painter, const U2Region ®ion, const QList<int> &seqIdx, int xStart, int yStart) const {
CHECK(!region.isEmpty(), false);
CHECK(!seqIdx.isEmpty(), false);
MsaHighlightingScheme* highlightingScheme = seqAreaWgt->getCurrentHighlightingScheme();
MaEditor* editor = seqAreaWgt->getEditor();
painter.setPen(Qt::black);
painter.setFont(editor->getFont());
MultipleAlignmentObject* maObj = editor->getMaObject();
SAFE_POINT(maObj != NULL, tr("Alignment object is NULL"), false);
const MultipleAlignment ma = maObj->getMultipleAlignment();
//Use dots to draw regions, which are similar to reference sequence
highlightingScheme->setUseDots(seqAreaWgt->getUseDotsCheckedState());
int rowHeight = 0;
foreach (const int rowIndex, seqIdx) {
rowHeight = drawRow(painter, ma, rowIndex, region, xStart, yStart);
yStart += ui->getRowHeightController()->getRowHeight(rowIndex);
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:22,代码来源:SequenceAreaRenderer.cpp
示例17: getMaxPackedRow
qint64 RTreeAssemblyAdapter::getMaxPackedRow(const U2Region& r, U2OpStatus& os) {
SQLiteReadQuery q(QString("SELECT MAX(prow1) FROM %1 AS i WHERE (" + RANGE_CONDITION_CHECK + ")").arg(indexTable), db, os);
q.bindInt64(1, r.endPos());
q.bindInt64(2, r.startPos);
return q.selectInt64();
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:6,代码来源:RTreeAssemblyAdapter.cpp
示例18: url
void ReadCSVAsAnnotationsTask::run() {
GUrl url(file);
IOAdapterId ioId = IOAdapterUtils::url2io(url);
IOAdapterFactory* iof = AppContext::getIOAdapterRegistry()->getIOAdapterFactoryById(ioId);
QScopedPointer<IOAdapter> io(iof->createIOAdapter());
if (!io->open(url, IOAdapterMode_Read)) {
setError(L10N::errorOpeningFileRead(url));
return;
}
QByteArray block(BUFF_SIZE, '\0');
int blockLen = 0;
QString text;
while ((blockLen = io->readBlock(block.data(), BUFF_SIZE)) > 0) {
int sizeBefore = text.length();
QString line = QString::fromLocal8Bit(block.data(), blockLen);
text.append(line);
if (text.length() != sizeBefore + line.length()) {
setError(L10N::errorReadingFile(url));
}
stateInfo.progress = io->getProgress();
}
int maxColumns = 0;
QList<QStringList> parsedLines = parseLinesIntoTokens(text, config, maxColumns, stateInfo);
foreach (const QStringList &lineTokens, parsedLines) {
SharedAnnotationData a(new AnnotationData);
bool ok = true;
QString error;
int startPos = -1;
int startPosOffset = 0;
int len = -1;
int endPos = -1;
QString groupName;
for (int column = 0; column < lineTokens.size() && ok; column++) {
if (column >= config.columns.size()) {
break;
}
const ColumnConfig& columnConf = config.columns.at(column);
const QString& token = lineTokens.at(column);
switch(columnConf.role) {
case ColumnRole_Qualifier:
assert(!columnConf.qualifierName.isEmpty());
a->qualifiers.append(U2Qualifier(columnConf.qualifierName, token));
break;
case ColumnRole_Name:
a->name = token.isEmpty() ? config.defaultAnnotationName : token;
ok = Annotation::isValidAnnotationName(a->name);
if (!ok) {
error = tr("Invalid annotation name: '%1'").arg(a->name);
}
break;
case ColumnRole_StartPos:
assert(startPos == -1);
startPos = token.toInt(&ok) - 1;
startPosOffset = columnConf.startPositionOffset;
if (!ok) {
error = tr("Start offset is not numeric: '%1'").arg(token);
}
break;
case ColumnRole_EndPos:
assert(endPos == -1);
endPos = token.toInt(&ok) + (columnConf.endPositionIsInclusive ? 1 : 0) - 1;
if (!ok) {
error = tr("End offset is not numeric: '%1'").arg(token);
}
break;
case ColumnRole_Length:
assert(len == -1);
len = token.toInt(&ok);
if (!ok) {
error = tr("Length is not numeric: '%1'").arg(token);
}
break;
case ColumnRole_ComplMark:
a->location->strand = (columnConf.complementMark.isEmpty() || token == columnConf.complementMark)
? U2Strand::Complementary : U2Strand::Direct;
break;
case ColumnRole_Group:
groupName = token;
break;
default:
assert(columnConf.role == ColumnRole_Ignore);
}
}
//add annotation
if (ok) {
//set up default name
if (a->name.isEmpty()) {
a->name = config.defaultAnnotationName;
}
//set up location
U2Region location;
if (startPos != -1) {
location.startPos = startPos + startPosOffset;
if (endPos != -1) {
location.length = endPos - startPos;
//.........这里部分代码省略.........
开发者ID:m-angelov,项目名称:ugene,代码行数:101,代码来源:ImportAnnotationsFromCSVTask.cpp
示例19: posToXCoordF
float DetViewMultiLineRenderer::posToXCoordF(qint64 p, const QSize &canvasSize, const U2Region &visibleRange) const {
CHECK(visibleRange.contains(p), -1);
qint64 symbolsPerLine = getSymbolsPerLine(canvasSize.width());
return commonMetrics.charWidth * (p % symbolsPerLine);
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:6,代码来源:DetViewMultiLineRenderer.cpp
注:本文中的U2Region类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论