CGridSampleLimits::CGridSampleLimits(wxWindow *parent, wxWindowID id) : _CGridEdit(parent,id), m_pValidatePct(NULL), m_pData(NULL), m_pMessageBook(NULL) //,m_bReadOnly(false) { wxString PEAKS(_T("peaks")); CreateGrid(ROW_MESSAGE_BOOK_OFFSET,2); EnableDragColSize(false); EnableDragRowSize(false); EnableScrolling(false,true); SetRowLabelValue(ROW_PULLUP,_T("Max. No. of pullups peaks per sample")); SetCellValue(ROW_PULLUP,1,PEAKS); SetRowLabelValue(ROW_STUTTER,_T("Max. No. of stutter peaks per sample")); SetCellValue(ROW_STUTTER,1,PEAKS); SetRowLabelValue(ROW_ADENYLATION,_T("Max. No. of adenylation peaks per sample")); SetCellValue(ROW_ADENYLATION,1,PEAKS); SetRowLabelValue(ROW_OFF_LADDER,_T("Max. off-ladder alleles per sample:")); SetCellValue(ROW_OFF_LADDER,1,PEAKS); SetRowLabelValue(ROW_RESIDUAL,_T("Max. residual for allele (<0.5 bp):")); SetCellValue(ROW_RESIDUAL,1,_T("Sample/Ladder BP alignment")); SetCellEditor(ROW_RESIDUAL,0,new wxGridCellFloatEditor(-1,4)); SetDefaultCellValidator(new nwxGridCellUIntRangeValidator(0,1000000,true)); SetCellValidator( new nwxGridCellDoubleRangeValidator(0.0,0.5,true), ROW_RESIDUAL,0); SetRowLabelValue(ROW_EXCESSIVE_RESIDUAL,_T("Max. No. of peaks with excessive residual:")); SetCellValue(ROW_EXCESSIVE_RESIDUAL,1,PEAKS); SetRowLabelValue(ROW_RFU_INCOMPLETE_SAMPLE,_T("Incomplete profile threshold for Reamp More/Reamp Less:")); SetCellValue(ROW_RFU_INCOMPLETE_SAMPLE,1,_T("RFU")); SetRowLabelValue(ROW_MIN_BPS_ARTIFACTS,_T("Ignore artifacts smaller than:")); SetCellValue(ROW_MIN_BPS_ARTIFACTS,1,_T("bps")); m_clrBackground = GetLabelBackgroundColour(); wxFont fnLabel = GetLabelFont(); for(int nRow = 0; nRow < ROW_MESSAGE_BOOK_OFFSET; nRow++) { SetCellBackgroundColour(nRow,1,m_clrBackground); SetReadOnly(nRow,1,true); SetCellFont(nRow,1,fnLabel); SetCellAlignment(nRow,0,wxALIGN_RIGHT, wxALIGN_CENTRE); } SetDefaultEditor(new wxGridCellFloatEditor(1,0)); SetColLabelValue(0,_T("Value")); SetColLabelValue(1,_T("Units")); SetRowLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE); SetColLabelAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); }
void CGridRFULimits::_Build() { wxFont fontChannel = GetDefaultCellFont(); wxFont fontDefault = fontChannel; fontChannel.SetWeight(wxFONTWEIGHT_BOLD); const CChannelColors *pChannelColors = NULL; int nCurrentColCount = GetNumberCols(); int i; int j; if(nCurrentColCount < m_nCOL_COUNT) { InsertCols(m_nCOL_CHANNEL_START, m_nCOL_COUNT - nCurrentColCount); _UpdateReadOnly(); } else if(nCurrentColCount > m_nCOL_COUNT) { DeleteCols(m_nCOL_CHANNEL_START,nCurrentColCount - m_nCOL_COUNT); } InitValidators(); SetDefaultCellValidator( new nwxGridCellUIntRangeValidator( mainApp::RFU_MIN_ENTER,mainApp::RFU_MAX_ENTER,true)); nwxGridCellUIntRangeValidator *pVreqd = new nwxGridCellUIntRangeValidator( mainApp::RFU_MIN_ENTER,mainApp::RFU_MAX_ENTER,false); // does not allow empty SetCellValidator(pVreqd,ROW_RFU_MIN,m_nCOL_SAMPLE); SetCellValidator(pVreqd,ROW_RFU_MIN,m_nCOL_ILS); SetCellValidator(pVreqd,ROW_RFU_MIN,m_nCOL_LADDER); EnableDragColSize(false); EnableDragRowSize(false); SetDefaultCellAlignment(wxALIGN_RIGHT,wxALIGN_CENTRE); for(i = 0; i < ROW_COUNT; i++) { for(j = 0; j < m_nCOL_COUNT; j++) { SetCellValue(i,j,"00000000"); // used for size if(_DisabledCell(i,j)) { SetCellBackgroundColour(i,j,GetGridLineColour()); } } } SetDefaultEditor(new wxGridCellFloatEditor(1,0)); SetColLabelValue(m_nCOL_SAMPLE,"Sample"); SetColLabelValue(m_nCOL_LADDER,"Ladder"); SetColLabelValue(m_nCOL_ILS," ILS "); SetRowLabelValue(ROW_RFU_MIN,"Analysis Threshold (RFU)"); SetRowLabelValue(ROW_RFU_INTERLOCUS,"Min. Interlocus RFU"); SetRowLabelValue(ROW_RFU_MAX,"Max. RFU"); SetRowLabelValue(ROW_DETECTION,"Detection Threshold (RFU)"); SetRowLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE); SetMargins(0,0); ChannelNumberIterator itrChannelCol; int nCol; const wxChar *psDye = NULL; wxString sLabel; for(itrChannelCol = m_vnChannelNumbers.begin(), nCol = m_nCOL_CHANNEL_START; itrChannelCol != m_vnChannelNumbers.end(); ++itrChannelCol, ++nCol) { if(m_pKitColors != NULL) { pChannelColors = m_pKitColors->GetColorChannel(*itrChannelCol); psDye = (pChannelColors == NULL) ? NULL : (const wxChar *) pChannelColors->GetDyeName(); } CGridLocusColumns::FORMAT_CHANNEL_DYE(&sLabel,*itrChannelCol,psDye); SetColLabelValue(nCol,sLabel); if(pChannelColors != NULL) { _SetupChannelColumn(nCol,pChannelColors->GetColorAnalyzed(),fontChannel); } else { _SetupDefaultChannelColumn(nCol); } } nwxGrid::UpdateLabelSizes(this); AutoSize(); _DisableUnused(); }
void CGridSampleLimits::SetData( CLabThresholds *pData, const CXMLmessageBook *pMessageBook) { m_pData = pData; m_pMessageBook = pMessageBook; typedef map<wxString,size_t> MSG_THRESHOLDS; set<wxString> setMsgThresholds; // message names for thresholds already used size_t nCount = ((m_pMessageBook != NULL) && m_pMessageBook->IsOK()) ? m_pMessageBook->GetMessageCount() : 0; if(nCount) { const wxString sEmpty; const wxString sUnitPCT(_T("%")); const CXMLmessageBookSM *pmsgSM; size_t nCountKeep = 0; bool bPct; // the following 5 will not use the message book setMsgThresholds.insert(CLabThresholds::g_psmNumberOfPullUpsInSample); setMsgThresholds.insert(CLabThresholds::g_psmNumberOfStuttersInSample); setMsgThresholds.insert(CLabThresholds::g_psmNumberOfAdenylationsInSample); setMsgThresholds.insert(CLabThresholds::g_psmNumberOfOffLadderAllelesInSample); setMsgThresholds.insert(CLabThresholds::g_psmNumberOfExcessiveResidualsInSample); m_vpMsgBookSM.clear(); m_vpMsgBookSM.reserve(nCount); for(size_t i = 0; i < nCount; i++) { pmsgSM = m_pMessageBook->GetMessage(i); if(setMsgThresholds.find(pmsgSM->GetName()) == setMsgThresholds.end()) { m_vpMsgBookSM.push_back(pmsgSM); setMsgThresholds.insert(pmsgSM->GetName()); if(!pmsgSM->EmptyDescriptor()) { nCountKeep++; } } } SetMessageBookRows((int)nCountKeep); if(nCountKeep) { wxFont fn = GetLabelFont(); vector<const CXMLmessageBookSM *>::iterator itrSM; int nRow = ROW_MESSAGE_BOOK_OFFSET; for(itrSM = m_vpMsgBookSM.begin(); itrSM != m_vpMsgBookSM.end(); ++itrSM) { pmsgSM = *itrSM; if(!pmsgSM->EmptyDescriptor()) { bPct = pmsgSM->IsPercent(); if(bPct) { SetCellValidator(GetPctValidator(),nRow,0); } SetRowLabelValue(nRow,pmsgSM->GetDescriptor()); SetCellBackgroundColour(nRow,1,m_clrBackground); SetCellFont(nRow,1,fn); SetCellValue(nRow,1,bPct ? sUnitPCT : sEmpty); SetReadOnly(nRow,1,true); if(pmsgSM->IsPreset()) { SetCellAlignment(nRow,0,wxALIGN_RIGHT,wxALIGN_CENTRE); } nRow++; } } } } SetCellValue(0,0,"00000000"); SetMargins(0,0); nwxGrid::UpdateLabelSizes(this); AutoSize(); }