void SequenceInfo::updateCommonStatisticsLayout() { ADVSequenceWidget *wgt = annotatedDnaView->getSequenceWidgetInFocus(); CHECK(wgt != NULL, ); ADVSequenceObjectContext *ctx = wgt->getActiveSequenceContext(); SAFE_POINT(ctx != NULL, tr("Sequence context is NULL"), ); SAFE_POINT(ctx->getAlphabet() != NULL, tr("Sequence alphbet is NULL"), ); int availableSpace = getAvailableSpace(ctx->getAlphabet()->getType()); QString statsInfo = QString("<table cellspacing=%1>").arg(COMMON_STATISTICS_TABLE_CELLSPACING); statsInfo += formTableRow(CAPTION_SEQ_REGION_LENGTH, getFormattedLongNumber(currentCommonStatistics.length), availableSpace); if (ctx->getAlphabet()->isNucleic()) { statsInfo += formTableRow(CAPTION_SEQ_GC_CONTENT, QString::number(currentCommonStatistics.gcContent, 'f', 2) + "%", availableSpace); statsInfo += formTableRow(CAPTION_SEQ_MOLAR_WEIGHT, QString::number(currentCommonStatistics.molarWeight, 'f', 2) + " Da", availableSpace); statsInfo += formTableRow(CAPTION_SEQ_MOLAR_EXT_COEF, QString::number(currentCommonStatistics.molarExtCoef) + " I/mol", availableSpace); statsInfo += formTableRow(CAPTION_SEQ_MELTING_TM, QString::number(currentCommonStatistics.meltingTm, 'f', 2) + " C", availableSpace); statsInfo += formTableRow(CAPTION_SEQ_NMOLE_OD, QString::number(currentCommonStatistics.nmoleOD260, 'f', 2), availableSpace); statsInfo += formTableRow(CAPTION_SEQ_MG_OD, QString::number(currentCommonStatistics.mgOD260, 'f', 2), availableSpace); } else if (ctx->getAlphabet()->isAmino()) { statsInfo += formTableRow(CAPTION_SEQ_MOLECULAR_WEIGHT, QString::number(currentCommonStatistics.molecularWeight, 'f', 2), availableSpace); statsInfo += formTableRow(CAPTION_SEQ_ISOELECTIC_POINT, QString::number(currentCommonStatistics.isoelectricPoint, 'f', 2), availableSpace); } statsInfo += "</table>"; statisticLabel->setText(statsInfo); }
void ADVGlobalAction::updateState() { AnnotatedDNAView* av = qobject_cast<AnnotatedDNAView*>(getObjectView()); ADVSequenceWidget* w = av->getSequenceWidgetInFocus(); bool enabled = w!=NULL; if (enabled && flags.testFlag(ADVGlobalActionFlag_SingleSequenceOnly) && qobject_cast<ADVSingleSequenceWidget*>(w) == NULL) { enabled = false; } if (enabled && !alphabetFilter.isEmpty()) { DNAAlphabetType t = w->getActiveSequenceContext()->getAlphabet()->getType(); enabled = alphabetFilter.contains(t); } setEnabled(enabled); }