Skip to content

Program style

blackrim edited this page Mar 3, 2013 · 8 revisions

The goal of phyx is to provide a set of command line tools for unix/gnu/linux (or anything else with a c++ compiler I suppose) that are intuitive and have a similar structure and feel across each program. This is similar for common unix tools like ls, rm, cd, and so on. In order to achieve this, there need to be some general style guidelines that each program should follow to give the sense that each program is part of the package and to generally make it easier to interact with each program.

Program arguments

Program arguments should be provided in one of two ways: at the command line or with a simple config file. The config file will always take the same format where each line will have the option name and the option. The command line arguments will take the form short and long arguments like -h param or --help=param. This is achieved by using the getopt_long function from #include <getopt.h>. See one of the existing mains for an example. The --help should produce something like this

Filter fastq files by mean quality score and send
result to standard output. Can read from stdin or file

Usage: pxfqfilt [OPTION]... [FILE]...

 -m, --mean=VALUE    mean value under which seqs are filtered
 -s, --seqf=FILE     input sequence file, stdin otherwise
 -o, --outf=FILE     output sequence file, stout otherwise
     --help          display this help and exit
     --version       display version and exit

Report bugs to: <https://github.com/FePhyFoFum/phyx/issues>
phyx home page: <https://github.com/FePhyFoFum/phyx>

and the --version should be like

pxfqfilt 0.1
Copyright (C) 2013 FePhyFoFum
Liscence GPLv2
written by Stephen A. Smith (blackrim)

so please format accordingly. (Of course with you as the author or added to the author if you edit something).

Man pages

Each program should have comprehensive man pages that are to be installed in the standard location.

File types

The file types that we support in all programs, where relevant (not that we support tree files in sequence programs), include fasta, fastq, phylip (extended), nexus, nexml, and newick.

Input/Output

Because most people use files, input and output files need to be supported. However, we will also support stdin/stdout.

Clone this wiki locally