@@ -218,12 +218,17 @@ main(int argc, const char **argv) {
218
218
string outfile;
219
219
bool VERBOSE;
220
220
bool TABULAR = false ;
221
+
222
+ string header_info;
223
+
221
224
/* ***************** COMMAND LINE OPTIONS ********************/
222
225
OptionParser opt_parse (strip_path (argv[0 ]),
223
226
" merge multiple methcounts files" ,
224
227
" <methcounts-files>" );
225
228
opt_parse.add_opt (" output" , ' o' , " output file name (default: stdout)" ,
226
229
false , outfile);
230
+ opt_parse.add_opt (" header" , ' h' ," header to print (ignored for tabular)" ,
231
+ false , header_info);
227
232
opt_parse.add_opt (" verbose" , ' v' ," print more run info" , false , VERBOSE);
228
233
opt_parse.add_opt (" tabular" , ' t' , " output as table" , false , TABULAR);
229
234
@@ -264,19 +269,20 @@ main(int argc, const char **argv) {
264
269
for (size_t i = 0 ; i < methcounts_files.size (); i++){
265
270
methcounts_files[i] = remove_extension (methcounts_files[i]);
266
271
}
267
- if (!TABULAR){
268
- out << " # " ;
269
- transform (methcounts_files. begin (), methcounts_files. end (),
270
- std::ostream_iterator<string>(out, " , " ),
271
- std::ptr_fun (&strip_path));
272
- out<< endl;
273
- }
274
- else {
272
+
273
+ // Print the header if the user specifies or if the output is to
274
+ // be in tabular format
275
+ if (!TABULAR && !header_info. empty ())
276
+ out << " # " << header_info << endl;
277
+
278
+ if (TABULAR) {
279
+ // tabular format does not include the '#' character
275
280
transform (methcounts_files.begin (), methcounts_files.end (),
276
281
std::ostream_iterator<string>(out, " \t " ),
277
282
std::ptr_fun (&strip_path));
278
283
out << endl;
279
284
}
285
+
280
286
vector<Site> sites;
281
287
vector<bool > outdated (infiles.size (), true );
282
288
0 commit comments