Mercurial > repos > bgruening > cp_export_to_spreadsheet
comparison cp_common_functions.py @ 6:f24c370e5ea4 draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 57a0433defa3cbc37ab34fbb0ebcfaeb680db8d5
author | bgruening |
---|---|
date | Sun, 05 Nov 2023 09:35:54 +0000 |
parents | f8fa0f6718a3 |
children |
comparison
equal
deleted
inserted
replaced
5:d0178bdcd00e | 6:f24c370e5ea4 |
---|---|
23 return f"{a}_{b}" | 23 return f"{a}_{b}" |
24 | 24 |
25 | 25 |
26 def get_total_number_of_modules(pipeline_lines): | 26 def get_total_number_of_modules(pipeline_lines): |
27 """Gets the number of modules from the header of the previous pipeline""" | 27 """Gets the number of modules from the header of the previous pipeline""" |
28 number_of_modules = pipeline_lines[LINE_NUM_MODULES].strip().split(':')[1] | 28 number_of_modules = pipeline_lines[LINE_NUM_MODULES].strip().split(":")[1] |
29 return int(number_of_modules) | 29 return int(number_of_modules) |
30 | 30 |
31 | 31 |
32 def get_pipeline_lines(input_pipeline): | 32 def get_pipeline_lines(input_pipeline): |
33 """Returns a list with the lines in the .cppipe file""" | 33 """Returns a list with the lines in the .cppipe file""" |
36 return lines | 36 return lines |
37 | 37 |
38 | 38 |
39 def update_module_count(pipeline_lines, count): | 39 def update_module_count(pipeline_lines, count): |
40 """Updates the number of modules in the .cppipe header""" | 40 """Updates the number of modules in the .cppipe header""" |
41 module_count_entry = pipeline_lines[LINE_NUM_MODULES].strip().split(':')[0] | 41 module_count_entry = pipeline_lines[LINE_NUM_MODULES].strip().split(":")[0] |
42 pipeline_lines[4] = f"{module_count_entry}:{count}\n" | 42 pipeline_lines[4] = f"{module_count_entry}:{count}\n" |
43 return pipeline_lines | 43 return pipeline_lines |
44 | 44 |
45 | 45 |
46 def write_pipeline(filename, lines_pipeline): | 46 def write_pipeline(filename, lines_pipeline): |
49 f.writelines(lines_pipeline) | 49 f.writelines(lines_pipeline) |
50 | 50 |
51 | 51 |
52 def build_header(module_name, module_number): | 52 def build_header(module_name, module_number): |
53 """Creates the first line of a module given the name and module number""" | 53 """Creates the first line of a module given the name and module number""" |
54 result = "|".join([f"{module_name}:[module_num:{module_number}", | 54 result = "|".join( |
55 "svn_version:\\'Unknown\\'", | 55 [ |
56 "variable_revision_number:4", | 56 f"{module_name}:[module_num:{module_number}", |
57 "show_window:False", | 57 "svn_version:\\'Unknown\\'", |
58 "notes:\\x5B\\x5D", | 58 "variable_revision_number:4", |
59 "batch_state:array(\\x5B\\x5D, dtype=uint8)", | 59 "show_window:False", |
60 "enabled:True", | 60 "notes:\\x5B\\x5D", |
61 "wants_pause:False]\n"]) | 61 "batch_state:array(\\x5B\\x5D, dtype=uint8)", |
62 "enabled:True", | |
63 "wants_pause:False]\n", | |
64 ] | |
65 ) | |
62 return result | 66 return result |