From 159e8ce584c3d1db205202eea5dcf61c02220592 Mon Sep 17 00:00:00 2001 From: Albert Vernon Smith Date: Thu, 2 Mar 2017 01:23:59 +0000 Subject: [PATCH 1/3] Fix pval calc for low t values --- OmicOUT/main.cpp | 10 ++-------- src/Algorithm.cpp | 11 ++--------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/OmicOUT/main.cpp b/OmicOUT/main.cpp index 55f7f97..2171ebb 100644 --- a/OmicOUT/main.cpp +++ b/OmicOUT/main.cpp @@ -56,14 +56,8 @@ void statistics(float b, float SE, int AL_name_idx, int AR_name_idx, resultH &r t=fabs(b/SE); - if( t < 1.6) - { - t1=4.4-t; - ptemp=0.5-0.1*t1*t; - } - else - { - ptemp=erfc(t*one_oversqrt2); + ptemp=erfc(t*one_oversqrt2); + } result rdata; diff --git a/src/Algorithm.cpp b/src/Algorithm.cpp index cfae126..1310e20 100644 --- a/src/Algorithm.cpp +++ b/src/Algorithm.cpp @@ -1156,15 +1156,8 @@ void Algorithm::hpc_statistics(int Ymiss, int n, int realN, if(h >= l) hasTminStorage = true; - if( t < 1.6) - { - t1=4.4-t; - ptemp=0.5-0.1*t1*t; - } - else - { - ptemp=erfc(t*one_oversqrt2); - } + ptemp=erfc(t*one_oversqrt2); + result rdata; From 83ea7836156ce22817974d8cc3988e7e92d105c3 Mon Sep 17 00:00:00 2001 From: Albert Vernon Smith Date: Wed, 7 Jun 2017 15:40:17 +0000 Subject: [PATCH 2/3] dos2unix --- OmicOUT/main.cpp | 290 +++++++++++++++++++++++------------------------ 1 file changed, 145 insertions(+), 145 deletions(-) diff --git a/OmicOUT/main.cpp b/OmicOUT/main.cpp index 2171ebb..fd832fe 100644 --- a/OmicOUT/main.cpp +++ b/OmicOUT/main.cpp @@ -1,20 +1,20 @@ #include #include -#include -#include -#include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include +#include #include #include - + using namespace std; @@ -79,144 +79,144 @@ void statistics(float b, float SE, int AL_name_idx, int AR_name_idx, resultH &r } -void parse_params(int argc, char *argv[], string &source, string &dest, bool &forceAllRes, bool &includeCov, float &minP, float &minR2 ) -{ - int c; - - unsigned pos; +void parse_params(int argc, char *argv[], string &source, string &dest, bool &forceAllRes, bool &includeCov, float &minP, float &minR2 ) +{ + int c; + + unsigned pos; bool out = false; - bool bin = false; - bool pval = false; - - - - while (1) - { - static struct option long_options[] = - { //-c XL --snp XR -p Y -b B -r 2 -t 2 - // These options set a flag. - //{"", no_argument, &verbose_flag, 1}, - //{"", no_argument, &verbose_flag, 0}, - // These options don't set a flag. + bool bin = false; + bool pval = false; + + + + while (1) + { + static struct option long_options[] = + { //-c XL --snp XR -p Y -b B -r 2 -t 2 + // These options set a flag. + //{"", no_argument, &verbose_flag, 1}, + //{"", no_argument, &verbose_flag, 0}, + // These options don't set a flag. //We distinguish them by their indices. - {"binsource", required_argument, 0, 'b'}, - {"out", required_argument, 0, 'o'}, + {"binsource", required_argument, 0, 'b'}, + {"out", required_argument, 0, 'o'}, {"pdisp", required_argument, 0, 'd'},// {"rdisp", required_argument, 0, 'r'},// {"fdcov", no_argument, 0, 'i'},// - {"fdgen", no_argument, 0, 'f'},// - {0, 0, 0, 0} - }; - - // getopt_long stores the option index here. - int option_index = 0; - - c = getopt_long(argc, argv, "b:o:d:r:fi", long_options, &option_index); - - - // Detect the end of the options. - if (c == -1) - break; - - if (!optarg && (c != 'f' && c != 'i')) - { - cout << "\nerror with argument parameter " << (char)c << endl; - exit(1); - } - - switch (c) - { - case 0: - /* If this option set a flag, do nothing else now. */ - if (long_options[option_index].flag != 0) - break; - printf("Long option %s", long_options[option_index].name); - if (optarg) - printf (" with arg %s", optarg); - printf("\n"); - break; - - - case 'o': - out = !out; - dest = string(optarg); - -// dest = string(optarg).find("."); -// if (pos != string::npos) -// dest = string(optarg).substr(0, pos); - - cout << "-o Writing output text file to " << dest << endl; + {"fdgen", no_argument, 0, 'f'},// + {0, 0, 0, 0} + }; + + // getopt_long stores the option index here. + int option_index = 0; + + c = getopt_long(argc, argv, "b:o:d:r:fi", long_options, &option_index); + + + // Detect the end of the options. + if (c == -1) + break; + + if (!optarg && (c != 'f' && c != 'i')) + { + cout << "\nerror with argument parameter " << (char)c << endl; + exit(1); + } + + switch (c) + { + case 0: + /* If this option set a flag, do nothing else now. */ + if (long_options[option_index].flag != 0) + break; + printf("Long option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf("\n"); + break; + + + case 'o': + out = !out; + dest = string(optarg); + +// dest = string(optarg).find("."); +// if (pos != string::npos) +// dest = string(optarg).substr(0, pos); + + cout << "-o Writing output text file to " << dest << endl; + break; + + case 'b': + bin = !bin; + source = string(optarg); + + pos = string(optarg).find("."); + if (pos != string::npos) + source = string(optarg).substr(0, pos); + + cout << "-o Reading input from file " << source << endl; break; - case 'b': - bin = !bin; - source = string(optarg); - - pos = string(optarg).find("."); - if (pos != string::npos) - source = string(optarg).substr(0, pos); - - cout << "-o Reading input from file " << source << endl; - break; - - - case 'd': + + case 'd': minP = fabs(atof(optarg)); - pval = true; - - cout << "-d Significance to display in .txt will be P-val's below " << minP << endl; + pval = true; + + cout << "-d Significance to display in .txt will be P-val's below " << minP << endl; break; - case 'r': - minR2 = (atof(optarg)); - - cout << "-r Minimum R2 to display in .txt will be above " << minR2 << endl; + case 'r': + minR2 = (atof(optarg)); + + cout << "-r Minimum R2 to display in .txt will be above " << minR2 << endl; break; - case 'i': - includeCov = true; - - cout << "-i Covariate results will be included in results" << endl; + case 'i': + includeCov = true; + + cout << "-i Covariate results will be included in results" << endl; break; - case 'f': - forceAllRes = true; - - cout << "-f Forcing all includec results to be considered independently of max P-val or min R2. (Overrides -t and -d, Big file!)"<< endl; - break; - - case '?': - /* getopt_long already printed an error message. */ - break; - - default: - abort(); - } - } - - /* Print any remaining command line arguments (not options). */ - if (optind < argc) - { - printf("non-option ARGV-elements: "); - while (optind < argc) - printf("%s ", argv[optind++]); - - putchar('\n'); - } - - //required arguments - if (!bin || !out || !pval) - { - cout << "Missing arguments!:" - << " o:"<< out << " b:" << bin << " d:" << pval - << endl; - exit(1); - } + case 'f': + forceAllRes = true; + + cout << "-f Forcing all includec results to be considered independently of max P-val or min R2. (Overrides -t and -d, Big file!)"<< endl; + break; + + case '?': + /* getopt_long already printed an error message. */ + break; + + default: + abort(); + } + } + + /* Print any remaining command line arguments (not options). */ + if (optind < argc) + { + printf("non-option ARGV-elements: "); + while (optind < argc) + printf("%s ", argv[optind++]); + + putchar('\n'); + } + + //required arguments + if (!bin || !out || !pval) + { + cout << "Missing arguments!:" + << " o:"<< out << " b:" << bin << " d:" << pval + << endl; + exit(1); + } } -int main(int argc, char *argv[] ) +int main(int argc, char *argv[] ) { string source; string dest; @@ -228,25 +228,25 @@ int main(int argc, char *argv[] ) parse_params(argc,argv,source,dest,forceAllRes,includeCov,minP,minR2); ifstream fp_allResults; - fp_allResults.open((source + ".dbin").c_str(),ios::in | ios::binary ); - if(fp_allResults == 0) - { - cout << "Error reading File "<< (source + ".dbin") << endl; - exit(1); + fp_allResults.open((source + ".dbin").c_str(),ios::in | ios::binary ); + if(fp_allResults == 0) + { + cout << "Error reading File "<< (source + ".dbin") << endl; + exit(1); } ifstream fp_InfoResults; - fp_InfoResults.open((source + ".ibin").c_str(),ios::in | ios::binary ); - if(fp_InfoResults == 0) - { - cout << "Error Creating File " << (source + ".ibin") << endl; - exit(1); + fp_InfoResults.open((source + ".ibin").c_str(),ios::in | ios::binary ); + if(fp_InfoResults == 0) + { + cout << "Error Creating File " << (source + ".ibin") << endl; + exit(1); } ofstream fp_sigResults; - fp_sigResults.open((dest + ".txt").c_str(),ios::out | ios::trunc); - if(fp_sigResults == 0) - { - cout << "Error Creating File "<< (dest + ".txt") << endl; - exit(1); + fp_sigResults.open((dest + ".txt").c_str(),ios::out | ios::trunc); + if(fp_sigResults == 0) + { + cout << "Error Creating File "<< (dest + ".txt") << endl; + exit(1); } From 706764e1d49224af362b5ec7a702dfdd86d409a3 Mon Sep 17 00:00:00 2001 From: Albert Vernon Smith Date: Wed, 7 Jun 2017 15:48:36 +0000 Subject: [PATCH 3/3] For compiling OmicOUT --- .gitignore | 4 ++++ OmicOUT/main.cpp | 18 ++++++++++++------ src/Makefile.am | 5 ++++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 4d2c022..7bf99eb 100644 --- a/.gitignore +++ b/.gitignore @@ -74,3 +74,7 @@ /lib/ /doc/*.aux /doc/auto/ +/OmicOUT/.deps/ +/OmicOUT/.dirstamp +/OmicOUT/omicout-main.o +/omicout diff --git a/OmicOUT/main.cpp b/OmicOUT/main.cpp index fd832fe..5d927b1 100644 --- a/OmicOUT/main.cpp +++ b/OmicOUT/main.cpp @@ -56,8 +56,14 @@ void statistics(float b, float SE, int AL_name_idx, int AR_name_idx, resultH &r t=fabs(b/SE); - ptemp=erfc(t*one_oversqrt2); - + if( t < 1.6) + { + t1=4.4-t; + ptemp=0.5-0.1*t1*t; + } + else + { + ptemp=erfc(t*one_oversqrt2); } result rdata; @@ -229,21 +235,21 @@ int main(int argc, char *argv[] ) ifstream fp_allResults; fp_allResults.open((source + ".dbin").c_str(),ios::in | ios::binary ); - if(fp_allResults == 0) + if(!fp_allResults.is_open()) { cout << "Error reading File "<< (source + ".dbin") << endl; exit(1); } ifstream fp_InfoResults; fp_InfoResults.open((source + ".ibin").c_str(),ios::in | ios::binary ); - if(fp_InfoResults == 0) + if(!fp_InfoResults) { cout << "Error Creating File " << (source + ".ibin") << endl; exit(1); } ofstream fp_sigResults; fp_sigResults.open((dest + ".txt").c_str(),ios::out | ios::trunc); - if(fp_sigResults == 0) + if(!fp_sigResults) { cout << "Error Creating File "<< (dest + ".txt") << endl; exit(1); @@ -474,4 +480,4 @@ int main(int argc, char *argv[] ) -} +} \ No newline at end of file diff --git a/src/Makefile.am b/src/Makefile.am index 5dd16ae..1f2feeb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ # NOTE: This is not a recursive makefile. This file is to be included # in the top Makefile.am -bin_PROGRAMS = omicabelnomm +bin_PROGRAMS = omicabelnomm omicout oanomm_cpp = src/AIOwrapper.cpp src/Algorithm.cpp src/Utility.cpp oanomm_headers = $(oanomm_cpp:.cpp=.h) src/Definitions.h @@ -11,3 +11,6 @@ omicabelnomm_CPPFLAGS = $(AM_CPPFLAGS) if USE_MPI omicabelnomm_CPPFLAGS += -DUSE_MPI endif + +omicout_SOURCES = OmicOUT/main.cpp +omicout_CPPFLAGS = $(AM_CPPFLAGS) \ No newline at end of file