Exemple #1
0
void CGridLocus::_ImplementColumn(int nCol,bool bAmel)
{
    int nStart = nCol;
    int nStop = nCol;
    int i;
    int k;
    int n = GetNumberCols();
    if(nCol >= n)
    {
        AppendCols(nCol - n + 1);
        nStart = n;
    }
    for(k = nStart; k <= nStop; ++k)
    {
        s.Printf("Peak %d",k+1);
        SetColLabelValue(k,s);
        for(i = ROW_RO_FIRST; i <= ROW_RO_LAST; i++)
        {
            DisableEdit(i,k);
        }
        SetBoolCell(ROW_HOMOZYGOUS,k);
        SetBoolCell(ROW_OFF_LADDER,k);
        SetBoolCell(ROW_DISABLE,k);

        SetCellEditor(ROW_BPS,k,new wxGridCellFloatEditor(12,7));
        SetCellRenderer(ROW_BPS,k,new wxGridCellFloatRenderer(12,7));
        if(!bAmel)
        {
            wxGridCellFloatEditor *pfe1(new wxGridCellFloatEditor(5,1));
            wxGridCellFloatRenderer *pfr1(new wxGridCellFloatRenderer(5,1));
            SetCellEditor(ROW_ALLELE,k,pfe1);
            SetCellRenderer(ROW_ALLELE,k,pfr1);
        }
        else
        {
            wxGridCellTextEditor *pe(new wxGridCellTextEditor);
            pe->SetParameters(_T("1"));
            SetCellEditor(ROW_ALLELE,k,pe);
        }

        SetCellAlignment(wxALIGN_RIGHT,  ROW_ALLELE,k);
        SetCellAlignment(wxALIGN_RIGHT,  ROW_BPS,k);
        SetCellAlignment(wxALIGN_RIGHT,  ROW_RFU,k);
        SetCellAlignment(wxALIGN_RIGHT,  ROW_TIME,k);
        SetCellAlignment(wxALIGN_RIGHT,  ROW_PEAK_AREA,k);
    }
}
bool CGridSampleLimits::TransferDataToWindow()
{
  bool bRtn = (m_pData != NULL) && (m_pMessageBook != NULL);
  if(bRtn)
  {
    SetCellValue(ROW_PULLUP,0,CPanelLabSettings::Number2Str(
      m_pData->GetMaxNumberOfPullupsPerSample()));
    SetCellValue(ROW_STUTTER,0,CPanelLabSettings::Number2Str(
      m_pData->GetMaxNumberOfStutterPeaksPerSample()));
    SetCellValue(ROW_ADENYLATION,0,CPanelLabSettings::Number2Str(
      m_pData->GetMaxNumberOfAdenylationsPerSample()));
    SetCellValue(ROW_OFF_LADDER,0,CPanelLabSettings::Number2Str(
      m_pData->GetMaxNumberOfOLAllelesPerSample()));
    SetCellValue(ROW_RESIDUAL,0,CPanelLabSettings::Number2Str(
      m_pData->GetMaxResidualForAlleleCall()));
    SetCellValue(ROW_EXCESSIVE_RESIDUAL,0,CPanelLabSettings::Number2Str(
      m_pData->GetMaxExcessiveResidual()));

    SetCellValue(ROW_RFU_INCOMPLETE_SAMPLE,0,CPanelLabSettings::Number2Str(
      m_pData->GetMaxRFUForIncompleteSample()));
    SetCellValue(ROW_MIN_BPS_ARTIFACTS,0,CPanelLabSettings::Number2Str(
      m_pData->GetMinBPSForArtifacts()));

    //  message book stuff
    int nRow = ROW_MESSAGE_BOOK_OFFSET;
    int nValue;
//    int nRowHeight = GetRowHeight(0);
    vector<const CXMLmessageBookSM *>::iterator itrMsg = m_vpMsgBookSM.begin();
    for(itrMsg = m_vpMsgBookSM.begin();
      itrMsg != m_vpMsgBookSM.end();
      ++itrMsg)
    {
      if(!(*itrMsg)->EmptyDescriptor())
      {
        nValue = m_pData->GetValue((*itrMsg)->GetName(),(*itrMsg)->GetThreshold());
        if((*itrMsg)->IsPreset())
        {
          SetBoolCell(nRow,0);
          SetBoolValue(nRow,0,!!nValue);
  //        SetRowHeight(nRow,nRowHeight);
        }
        else
        {
          SetCellValue(nRow,0,
            CPanelLabSettings::Number2Str(nValue));
        }
        ++nRow;
      }
    }
  }
  return bRtn;
}
CGridAlerts::CGridAlerts(
  COARmessages *pMsgEdit,
  wxWindow *parent,
  wxWindowID id,
  int nType,
  bool bReadOnly) :
    _CGridEdit(parent,id,bReadOnly),
    m_pMsgEdit(pMsgEdit),
    m_nChannelColumn(-1),
    m_nLocusColumn(-1),
    m_nInCellChangeEvent(0)
{
  int bChannel = !!(nType & TYPE_CHANNEL);
  int bLocus = !!(nType & TYPE_LOCUS);
  size_t nCount = m_pMsgEdit->GetMessageCount();
  if(nCount)
  {
    const wxString sDisable(_T("Enabled"));
    int nColCount = 2 + bChannel + bLocus;
    int nCol = nColCount;
    CreateGrid((int)nCount,nColCount);
    SetColLabelAlignment(wxALIGN_LEFT, wxALIGN_CENTRE);
    SetColLabelValue(--nCol,_T("Alert"));
    SetColLabelValue(--nCol,sDisable);
    if(bChannel)
    {
      SetColLabelValue(--nCol,LABEL_CHANNEL);
      m_nChannelColumn = nCol;
    }
    if(bLocus)
    {
      SetColLabelValue(--nCol,LABEL_LOCUS);
      m_nLocusColumn = nCol;
    }
    SetRowLabelSize(2);
    for(size_t j = 0; j < nCount; j++)
    {
      nCol = nColCount;
      SetCellAlignment((int)j,--nCol,wxALIGN_LEFT,wxALIGN_CENTRE);
      SetBoolCell((int)j,--nCol);
      SetCellAlignment((int)j,nCol,wxALIGN_CENTRE,wxALIGN_CENTRE);
      if(bChannel)
      {
        SetCellAlignment((int)j,m_nChannelColumn,wxALIGN_CENTRE,wxALIGN_CENTRE);
        SetReadOnly((int)j,m_nChannelColumn,true);
      }
      if(bLocus)
      {
        SetCellAlignment((int)j,m_nLocusColumn,wxALIGN_LEFT,wxALIGN_CENTRE);
        SetReadOnly((int)j,m_nLocusColumn,true);
      }
      SetRowLabelValue((int)j,wxEmptyString);
    }
    TransferDataToWindow();
    SetColLabelSize(GetRowSize(0));
  }
  else
  {
    CreateGrid(1,1);
    nwxGrid::SetMessageGrid(this,_T("There are no " COAR_NOTICE_DISPLAY));
  }
  AutoSizeColumns();
  DisableDragRowSize();
  if(bReadOnly)
  {
    DisableDragColSize();
  }
}
Exemple #4
0
CGridCMF::CGridCMF(
  CDialogCMF *parent,
  wxWindowID id,
  COARfile *pFile,
  COARsampleSort *pSort)
  : _CGridEdit(parent,id,false),
    m_pParent(parent),
    m_pFile(pFile),
    m_pSort(pSort)
{
  wxString s;
  vector<int> vnSample;
  COARsample *pSample;
  size_t n = m_pFile->GetSampleCount();
  size_t i;
  int j = 0;

  m_vpSample.reserve(n);
  vnSample.reserve(n);
    // a little overkill because of ladders and controls
  for(i = 0; i < n; i++)
  {
    j++;
    pSample = m_pSort->GetSample(i);
    if(pSample->IsSampleType() && !pSample->IsDisabled())
    {
      m_vpSample.push_back(pSample);
      vnSample.push_back(j);
    }
  }

  n = m_vpSample.size();
  if(!n)
  {
    CreateGrid(1,1);
    SetCellValue(0,0,"There are no samples");
    SetReadOnly(0,0,true);
    AutoSize();
  }
  else
  {
    int ii;
    CreateGrid((int)n, (int)COLUMN_COUNT);
    SetRowLabelAlignment(wxALIGN_LEFT,wxALIGN_CENTRE);
    for(i = 0; i < n; i++)
    {
      ii = (int)i;
      pSample = m_vpSample.at(i);
      s = CGridAnalysis::FormatRowLabel(
        vnSample.at(i), (int)n, pSample->GetName());
      SetRowLabelValue((int)i,s);
      SetBoolCell(ii,EXCLUDE);
      SetBoolCell(ii,PARTIAL);
      SetCellEditor(ii,SPECIMEN_TYPE,_CreateTypeEditor());
      SetReadOnly(ii,EMPTY_LOCI,true);
    }
    for(i = 0; i < (size_t) COLUMN_COUNT; i++)
    {
      s = COL_LABELS[i];
      SetColLabelValue((int)i,s);
    }
    SetColLabelAlignment(wxALIGN_LEFT,wxALIGN_CENTRE);
  }
}