Changeset 1014


Ignore:
Timestamp:
Mar 30, 2009, 6:40:55 PM (12 years ago)
Author:
Jari Häkkinen
Message:

Fixes #191. Added standard options and also assay annotation data file option.

Location:
plugins/base2/net.sf.basedb.normalizers/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/c++/bin/qQN.cc

    r989 r1014  
    2323*/
    2424
    25 #include "yat/normalizer/ColumnNormalizer.h"
    26 #include "yat/normalizer/qQuantileNormalizer.h"
     25#include <config.h> // this header file is created by configure
    2726
    28 #include "yat/utility/Matrix.h"
     27#include <yat/normalizer/ColumnNormalizer.h>
     28#include <yat/normalizer/qQuantileNormalizer.h>
    2929
     30#include <yat/utility/CommandLine.h>
     31#include <yat/utility/Matrix.h>
     32#include <yat/utility/OptionArg.h>
     33#include <yat/utility/OptionHelp.h>
     34#include <yat/utility/OptionSwitch.h>
     35
     36#include <cstdlib>
    3037#include <fstream>
    3138#include <iostream>
     
    3643
    3744  using namespace normalizer;
     45  using namespace utility;
    3846
    39   utility::Matrix m(std::cin,'\t');
    40   utility::Matrix result(m.rows(),m.columns());
     47  CommandLine cmd;
     48  OptionArg<std::string> dir(cmd, "assay-data", "assay annotation file");
     49  OptionHelp help(cmd);
     50  help.synopsis()=(std::string("See ") +
     51                   "http://baseplugins.thep.lu.se/net.sf.basedb.normalizers " +
     52                   "for\ndetails on this program\n");
     53  OptionSwitch version(cmd, "version", "output version and exit");
     54  std::stringstream copyright;
     55  copyright << cmd.program_name() << VERSION << '\n'
     56            << "Copyright (C) 2009 Jari Häkkinen\n\n"
     57            << "This is free software see the source for copying "
     58            << "conditions. There is NO\nwarranty; not even for "
     59            << "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
     60  try {
     61    cmd.parse(argc, argv);
     62  }
     63  catch (cmd_error& e) {
     64    if (version.present()) {
     65      std::cout << copyright.str();
     66      return EXIT_SUCCESS;
     67    }
     68    std::cout << e.what() << std::endl;
     69    return EXIT_FAILURE;
     70  } 
     71  if (version.present()) {
     72    std::cout << copyright.str();
     73    return EXIT_SUCCESS;
     74  }
     75
     76  Matrix m(std::cin,'\t');
     77  Matrix result(m.rows(),m.columns());
    4178  qQuantileNormalizer qqn(m.begin_column(0), m.end_column(0),100);
    4279  ColumnNormalizer<qQuantileNormalizer> cn(qqn);
     
    4481  std::cout << result << std::endl;
    4582
    46   return 0;
     83  return EXIT_SUCCESS;
    4784}
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/net/sf/basedb/plugins/qQuantileNormalization.java

    r1007 r1014  
    214214    assaydata="assay.data";
    215215    exportData();
    216     String[] cmd = { "qQN" };
     216    String[] cmd = { "qQN", "--assay-data", assaydata };
    217217    execute(cmd);
    218218  }
Note: See TracChangeset for help on using the changeset viewer.