Mercurial > repos > nick > allele_counts_1
view tests/run-tests.py @ 13:df1fb577db0d
Version 1.2: Add strand bias column, rename minor allele frequency column.
author | me <nmapsy@gmail.com> |
---|---|
date | Tue, 03 Dec 2013 13:45:16 -0500 |
parents | 97b772e3a0f1 |
children | 44c3abd1b767 |
line wrap: on
line source
#!/usr/bin/env python import os import sys import subprocess DATASETS = [ 'artificial', 'artificial-samples', 'artificial-nofilt', 'real', 'real-mit', 'real-mit-s', 'real-nofilt', ] IN_EXT = '.vcf.in' OUT_EXT = '.csv.out' ARGS_KEY = '##comment="ARGS=' def main(): test_dir = os.path.dirname(os.path.relpath(sys.argv[0])) if test_dir: test_dir += os.sep for dataset in DATASETS: infile = test_dir+dataset+IN_EXT outfile = test_dir+dataset+OUT_EXT if not os.path.exists(infile): sys.stderr.write("Error: file not found: "+infile+"\n") continue if not os.path.exists(outfile): sys.stderr.write("Error: file not found: "+outfile+"\n") continue options = read_options(infile) script_cmd = 'allele-counts.py '+options+' -i '+infile bash_cmd = 'diff '+outfile+' <('+script_cmd+')' # print infile+":" print script_cmd subprocess.call(['bash', '-c', bash_cmd]) def read_options(infile): with open(infile, 'r') as infilehandle: for line in infilehandle: line.strip() if ARGS_KEY == line[:len(ARGS_KEY)]: return line[len(ARGS_KEY):-2] return '' if __name__ == '__main__': main()