Mercurial > repos > nick > allele_counts_1
changeset 12:97b772e3a0f1
Uploaded tarball.
author | nick |
---|---|
date | Tue, 10 Sep 2013 13:14:07 -0400 |
parents | 566e42c97532 |
children | df1fb577db0d |
files | allele-counts.xml tests/run-tests.py |
diffstat | 2 files changed, 8 insertions(+), 93 deletions(-) [+] |
line wrap: on
line diff
--- a/allele-counts.xml Tue Sep 10 13:00:28 2013 -0400 +++ b/allele-counts.xml Tue Sep 10 13:14:07 2013 -0400 @@ -1,14 +1,13 @@ <tool id="allele_counts_1" version="1.1" name="Variant Annotator"> <description> process variant counts</description> - <command interpreter="python">allele-counts.py -i $input -o $output -f $freq -c $covg $header $stranded $nofilt -r $seed</command> + <command interpreter="python">allele-counts.py -i $input -o $output -f $freq -c $covg $header $stranded $nofilt</command> <inputs> <param name="input" type="data" format="vcf" label="Input variants from Naive Variants Detector"/> - <param name="freq" type="float" value="1.0" min="0" max="100" label="Minor allele frequency threshold" help="in percent"/> - <param name="covg" type="integer" value="10" min="0" label="Coverage threshold" help="in reads (per strand)"/> + <param name="freq" type="float" value="1.0" min="0" max="100" label="Minor allele frequency threshold (in percent)"/> + <param name="covg" type="integer" value="10" min="0" label="Coverage threshold (in reads per strand)"/> <param name="nofilt" type="boolean" truevalue="-n" falsevalue="" checked="False" label="Do not filter sites or alleles" /> <param name="stranded" type="boolean" truevalue="-s" falsevalue="" checked="False" label="Output stranded base counts" /> <param name="header" type="boolean" truevalue="-H" falsevalue="" checked="True" label="Write header line" /> - <param name="seed" type="text" value="" label="PRNG seed" /> </inputs> <outputs> <data name="output" format="tabular"/> @@ -18,16 +17,6 @@ <exit_code range=":-1" err_level="fatal"/> </stdio> - <tests> - <test> - <param name="input" value="tests/artificial.vcf.in" /> - <param name="freq" value="10" /> - <param name="covg" value="10" /> - <param name="seed" value="1" /> - <output name="output" file="tests/artificial.csv.out" /> - </test> - </tests> - <help> .. class:: infomark
--- a/tests/run-tests.py Tue Sep 10 13:00:28 2013 -0400 +++ b/tests/run-tests.py Tue Sep 10 13:14:07 2013 -0400 @@ -16,49 +16,12 @@ OUT_EXT = '.csv.out' ARGS_KEY = '##comment="ARGS=' -XML = { - 'tests_start':' <tests>', - 'test_start': ' <test>', - 'input': ' <param name="input" value="tests/%s" />', - 'param': ' <param name="%s" value="%s" />', - 'output': ' <output name="output" file="tests/%s" />', - 'test_end': ' </test>', - 'tests_end': ' </tests>', -} -PARAMS = { - '-f':'freq', - '-c':'covg', - '-H':'header', - '-s':'stranded', - '-n':'nofilt', - '-r':'seed', -} -PARAM_ARG = { - '-f':True, - '-c':True, - '-H':False, - '-s':False, - '-n':False, - '-r':True, -} - def main(): - do_print_xml = False - if len(sys.argv) > 1: - if sys.argv[1] == '-x': - do_print_xml = True - else: - sys.stderr.write("Error: unrecognized option '"+sys.argv[1]+"'\n") - sys.exit(1) - test_dir = os.path.dirname(os.path.relpath(sys.argv[0])) if test_dir: test_dir += os.sep - if do_print_xml: - print XML.get('tests_start') - for dataset in DATASETS: infile = test_dir+dataset+IN_EXT outfile = test_dir+dataset+OUT_EXT @@ -71,48 +34,11 @@ continue options = read_options(infile) - if do_print_xml: - print_xml(infile, outfile, options, XML, PARAMS, PARAM_ARG) - else: - run_tests(infile, outfile, options) - - if do_print_xml: - print XML.get('tests_end') - - -def run_tests(infile, outfile, options): - script_cmd = 'allele-counts.py '+options+' -i '+infile - bash_cmd = 'diff '+outfile+' <('+script_cmd+')' - print script_cmd - subprocess.call(['bash', '-c', bash_cmd]) - - -def print_xml(infile, outfile, options_str, xml, params, param_arg): - infile = os.path.basename(infile) - outfile = os.path.basename(outfile) - - options = options_str.split() # on whitespace - - print xml.get('test_start') - print xml.get('input') % infile - - i = 0 - while i < len(options): - opt = options[i] - if not params.has_key(opt) or not param_arg.has_key(opt): - sys.stderr.write("Error: unknown option '"+opt+"' in ARGS list in file " - +infile+"\n") - sys.exit(1) - if param_arg[opt]: - i+=1 - arg = options[i] - print xml.get('param') % (params[opt], arg) - else: - print xml.get('param') % (params[opt], opt) - i+=1 - - print xml.get('output') % outfile - print xml.get('test_end') + 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):