1 | // $Id: qQN.cc 1014 2009-03-30 16:40:55Z jari $ |
---|
2 | |
---|
3 | /* |
---|
4 | Copyright (C) 2009 Jari Häkkinen |
---|
5 | |
---|
6 | This file is part of the Normalizers plug-in package for BASE |
---|
7 | (net.sf.based.normalizers). The package is available at |
---|
8 | http://baseplugins.thep.lu.se/ BASE main site is |
---|
9 | http://base.thep.lu.se/ |
---|
10 | |
---|
11 | This is free software; you can redistribute it and/or modify it |
---|
12 | under the terms of the GNU General Public License as published by |
---|
13 | the Free Software Foundation; either version 3 of the License, or |
---|
14 | (at your option) any later version. |
---|
15 | |
---|
16 | The software is distributed in the hope that it will be useful, but |
---|
17 | WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
19 | General Public License for more details. |
---|
20 | |
---|
21 | You should have received a copy of the GNU General Public License |
---|
22 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
23 | */ |
---|
24 | |
---|
25 | #include <config.h> // this header file is created by configure |
---|
26 | |
---|
27 | #include <yat/normalizer/ColumnNormalizer.h> |
---|
28 | #include <yat/normalizer/qQuantileNormalizer.h> |
---|
29 | |
---|
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> |
---|
37 | #include <fstream> |
---|
38 | #include <iostream> |
---|
39 | |
---|
40 | using namespace theplu::yat; |
---|
41 | |
---|
42 | int main(int argc, char* argv[]) |
---|
43 | { |
---|
44 | using namespace normalizer; |
---|
45 | using namespace utility; |
---|
46 | |
---|
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()); |
---|
78 | qQuantileNormalizer qqn(m.begin_column(0), m.end_column(0),100); |
---|
79 | ColumnNormalizer<qQuantileNormalizer> cn(qqn); |
---|
80 | cn(m,result); |
---|
81 | std::cout << result << std::endl; |
---|
82 | |
---|
83 | return EXIT_SUCCESS; |
---|
84 | } |
---|