annotate mothur/tools/mothur/mothur_wrapper.py @ 13:4f797d3eee3a

Change default processor counts to 8, mothur_wrapper.py can overide processors allocated with ENVIRONMENT variable MOTHUR_MAX_PROCESSORS
author Jim Johnson <jj@umn.edu>
date Wed, 05 Oct 2011 10:34:44 -0500
parents 370b3fc4e7d3
children a6189f58fedb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
7
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
7 mothur v.1.20.0
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'
7
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
31 ## Before version 1.18.0 Many mothur commands first required data to be read into memory using: read.otu, read.dist, or read.tree
0
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
13
4f797d3eee3a Change default processor counts to 8, mothur_wrapper.py can overide processors allocated with ENVIRONMENT variable MOTHUR_MAX_PROCESSORS
Jim Johnson <jj@umn.edu>
parents: 12
diff changeset
49 max_processors = os.getenv('MOTHUR_MAX_PROCESSORS') if os.getenv('MOTHUR_MAX_PROCESSORS') else 8
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
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
57 # add extra file ouput
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
58 # add object tags for svg files
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
59 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
60 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
61 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
62 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
63 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
64 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
65 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
66 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
67 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
68 try:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
69 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
70 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
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.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
73 continue
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
74 elif line.startswith('Mothur\'s directories:') :
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
75 continue
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
76 elif line.startswith('outputDir=') :
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
77 continue
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
78 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
79 continue
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
80 elif line.find(tmp_output_dir_name) >= 0:
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
81 # if debug: print >> sys.stdout, 'logfile_to_html #%s#' % line
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
82 if line.strip().endswith('.svg'):
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
83 line = re.sub(out_pat,' <object id="object" type="image/svg+xml" data="\\1">\\1</object> <br><a href="\\1">\\1</a> <hr/>',line)
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
84 else:
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
85 line = re.sub(out_pat,'<a href="\\1">\\1</a>',line)
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
86 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
87 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
88 html.write(line)
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
89 except Exception, e:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
90 print(str(e))
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
91 pass
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
92 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
93 html.close()
1
fcc0778f6987 Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 0
diff changeset
94 #Overide the processors option
fcc0778f6987 Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 0
diff changeset
95 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: 0
diff changeset
96 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: 0
diff changeset
97 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
98 #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
99 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
100 # 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
101 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
102 #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
103 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
104 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
105 #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
106 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
107 """
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
108 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
109 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
110 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
111 """
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
112 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
113 vals = []
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
114 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
115 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
116 (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
117 try:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
118 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
119 except:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
120 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
121 vals.append(fname)
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
122 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
123 else:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
124 vals.append(val)
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
125 return '-'.join(vals)
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
126 return value
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
127 #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
128 # 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
129 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
130 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
131 params = []
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
132 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
133 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
134 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
135 missing = True
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
136 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
137 # 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
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+sel), 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 value != None:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
141 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
142 missing = False
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
143 except Exception, e:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
144 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
145 if missing:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
146 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
147 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
148 try:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
149 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
150 # 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
151 if value != None:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
152 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
153 else:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
154 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
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 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
157 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
158 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
159 # 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
160 try:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
161 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
162 # 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
163 if value != None:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
164 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
165 except Exception, e:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
166 # 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
167 # 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
168 pass
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
169 return params
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
170 """
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
171 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
172 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
173 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
174 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
175 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
176 """
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
177 cmd_dict = dict()
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
178 cmd_dict['align.check'] = dict({'required' : ['fasta','map']})
12
370b3fc4e7d3 Mothur galaxy tool updates for Mothur version 1.21.0, fix help section warnings
Jim Johnson <jj@umn.edu>
parents: 7
diff changeset
179 cmd_dict['align.seqs'] = dict({'required' : ['fasta','reference',], 'optional' : ['search','ksize','align','match','mismatch','gapopen','gapextend','flip','threshold','save','processors']})
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
180 cmd_dict['amova'] = dict({'required' : ['phylip','design'] , 'optional' : ['alpha','iters']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
181 cmd_dict['anosim'] = dict({'required' : ['phylip','design'] , 'optional' : ['alpha','iters']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
182 cmd_dict['bin.seqs'] = dict({'required' : ['list','fasta'], 'optional' : ['name','label','group']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
183 cmd_dict['bootstrap.shared'] = dict({'required' : ['shared'], 'optional' : ['calc','groups','iters','label']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
184 #catchall
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
185 cmd_dict['chimera.bellerophon'] = dict({'required' : ['fasta'], 'optional' : ['filter','correction','window','increment','processors']})
12
370b3fc4e7d3 Mothur galaxy tool updates for Mothur version 1.21.0, fix help section warnings
Jim Johnson <jj@umn.edu>
parents: 7
diff changeset
186 cmd_dict['chimera.ccode'] = dict({'required' : ['fasta','reference'], 'optional' : ['filter','mask','window','numwanted','save','processors']})
370b3fc4e7d3 Mothur galaxy tool updates for Mothur version 1.21.0, fix help section warnings
Jim Johnson <jj@umn.edu>
parents: 7
diff changeset
187 cmd_dict['chimera.check'] = dict({'required' : ['fasta','reference'], 'optional' : ['ksize','svg','name','increment','save','processors']})
370b3fc4e7d3 Mothur galaxy tool updates for Mothur version 1.21.0, fix help section warnings
Jim Johnson <jj@umn.edu>
parents: 7
diff changeset
188 cmd_dict['chimera.pintail'] = dict({'required' : ['fasta','reference'], 'optional' : ['conservation','quantile','filter','mask','window','increment','save','processors']})
370b3fc4e7d3 Mothur galaxy tool updates for Mothur version 1.21.0, fix help section warnings
Jim Johnson <jj@umn.edu>
parents: 7
diff changeset
189 cmd_dict['chimera.slayer'] = dict({'required' : ['fasta','reference'], 'optional' : ['name','search','window','increment','match','mismatch','numwanted','parents','minsim','mincov','iters','minbs','minsnp','divergence','realign','split','blastlocation','save','processors']})
7
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
190 cmd_dict['chimera.uchime'] = dict({'required' : ['fasta'], 'optional' : ['name','reference','abskew','chimealns','minh','mindiv','xn','dn','xa','chunks','minchunk','idsmoothwindow','minsmoothid','maxp','skipgaps','skipgaps2','minlen','maxlen','ucl','queryfract','processors']})
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
191 cmd_dict['chop.seqs'] = dict({'required' : ['fasta','numbases'], 'optional' : ['countgaps','keep','short']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
192 cmd_dict['classify.otu'] = dict({'required' : ['list','taxonomy'],'optional' : ['name','cutoff','label','group','probs','basis','reftaxonomy']})
12
370b3fc4e7d3 Mothur galaxy tool updates for Mothur version 1.21.0, fix help section warnings
Jim Johnson <jj@umn.edu>
parents: 7
diff changeset
193 cmd_dict['classify.seqs'] = dict({'required' : ['fasta','reference','taxonomy'],'optional' : ['name','search','ksize','method','match','mismatch','gapopen','gapextend','numwanted','probs','save','processors']})
370b3fc4e7d3 Mothur galaxy tool updates for Mothur version 1.21.0, fix help section warnings
Jim Johnson <jj@umn.edu>
parents: 7
diff changeset
194 #clear.memory ## not needed in galaxy framework
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
195 cmd_dict['clearcut'] = dict({'required' : [['phylip','fasta']],'optional' : ['seed','norandom','shuffle','neighbor','expblen','expdist','ntrees','matrixout','kimura','jukes','protein','DNA']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
196 cmd_dict['cluster'] = dict({'required' : [['phylip','column']] , 'optional' : ['name','method','cutoff','hard','precision','sim','showabund','timing']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
197 cmd_dict['cluster.classic'] = dict({'required' : ['phylip'] , 'optional' : ['name','method','cutoff','hard','sim','precision']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
198 cmd_dict['cluster.fragments'] = dict({'required' : ['fasta'] , 'optional' : ['name','diffs','percent']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
199 cmd_dict['cluster.split'] = dict({'required' : [['fasta','phylip','column']] , 'optional' : ['name','method','splitmethod','taxonomy','taxlevel','showabund','cutoff','hard','large','precision','timing','processors']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
200 cmd_dict['collect.shared'] = dict({'required' : ['shared'], 'optional' : ['calc','label','freq','groups','all']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
201 cmd_dict['collect.single'] = dict({'required' : [['list', 'sabund', 'rabund', 'shared']], 'optional' : ['calc','abund','size','label','freq']})
7
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
202 cmd_dict['consensus.seqs'] = dict({'required' : ['fasta'], 'optional' : ['list','name','label','cutoff']})
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
203 cmd_dict['corr.axes'] = dict({'required' : [['shared','relabund','metadata'],'axes'], 'optional' : ['label','groups','method','numaxes']})
7
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
204 cmd_dict['count.seqs'] = dict({'required' : ['name'], 'optional' : ['group','groups']})
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
205 cmd_dict['degap.seqs'] = dict({'required' : ['fasta']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
206 cmd_dict['deunique.seqs'] = dict({'required' : ['fasta','name'], 'optional' : []})
7
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
207 cmd_dict['deunique.tree'] = dict({'required' : ['tree','name'], 'optional' : []})
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
208 cmd_dict['dist.seqs'] = dict({'required' : ['fasta'], 'optional' : ['calc','countends','output','cutoff','oldfasta','column','processors']})
7
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
209 cmd_dict['dist.shared'] = dict({'required' : ['shared'], 'optional' : ['calc','label','groups','output','processors']})
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
210 cmd_dict['fastq.info'] = dict({'required' : ['fastq'], 'optional' : []})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
211 cmd_dict['filter.seqs'] = dict({'required' : ['fasta'], 'optional' : ['vertical','trump','soft','hard','processors']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
212 cmd_dict['get.group'] = dict({'required' : ['shared'], 'optional' : []})
12
370b3fc4e7d3 Mothur galaxy tool updates for Mothur version 1.21.0, fix help section warnings
Jim Johnson <jj@umn.edu>
parents: 7
diff changeset
213 cmd_dict['get.groups'] = dict({'required' : ['group'], 'optional' : ['groups','accnos','fasta','name','list','shared','taxonomy']})
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
214 cmd_dict['get.lineage'] = dict({'required' : ['taxonomy','taxon'],'optional' : ['fasta','name','group','list','alignreport','dups']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
215 cmd_dict['get.otulist'] = dict({'required' : ['list'], 'optional' : ['label','sort']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
216 cmd_dict['get.oturep'] = dict({'required' : ['fasta','list',['phylip','column']], 'optional' : ['name','label','group','groups','sorted','precision','cutoff','large','weighted']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
217 cmd_dict['get.otus'] = dict({'required' : ['group','list','label'], 'optional' : ['groups','accnos']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
218 cmd_dict['get.rabund'] = dict({'required' : [['list','sabund']],'optional' : ['sorted','label']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
219 cmd_dict['get.relabund'] = dict({'required' : ['shared'],'optional' : ['scale','label','groups']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
220 cmd_dict['get.sabund'] = dict({'required' : [['list','rabund']],'optional' : ['label']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
221 cmd_dict['get.seqs'] = dict({'required' : ['accnos',['fasta','qfile','name','group','list','alignreport','taxonomy']], 'optional' : ['dups']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
222 cmd_dict['get.sharedseqs'] = dict({'required' : ['list','group'], 'optional' : ['label', 'unique', 'shared', 'output', 'fasta']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
223 cmd_dict['hcluster'] = dict({'required' : [['column','phylip']] , 'optional' : ['name','method','cutoff','hard','precision','sorted','showabund','timing']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
224 cmd_dict['heatmap.bin'] = dict({'required' : [['list', 'sabund', 'rabund', 'shared']], 'optional' : ['label','groups','scale','sorted','numotu','fontsize']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
225 cmd_dict['heatmap.sim'] = dict({'required' : [['shared','phylip','column']], 'optional' : ['calc','name','label','groups']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
226 cmd_dict['homova'] = dict({'required' : ['phylip','design'] , 'optional' : ['alpha','iters']})
13
4f797d3eee3a Change default processor counts to 8, mothur_wrapper.py can overide processors allocated with ENVIRONMENT variable MOTHUR_MAX_PROCESSORS
Jim Johnson <jj@umn.edu>
parents: 12
diff changeset
227 cmd_dict['indicator'] = dict({'required' : [['tree','design'],['shared','relabund']], 'optional' : ['groups','label','processors']})
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
228 cmd_dict['libshuff'] = dict({'required' : ['phylip','group'],'optional' : ['groups','iters','form','sim','step','cutoff']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
229 cmd_dict['list.seqs'] = dict({'required' : [['fasta','name','group','list','alignreport','taxonomy']]})
13
4f797d3eee3a Change default processor counts to 8, mothur_wrapper.py can overide processors allocated with ENVIRONMENT variable MOTHUR_MAX_PROCESSORS
Jim Johnson <jj@umn.edu>
parents: 12
diff changeset
230 cmd_dict['make.fastq'] = dict({'required' : ['fasta','qfile'] , 'optional' : []})
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
231 cmd_dict['make.group'] = dict({'required' : ['fasta','groups'], 'optional' : []})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
232 cmd_dict['make.shared'] = dict({'required' : ['list','group'], 'optional' : ['label','groups','ordergroup']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
233 cmd_dict['mantel'] = dict({'required' : ['phylip','phylip2'] , 'optional' : ['method','iters']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
234 cmd_dict['merge.files'] = dict({'required' : ['input','output']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
235 cmd_dict['merge.groups'] = dict({'required' : ['shared','design'], 'optional' : ['groups', 'label']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
236 cmd_dict['metastats'] = dict({'required' : ['shared','design'], 'optional' : ['groups', 'label','iters','threshold','sets','processors']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
237 cmd_dict['nmds'] = dict({'required' : ['phylip'], 'optional' : ['axes','mindim','maxdim','iters','maxiters','epsilon']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
238 cmd_dict['normalize.shared'] = dict({'required' : [['shared','relabund']], 'optional' : ['label','method','norm','groups','makerelabund']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
239 cmd_dict['otu.hierarchy'] = dict({'required' : ['list','label'], 'optional' : ['output']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
240 cmd_dict['pairwise.seqs'] = dict({'required' : ['fasta'], 'optional' : ['align','calc','countends','output','cutoff','match','mismatch','gapopen','gapextend','processors']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
241 cmd_dict['parse.list'] = dict({'required' : ['list','group'], 'optional' : ['label']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
242 cmd_dict['parsimony'] = dict({'required' : ['tree'], 'optional' : ['group','groups','name','iters','random','processors']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
243 cmd_dict['pca'] = dict({'required' : [['shared','relabund']], 'optional' : ['label','groups','metric']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
244 cmd_dict['pcoa'] = dict({'required' : ['phylip'], 'optional' : ['metric']})
7
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
245 cmd_dict['phylo.diversity'] = dict({'required' : ['tree'],'optional' : ['group','name','groups','iters','freq','scale','rarefy','collect','summary','processors']})
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
246 cmd_dict['phylotype'] = dict({'required' : ['taxonomy'],'optional' : ['name','cutoff','label']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
247 cmd_dict['pre.cluster'] = dict({'required' : ['fasta'], 'optional' : ['name','diffs']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
248 cmd_dict['rarefaction.shared'] = dict({'required' : ['shared'], 'optional' : ['calc','label','iters','groups','jumble']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
249 cmd_dict['rarefaction.single'] = dict({'required' : [['list', 'sabund', 'rabund', 'shared']], 'optional' : ['calc','abund','iters','label','freq','processors']})
12
370b3fc4e7d3 Mothur galaxy tool updates for Mothur version 1.21.0, fix help section warnings
Jim Johnson <jj@umn.edu>
parents: 7
diff changeset
250 cmd_dict['remove.groups'] = dict({'required' : ['group'], 'optional' : ['groups','accnos','fasta','name','list','shared','taxonomy']})
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
251 cmd_dict['remove.lineage'] = dict({'required' : ['taxonomy','taxon'],'optional' : ['fasta','name','group','list','alignreport','dups']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
252 cmd_dict['remove.otus'] = dict({'required' : ['group','list','label'], 'optional' : ['groups','accnos']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
253 cmd_dict['remove.rare'] = dict({'required' : [['list','sabund','rabund','shared'],'nseqs'], 'optional' : ['group','groups','label','bygroup']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
254 cmd_dict['remove.seqs'] = dict({'required' : ['accnos',['fasta','qfile','name','group','list','alignreport','taxonomy']], 'optional' : ['dups']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
255 cmd_dict['reverse.seqs'] = dict({'required' : ['fasta']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
256 cmd_dict['screen.seqs'] = dict({'required' : ['fasta'], 'optional' : ['start','end','maxambig','maxhomop','minlength','maxlength','criteria','optimize','name','group','alignreport','processors']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
257 cmd_dict['sens.spec'] = dict({'required' : ['list',['column','phylip']] , 'optional' : ['label','cutoff','hard','precision']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
258 cmd_dict['sffinfo'] = dict({'required' : [['sff','sfftxt']], 'optional' : ['fasta','qfile','trim','sfftxt','flow','accnos']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
259 cmd_dict['split.abund'] = dict({'required' : ['fasta',['name','list']], 'optional' : ['cutoff','group','groups','label','accnos']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
260 cmd_dict['split.groups'] = dict({'required' : ['fasta','group'], 'optional' : ['name','groups']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
261 cmd_dict['sub.sample'] = dict({'required' : [['fasta','list','sabund','rabund','shared']], 'optional' : ['name','group','groups','label','size','persample']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
262 cmd_dict['summary.seqs'] = dict({'required' : ['fasta'], 'optional' : ['name','processors']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
263 cmd_dict['summary.shared'] = dict({'required' : ['shared'], 'optional' : ['calc','label','groups','all','distance','processors']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
264 cmd_dict['summary.single'] = dict({'required' : [['list','sabund','rabund','shared']], 'optional' : ['calc','abund','size','label','groupmode']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
265 cmd_dict['tree.shared'] = dict({'required' : [['shared','phylip','column']], 'optional' : ['name','groups','calc','cutoff','precision','label']})
13
4f797d3eee3a Change default processor counts to 8, mothur_wrapper.py can overide processors allocated with ENVIRONMENT variable MOTHUR_MAX_PROCESSORS
Jim Johnson <jj@umn.edu>
parents: 12
diff changeset
266 cmd_dict['trim.seqs'] = dict({'required' : ['fasta'], 'optional' : ['name','group','oligos','qfile','qaverage','qthreshold','qwindowaverage','qwindowsize','rollaverage','qstepsize','qtrim','flip','maxambig','maxhomop','minlength','maxlength','bdiffs','pdiffs','tdiffs','allfiles','keepfirst','removelast','processors']})
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
267 cmd_dict['unifrac.unweighted'] = dict({'required' : ['tree'], 'optional' : ['name','group','groups','iters','distance','random','root','processors']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
268 cmd_dict['unifrac.weighted'] = dict({'required' : ['tree'], 'optional' : ['name','group','groups','iters','distance','random','root','processors']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
269 cmd_dict['unique.seqs'] = dict({'required' : ['fasta'], 'optional' : ['name']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
270 cmd_dict['venn'] = dict({'required' : [['list','shared']], 'optional' : ['calc','label','groups','abund','nseqs','permute']})
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
271
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
272 parser = optparse.OptionParser()
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
273 # 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
274 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
275 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
276 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
277 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
278 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
279 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
280 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
281 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
282 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
283 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
284 # 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
285 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
286 # 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
287 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
288 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
289 # 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
290 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
291 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
292 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
293 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
294 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
295 # 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
296 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
297 # 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
298 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
299 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
300 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
301 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
302 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
303 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
304 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
305 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
306 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
307 # 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
308 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
309 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
310 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
311 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
312 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
313 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' )
5
e2e2071d2c62 Add missing qual params to trim.seqs
jj@dbw-galaxy-dev.msi.umn.edu
parents: 2
diff changeset
314 parser.add_option( '--qwindowaverage', dest='qwindowaverage', type="int", help='Remove sequences that have a window average quality below the value' )
e2e2071d2c62 Add missing qual params to trim.seqs
jj@dbw-galaxy-dev.msi.umn.edu
parents: 2
diff changeset
315 parser.add_option( '--qwindowsize', dest='qwindowsize', type="int", help='WIndow size for qwindowaverage' )
e2e2071d2c62 Add missing qual params to trim.seqs
jj@dbw-galaxy-dev.msi.umn.edu
parents: 2
diff changeset
316 parser.add_option( '--rollaverage', dest='rollaverage', type="int", help='Remove sequences that have a average quality below the value in a rolling window' )
e2e2071d2c62 Add missing qual params to trim.seqs
jj@dbw-galaxy-dev.msi.umn.edu
parents: 2
diff changeset
317 parser.add_option( '--qstepsize', dest='qstepsize', type="int", help='Distance to move a rolling window for each step' )
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( '--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
319 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
320 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
321 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
322 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
323 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
324 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
325 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
326 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
327 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
328 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
329 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
330 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
331 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
332 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
333 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
334 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
335 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
336 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: 0
diff changeset
337 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
338 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: 0
diff changeset
339 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
340 # 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
341 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
342 parser.add_option( '--template', dest='template', help=' file ' )
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
343 parser.add_option( '--reference', dest='reference', help=' file ' )
0
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( '--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
345 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
346 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
347 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
348 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
349 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
350 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
351 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
352 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: 0
diff changeset
353 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
354 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' )
7
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
355 parser.add_option( '--sim', dest='sim', help='Calculate similarity rather than distance' )
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( '--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
357 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
358 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
359 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
360 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
361 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
362 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
363 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
364 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
365 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
366 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
367 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
368 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
369 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
370 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
371 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
372 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
373 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
374 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
375 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
376 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
377 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: 0
diff changeset
378 parser.add_option( '--splitmethod', dest='splitmethod', help='Method to split a distance file - cluster.split' )
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
379 parser.add_option( '--split', dest='split', help='Chimera split parameter, whether to detect trimeras and quadmeras' )
0
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( '--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
381 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
382 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
383 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
384 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
385 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: 0
diff changeset
386 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
387 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
388 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
389 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
390 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
391 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
392 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
393 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
394 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: 0
diff changeset
395 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: 0
diff changeset
396 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: 0
diff changeset
397 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
398 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
399 parser.add_option( '--sff', dest='sff', help='Sff file' )
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
400 parser.add_option( '--svg', dest='svg', help='SVG' )
0
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( '--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
402 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
403 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
404 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
405 parser.add_option( '--phylip', dest='phylip', help='' )
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
406 parser.add_option( '--phylip2', dest='phylip2', help='' )
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
407 parser.add_option( '--column', dest='column', help='' )
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
408 parser.add_option( '--sort', dest='sort', help='specify sort order' )
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
409 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
410 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
411 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
412 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
413 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
414 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
415 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
416 parser.add_option( '--neqs', dest='neqs', help='' )
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
417 parser.add_option( '--random', dest='random', help='' )
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
418 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
419 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
420 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
421 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
422 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
423 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
424 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
425 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
426 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
427 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
428 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
429 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
430 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
431 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
432 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: 0
diff changeset
433 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: 0
diff changeset
434 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: 0
diff changeset
435 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: 0
diff changeset
436 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: 0
diff changeset
437 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: 0
diff changeset
438 parser.add_option( '--epsilon', dest='epsilon', help='' )
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
439 parser.add_option( '--alpha', dest='alpha', help='' )
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
440 parser.add_option( '--root', dest='root', help='' )
1
fcc0778f6987 Migrated tool version 1.16.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 0
diff changeset
441 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: 0
diff changeset
442 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: 0
diff changeset
443 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: 0
diff changeset
444 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: 0
diff changeset
445 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: 0
diff changeset
446 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: 0
diff changeset
447 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: 0
diff changeset
448 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: 0
diff changeset
449 parser.add_option( '--processors', dest='processors', type='int', action='callback', callback=processors_callback, help='Number of processors to use' )
7
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
450 parser.add_option( '--abskew', dest='abskew', type="float", help='Minimum abundance skew.')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
451 parser.add_option( '--chimealns', dest='chimealns', help='Boolean - produce a file containing multiple alignments of query sequences')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
452 parser.add_option( '--minh', dest='minh', type="float", help='mininum score to report chimera.')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
453 parser.add_option( '--mindiv', dest='mindiv', type="float", help='mininum score to report chimera.')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
454 parser.add_option( '--xn', dest='xn', type="float", help='weight of a no vote')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
455 parser.add_option( '--dn', dest='dn', type="float", help='pseudo-count prior on number of no votes')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
456 parser.add_option( '--xa', dest='xa', type="float", help='weight of an abstain vote')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
457 parser.add_option( '--chunks', dest='chunks', type="int", help='the number of chunks to extract from the query sequence')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
458 parser.add_option( '--minchunk', dest='minchunk', type="int", help='the minimum length of a chunk')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
459 parser.add_option( '--idsmoothwindow', dest='idsmoothwindow', type="int", help='ength of id smoothing window')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
460 parser.add_option( '--minsmoothid', dest='minsmoothid', type="float", help='minimum factional identity over smoothed window')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
461 parser.add_option( '--maxp', dest='maxp', type="int", help='maximum number of candidate parents to consider')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
462 parser.add_option( '--skipgaps', dest='skipgaps', help='Boolean')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
463 parser.add_option( '--skipgaps2', dest='skipgaps2', help='Boolean')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
464 parser.add_option( '--ucl', dest='ucl', help='')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
465 parser.add_option( '--queryfract', dest='queryfract', type="float", help='')
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
466 parser.add_option( '--minlen', dest='minlen', type="int", help='Minimun sequence length' )
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
467 parser.add_option( '--maxlen', dest='maxlen', type="int", help='Maximun sequence length' )
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
468 # 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
469 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
470 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
471 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
472 parser.add_option( '--relabund', dest='relabund', help='' )
12
370b3fc4e7d3 Mothur galaxy tool updates for Mothur version 1.21.0, fix help section warnings
Jim Johnson <jj@umn.edu>
parents: 7
diff changeset
473 parser.add_option( '--makerelabund', dest='makerelabund', help='Whether to convert to a relabund file' )
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
474 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
475 # 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
476 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
477
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
478 (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
479 """
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
480 """
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
481 # 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
482 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
483 debug = options.debug
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
484 params = []
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
485 inputdir = None
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
486 outputdir = None
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
487 tmp_dir = None
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
488 tempdefault = ''
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
489 # 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
490 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
491 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
492 # Read directory options
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
493 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
494 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
495 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
496 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
497 else:
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
498 if options.outputdir != None:
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
499 if not os.path.isdir(options.outputdir):
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
500 os.makedirs(options.outputdir)
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
501 tmp_dir = os.path.join(options.outputdir,'tmp')
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
502 if not os.path.isdir(tmp_dir):
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
503 os.makedirs(tmp_dir)
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
504 else:
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
505 tmp_dir = tempfile.mkdtemp()
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
506 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
507 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
508 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
509 inputdir = options.inputdir
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
510 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
511 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
512 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
513 try:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
514 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
515 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
516 except Exception, e:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
517 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
518 outputdir = options.outputdir
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
519 # Set directories
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
520 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
521 inputdir = tmp_dir
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
522 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
523 outputdir = tempfile.mkdtemp()
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
524 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
525 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
526 # 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
527 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
528 # 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
529 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
530 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
531 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
532 # 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
533 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
534 # 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
535 # 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
536 params.append('%s(%s)' % (options.cmd,cmd_opts))
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
537 if debug: params.append('get.current()')
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
538 try:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
539 # 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
540 # 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
541 cmdline = 'mothur "#' + '; '.join(params) + '"'
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
542 if debug: print >> sys.stdout, '%s' % cmdline
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
543 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
544 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
545 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
546 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
547 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
548 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
549 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
550 # 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
551 returncode = proc.wait()
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
552 if debug: print >> sys.stdout, 'returncode %d' % returncode
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
553 tmp_stderr.close()
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
554 # 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
555 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
556 stderr = ''
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
557 buffsize = 1048576
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
558 try:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
559 while True:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
560 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
561 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
562 break
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
563 except OverflowError:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
564 pass
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
565 tmp_stderr.close()
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
566 tmp_stdout.close()
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
567 if debug: print >> sys.stdout, 'parse %s' % tmp_stdout_name
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
568 if returncode != 0:
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
569 try:
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
570 # try to copy stdout to the logfile
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
571 for output in options.result.split(','):
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
572 # Each item has a regex pattern and a file path to a galaxy dataset
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
573 (pattern,path) = output.split(':')
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
574 if debug: print >> sys.stdout, '%s -> %s' % (pattern,path)
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
575 if pattern.find('\.logfile') > 0:
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
576 if path != None and os.path.exists(path):
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
577 logfile_to_html(tmp_stdout_name,path,inputdir,outputdir,title="Mothur %s Error Logfile" % options.cmd)
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
578 break
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
579 except:
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
580 pass
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
581 raise Exception, stderr
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
582 stdout = ''
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
583 # 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
584 tmp_stdout = open( tmp_stdout_name, 'rb' )
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
585 # try to find a "little" something interesting to print as info for the galaxy interface
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
586 info = ''
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
587 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
588 pattern = '^.*$'
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
589 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
590 # 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
591 pattern = '\S.*\tyes$'
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
592 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
593 # 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
594 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
595 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
596 # 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
597 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
598 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
599 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
600 # 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
601 chimera_count = 0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
602 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
603 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
604 chimera_count += 1
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
605 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
606 else:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
607 found_begin = False
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
608 info_chars = 0
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
609 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
610 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
611 continue
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
612 if line.startswith('**************'):
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
613 continue
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
614 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
615 continue
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
616 if re.match('^Reading .*',line):
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
617 continue
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
618 if re.match('^Merging .*',line):
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
619 continue
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
620 if re.match('^DONE.*',line):
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
621 continue
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
622 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
623 continue
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
624 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
625 continue
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
626 # if re.match('^(unique|[0-9.]*)(\t\d+)+',line): # abundance from cluster commands
7
7bfe1f843858 Support Mothur v1.20
Jim Johnson <jj@umn.edu>
parents: 5
diff changeset
627 if not options.cmd.startswith('unifrac') and re.match('^(unique|[0-9.]+)(\t\d+)*',line): # abundance from cluster commands, allow unique line into info
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
628 continue
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
629 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
630 break
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
631 if found_begin and info_chars < 200:
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
632 info += "%s" % line
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
633 info_chars += len(line)
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
634 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
635 found_begin = True
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
636 tmp_stdout.close()
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
637 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
638 # Collect output files
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
639 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
640 if debug: print >> sys.stdout, '%s' % flist
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
641 # chimera.check can generate svg files, but they are not listed in the mothur.*.logfile, so we'll added them in here
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
642 if options.cmd == 'chimera.check':
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
643 svgs = []
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
644 mothurlog = None
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
645 for fname in flist:
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
646 if fname.endswith('.svg'):
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
647 svgs.append(fname)
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
648 elif fname.endswith('.logfile'):
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
649 mothurlog = fname
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
650 # 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
651 # 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
652 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
653 # 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
654 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
655 # 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
656 (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
657 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
658 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
659 continue
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
660 found = False
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
661 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
662 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
663 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
664 found = True
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
665 flist.remove(fname)
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
666 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
667 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
668 # 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
669 logfile_to_html(fpath,path,inputdir,outputdir,title="Mothur %s Logfile" % options.cmd)
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
670 elif outputdir == options.outputdir:
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
671 # Use a hard link if outputdir is the extra_files_path, allows link from mothur logfile without copying data.
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
672 try:
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
673 if debug: print >> sys.stdout, 'link %s %s' % (fpath, path)
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
674 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
675 except:
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
676 if debug: print >> sys.stdout, 'copy %s %s' % (fpath, path)
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
677 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
678 else:
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
679 if debug: print >> sys.stdout, 'copy2 %s %s' % (fpath, path)
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
680 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
681 break
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
682 # mothur.*.logfile may be in tmp_dir
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
683 # 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
684 if not found:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
685 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
686 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
687 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
688 fpath = os.path.join(tmp_dir,fname)
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
689 if fname.endswith('.logfile'):
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
690 # Make the logfile into html
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
691 logfile_to_html(fpath,path,inputdir,outputdir,title="Mothur %s Logfile" % options.cmd)
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
692 else:
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
693 shutil.copy2(fpath, path)
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
694 break
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
695 # 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
696 # 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
697 # --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
698 # 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
699 # 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
700 # 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
701 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
702 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
703 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
704 (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
705 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
706 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
707 if m:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
708 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
709 if len(m.groups()) > 0:
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
710 # remove underscores since galaxy uses that as a field separator for dynamic datasets
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
711 root = m.groups()[0].replace('_','')
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
712 else:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
713 # 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
714 # 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
715 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
716 # 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
717 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
718 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
719 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
720 try:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
721 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
722 except:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
723 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
724 except Exception, e:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
725 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
726 """
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
727 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
728 # 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
729 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
730 """
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
731 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
732 finally:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
733 # 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
734 # 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
735 try:
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
736 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
737 if os.path.islink(outputdir):
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
738 if debug: print >> sys.stdout, 'rm outputdir %s' % outputdir
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
739 os.remove(outputdir)
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
740 if debug: print >> sys.stdout, 'rmtree outputdir %s' % outputdir
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
741 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
742 else:
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
743 if debug: print >> sys.stdout, 'rmtree %s' % outputdir
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
744 shutil.rmtree(outputdir)
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
745 if inputdir != options.inputdir and os.path.exists(inputdir):
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
746 if debug: print >> sys.stdout, 'rmtree %s' % inputdir
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
747 shutil.rmtree(inputdir)
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
748 except:
2
e990ac8a0f58 Migrated tool version 1.19.0 from old tool shed archive to new tool shed repository
jjohnson
parents: 1
diff changeset
749 if debug: print >> sys.stdout, 'rmtree failed'
0
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
750 pass
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
751
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
752
3202a38e44d9 Migrated tool version 1.15.1 from old tool shed archive to new tool shed repository
jjohnson
parents:
diff changeset
753 if __name__ == "__main__": __main__()