Beispiel #1
0
bool CGridLabThresholdsLadder::TransferDataFromWindow()
{
  bool bRtn = m_pData != NULL;
  if(bRtn)
  {
    CLabLocusThreshold LocusLimits;
    int nILS = GetNumberCols() - 1;
    int nCol;

    CLabRFU &rfu(*m_pData->GetRFUladder());
    CLabRFU &rfuILS(*m_pData->GetRFUls());
    CLabRFU *pRFU = &rfu;

    // get defaults and ILS
    for(nCol = 0; bRtn && (nCol <= nILS); nCol += nILS)
    {
      _GetColumn(nCol,&LocusLimits);
      // setup defaults

      pRFU->SetFractionMaxPeak(
        LocusLimits.GetFractionMaxPeak());
      pRFU->SetPullupFractionFilter(
        LocusLimits.GetPullupFractionFilter());
      pRFU->SetStutterThreshold(
        LocusLimits.GetStutter());
      pRFU->SetAdenylationThreshold(
        LocusLimits.GetAdenylation());

      //  perform validation here

      pRFU = &rfuILS;
    }
    for(nCol = 1; nCol < nILS; nCol++)
    {

      if(_GetColumn(nCol,&LocusLimits))
      {
        rfu.SetLocusThreshold(LocusLimits);
      }
      else
      {
        bRtn = false;
        nCol = nILS; // loop exit
      }
    }
  }
  return bRtn;
}
Beispiel #2
0
bool CGridLabThresholdsSample::TransferDataFromWindow()
{
  CLabLocusThreshold LocusLimits;
  bool bRtn = 
    (m_pData != NULL) && _GetColumn(0,&LocusLimits);
  if(bRtn)
  {
    CLabRFU &rfu(*m_pData->GetRFUsample());

    // setup defaults

    m_pData->SetHeterozygousImbalanceLimit(
      LocusLimits.GetHeterozygousImbalanceLimit());
    m_pData->SetMinBoundForHomozygote(
      LocusLimits.GetMinBoundForHomozygote());
    rfu.SetFractionMaxPeak(
      LocusLimits.GetFractionMaxPeak());
    rfu.SetPullupFractionFilter(
      LocusLimits.GetPullupFractionFilter());
    rfu.SetStutterThreshold(
      LocusLimits.GetStutter());
    rfu.SetPlusStutterThreshold(
      LocusLimits.GetPlusStutter());
    rfu.SetAdenylationThreshold(
      LocusLimits.GetAdenylation());

    // Setup Loci

    int n = GetNumberCols();
    for(int i = 1; i < n; i++)
    {
      if(_GetColumn(i,&LocusLimits))
      {
        rfu.SetLocusThreshold(LocusLimits);
      }
      else
      {
        bRtn = false;
        i = n; // loop exit
      }
    }
  }
  return bRtn;
}
void FillNet(shared_ptr< Layer<float> > data_layer,
             shared_ptr< Layer<float> > label_layer, int num_output) {

  std::function<float()> rfu = GetRandomUniform<float>(-1.0, 1.0);
  std::function<float()> riu = GetRandomUniform(0, num_output);

  if (data_layer != NULL) {
    std::vector<cv::Mat> images;
    std::vector<int> labels;

    shared_ptr<caffe::MemoryDataLayer<float>> data_layer_ptr =
        boost::dynamic_pointer_cast<caffe::MemoryDataLayer<float>>(data_layer);

    // int bn = data_layer_ptr->batch_size();
    int bc = data_layer_ptr->channels();
    int bh = data_layer_ptr->height();
    int bw = data_layer_ptr->width();

    cv::Mat image(bh, bw, CV_32FC(bc));

#pragma omp parallel for
    for (int h = 0; h < bh; ++h) {
      for (int w = 0; w < bw; ++w) {
        for (int c = 0; c < bc; ++c) {
          *(image.ptr<float>(h, w) + c) = rfu();
        }
      }
    }

    images.push_back(image);
    labels.push_back(0);
    data_layer_ptr->AddMatVector(images, labels);

  }

  if (label_layer != NULL) {
    std::vector<cv::Mat> images;
    std::vector<int> labels;

    shared_ptr<caffe::MemoryDataLayer<float>> layer_ptr =
        boost::dynamic_pointer_cast<caffe::MemoryDataLayer<float>>(label_layer);

    // int bn = layer_ptr->batch_size();
    int bc = layer_ptr->channels();
    int bh = layer_ptr->height();
    int bw = layer_ptr->width();

    cv::Mat image(bh, bw, CV_32FC(bc));

#pragma omp parallel for
    for (int h = 0; h < bh; ++h) {
      for (int w = 0; w < bw; ++w) {
        for (int c = 0; c < bc; ++c) {
          *(image.ptr<float>(h, w) + c) = riu();
        }
      }
    }

    images.push_back(image);
    labels.push_back(0);
    layer_ptr->AddMatVector(images, labels);
  }
}