c++/EEDB/Tools/OSCTableGenerator.cpp
//////////////////////////////////////////////////////////////////////////////
//
// generate osctable version of feature line
//
//////////////////////////////////////////////////////////////////////////////
generate osctable version of feature line
generate osctable version of feature line
string  EEDB::Tools::OSCTableGenerator::osctable_feature_output(EEDB::Feature* feature) {
  string  str;
  char buffer[2048];
  if(feature == NULL) { return str; }
  if(_export_subfeatures == "bed") {
    str = feature->bed_description("BED12");
  } else if(_export_subfeatures == "cigar") {
    str = feature->bed_description("BED6");
    str += "\t" + feature->category_cigar();
  } else {
    str = feature->bed_description("BED6");
  }
  if(_export_feature_metadata) {
    str += "\t" + feature->metadataset()->gff_description();
  }
  list<EEDB::Experiment*>::iterator  it1;
  list<EEDB::Datatype*>::iterator    it2;
  for(it1 = _experiments.begin(); it1 != _experiments.end(); it1++) {
    EEDB::Experiment *experiment = (*it1);
    for(it2 = _expression_datatypes.begin(); it2 != _expression_datatypes.end(); it2++) {
      EEDB::Datatype* datatype = (*it2);
      EEDB::Expression *express = feature->find_expression(experiment, datatype);
      if(express) {
        snprintf(buffer, 2040, "\t%1.2f", express->value());
        str += buffer;
      } else {
        str += "\t0.0";
      }
    }
  }
  return str;
}
string EEDB :: Tools :: OSCTableGenerator :: osctable_feature_output ( EEDB :: Feature * feature ) { string str ; char buffer [ 2048 ] ; if ( feature == NULL ) { return str ; } if ( _export_subfeatures == " " ) { str = feature -> bed_description ( " " ) ; } else if ( _export_subfeatures == " " ) { str = feature -> bed_description ( " " ) ; str += " \t " + feature -> category_cigar ( ) ; } else { str = feature -> bed_description ( " " ) ; } if ( _export_feature_metadata ) { str += " \t " + feature -> metadataset ( ) -> gff_description ( ) ; } list < EEDB :: Experiment * > :: iterator it1 ; list < EEDB :: Datatype * > :: iterator it2 ; for ( it1 = _experiments . begin ( ) ; it1 != _experiments . end ( ) ; it1 ++ ) { EEDB :: Experiment * experiment = ( * it1 ) ; for ( it2 = _expression_datatypes . begin ( ) ; it2 != _expression_datatypes . end ( ) ; it2 ++ ) { EEDB :: Datatype * datatype = ( * it2 ) ; EEDB :: Expression * express = feature -> find_expression ( experiment , datatype ) ; if ( express ) { snprintf ( buffer , 2040 , " \t " , express -> value ( ) ) ; str += buffer ; } else { str += " \t " ; } } } return str ; }
generate osctable version of feature line
generate osctable version of feature line
//str += _osctable_feature_metadata(feature);