Changeset 1023
- Timestamp:
- Apr 7, 2009, 12:35:48 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/base2/net.sf.basedb.normalizers/trunk/src/c++/bin/qQN.cc
r1020 r1023 49 49 { 50 50 CommandLine cmd; 51 OptionArg<std::string> assay(cmd, "assay-data", "assay annotation file"); 51 OptionArg<std::string> assay(cmd, "assay-data", "assay annotations", true); 52 OptionArg<std::string> indata(cmd, "in-data", "data to be normalized"); 53 OptionArg<std::string> outdata(cmd, "out-data", "normalized data"); 52 54 OptionHelp help(cmd); 53 55 help.synopsis()=(std::string("See ") + … … 77 79 } 78 80 81 if (version.present()) { 82 std::cout << copyright.str(); 83 return EXIT_SUCCESS; 84 } 85 86 std::ifstream* infile=NULL; 87 std::streambuf* cin_buffer=NULL; 88 if (indata.present()) { 89 infile=new std::ifstream(indata.value().c_str()); 90 cin_buffer = std::cin.rdbuf(); // save cin's input buffer 91 std::cin.rdbuf(infile->rdbuf()); 92 } 79 93 Matrix m(std::cin,'\t'); 94 if (indata.present()) { 95 std::cin.rdbuf(cin_buffer); // restore old input buffer 96 infile->close(); 97 delete infile; 98 } 99 80 100 std::vector<double> target(m.rows(),0); 81 101 ( assay.present() ? create_target(target,m,assay.value()) : … … 85 105 Matrix result(m.rows(),m.columns()); 86 106 cn(m,result); 107 108 std::ofstream* outfile=NULL; 109 std::streambuf* cout_buffer = std::cout.rdbuf(); 110 if (outdata.present()) { 111 outfile=new std::ofstream(outdata.value().c_str()); 112 cout_buffer = std::cout.rdbuf(); // save cout's output buffer 113 std::cout.rdbuf(outfile->rdbuf()); 114 } 87 115 std::cout << result << std::endl; 116 if (outdata.present()) { 117 std::cout.rdbuf(cout_buffer); // restore old output buffer 118 outfile->close(); 119 delete outfile; 120 } 88 121 89 122 return EXIT_SUCCESS;
Note: See TracChangeset
for help on using the changeset viewer.