Mercurial > repos > jjohnson > spectrast
comparison spectrast_params.py @ 5:274fdc50169b draft default tip
planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/spectrast commit e5b5b15b0a995c8588ff62f92fd0a2329fb7a6a5-dirty
| author | jjohnson |
|---|---|
| date | Wed, 25 Jul 2018 15:05:34 -0400 |
| parents | c9bfe6adb7cd |
| children |
comparison
equal
deleted
inserted
replaced
| 4:c9bfe6adb7cd | 5:274fdc50169b |
|---|---|
| 201 ' to create an updated search.params') | 201 ' to create an updated search.params') |
| 202 parser.add_argument( | 202 parser.add_argument( |
| 203 'param_files', nargs='*', | 203 'param_files', nargs='*', |
| 204 help='A SpectraST search.params files') | 204 help='A SpectraST search.params files') |
| 205 parser.add_argument( | 205 parser.add_argument( |
| 206 '-m', '--mode', choices=['search','create','filter'], | 206 '-m', '--mode', choices=['search', 'create', 'filter'], |
| 207 help='') | 207 help='') |
| 208 parser.add_argument( | 208 parser.add_argument( |
| 209 '-o', '--output', | 209 '-o', '--output', |
| 210 help='Output file (-) for stdout') | 210 help='Output file (-) for stdout') |
| 211 args = parser.parse_args() | 211 args = parser.parse_args() |
| 213 output_wtr = open(args.output, 'w')\ | 213 output_wtr = open(args.output, 'w')\ |
| 214 if args.output and args.output != '-' else sys.stdout | 214 if args.output and args.output != '-' else sys.stdout |
| 215 | 215 |
| 216 optpat = re.compile('^([a-z]\w+)\s*[=:]\s*([^=]+)$') | 216 optpat = re.compile('^([a-z]\w+)\s*[=:]\s*([^=]+)$') |
| 217 | 217 |
| 218 valid_opts = search_opts if args.mode == 'search' else create_opts if args.mode == 'create' else filter_opts | 218 valid_opts = search_opts if args.mode == 'search'\ |
| 219 else create_opts if args.mode == 'create' else filter_opts | |
| 219 valid_params = dict() | 220 valid_params = dict() |
| 220 | 221 |
| 221 # Collect all valid_params | 222 # Collect all valid_params |
| 222 def parse_params(param_file, fh, valid_opts): | 223 def parse_params(param_file, fh, valid_opts): |
| 223 for i, line in enumerate(fh): | 224 for i, line in enumerate(fh): |
| 245 print('parse_params: %s' % e, file=sys.stderr) | 246 print('parse_params: %s' % e, file=sys.stderr) |
| 246 | 247 |
| 247 # Write valid_params | 248 # Write valid_params |
| 248 for valid_opt in valid_opts: | 249 for valid_opt in valid_opts: |
| 249 if valid_opt in valid_params: | 250 if valid_opt in valid_params: |
| 250 print('%s = %s' % (valid_opt, valid_params[valid_opt]), file=output_wtr) | 251 print('%s = %s' % (valid_opt, valid_params[valid_opt]), |
| 252 file=output_wtr) | |
| 251 | 253 |
| 252 | 254 |
| 253 if __name__ == "__main__": | 255 if __name__ == "__main__": |
| 254 __main__() | 256 __main__() |
| 255 |
