Ejemplo n.º 1
0
bool BkgModelControlOpts::read_file_xyflow(HashTable_xyflow &xyf_hash, int numFlows)
{
    xyf_hash.clear();
    xyf_hash.setFilename(bkgModel_xyflow_fname_in);
    //xyf_hash.set_xyflow_limits(numFlows);
    std::ifstream infile;
    infile.open(bkgModel_xyflow_fname_in.c_str());
    if (infile.is_open()) { /* ok, proceed with output */
        std::string line;
        int nLines = 0;
        while(!infile.eof()){
          //read data from file
          std::getline (infile,line);
          if (line.length()==0)
              break;
          nLines++;
          std::vector<std::string> tokens;
          split(line,' ',tokens);
          int x = atoi(tokens[0].c_str());
          int y = atoi(tokens[1].c_str());
          int f = atoi(tokens[2].c_str());
          xyf_hash.insert_xyflow(x,y,f);
          xyf_hash.insert_xy(x,y);
          //std::cout << r << " " << c << " " << flow << std::endl;
        }
        std::cout << nLines << " lines read by read_file_xyflow()..."  << std::endl << std::flush;
        //xyf_hash.print();
    }
    else {
        std::cerr << "read_file_xyflow() open error!!!"  << std::endl << std::flush;
        return (false);
    }
    infile.close();
    return (true);
}
Ejemplo n.º 2
0
void BkgParamH5::InitBeads_xyflow(int write_params_flag, HashTable_xyflow &xyf_hash)
{
  if ( write_params_flag>1 )
  {
    int nBeads_xyf = xyf_hash.size(); // for xyflow traces
    int nBeads_xy = xyf_hash.size_xy(); // for key traces only
    assert(nBeads_xyf>0);
    assert(nBeads_xy>0);
    beads_xyflow_predicted.InitBasicCube(h5TraceDbg,nBeads_xyf,max_frames,1,"/xyflow/predicted","predicted trace","");
    beads_xyflow_corrected.InitBasicCube(h5TraceDbg,nBeads_xyf,max_frames,1,"/xyflow/corrected","background-adjusted trace","");
    beads_xyflow_amplitude.InitBasicCube(h5TraceDbg,nBeads_xyf,1,1,"/xyflow/amplitude","row:col:flow amplitude","");
    beads_xyflow_residual.InitBasicCube (h5TraceDbg,nBeads_xyf,1,1,"/xyflow/residual", "residual error", "residual");
    beads_xyflow_location.InitBasicCube(h5TraceDbg,nBeads_xyf,3,1,"/xyflow/location","row:col:flow location","");
    beads_xyflow_hplen.InitBasicCube(h5TraceDbg,nBeads_xyf,2,1,"/xyflow/hplen","ACGT:len, homopolymer length of the reference sequence","");
    beads_xyflow_mm.InitBasicCube(h5TraceDbg,nBeads_xyf,1,1,"/xyflow/mismatch","mismatch, m/mm=0/1","");
    beads_xyflow_kmult.InitBasicCube(h5TraceDbg,nBeads_xyf,1,1,"/xyflow/kmult","kmult","");
    beads_xyflow_dmult.InitBasicCube(h5TraceDbg,nBeads_xyf,1,1,"/xyflow/dmult","dmult","");
    beads_xyflow_SP.InitBasicCube(h5TraceDbg,nBeads_xyf,1,1,"/xyflow/SP","SP: copies*copy_multiplier","");
    beads_xyflow_R.InitBasicCube(h5TraceDbg,nBeads_xyf,1,1,"/xyflow/R","R: ratio of bead buffering to empty buffering","");
    beads_xyflow_gainSens.InitBasicCube(h5TraceDbg,nBeads_xyf,1,1,"/xyflow/gainSens","gain*sens","");
    beads_xyflow_fittype.InitBasicCube(h5TraceDbg,nBeads_xyf,1,1,"/xyflow/fittype","fittype","");
    beads_xyflow_timeframe.InitBasicCube (h5TraceDbg,nBeads_xyf,max_frames,1,"/xyflow/timeframe", "Time Frame", "frameNumber");
    beads_xyflow_taub.InitBasicCube(h5TraceDbg,nBeads_xyf,1,1,"/xyflow/taub","taub","");

    ptrs.m_beads_xyflow_predicted = beads_xyflow_predicted.Ptr();
    ptrs.m_beads_xyflow_corrected = beads_xyflow_corrected.Ptr();
    ptrs.m_beads_xyflow_amplitude = beads_xyflow_amplitude.Ptr();
    ptrs.m_beads_xyflow_location = beads_xyflow_location.Ptr();
    ptrs.m_beads_xyflow_hplen = beads_xyflow_hplen.Ptr();
    ptrs.m_beads_xyflow_mm = beads_xyflow_mm.Ptr();
    ptrs.m_beads_xyflow_kmult = beads_xyflow_kmult.Ptr();
    ptrs.m_beads_xyflow_dmult = beads_xyflow_dmult.Ptr();
    ptrs.m_beads_xyflow_SP = beads_xyflow_SP.Ptr();
    ptrs.m_beads_xyflow_R = beads_xyflow_R.Ptr();
    ptrs.m_beads_xyflow_gainSens = beads_xyflow_gainSens.Ptr();
    ptrs.m_beads_xyflow_fittype = beads_xyflow_fittype.Ptr();
    ptrs.m_beads_xyflow_timeframe = beads_xyflow_timeframe.Ptr();
    ptrs.m_beads_xyflow_residual = beads_xyflow_residual.Ptr();
    ptrs.m_beads_xyflow_taub = beads_xyflow_taub.Ptr();

    ptrs.m_xyflow_hashtable = &xyf_hash;

    // key traces corresponding the the (x,y) locations of xyflow
    beads_xyflow_location_keys.InitBasicCube(h5TraceDbg,nBeads_xy,2,1,"/xyflow/keys_location","row:col:flow location","");
    beads_xyflow_predicted_keys.InitBasicCube(h5TraceDbg,nBeads_xy,max_frames,4,"/xyflow/keys_predicted","predicted trace for keys","");
    beads_xyflow_corrected_keys.InitBasicCube(h5TraceDbg,nBeads_xy,max_frames,4,"/xyflow/keys_corrected","background-adjusted trace for keys","");
    ptrs.m_beads_xyflow_location_keys = beads_xyflow_location_keys.Ptr();
    ptrs.m_beads_xyflow_predicted_keys = beads_xyflow_predicted_keys.Ptr();
    ptrs.m_beads_xyflow_corrected_keys = beads_xyflow_corrected_keys.Ptr();

  }
}
Ejemplo n.º 3
0
bool BkgModelControlOpts::read_file_rcflow(HashTable_xyflow &xyf_hash, int numFlows)
{
    xyf_hash.clear();
    xyf_hash.setFilename(bkgModel_xyflow_fname_in);
    //xyf_hash.set_xyflow_limits(numFlows);
    std::ifstream infile;
    infile.open(bkgModel_xyflow_fname_in.c_str());
    if (infile.is_open()) { /* ok, proceed with output */
        std::string line;
        int nLines = 0;
        while(!infile.eof()){
          //read data from file
          std::getline (infile,line);
          if (line.length()==0)
              break;
          nLines++;
          std::vector<std::string> tokens;
          std::vector<std::string> elem;
          split(line,'\t',tokens);
          if (tokens.size()<2) {
              split(line,' ',tokens);
              if (tokens.size()<2) {
                  std::cerr << "read_file_rcflow() parsing error: not enough number of tokens in line: " << line << std::endl << std::flush;
                  assert(tokens.size()>=2);
              }
          }
          split(tokens[0],':',elem);
          //int nTokens = elem.size();
          int r = atoi(tokens[0].c_str());
          int c = atoi(tokens[1].c_str());
          int f = atoi(tokens[2].c_str());
          xyf_hash.insert_rcflow(r,c,f);
          xyf_hash.insert_rc(r,c);
          //std::cout << r << " " << c << " " << flow << std::endl;
        }
        std::cout << nLines << " lines read by read_file_rcflow()..."  << std::endl << std::flush;
        //xyf_hash.print();
    }
    else {
        std::cerr << "read_file_rcflow() open error!!!"  << std::endl << std::flush;
        return (false);
    }
    infile.close();
    return (true);
}