Skip to content

Commit b3eafde

Browse files
committed
Condense help message. Fix version printing.
1 parent 1785568 commit b3eafde

File tree

3 files changed

+57
-56
lines changed

3 files changed

+57
-56
lines changed

src/data.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ snpsea::snpsea(
2828
ulong max_iterations
2929
)
3030
{
31-
std::cout << "# SNPsea v0.1\n\n";
31+
std::cout << "# SNPsea " << SNPSEA_VERSION << "\n\n";
3232

3333
write_args(
3434
user_snpset_file,

src/option.cpp

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,31 @@ int main(int argc, const char * argv[])
1818
ezOptionParser opt;
1919

2020
opt.overview =
21-
"SNPsea: an efficient statistical assessment for enrichment\n"
22-
"of continuous or binary gene annotations within disease loci.\n"
23-
"=============================================================";
24-
opt.syntax = "snpsea [OPTIONS]";
25-
opt.example =
26-
"Steps:\n"
27-
" 1. Condition each column in --gene-matrix on the columns listed\n"
28-
" in the --condition file.\n"
21+
"SNPsea: test trait-associated loci for enrichment\n"
22+
"of gene measurements or binary annotations.\n"
23+
"=================================================\n"
24+
" 1. Condition --gene-matrix on columns listed in --condition.\n"
2925
" 2. Test each column in --gene-matrix for enrichment of genes\n"
30-
" for the user's SNPs in --snps assigned to SNP intervals\n"
31-
" provided in --snp-intervals.\n"
32-
" 3. Replicate the test with the null matched SNP sets\n"
33-
" sampled from: --null-snps\n"
34-
" for the specified number of iterations: --max-iterations\n"
35-
" and stop testing a column after --min-observations null SNP\n"
36-
" sets with higher scores are observed.\n"
37-
"\n"
38-
"snpsea --snps file.txt \\ # or --snps random20 \n"
39-
" --gene-matrix file.gct.gz \\\n"
40-
" --null-snps file.txt \\\n"
41-
" --snp-intervals file.bed.gz \\\n"
42-
" --gene-intervals file.bed.gz \\\n"
43-
" --condition file.txt \\\n"
44-
" --out folder \\\n"
45-
" --slop 250e3 \\\n"
46-
" --threads 2 \\\n"
47-
" --null-snpsets 100 \\\n"
48-
" --min-observations 25 \\\n"
49-
" --max-iterations 1e6\n\n";
26+
" within --snps assigned to intervals in --snp-intervals.\n"
27+
" 3. Repeat with the null matched SNP set from --null-snps\n"
28+
" for --max-iterations and stop if --min-observations null SNP\n"
29+
" sets with higher scores are observed for that column.";
30+
opt.syntax = " snpsea [OPTIONS]";
31+
opt.example =
32+
" snpsea --snps file.txt \\ # or --snps random20 \n"
33+
" --gene-matrix file.gct.gz \\\n"
34+
" --null-snps file.txt \\\n"
35+
" --snp-intervals file.bed.gz \\\n"
36+
" --gene-intervals file.bed.gz \\\n"
37+
" --condition file.txt \\\n"
38+
" --out folder \\\n"
39+
" --slop 250e3 \\\n"
40+
" --threads 2 \\\n"
41+
" --null-snpsets 100 \\\n"
42+
" --min-observations 25 \\\n"
43+
" --max-iterations 1e6\n\n";
5044
opt.footer =
51-
"SNPsea v0.1 Copyright (C) 2013 Kamil Slowikowski"
45+
"SNPsea " SNPSEA_VERSION " Copyright (C) 2013 Kamil Slowikowski"
5246
" <slowikow@broadinstitute.org>\n"
5347
"This program is free and without warranty under the GPLv3 license.\n\n";
5448

@@ -57,7 +51,7 @@ int main(int argc, const char * argv[])
5751
0, // Required?
5852
0, // Number of args expected.
5953
0, // Delimiter if expecting multiple args.
60-
"Display usage instructions.", // Help description.
54+
"* Display usage instructions.", // Help description.
6155
"-h", // Flag token.
6256
"--help" // Flag token.
6357
);
@@ -67,7 +61,7 @@ int main(int argc, const char * argv[])
6761
0, // Required?
6862
0, // Number of args expected.
6963
0, // Delimiter if expecting multiple args.
70-
"Display version and exit.\n\n", // Help description.
64+
"* Display version and exit.\n", // Help description.
7165
"-v", // Flag token.
7266
"--version" // Flag token.
7367
);
@@ -77,9 +71,9 @@ int main(int argc, const char * argv[])
7771
1, // Required?
7872
1, // Number of args expected.
7973
0, // Delimiter if expecting multiple args.
80-
"Text file with SNP identifiers in the first column.\n"
74+
"* Text file with SNP identifiers in the first column.\n"
8175
"Instead of a file name, you may use 'randomN' with an integer N for"
82-
" a random SNP list of length N.\n\n",
76+
" a random SNP list of length N.\n",
8377
"--snps" // Flag token.
8478
);
8579

@@ -88,8 +82,8 @@ int main(int argc, const char * argv[])
8882
1, // Required?
8983
1, // Number of args expected.
9084
0, // Delimiter if expecting multiple args.
91-
"Gene matrix file in GCT format. The Name column must contain the"
92-
" same gene identifiers as in --gene-intervals.\n\n",
85+
"* Gene matrix file in GCT format. The Name column must contain the"
86+
" same gene identifiers as in --gene-intervals.\n",
9387
"--gene-matrix" // Flag token.
9488
);
9589

@@ -98,8 +92,8 @@ int main(int argc, const char * argv[])
9892
1, // Required?
9993
1, // Number of args expected.
10094
0, // Delimiter if expecting multiple args.
101-
"BED file with gene intervals. The fourth column must contain the"
102-
" same gene identifiers as in --gene-matrix.\n\n",
95+
"* BED file with gene intervals. The fourth column must contain the"
96+
" same gene identifiers as in --gene-matrix.\n",
10397
"--gene-intervals" // Flag token.
10498
);
10599

@@ -108,8 +102,8 @@ int main(int argc, const char * argv[])
108102
1, // Required?
109103
1, // Number of args expected.
110104
0, // Delimiter if expecting multiple args.
111-
"BED file with all known SNP intervals. The fourth column must"
112-
" contain the same SNP identifiers as in --snps and --null-snps.\n\n",
105+
"* BED file with all known SNP intervals. The fourth column must"
106+
" contain the same SNP identifiers as in --snps and --null-snps.\n",
113107
"--snp-intervals" // Flag token.
114108
);
115109

@@ -118,9 +112,9 @@ int main(int argc, const char * argv[])
118112
1, // Required?
119113
1, // Number of args expected.
120114
0, // Delimiter if expecting multiple args.
121-
"Text file with SNP identifiers to sample when generating null"
115+
"* Text file with SNP identifiers to sample when generating null"
122116
" matched or random SNP sets. These SNPs must be a subset of"
123-
" --snp-intervals.\n\n",
117+
" --snp-intervals.\n",
124118
"--null-snps" // Flag token.
125119
);
126120

@@ -129,7 +123,7 @@ int main(int argc, const char * argv[])
129123
1, // Required?
130124
1, // Number of args expected.
131125
0, // Delimiter if expecting multiple args.
132-
"Create output files in this directory.\n\n", // Help description.
126+
"* Create output files in this directory.\n", // Help description.
133127
"--out" // Flag token.
134128
);
135129

@@ -138,10 +132,10 @@ int main(int argc, const char * argv[])
138132
0, // Required?
139133
1, // Number of args expected.
140134
0, // Delimiter if expecting multiple args.
141-
"Text file with a list of columns in --gene-matrix to condition on"
135+
"* Text file with a list of columns in --gene-matrix to condition on"
142136
" before calculating p-values. Each column in --gene-matrix is"
143137
" projected onto each column listed in this file and its projection"
144-
" is subtracted.\n\n",
138+
" is subtracted.\n",
145139
"--condition" // Flag token.
146140
);
147141

@@ -151,8 +145,8 @@ int main(int argc, const char * argv[])
151145
0, // Required?
152146
1, // Number of args expected.
153147
0, // Delimiter if expecting multiple args.
154-
"If a SNP overlaps no gene intervals, extend the SNP interval this"
155-
" many nucleotides further and try again.\n[default: 250000]\n\n",
148+
"* If a SNP overlaps no gene intervals, extend the SNP interval this"
149+
" many nucleotides further and try again.\n[default: 250000]\n",
156150
"--slop", // Flag token.
157151
vU8
158152
);
@@ -163,7 +157,7 @@ int main(int argc, const char * argv[])
163157
0, // Required?
164158
1, // Number of args expected.
165159
0, // Delimiter if expecting multiple args.
166-
"Number of threads to use.\n[default: 1]\n\n",
160+
"* Number of threads to use.\n[default: 1]\n",
167161
"--threads", // Flag token.
168162
gt1
169163
);
@@ -174,8 +168,8 @@ int main(int argc, const char * argv[])
174168
0, // Required?
175169
1, // Number of args expected.
176170
0, // Delimiter if expecting multiple args.
177-
"Test this many null matched SNP sets, so you can compare"
178-
" your results to a distribution of null results.\n[default: 10]\n\n",
171+
"* Test this many null matched SNP sets, so you can compare"
172+
" your results to a distribution of null results.\n[default: 10]\n",
179173
"--null-snpsets", // Flag token.
180174
gt0
181175
);
@@ -185,10 +179,10 @@ int main(int argc, const char * argv[])
185179
0, // Required?
186180
1, // Number of args expected.
187181
0, // Delimiter if expecting multiple args.
188-
"Stop testing a column in --gene-matrix after observing this many"
182+
"* Stop testing a column in --gene-matrix after observing this many"
189183
" null SNP sets with specificity scores greater or equal to those"
190184
" obtained with the SNP set in --snps. Increase this value to obtain"
191-
" more accurate p-values.\n[default: 25]\n\n",
185+
" more accurate p-values.\n[default: 25]\n",
192186
"--min-observations", // Flag token.
193187
gt1
194188
);
@@ -198,9 +192,9 @@ int main(int argc, const char * argv[])
198192
0, // Required?
199193
1, // Number of args expected.
200194
0, // Delimiter if expecting multiple args.
201-
"Maximum number of null SNP sets tested against each column in"
195+
"* Maximum number of null SNP sets tested against each column in"
202196
" --gene-matrix. Increase this value to resolve smaller p-values."
203-
"\n[default: 1000]\n\n",
197+
"\n[default: 1000]\n",
204198
"--max-iterations", // Flag token.
205199
gt1
206200
);
@@ -213,13 +207,18 @@ int main(int argc, const char * argv[])
213207
return 1;
214208
}
215209

210+
if (opt.isSet("-v")) {
211+
std::cout << SNPSEA_VERSION << std::endl;
212+
return 1;
213+
}
214+
216215
std::vector<std::string> badOptions;
217216
int i;
218217
if (!opt.gotRequired(badOptions)) {
219218
Usage(opt);
220219
for (i = 0; i < badOptions.size(); ++i) {
221220
std::cerr << "ERROR: Missing required option "
222-
<< badOptions[i] << ".\n\n";
221+
<< badOptions[i] << ".\n";
223222
}
224223
return 1;
225224
}
@@ -228,7 +227,7 @@ int main(int argc, const char * argv[])
228227
Usage(opt);
229228
for (i = 0; i < badOptions.size(); ++i) {
230229
std::cerr << "ERROR: Got unexpected number of arguments for "
231-
<< badOptions[i] << ".\n\n";
230+
<< badOptions[i] << ".\n";
232231
}
233232
return 1;
234233
}

src/snpsea.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#ifndef _SNPSEA_H
55
#define _SNPSEA_H
66

7+
#define SNPSEA_VERSION "v1.0.1"
8+
79
#include <Eigen/Dense>
810
#include "IntervalTree.h"
911
#include "common.h"

0 commit comments

Comments
 (0)