Mercurial > repos > jjohnson > mothur_toolsuite
annotate mothur/tools/mothur/mothur_wrapper.py @ 1:fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
| author | jjohnson | 
|---|---|
| date | Tue, 07 Jun 2011 17:35:35 -0400 | 
| parents | 3202a38e44d9 | 
| children | e990ac8a0f58 | 
| rev | line source | 
|---|---|
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 1 #!/usr/bin/env python | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 2 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 3 """ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 4 http://www.mothur.org/ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 5 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 6 Supports mothur version | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 7 mothur v.1.15.0 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 8 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 9 Class encapsulating Mothur galaxy tool. | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 10 Expect each invocation to include: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 11 Here is an example call to this script with an explanation before each param : | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 12 mothur_wrapper.py | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 13 # name of a mothur command, this is required | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 14 --cmd='summary.shared' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 15 # Galaxy output dataset list, these are output files that can be determined before the command is run | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 16 # The items in the list are separated by commas | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 17 # Each item contains a regex to match the output filename and a galaxy dataset filepath in which to copy the data (separated by :) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 18 --result='^mothur.\S+\.logfile$:'/home/galaxy/data/database/files/002/dataset_2613.dat,'^\S+\.summary$:'/home/galaxy/data/database/files/002/dataset_2614.dat | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 19 # Galaxy output dataset extra_files_path direcotry in which to put all output files | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 20 --outputdir='/home/galaxy/data/database/files/002/dataset_2613_files' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 21 # The id of one of the galaxy outputs (e.g. the mothur logfile) used for dynamic dataset generation | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 22 # http://bitbucket.org/galaxy/galaxy-central/wiki/ToolsMultipleOutput | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 23 --datasetid='2578' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 24 # The galaxy directory in which to copy all output files for dynamic dataset generation | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 25 --new_file_path='/home/galaxy/data/database/tmp' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 26 # specifies files to copy to the new_file_path | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 27 # The list is separated by commas | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 28 # Each item conatins: a regex pattern for matching filenames and a galaxy datatype (separated by :) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 29 # The regex match.groups()[0] is used as the id name of the dataset, and must result in unique name for each output | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 30 --new_datasets='^\S+?\.((\S+)\.(unique|[0-9.]*)\.dist)$:lower.dist' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 31 # Many mothur commands first require data to be read into memory using: read.otu, read.dist, or read.tree | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 32 # This prequisite command and its params are prefixed with 'READ_' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 33 --READ_cmd='read.otu' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 34 --READ_list=/home/galaxy/data/database/files/001/dataset_1557.dat | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 35 --READ_group='/home/galaxy/data/database/files/001/dataset_1545.dat' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 36 --READ_label='unique,0.07' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 37 """ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 38 # import pkg_resources; | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 39 import logging, os, string, sys, tempfile, glob, shutil, types, urllib, optparse, re | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 40 import shlex, subprocess | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 41 from stat import * | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 42 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 43 log = logging.getLogger( __name__ ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 44 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 45 assert sys.version_info[:2] >= ( 2, 4 ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 46 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 47 debug = False | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 48 #debug = True | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 49 max_processors = 1 | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 50 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 51 def stop_err( msg ): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 52 sys.stderr.write( "%s\n" % msg ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 53 sys.exit() | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 54 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 55 def __main__(): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 56 # tranform the logfile into html | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 57 def logfile_to_html(logfile_path,htmlfile_path,tmp_input_dir_name,tmp_output_dir_name,title="Mothur Logfile"): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 58 if debug: print >> sys.stdout, 'logfile_to_html %s -> %s' % (logfile_path, htmlfile_path) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 59 if debug: print >> sys.stdout, 'logfile_to_html input_dir: %s' % tmp_input_dir_name | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 60 if debug: print >> sys.stdout, 'logfile_to_html output_dir: %s' % tmp_output_dir_name | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 61 txt = open(logfile_path,'r') | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 62 in_pat = re.sub('[^a-zA-Z0-9_/]','.',tmp_input_dir_name) + '/(.+)' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 63 out_pat = re.sub('[^a-zA-Z0-9_/]','.',tmp_output_dir_name) + '/(.+)' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 64 html = open(htmlfile_path,'w') | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 65 html.write("<html><head><title>%s</title></head>\n<body>\n<pre>\n" % title) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 66 try: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 67 for line in txt: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 68 if line.find('set.dir') >= 0: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 69 continue | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 70 elif line.find('put directory to ') >= 0: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 71 continue | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 72 elif line.startswith('Type ') : | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 73 continue | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 74 elif line.find(tmp_output_dir_name) >= 0: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 75 line = re.sub(out_pat,'<a href="\\1">\\1</a>',line) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 76 elif line.find(tmp_input_dir_name) >= 0: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 77 line = re.sub(in_pat,'\\1',line) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 78 html.write(line) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 79 except Exception, e: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 80 print(str(e)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 81 pass | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 82 html.write('</pre>\n</body>\n</html>\n') | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 83 html.close() | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 84 #Overide the processors option | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 85 def processors_callback(option, opt, value, parser): | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 86 val = value if value <= max_processors else max_processors | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 87 setattr(parser.values, option.dest, val) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 88 #Strip out "(xx)" confidence values from a taxonomy list | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 89 def remove_confidence_callback(option, opt, value, parser): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 90 # val = "'" + re.sub('\(\d+\)','',value) + "'" | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 91 setattr(parser.values, option.dest, re.sub('\(\d+\)','',value)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 92 #Mothur separates items in a list of values with hyphens | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 93 def multi_val_callback(option, opt, value, parser): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 94 setattr(parser.values, option.dest, '-'.join(value.split(','))) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 95 #Handle list arguments that may contain dataset files | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 96 def prepare_input(value,input_dir): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 97 """ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 98 Mothur requires items in a list of input values to be separated by hyphens | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 99 Change list separator from comma to hyphen | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 100 If those items are files, copy them to the input dir. | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 101 """ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 102 if input_dir != None and value != None and isinstance(value, str): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 103 vals = [] | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 104 for val in value.split(','): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 105 if val[0] == '/' and os.path.isfile(val): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 106 (dir,fname) = os.path.split(val) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 107 try: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 108 os.symlink(val,os.path.join(input_dir,fname)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 109 except: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 110 shutil.copy(val,os.path.join(input_dir,fname)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 111 vals.append(fname) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 112 if debug: print >> sys.stderr, "scp %s %s" % (val, os.path.join(input_dir,fname)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 113 else: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 114 vals.append(val) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 115 return '-'.join(vals) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 116 return value | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 117 #Parse Command Line and get a list of params | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 118 # Prefix is used to differentiate between prerequisite commands: read.otu, read.dist, read.tree | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 119 def get_params(cmd, options, input_dir, prefix=''): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 120 if debug: print >> sys.stderr, options | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 121 params = [] | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 122 for opt in cmd_dict[cmd]['required']: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 123 if debug: print >> sys.stderr, opt | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 124 if isinstance(opt,list): # One of these must be present | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 125 missing = True | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 126 for sel in opt: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 127 # if debug: print >> sys.stderr, sel | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 128 try: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 129 value = prepare_input(getattr(options,prefix+sel), input_dir) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 130 if value != None: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 131 params.append('%s=%s' % (sel,value)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 132 missing = False | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 133 except Exception, e: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 134 stop_err('Illegal option for cmd %s : %s %s' % (cmd,sel,e)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 135 if missing: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 136 stop_err('Missing a required parameter for %s, need one of %s' % (cmd,opt)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 137 else: # This option is required | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 138 try: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 139 value = prepare_input(getattr(options,prefix+opt), input_dir) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 140 # if debug: print >> sys.stderr, value | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 141 if value != None: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 142 params.append('%s=%s' % (opt,value)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 143 else: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 144 stop_err('Missing a required parameter for %s : %s' % (cmd,opt)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 145 except Exception, e: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 146 stop_err('Illegal option %s %s' % (opt,e)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 147 if 'optional' in cmd_dict[cmd]: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 148 for opt in cmd_dict[cmd]['optional']: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 149 # if debug: print >> sys.stderr, opt | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 150 try: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 151 value = prepare_input(getattr(options,prefix+opt), input_dir) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 152 # if debug: print >> sys.stderr, value | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 153 if value != None: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 154 params.append('%s=%s' % (opt,value)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 155 except Exception, e: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 156 # should distinguish between READ_ opts and cmd opts | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 157 # stop_err('Illegal option for %s : %s' % (cmd,opt)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 158 pass | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 159 return params | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 160 """ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 161 The command dict has a dict for each mothur command with required and options arguments | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 162 The top level list of required arguments is interpreted that each value item is required and any list item represents a choice of arguments | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 163 This covers many, but not all of the argument dependency requirements. | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 164 For example - read.dist required a phylip or (column and name) argument. | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 165 The complexity of inputs should be handled by the glaxy tool xml file. | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 166 """ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 167 cmd_dict = dict() | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 168 cmd_dict['merge.files'] = dict({'required' : ['input','output']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 169 cmd_dict['make.group'] = dict({'required' : ['fasta','groups'], 'optional' : ['output']}) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 170 cmd_dict['merge.groups'] = dict({'required' : ['shared','design'], 'optional' : ['groups', 'label']}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 171 cmd_dict['summary.seqs'] = dict({'required' : ['fasta'], | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 172 'outputs' : ['.names']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 173 cmd_dict['reverse.seqs'] = dict({'required' : ['fasta']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 174 cmd_dict['degap.seqs'] = dict({'required' : ['fasta']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 175 cmd_dict['unique.seqs'] = dict({'required' : ['fasta'], 'optional' : ['names']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 176 cmd_dict['deunique.seqs'] = dict({'required' : ['fasta','names'], 'optional' : []}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 177 cmd_dict['chop.seqs'] = dict({'required' : ['fasta','numbases'], 'optional' : ['keep','short']}) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 178 cmd_dict['filter.seqs'] = dict({'required' : ['fasta'], 'optional' : ['vertical','trump','soft','hard','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 179 cmd_dict['screen.seqs'] = dict({'required' : ['fasta'], 'optional' : ['start','end','maxambig','maxhomop','minlength','maxlength','criteria','optimize','name','group','alignreport','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 180 cmd_dict['trim.seqs'] = dict({'required' : ['fasta'], 'optional' : ['group','oligos','qfile','qaverage','qthreshold','qtrim','flip','maxambig','maxhomop','minlength','maxlength','bdiffs','pdiffs','tdiffs','allfiles','keepfirst','removelast']}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 181 cmd_dict['list.seqs'] = dict({'required' : [['fasta','name','group','list','alignreport','taxonomy']]}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 182 cmd_dict['get.seqs'] = dict({'required' : ['accnos',['fasta','qfile','name','group','list','alignreport','taxonomy']], 'optional' : ['dups']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 183 cmd_dict['remove.seqs'] = dict({'required' : ['accnos',['fasta','qfile','name','group','list','alignreport','taxonomy']], 'optional' : ['dups']}) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 184 cmd_dict['align.seqs'] = dict({'required' : ['candidate','template'], 'optional' : ['search','ksize','align','match','mismatch','gapopen','gapextend','flip','threshold','processors']}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 185 cmd_dict['align.check'] = dict({'required' : ['fasta','map']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 186 cmd_dict['pre.cluster'] = dict({'required' : ['fasta'], 'optional' : ['names','diffs']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 187 cmd_dict['bin.seqs'] = dict({'required' : ['fasta'], 'optional' : ['name','label','group']}) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 188 cmd_dict['classify.seqs'] = dict({'required' : ['fasta','template','taxonomy'],'optional' : ['name','search','ksize','method','match','mismatch','gapopen','gapextend','numwanted','probs','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 189 cmd_dict['classify.otu'] = dict({'required' : ['list','taxonomy'],'optional' : ['name','cutoff','label','group','probs','basis','reftaxonomy']}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 190 # label=0.01-0.02-0.03 from 0.01,0.02,0.03 string.replace(options.label,',','-') | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 191 cmd_dict['chimera.bellerophon'] = dict({'required' : ['fasta'], 'optional' : ['filter','correction','window','increment','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 192 cmd_dict['chimera.ccode'] = dict({'required' : ['fasta','template'], 'optional' : ['filter','mask','window','numwanted','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 193 cmd_dict['chimera.check'] = dict({'required' : ['fasta','template'], 'optional' : ['ksize','svg','name','increment','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 194 cmd_dict['chimera.pintail'] = dict({'required' : ['fasta','template'], 'optional' : ['conservation','quantile','filter','mask','window','increment','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 195 cmd_dict['chimera.slayer'] = dict({'required' : ['fasta','template'], 'optional' : ['name','search','window','increment','match','mismatch','numwanted','parents','minsim','mincov','iters','minbs','minsnp','divergence','realign','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 196 cmd_dict['dist.seqs'] = dict({'required' : ['fasta'], 'optional' : ['calc','countends','output','cutoff','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 197 cmd_dict['pairwise.seqs'] = dict({'required' : ['fasta'], 'optional' : ['align','calc','countends','output','cutoff','match','mismatch','gapopen','gapextend','processors']}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 198 cmd_dict['read.dist'] = dict({'required' : [['phylip','column']], 'optional' : ['name','cutoff','hard','precision','sim','group']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 199 cmd_dict['read.otu'] = dict({'required' : [['rabund','sabund','list','shared','relabund']], 'optional' : ['label','group','groups','ordergroup']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 200 cmd_dict['read.tree'] = dict({'required' : ['tree'], 'optional' : ['name','group']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 201 cmd_dict['cluster'] = dict({'required' : [] , 'optional' : ['method','cutoff','hard','precision']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 202 cmd_dict['hcluster'] = dict({'required' : [['column','phylip']] , 'optional' : ['name','method','cutoff','hard','precision','sorted','showabund']}) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 203 cmd_dict['cluster.fragments'] = dict({'required' : ['fasta'] , 'optional' : ['name','diffs','percent']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 204 cmd_dict['cluster.split'] = dict({'required' : [['fasta','phylip','column']] , 'optional' : ['name','method','splitmethod','taxonomy','taxlevel','showabund','cutoff','hard','large','precision','timing','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 205 cmd_dict['metastats'] = dict({'required' : ['design'], 'optional' : ['groups', 'label','iters','threshold','sets','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 206 cmd_dict['summary.single'] = dict({'required' : [], 'optional' : ['calc','abund','size','label','groupmode','processors']}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 207 cmd_dict['summary.shared'] = dict({'required' : [], 'optional' : ['calc','label','groups','all','distance']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 208 cmd_dict['collect.single'] = dict({'required' : [], 'optional' : ['calc','abund','size','label','freq']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 209 cmd_dict['collect.shared'] = dict({'required' : [], 'optional' : ['calc','label','freq','groups','all']}) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 210 cmd_dict['rarefaction.single'] = dict({'required' : [], 'optional' : ['calc','abund','iters','label','freq','processors']}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 211 cmd_dict['rarefaction.shared'] = dict({'required' : [], 'optional' : ['label','iters','groups','jumble']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 212 cmd_dict['normalize.shared'] = dict({'required' : [], 'optional' : ['label','method','norm','groups']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 213 cmd_dict['dist.shared'] = dict({'required' : [], 'optional' : ['calc','label','groups','output']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 214 cmd_dict['split.abund'] = dict({'required' : ['fasta',['name','list']], 'optional' : ['cutoff','group','groups','label','accnos']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 215 cmd_dict['split.groups'] = dict({'required' : ['fasta','group'], 'optional' : []}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 216 cmd_dict['tree.shared'] = dict({'required' : [], 'optional' : ['groups','calc','cutoff','precision','label']}) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 217 cmd_dict['unifrac.unweighted'] = dict({'required' : [], 'optional' : ['groups','iters','distance','random','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 218 cmd_dict['unifrac.weighted'] = dict({'required' : [], 'optional' : ['groups','iters','distance','random','processors']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 219 cmd_dict['parsimony'] = dict({'required' : [], 'optional' : ['groups','iters','random','processors']}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 220 cmd_dict['sffinfo'] = dict({'required' : ['sff'], 'optional' : ['fasta','qfile','trim','sfftxt','flow','accnos']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 221 cmd_dict['fastq.info'] = dict({'required' : ['fastq'], 'optional' : []}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 222 cmd_dict['heatmap.bin'] = dict({'required' : [], 'optional' : ['label','groups','scale','sorted','numotu','fontsize']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 223 cmd_dict['heatmap.sim'] = dict({'required' : [], 'optional' : ['calc','phylip','column','name','label','groups']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 224 cmd_dict['venn'] = dict({'required' : [], 'optional' : ['calc','label','groups','nseqs','permute']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 225 cmd_dict['pcoa'] = dict({'required' : ['phylip'], 'optional' : []}) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 226 cmd_dict['pca'] = dict({'required' : [], 'optional' : ['label','groups','metric']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 227 cmd_dict['nmds'] = dict({'required' : ['phylip'], 'optional' : ['axes','mindim','maxdim','iters','maxiters','epsilon']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 228 cmd_dict['corr.axes'] = dict({'required' : [['shared','relabund','metadata'],'axes'], 'optional' : ['label','groups','method','numaxes']}) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 229 cmd_dict['get.group'] = dict({'required' : [], 'optional' : []}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 230 cmd_dict['phylotype'] = dict({'required' : ['taxonomy'],'optional' : ['name','cutoff','label']}) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 231 cmd_dict['phylo.diversity'] = dict({'required' : [],'optional' : ['groups','iters','freq','processors','scale','rarefy','collect','summary','processors']}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 232 cmd_dict['get.oturep'] = dict({'required' : ['fasta','list'], 'optional' : ['phylip','column','name','label','group','groups','sorted','precision','cutoff','large','weighted']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 233 cmd_dict['get.relabund'] = dict({'required' : [],'optional' : ['scale','label','groups']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 234 cmd_dict['libshuff'] = dict({'required' : [],'optional' : ['iters','form','step','cutoff']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 235 # clearcut options not needed in galaxy: 'version','verbose','quiet','stdout' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 236 cmd_dict['clearcut'] = dict({'required' : [['list','fasta']],'optional' : ['seed','norandom','shuffle','neighbor','expblen','expdist','ntrees','matrixout','kimura','jukes','protein','DNA']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 237 cmd_dict['get.lineage'] = dict({'required' : ['taxonomy','taxon'],'optional' : ['fasta','name','group','list','alignreport','dups']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 238 cmd_dict['remove.lineage'] = dict({'required' : ['taxonomy','taxon'],'optional' : ['fasta','name','group','list','alignreport','dups']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 239 cmd_dict['bootstrap.shared'] = dict({'required' : [], 'optional' : ['calc','groups','iters','label']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 240 """ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 241 Mothur 1.15 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 242 """ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 243 cmd_dict['cluster.classic'] = dict({'required' : [] , 'optional' : ['method','cutoff','hard','precision']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 244 cmd_dict['get.groups'] = dict({'required' : ['group'], 'optional' : ['groups','accnos','fasta','name','list','taxonomy']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 245 cmd_dict['remove.groups'] = dict({'required' : ['group'], 'optional' : ['groups','accnos','fasta','name','list','taxonomy']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 246 cmd_dict['get.otus'] = dict({'required' : ['group','list','label'], 'optional' : ['groups','accnos']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 247 cmd_dict['remove.otus'] = dict({'required' : ['group','list','label'], 'optional' : ['groups','accnos']}) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 248 cmd_dict['remove.rare'] = dict({'required' : [['list','sabund','rabund','shared'],'nseqs'], 'optional' : ['group','groups','label','bygroup']}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 249 cmd_dict['parse.list'] = dict({'required' : ['list','group'], 'optional' : ['label']}) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 250 | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 251 cmd_dict['sub.sample'] = dict({'required' : [['fasta','list','sabund','rabund','shared']], 'optional' : ['name','group','groups','label','size','persample']}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 252 cmd_dict['consensus.seqs'] = dict({'required' : ['fasta'], 'optional' : ['list','name','label']}) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 253 cmd_dict['indicator'] = dict({'required' : ['tree',['shared','relabund']], 'optional' : ['groups','label','design']}) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 254 parser = optparse.OptionParser() | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 255 # Options for managing galaxy interaction | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 256 parser.add_option( '--debug', dest='debug', action='store_true', default=False, help='Turn on wrapper debugging to stdout' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 257 parser.add_option( '--cmd', dest='cmd', help='The mothur command' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 258 parser.add_option( '--inputdir', dest='inputdir', help='The directory in which to work' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 259 parser.add_option( '--outputdir', dest='outputdir', help='The directory in which to work' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 260 parser.add_option( '--tmpdir', dest='tmpdir', help='The directory in which to work' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 261 parser.add_option( '--tempdefault', dest='tempdefault', help='The default directory in which to search for input' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 262 parser.add_option( '--result', dest='result', help='The name pattern and destination for each output file' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 263 parser.add_option( '--new_file_path', dest='new_file_path', help='The Galaxy new_file_path, dir for extra output datasets' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 264 parser.add_option( '--datasetid', dest='datasetid', help='The Galaxy new_file_path, dir for extra output datasets' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 265 parser.add_option( '--new_datasets', dest='new_datasets', help='The name pattern and datatype ext for ouputs' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 266 # Options for prerequisite Read commands | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 267 parser.add_option( '--READ_cmd', dest='READ_cmd', help='The mothur command' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 268 # required arguments for Read.dist | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 269 parser.add_option( '--READ_phylip', dest='READ_phylip', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 270 parser.add_option( '--READ_column', dest='READ_column', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 271 # required arguments for Read.otu | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 272 parser.add_option( '--READ_rabund', dest='READ_rabund', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 273 parser.add_option( '--READ_sabund', dest='READ_sabund', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 274 parser.add_option( '--READ_list', dest='READ_list', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 275 parser.add_option( '--READ_shared', dest='READ_shared', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 276 parser.add_option( '--READ_relabund', dest='READ_relabund', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 277 # required arguments for Read.tree | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 278 parser.add_option( '--READ_tree', dest='READ_tree', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 279 # optional arguments for Read cmds | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 280 parser.add_option( '--READ_name', dest='READ_name', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 281 parser.add_option( '--READ_cutoff', dest='READ_cutoff', type="float", help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 282 parser.add_option( '--READ_hard', dest='READ_hard', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 283 parser.add_option( '--READ_precision', dest='READ_precision', type="int", help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 284 parser.add_option( '--READ_sim', dest='READ_sim', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 285 parser.add_option( '--READ_group', dest='READ_group', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 286 parser.add_option( '--READ_groups', dest='READ_groups', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 287 parser.add_option( '--READ_ordergroup', dest='READ_ordergroup', help='') | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 288 parser.add_option( '--READ_label', dest='READ_label', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 289 # Parameter specified in mothur | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 290 parser.add_option( '--numbases', dest='numbases', type="int", help='Number of base to allow' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 291 parser.add_option( '--fasta', dest='fasta', help='fasta file paths' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 292 parser.add_option( '--fastq', dest='fastq', help='fastq file paths' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 293 parser.add_option( '--qfile', dest='qfile', help='Sequence read quality file (454 platform)' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 294 parser.add_option( '--qaverage', dest='qaverage', type="int", help='Remove sequences that have an average quality below the value' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 295 parser.add_option( '--qthreshold', dest='qthreshold', type="int", help='If at any point a base call in a sequence has a quality score below the value provided to the option, the sequence is terminated' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 296 parser.add_option( '--qtrim', dest='qtrim', help='For sequence below qthreshold, false to scrap file, true to trimmed and in trim file' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 297 parser.add_option( '--flip', dest='flip', help='If true, reverse complement the sequences' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 298 parser.add_option( '--maxambig', dest='maxambig', type="int", help='Number of ambiguous base calls to allow' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 299 parser.add_option( '--maxhomop', dest='maxhomop', type="int", help='Maximun homopolymer length allowed' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 300 parser.add_option( '--minlength', dest='minlength', type="int", help='Minimun sequence length' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 301 parser.add_option( '--maxlength', dest='maxlength', type="int", help='Maximun sequence length' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 302 parser.add_option( '--oligos', dest='oligos', help='The oligos option takes a file that can contain the sequences of the forward and reverse primers and barcodes and their sample identifier.' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 303 parser.add_option( '--bdiffs', dest='bdiffs', type="int", help='Number of barcode differences to allow' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 304 parser.add_option( '--pdiffs', dest='pdiffs', type="int", help='Number of primer differences to allow' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 305 parser.add_option( '--tdiffs', dest='tdiffs', type="int", help='Total number of barcode and primer differences to allow' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 306 parser.add_option( '--diffs', dest='diffs', type="int", help='Number of mismatched bases to allow between sequences in a group' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 307 parser.add_option( '--allfiles', dest='allfiles', help='T - generate fasta and group for each barcode' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 308 parser.add_option( '--name', dest='name', help='A file containing a 2 column table: name, and comma separated list of represetatives' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 309 parser.add_option( '--accnos', dest='accnos', help='A file containing a list of names' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 310 parser.add_option( '--groups', dest='groups', help='pairwise group labels' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 311 parser.add_option( '--group', dest='group', help='A file containing a list of names' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 312 parser.add_option( '--list', dest='list', help='A file containing a list of names' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 313 parser.add_option( '--alignreport', dest='alignreport', help='A align.report file ' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 314 parser.add_option( '--taxonomy', dest='taxonomy', help='A Taxonomy file' ) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 315 parser.add_option( '--reftaxonomy', dest='reftaxonomy', help='A Taxonomy file' ) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 316 parser.add_option( '--taxon', dest='taxon', help='A Taxon' ) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 317 parser.add_option( '--taxlevel', dest='taxlevel', type="int", help='A Taxonomy level' ) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 318 # parser.add_option( '--taxon', dest='taxon', action="callback", callback=remove_confidence_callback, help='A Taxon' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 319 parser.add_option( '--candidate', dest='candidate', help=' file ' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 320 parser.add_option( '--template', dest='template', help=' file ' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 321 parser.add_option( '--dups', dest='dups', help='if True also apply to the aliases from the names files' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 322 parser.add_option( '--keep', dest='keep', help='Either front or back to specify the which end of the sequence to keep' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 323 parser.add_option( '--search', dest='search', help='Method for finding the template sequence: kmer, blast, suffix' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 324 parser.add_option( '--ksize', dest='ksize', type="int", help='Size of kmers (5 - 12)' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 325 parser.add_option( '--align', dest='align', help='Alignment method: needleman, blastn, gotoh' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 326 parser.add_option( '--match', dest='match', type="float", help='Reward for a match, default is +1.0' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 327 parser.add_option( '--mismatch', dest='mismatch', type="float", help='Penalty for a mismatch, default is -1.0' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 328 parser.add_option( '--gapopen', dest='gapopen', type="float", help='Penalty for a opening, default is -2.0' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 329 parser.add_option( '--gapextend', dest='gapextend', type="float", help='Penalty for extending a gap, default is -1.0' ) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 330 parser.add_option( '--precision', dest='precision', type="int", help='' ) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 331 parser.add_option( '--threshold', dest='threshold', type="float", help='Cutoff at which an alignment is deemed bad and the reverse complement may be tried, 0.0 - 1.0 default 0.50' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 332 parser.add_option( '--map', dest='map', help='File containing the secondary structure map.' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 333 parser.add_option( '--label', dest='label', type='string', action="callback", callback=multi_val_callback, help='Distance levels you would like a output files created for(separated by commas or dashes)' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 334 parser.add_option( '--filter', dest='filter', help='If true, a 50% soft filter will be applied' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 335 parser.add_option( '--correction', dest='correction', help='If true, square root of the distances is used instead of the distance value' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 336 parser.add_option( '--window', dest='window', type="int", help='Window size for searching for chimeras, default is 1/4 sequence length' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 337 parser.add_option( '--increment', dest='increment', type="int", help='How far you move each window while finding chimeric sequences, default is 25' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 338 parser.add_option( '--mask', dest='mask', help='A file containing one sequence you wish to use as a mask for the your sequences' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 339 parser.add_option( '--numwanted', dest='numwanted', type="int", help='How many sequences you would each query sequence compared with' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 340 parser.add_option( '--start', dest='start', type="int", help='Remove sequences that start after thisposition' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 341 parser.add_option( '--end', dest='end', type="int", help='Remove sequences that end before this position' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 342 parser.add_option( '--criteria', dest='criteria', type="int", help='Percentage of sequences to match' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 343 parser.add_option( '--optimize', dest='optimize', help='List of parameters to optimize' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 344 parser.add_option( '--vertical', dest='vertical', help='Ignore any column that only contains gap characters, "-" or "."' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 345 parser.add_option( '--trump', dest='trump', help='Remove a column if the trump character is found at that position in any sequence of the alignment.' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 346 parser.add_option( '--soft', dest='soft', type='int', help='Soft Mask - percentage required to retain column. (0-100)' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 347 parser.add_option( '--hard', dest='hard', help='Hard Column Filter - A file should only contain one line consisting of 0 and 1 chars' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 348 parser.add_option( '--calc', dest='calc', help='Calc Method - Gap Penality' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 349 parser.add_option( '--countends', dest='countends', help='Penalize terminal gaps' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 350 # parser.add_option( '--cutoff', dest='cutoff', type="float", help='Distance Cutoff threshold, discard larger distances' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 351 parser.add_option( '--cutoff', dest='cutoff', help='Distance Cutoff threshold, discard larger distances' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 352 parser.add_option( '--countgaps', dest='countgaps', help='count gaps as bases' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 353 parser.add_option( '--output', dest='output', help='Format for output' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 354 parser.add_option( '--method', dest='method', help='Method to use for analysis - cluster' ) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 355 parser.add_option( '--splitmethod', dest='splitmethod', help='Method to split a distance file - cluster.split' ) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 356 parser.add_option( '--abund', dest='abund', type='int', help='Threshold for rare to Abundant OTU classification' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 357 parser.add_option( '--size', dest='size', type='int', help='Size - sample size' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 358 parser.add_option( '--groupmode', dest='groupmode', help='Collate groups into one result table' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 359 parser.add_option( '--all', dest='all', help='Calculate for all' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 360 parser.add_option( '--freq', dest='freq', type="float", help='Frequency of sequences to choose, as fraction is 0.0 - 1.0 or iteration if int > 1' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 361 parser.add_option( '--iters', dest='iters', type='int', help='Iterations of randomizations' ) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 362 parser.add_option( '--maxiters', dest='maxiters', type='int', help='Iterations of randomizations' ) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 363 parser.add_option( '--jumble', dest='jumble', help='If false, just a collector curve across the samples' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 364 parser.add_option( '--conservation', dest='conservation', help='Template frequency information' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 365 parser.add_option( '--quantile', dest='quantile', help='Template quantile information' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 366 parser.add_option( '--parents', dest='parents', type='int', help='Number of Parents to investigate' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 367 parser.add_option( '--minsim', dest='minsim', type='int', help='Minimum simarity (0-100 percent)' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 368 parser.add_option( '--mincov', dest='mincov', type='int', help='Minimum coverage (0-100 percent)' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 369 parser.add_option( '--minbs', dest='minbs', type='int', help='Minimum bootstrap support (0-100 percent)' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 370 parser.add_option( '--minsnp', dest='minsnp', type='int', help='Minimum SNPs to sample(0-100 percent)' ) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 371 parser.add_option( '--mindim', dest='mindim', type='int', help='Minimum dimensions' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 372 parser.add_option( '--maxdim', dest='maxdim', type='int', help='Maximum dimensions' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 373 parser.add_option( '--percent', dest='percent', type='int', help='(0-100 percent)' ) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 374 parser.add_option( '--divergence', dest='divergence', type='float', help='Divergence cutoff for chimera determination' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 375 parser.add_option( '--sff', dest='sff', help='Sff file' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 376 parser.add_option( '--sfftxt', dest='sfftxt', help='Generate a sff.txt file' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 377 parser.add_option( '--flow', dest='flow', help='Generate a flowgram file' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 378 parser.add_option( '--trim', dest='trim', help='Whether sequences and quality scores are trimmed to the clipQualLeft and clipQualRight values' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 379 parser.add_option( '--input', dest='input', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 380 parser.add_option( '--phylip', dest='phylip', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 381 parser.add_option( '--column', dest='column', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 382 parser.add_option( '--sorted', dest='sorted', help='Input is presorted' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 383 parser.add_option( '--showabund', dest='showabund', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 384 parser.add_option( '--short', dest='short', help='Keep sequences that are too short to chop' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 385 parser.add_option( '--distance', dest='distance', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 386 parser.add_option( '--scale', dest='scale', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 387 parser.add_option( '--numotu', dest='numotu', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 388 parser.add_option( '--fontsize', dest='fontsize', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 389 parser.add_option( '--neqs', dest='neqs', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 390 parser.add_option( '--permute', dest='permute', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 391 parser.add_option( '--rarefy', dest='rarefy', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 392 parser.add_option( '--collect', dest='collect', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 393 parser.add_option( '--summary', dest='summary', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 394 parser.add_option( '--large', dest='large', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 395 parser.add_option( '--shuffle', dest='shuffle', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 396 parser.add_option( '--neighbor', dest='neighbor', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 397 parser.add_option( '--expblen', dest='expblen', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 398 parser.add_option( '--expdist', dest='expdist', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 399 parser.add_option( '--ntrees', dest='ntrees', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 400 parser.add_option( '--DNA', dest='DNA', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 401 parser.add_option( '--protein', dest='protein', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 402 parser.add_option( '--kimura', dest='kimura', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 403 parser.add_option( '--jukes', dest='jukes', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 404 parser.add_option( '--matrixout', dest='matrixout', help='' ) | 
| 1 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 405 parser.add_option( '--nseqs', dest='nseqs', help='' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 406 parser.add_option( '--bygroup', dest='bygroup', help='' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 407 parser.add_option( '--design', dest='design', help='' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 408 parser.add_option( '--sets', dest='sets', help='' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 409 parser.add_option( '--metric', dest='metric', help='' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 410 parser.add_option( '--epsilon', dest='epsilon', help='' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 411 parser.add_option( '--axes', dest='axes', help='table of name column followed by columns of axis values' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 412 parser.add_option( '--numaxes', dest='numaxes', help='the number of axes' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 413 parser.add_option( '--metadata', dest='metadata', help='data table with columns of floating-point values' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 414 parser.add_option( '--basis', dest='basis', help='what the summary file represents' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 415 parser.add_option( '--keepfirst', dest='keepfirst', help='trimming' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 416 parser.add_option( '--removelast', dest='removelast', help='trimming' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 417 parser.add_option( '--persample', dest='persample', help='sub sample option' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 418 parser.add_option( '--timing', dest='timing', help='timing option' ) | 
| 
fcc0778f6987
Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
 jjohnson parents: 
0diff
changeset | 419 parser.add_option( '--processors', dest='processors', type='int', action='callback', callback=processors_callback, help='Number of processors to use' ) | 
| 0 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 420 # include read.otu options | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 421 parser.add_option( '--rabund', dest='rabund', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 422 parser.add_option( '--sabund', dest='sabund', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 423 parser.add_option( '--shared', dest='shared', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 424 parser.add_option( '--relabund', dest='relabund', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 425 parser.add_option( '--ordergroup', dest='ordergroup', help='') | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 426 # include read.tree options | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 427 parser.add_option( '--tree', dest='tree', help='' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 428 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 429 (options, args) = parser.parse_args() | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 430 """ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 431 """ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 432 # print >> sys.stderr, options # so will appear as blurb for file | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 433 if options.debug != None: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 434 debug = options.debug | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 435 params = [] | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 436 inputdir = None | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 437 outputdir = None | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 438 tmp_dir = None | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 439 tempdefault = '' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 440 # Report exception if no command is given | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 441 if options.cmd == None: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 442 stop_err('No mothur command given') | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 443 # Read directory options | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 444 if options.tmpdir != None: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 445 if not os.path.isdir(options.tmpdir): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 446 os.makedirs(options.tmpdir) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 447 tmp_dir = options.tmpdir | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 448 else: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 449 tmp_dir = tempfile.mkdtemp() | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 450 if options.inputdir != None: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 451 if not os.path.isdir(options.inputdir): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 452 os.makedirs(options.inputdir) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 453 inputdir = options.inputdir | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 454 if options.outputdir != None: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 455 if not os.path.isdir(options.outputdir): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 456 os.makedirs(options.outputdir) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 457 try: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 458 outputdir = os.path.join(tmp_dir,'out') | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 459 os.symlink(options.outputdir,outputdir) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 460 except Exception, e: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 461 print >> sys.stderr, e | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 462 outputdir = options.outputdir | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 463 # Set directories | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 464 if inputdir == None or not os.path.isdir(inputdir): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 465 inputdir = tmp_dir | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 466 if outputdir == None or not os.path.isdir(outputdir): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 467 outputdir = tempfile.mkdtemp() | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 468 if options.tempdefault != None and os.path.isdir(options.tempdefault): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 469 tempdefault = ', tempdefault=%s' % options.tempdefault | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 470 # params.append('set.dir(input=%s,output=%s%s)' % (inputdir,outputdir,tempdefault)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 471 params.append('set.dir(output=%s%s)' % (outputdir,tempdefault)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 472 # Check for prerequisite read command | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 473 if options.READ_cmd != None: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 474 read_cmd_opts = ','.join(get_params(options.READ_cmd,options,inputdir,prefix='READ_')) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 475 params.append('%s(%s)' % (options.READ_cmd,read_cmd_opts)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 476 # Check for command options | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 477 cmd_opts = ','.join(get_params(options.cmd,options,inputdir)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 478 # print >> sys.stderr, cmd_opts | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 479 # print >> sys.stderr, params # so will appear as blurb for file | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 480 params.append('%s(%s)' % (options.cmd,cmd_opts)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 481 try: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 482 # Generate the mothur commandline | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 483 # http://www.mothur.org/wiki/Command_line_mode | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 484 cmdline = 'mothur "#' + '; '.join(params) + '"' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 485 # print >> sys.stdout, '%s' % cmdline | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 486 if tmp_dir == None or not os.path.isdir(tmp_dir): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 487 tmp_dir = tempfile.mkdtemp() | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 488 tmp_stderr_name = tempfile.NamedTemporaryFile( dir=tmp_dir,suffix='.err' ).name | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 489 tmp_stderr = open( tmp_stderr_name, 'wb' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 490 tmp_stdout_name = tempfile.NamedTemporaryFile( dir=tmp_dir,suffix='.out' ).name | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 491 tmp_stdout = open( tmp_stdout_name, 'wb' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 492 proc = subprocess.Popen( args=cmdline, shell=True, cwd=tmp_dir, stderr=tmp_stderr.fileno(), stdout=tmp_stdout.fileno() ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 493 # proc = subprocess.Popen( args=cmdline, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 494 returncode = proc.wait() | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 495 tmp_stderr.close() | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 496 # get stderr, allowing for case where it's very large | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 497 tmp_stderr = open( tmp_stderr_name, 'rb' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 498 stderr = '' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 499 buffsize = 1048576 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 500 try: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 501 while True: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 502 stderr += tmp_stderr.read( buffsize ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 503 if not stderr or len( stderr ) % buffsize != 0: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 504 break | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 505 except OverflowError: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 506 pass | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 507 tmp_stderr.close() | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 508 if returncode != 0: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 509 raise Exception, stderr | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 510 stdout = '' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 511 # Parse stdout to provide info | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 512 tmp_stdout.close() | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 513 tmp_stdout = open( tmp_stdout_name, 'rb' ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 514 info = '' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 515 if options.cmd.startswith('chimera') and not options.cmd.endswith('check'): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 516 pattern = '^.*$' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 517 if options.cmd == 'chimera.slayer': | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 518 # gi|11093931|MNE12|AF293003 yes | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 519 pattern = '\S.*\tyes$' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 520 elif options.cmd == 'chimera.bellerophon': | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 521 # gi|11093939|MNB2|AF293011 is a suspected chimera at breakpoint 2195 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 522 pattern = '\S.* suspected chimera .*' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 523 elif options.cmd == 'chimera.ccode': | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 524 # gi|11093940|MNF8|AF293012 was found have at least one chimeric window. | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 525 pattern = '\S.* chimeric window.*' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 526 elif options.cmd == 'chimera.pintail': | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 527 pattern = '\S.*chimera.*Yes' | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 528 # move new generated template .freq and .quan files to outputdir | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 529 chimera_count = 0 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 530 for line in tmp_stdout: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 531 if re.match(pattern,line): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 532 chimera_count += 1 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 533 info += "Chimeras: %d" % chimera_count | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 534 else: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 535 found_begin = False | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 536 for line in tmp_stdout: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 537 if line.find(outputdir) >= 0: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 538 continue | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 539 if re.match('^Processing.*',line): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 540 continue | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 541 if re.match('.*\.\.\.\s*$',line): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 542 continue | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 543 if re.match('^\d*\s*$',line): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 544 continue | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 545 if re.match('Output .*',line): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 546 break | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 547 if found_begin: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 548 info += "%s" % line | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 549 if re.match('mothur > ' + options.cmd + '\(.*\)', line): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 550 found_begin = True | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 551 tmp_stdout.close() | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 552 print >> sys.stdout, info | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 553 # Collect output files | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 554 flist = os.listdir(outputdir) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 555 if debug: print >> sys.stdout, '%s' % flist | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 556 # process option result first | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 557 # These are the known galaxy datasets listed in the --result= param | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 558 if len(flist) > 0 and options.result: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 559 # items in list are separated by commas | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 560 for output in options.result.split(','): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 561 # Each item has a regex pattern and a file path to a galaxy dataset | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 562 (pattern,path) = output.split(':') | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 563 if debug: print >> sys.stdout, '%s -> %s' % (pattern,path) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 564 if path == None or path == 'None': | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 565 continue | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 566 found = False | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 567 for fname in flist: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 568 if debug: print >> sys.stdout, 'outdir %s match: %s' % (fname,re.match(pattern,fname)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 569 if re.match(pattern,fname): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 570 found = True | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 571 flist.remove(fname) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 572 fpath = os.path.join(outputdir,fname) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 573 if fname.endswith('.logfile'): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 574 # Make the logfile into html | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 575 logfile_to_html(fpath,path,inputdir,outputdir,title="Mothur %s Logfile" % options.cmd) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 576 elif False and outputdir == options.outputdir: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 577 # Use a hard link if outputdir is the extra_files_path | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 578 try: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 579 os.link(fpath, path) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 580 except: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 581 shutil.copy2(fpath, path) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 582 else: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 583 shutil.copy2(fpath, path) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 584 break | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 585 # chimera.pintail e.g. generates files in the working dir that we might want to save | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 586 if not found: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 587 for fname in os.listdir(tmp_dir): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 588 if debug: print >> sys.stdout, 'tmpdir %s match: %s' % (fname,re.match(pattern,fname)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 589 if re.match(pattern,fname): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 590 fpath = os.path.join(tmp_dir,fname) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 591 shutil.copy2(fpath, path) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 592 break | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 593 # Handle the dynamically generated galaxy datasets | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 594 # http://bitbucket.org/galaxy/galaxy-central/wiki/ToolsMultipleOutput | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 595 # --new_datasets= specifies files to copy to the new_file_path | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 596 # The list items are separated by commas | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 597 # Each item conatins: a regex pattern for matching filenames and a galaxy datatype (separated by :) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 598 # The regex match.groups()[0] is used as the id name of the dataset, and must result in unique name for each output | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 599 if options.new_datasets != None and options.new_file_path != None and options.datasetid != None: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 600 datasets = options.new_datasets.split(',') | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 601 for output in options.new_datasets.split(','): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 602 (pattern,ext) = output.split(':'); | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 603 for fname in flist: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 604 m = re.match(pattern,fname) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 605 if m: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 606 fpath = os.path.join(outputdir,fname) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 607 if len(m.groups()) > 0: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 608 root = m.groups()[0] | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 609 else: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 610 # remove the ext from the name if it exists, galaxy will add back later | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 611 # remove underscores since galaxy uses that as a field separator for dynamic datasets | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 612 root = re.sub('\.?'+ext+'$','',fname).replace('_','').replace('.','') | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 613 # filename pattern required by galaxy | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 614 fn = "%s_%s_%s_%s_%s" % ( 'primary', options.datasetid, root, 'visible', ext ) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 615 if debug: print >> sys.stdout, '> %s' % fpath | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 616 if debug: print >> sys.stdout, '< %s' % os.path.join(options.new_file_path,fn) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 617 try: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 618 os.link(fpath, os.path.join(options.new_file_path,fn)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 619 except: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 620 shutil.copy2(fpath, os.path.join(options.new_file_path,fn)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 621 except Exception, e: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 622 msg = str(e) + stderr | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 623 """ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 624 if len(msg) < 50 and stdout != None: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 625 # include the last line of stdout | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 626 msg += stdout.splitlines()[-1] | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 627 """ | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 628 stop_err( 'Error running ' + msg) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 629 finally: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 630 # Only remove temporary directories | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 631 # Enclose in try block, so we don't report error on stale nfs handles | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 632 try: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 633 if outputdir != options.outputdir and os.path.exists(outputdir): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 634 if os.path.islink(outputdir): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 635 os.remove(outputdir) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 636 shutil.rmtree(os.path.dirname(outputdir)) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 637 else: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 638 shutil.rmtree(outputdir) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 639 if inputdir != options.inputdir and os.path.exists(inputdir): | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 640 shutil.rmtree(inputdir) | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 641 except: | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 642 pass | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 643 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 644 | 
| 
3202a38e44d9
Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
 jjohnson parents: diff
changeset | 645 if __name__ == "__main__": __main__() | 
