comparison hardklor.py @ 6:73fc27617b2e draft default tip

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tools/hardklor commit 44c3e37a12f60b01521d3e3f18b7f16664f954cc"
author galaxyp
date Tue, 07 Apr 2020 03:27:32 -0400
parents d796e6613d19
children
comparison
equal deleted inserted replaced
5:c5b3b7eafd46 6:73fc27617b2e
8 import subprocess 8 import subprocess
9 9
10 10
11 CONFIG_FILE = 'hk.conf' 11 CONFIG_FILE = 'hk.conf'
12 extension_lookup = { 12 extension_lookup = {
13 'mzml' : 'mzML', 13 'mzml': 'mzML',
14 'mzxml' : 'mzXML', 14 'mzxml': 'mzXML',
15 'ms1' : 'MS1', 15 'ms1': 'MS1',
16 } 16 }
17 17
18 # input: 18 # input:
19 ms1_ext = sys.argv[1] 19 ms1_ext = sys.argv[1]
20 ms1_file = sys.argv[2] 20 ms1_file = sys.argv[2]
21 output_file = sys.argv[3] 21 output_file = sys.argv[3]
31 # create softlinks since hardklor needs "proper" extensions for input files 31 # create softlinks since hardklor needs "proper" extensions for input files
32 if ms1_ext in extension_lookup: 32 if ms1_ext in extension_lookup:
33 ms1_ext = extension_lookup[ms1_ext] 33 ms1_ext = extension_lookup[ms1_ext]
34 linkname = 'ms1_dsetlink.{0}'.format(ms1_ext) 34 linkname = 'ms1_dsetlink.{0}'.format(ms1_ext)
35 os.symlink(ms1_file, linkname) 35 os.symlink(ms1_file, linkname)
36 ms1_file = linkname 36 ms1_file = linkname
37 37
38 # load template and dump to config file 38 # load template and dump to config file
39 with open(config_load) as fp: 39 with open(config_load) as fp:
40 config_str = fp.read() 40 config_str = fp.read()
41 config_to_dump = config_str.format( 41 config_to_dump = config_str.format(
51 correlation=options['correlation'], 51 correlation=options['correlation'],
52 sensitivity=options['sensitivity'], 52 sensitivity=options['sensitivity'],
53 maxfeat=options['maxfeat'], 53 maxfeat=options['maxfeat'],
54 inputfile=ms1_file, 54 inputfile=ms1_file,
55 outputfile=output_file, 55 outputfile=output_file,
56 ) 56 )
57 with open(CONFIG_FILE, 'w') as fp: 57 with open(CONFIG_FILE, 'w') as fp:
58 fp.write(config_to_dump) 58 fp.write(config_to_dump)
59 59
60 # Run hardklor 60 # Run hardklor
61 err = subprocess.call(['hardklor', CONFIG_FILE]) 61 err = subprocess.call(['hardklor', CONFIG_FILE])