django-to-galaxy 0.6.9.8__py3-none-any.whl → 0.6.9.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of django-to-galaxy might be problematic. Click here for more details.

@@ -0,0 +1,136 @@
1
+ # Generated by Django 5.2.3 on 2025-09-09 13:15
2
+
3
+ import django.db.models.deletion
4
+ from django.db import migrations, models
5
+
6
+
7
+ class Migration(migrations.Migration):
8
+
9
+ dependencies = [
10
+ (
11
+ "django_to_galaxy",
12
+ "0011_rename__step_jobs_count_workflow__step_count_and_more",
13
+ ),
14
+ ]
15
+
16
+ operations = [
17
+ migrations.AddField(
18
+ model_name="workflowinput",
19
+ name="collection_type",
20
+ field=models.CharField(
21
+ blank=True,
22
+ choices=[
23
+ ("record", "Record"),
24
+ ("paired", "Dataset Pair"),
25
+ ("list", "List of Datasets"),
26
+ ("list:record", "List of Records"),
27
+ ("list:paired", "List of Dataset Pairs"),
28
+ (
29
+ "list:paired_or_unpaired",
30
+ "Mixed List of Paired and Unpaired Datasets",
31
+ ),
32
+ ],
33
+ default=None,
34
+ max_length=25,
35
+ null=True,
36
+ ),
37
+ ),
38
+ migrations.AddField(
39
+ model_name="workflowinput",
40
+ name="default_value",
41
+ field=models.CharField(blank=True, max_length=255, null=True),
42
+ ),
43
+ migrations.AddField(
44
+ model_name="workflowinput",
45
+ name="input_type",
46
+ field=models.CharField(
47
+ choices=[
48
+ ("data_input", "data_input"),
49
+ ("data_collection_input", "data_collection_input"),
50
+ ("parameter_input", "parameter_input"),
51
+ ],
52
+ default="data_input",
53
+ max_length=25,
54
+ ),
55
+ ),
56
+ migrations.AddField(
57
+ model_name="workflowinput",
58
+ name="multiple",
59
+ field=models.BooleanField(default=False),
60
+ ),
61
+ migrations.AddField(
62
+ model_name="workflowinput",
63
+ name="parameter_type",
64
+ field=models.CharField(
65
+ blank=True,
66
+ choices=[
67
+ ("text", "text"),
68
+ ("integer", "integer"),
69
+ ("float", "float"),
70
+ ("boolean", "boolean"),
71
+ ("color", "color"),
72
+ ("directory_uri", "directory_uri"),
73
+ ],
74
+ default=None,
75
+ max_length=15,
76
+ null=True,
77
+ ),
78
+ ),
79
+ migrations.CreateModel(
80
+ name="WorkflowInputTextOption",
81
+ fields=[
82
+ (
83
+ "id",
84
+ models.BigAutoField(
85
+ auto_created=True,
86
+ primary_key=True,
87
+ serialize=False,
88
+ verbose_name="ID",
89
+ ),
90
+ ),
91
+ ("text_option", models.CharField(max_length=255)),
92
+ (
93
+ "workflow_input",
94
+ models.ForeignKey(
95
+ on_delete=django.db.models.deletion.CASCADE,
96
+ to="django_to_galaxy.workflowinput",
97
+ ),
98
+ ),
99
+ ],
100
+ ),
101
+ migrations.AddField(
102
+ model_name="workflowinput",
103
+ name="restrict_text_values",
104
+ field=models.ManyToManyField(to="django_to_galaxy.workflowinputtextoption"),
105
+ ),
106
+ migrations.AddConstraint(
107
+ model_name="workflowinput",
108
+ constraint=models.CheckConstraint(
109
+ condition=models.Q(
110
+ models.Q(
111
+ ("input_type", "parameter_input"),
112
+ ("parameter_type__isnull", False),
113
+ ("collection_type__isnull", True),
114
+ ),
115
+ models.Q(
116
+ ("input_type", "data_input"),
117
+ ("parameter_type__isnull", True),
118
+ ("collection_type__isnull", True),
119
+ ),
120
+ models.Q(
121
+ ("input_type", "data_collection_input"),
122
+ ("parameter_type__isnull", True),
123
+ ("collection_type__isnull", False),
124
+ ),
125
+ _connector="OR",
126
+ ),
127
+ name="workflowinputs_types_congruant",
128
+ ),
129
+ ),
130
+ migrations.AddConstraint(
131
+ model_name="workflowinputtextoption",
132
+ constraint=models.UniqueConstraint(
133
+ fields=("workflow_input", "text_option"), name="unique_input_option"
134
+ ),
135
+ ),
136
+ ]
@@ -5,4 +5,4 @@ from .history import History # noqa
5
5
  from .invocation import Invocation # noqa
6
6
  from .workflow import Workflow # noqa
7
7
  from .galaxy_element import Tag # noqa
8
- from .accepted_input import WorkflowInput, Format # noqa
8
+ from .accepted_input import WorkflowInput, Format, WorkflowInputTextOption # noqa
@@ -1,28 +1,139 @@
1
1
  from django.db import models
2
+ from django.db.models import Q
3
+
4
+ DATA = "data_input"
5
+ COLLECTION = "data_collection_input"
6
+ PARAMETER = "parameter_input"
7
+ INPUT_TYPE_CHOICES = [
8
+ (DATA, "data_input"),
9
+ (COLLECTION, "data_collection_input"),
10
+ (PARAMETER, "parameter_input"),
11
+ ]
12
+
13
+ P_TEXT = "text"
14
+ P_INTEGER = "integer"
15
+ P_FLOAT = "float"
16
+ P_BOOLEAN = "boolean"
17
+ P_COLOR = "color"
18
+ P_DIRECTORY_URI = "directory_uri"
19
+ PARAMETER_TYPE_CHOICES = [
20
+ (P_TEXT, "text"),
21
+ (P_INTEGER, "integer"),
22
+ (P_FLOAT, "float"),
23
+ (P_BOOLEAN, "boolean"),
24
+ (P_COLOR, "color"),
25
+ (P_DIRECTORY_URI, "directory_uri"),
26
+ ]
27
+
28
+ C_RECORD = "record"
29
+ C_PAIRED = "paired"
30
+ C_LIST = "list"
31
+ C_LIST_RECORD = "list:record"
32
+ C_LIST_PAIRED = "list:paired"
33
+ C_LIST_PAIRED_UNPAIRED = "list:paired_or_unpaired"
34
+ COLLECTION_TYPE_CHOICES = [
35
+ (C_RECORD, "Record"),
36
+ (C_PAIRED, "Dataset Pair"),
37
+ (C_LIST, "List of Datasets"),
38
+ (C_LIST_RECORD, "List of Records"),
39
+ (C_LIST_PAIRED, "List of Dataset Pairs"),
40
+ (C_LIST_PAIRED_UNPAIRED, "Mixed List of Paired and Unpaired Datasets"),
41
+ ]
2
42
 
3
43
 
4
44
  class Format(models.Model):
5
- format = models.CharField(max_length=200, unique=True)
6
45
  """Format on the galaxy side."""
7
46
 
47
+ format = models.CharField(max_length=200, unique=True)
48
+
8
49
  def __str__(self):
9
50
  return f"{self.format}"
10
51
 
11
52
 
53
+ class WorkflowInputTextOption(models.Model):
54
+ """Text option for a workflow input on Galaxy side."""
55
+
56
+ workflow_input = models.ForeignKey(
57
+ "WorkflowInput", null=False, on_delete=models.CASCADE
58
+ )
59
+ text_option = models.CharField(max_length=255)
60
+
61
+ class Meta:
62
+ constraints = [
63
+ models.UniqueConstraint(
64
+ fields=["workflow_input", "text_option"], name="unique_input_option"
65
+ )
66
+ ]
67
+
68
+ def __str__(self):
69
+ return f"{self.text_option}"
70
+
71
+ def __repr__(self):
72
+ return f"Input: {self!s}"
73
+
74
+
12
75
  class WorkflowInput(models.Model):
76
+ """Accepted input for a workflow on Galaxy side."""
77
+
13
78
  galaxy_step_id = models.IntegerField(null=False)
14
79
  """Step id on the galaxy side."""
15
80
  label = models.CharField(max_length=100, blank=True)
16
81
  """Label on the galaxy side."""
17
82
  workflow = models.ForeignKey("Workflow", null=False, on_delete=models.CASCADE)
18
83
  """Workflow id."""
84
+ input_type = models.CharField(
85
+ max_length=25, choices=INPUT_TYPE_CHOICES, default=DATA
86
+ )
87
+ """Type of input on the galaxy side."""
19
88
  formats = models.ManyToManyField("Format")
20
89
  """Accepted input formats on the galaxy side."""
90
+ parameter_type = models.CharField(
91
+ max_length=15,
92
+ choices=PARAMETER_TYPE_CHOICES,
93
+ default=None,
94
+ null=True,
95
+ blank=True,
96
+ )
97
+ """Type of input if it is a parameter input."""
98
+ collection_type = models.CharField(
99
+ max_length=25,
100
+ choices=COLLECTION_TYPE_CHOICES,
101
+ default=None,
102
+ null=True,
103
+ blank=True,
104
+ )
105
+ """Type of input if it is a parameter input."""
21
106
  optional = models.BooleanField(default=False)
22
107
  """Workflow input optional information on the galaxy side."""
108
+ default_value = models.CharField(max_length=255, null=True, blank=True)
109
+ """Default value of the input (either text, integer, float, boolean)"""
110
+ multiple = models.BooleanField(default=False)
111
+ """If the input can get multiple values on the galaxy side."""
112
+
113
+ class Meta:
114
+ constraints = [
115
+ models.CheckConstraint(
116
+ check=Q(
117
+ Q(input_type=PARAMETER)
118
+ & Q(parameter_type__isnull=False)
119
+ & Q(collection_type__isnull=True)
120
+ )
121
+ | Q(
122
+ Q(input_type=DATA)
123
+ & Q(parameter_type__isnull=True)
124
+ & Q(collection_type__isnull=True)
125
+ )
126
+ | Q(
127
+ Q(input_type=COLLECTION)
128
+ & Q(parameter_type__isnull=True)
129
+ & Q(collection_type__isnull=False)
130
+ ),
131
+ name="workflowinputs_types_congruant",
132
+ )
133
+ ]
23
134
 
24
135
  def __str__(self):
25
- return f"{self.label} of {self.workflow!r}"
136
+ return f"{self.label}"
26
137
 
27
138
  def __repr__(self):
28
139
  return f"Input: {self!s}"
@@ -22,7 +22,7 @@ class GalaxyInstance(models.Model):
22
22
  Whether the instance is available or not.
23
23
  """
24
24
  try:
25
- response = requests.get(self.url, timeout=2)
25
+ response = requests.head(self.url, timeout=30)
26
26
  response.raise_for_status()
27
27
  return True
28
28
  except Exception:
@@ -1,6 +1,5 @@
1
1
  from bioblend.galaxy.objects import wrappers
2
2
  from django.db import models
3
-
4
3
  from .history import History
5
4
  from .invocation import Invocation
6
5
  from .galaxy_element import GalaxyElement
@@ -50,6 +49,366 @@ class Workflow(GalaxyElement):
50
49
  self.save(update_fields=["_step_count"])
51
50
  return self._step_count
52
51
 
52
+ def _get_tool_input(self, tool_label, tool):
53
+ """
54
+ Retrieve a specific tool input dictionary from a Galaxy tool definition.
55
+
56
+ This method navigates the nested structure of a tool's inputs or conditional cases
57
+ to locate the input corresponding to `tool_label`. It supports labels that reference
58
+ nested inputs using a "|" separator.
59
+
60
+ Args:
61
+ tool_label (str): The label of the input to retrieve. Can be a simple label
62
+ or a nested label separated by "|", e.g. "param_group|param_name".
63
+ tool (dict): The tool definition dictionary returned by Galaxy
64
+ (from gi.tools.show_tool),
65
+ which may contain:
66
+ - "inputs": a list of input dictionaries
67
+ - "cases": a list of conditional input cases
68
+
69
+ Returns:
70
+ dict: The dictionary representing the requested input, including all its parameters.
71
+ If the input cannot be found, raises a ValueError or returns the original `tool`
72
+ if it has no matching inputs/cases.
73
+
74
+ Raises:
75
+ ValueError: If the target input cannot be found when navigating a nested label.
76
+
77
+ Notes:
78
+ - Nested labels separated by "|" are resolved recursively.
79
+ - Handles both regular "inputs" and conditional "cases".
80
+ - If no inputs or cases match the label, the original `tool` dictionary is returned
81
+ (for non-nested top-level tool access).
82
+
83
+ Example:
84
+ tool = {
85
+ "inputs": [{"name": "param1", "type": "text"},
86
+ {"name": "param2", "type": "integer"}]
87
+ }
88
+
89
+ _get_tool_input("param1", tool)
90
+ # Returns: {"name": "param1", "type": "text"}
91
+
92
+ tool = {
93
+ "cases": [{"inputs": [{"name": "choice1", "type": "text"}]}]
94
+ }
95
+
96
+ _get_tool_input("choice1", tool)
97
+ # Returns: {"name": "choice1", "type": "text"}
98
+ """
99
+ if "|" in tool_label:
100
+ first, tool_label = tool_label.split("|", maxsplit=1)
101
+ if "inputs" in tool.keys():
102
+ for x in tool["inputs"]:
103
+ if x["name"] == first:
104
+ return self._get_tool_input(tool_label, x)
105
+ elif "cases" in tool.keys():
106
+ for x in tool["cases"]:
107
+ if x["inputs"]:
108
+ if x["inputs"][0]["name"] == first:
109
+ return self._get_tool_input(tool_label, x["inputs"][0])
110
+ else:
111
+ raise ValueError(
112
+ f"Cannot find the target tool from this tool label: {tool_label}."
113
+ )
114
+ else:
115
+ if "inputs" in tool.keys():
116
+ for x in tool["inputs"]:
117
+ if x["name"] == tool_label:
118
+ return x
119
+ elif "cases" in tool.keys():
120
+ for x in tool["cases"]:
121
+ if x["inputs"]:
122
+ if x["inputs"][0]["name"] == tool_label:
123
+ return x["inputs"][0]
124
+ else:
125
+ return tool
126
+
127
+ def _get_subworkflow_inputs(self, gi, input_mapping):
128
+ """
129
+ Recursively retrieve input information from subworkflows linked to a parameter input.
130
+
131
+ This private method inspects the subworkflow referenced in `input_mapping["target_subwf"]`
132
+ and updates the mapping with tools or nested subworkflows that consume the input.
133
+ It handles multiple levels of nested subworkflows recursively.
134
+
135
+ Args:
136
+ gi (GalaxyInstance): The Galaxy instance object (typically
137
+ `self.galaxy_owner.obj_gi.gi`) used to query workflows and tool details.
138
+ input_mapping (dict): A dictionary representing a single parameter input.
139
+ It must contain:
140
+ - `has_subwf` (bool): True if the input is consumed by a subworkflow.
141
+ - `target_subwf` (dict): Information about the first subworkflow that consumes
142
+ the input:
143
+ - `workflow_id` (str): ID of the subworkflow
144
+ - `input_name` (str): Name of the input in the subworkflow
145
+ - `target_tools` (list): List of tools that consume the input (will be updated)
146
+ - `has_tool` (bool): Flag indicating whether a tool consumes the input (may be
147
+ updated)
148
+
149
+ Returns:
150
+ dict: The updated `input_mapping` with:
151
+ - `target_tools` populated with tools consuming the input from the subworkflow
152
+ - `target_subwf` updated if nested subworkflows exist
153
+ - `has_subwf` set to False once all subworkflow inputs have been resolved
154
+
155
+ Notes:
156
+ - This function uses recursion to traverse multiple levels of nested subworkflows.
157
+ - It only processes the first subworkflow consuming the input at each level.
158
+ - The function distinguishes between steps of type `"tool"` and `"subworkflow"`.
159
+
160
+ Example:
161
+ Before:
162
+ {
163
+ "label": "Parameter X",
164
+ "type": "parameter_input",
165
+ "target_tools": [],
166
+ "target_subwf": {"input_name": "sub_input", "workflow_id": "wf_123"},
167
+ "has_subwf": True
168
+ }
169
+
170
+ After:
171
+ {
172
+ "label": "Parameter X",
173
+ "type": "parameter_input",
174
+ "target_tools": [
175
+ {"input_name": "param1", "tool_id": "tool_456"}
176
+ ],
177
+ "target_subwf": None,
178
+ "has_subwf": False
179
+ }
180
+ """
181
+
182
+ if not input_mapping["has_subwf"]:
183
+ return input_mapping
184
+
185
+ subworkflow_id = input_mapping["target_subwf"]["workflow_id"]
186
+ input_label = input_mapping["target_subwf"]["input_name"]
187
+
188
+ # Get the subworkflow information
189
+ data = gi.workflows.show_workflow(subworkflow_id, instance=True)
190
+
191
+ input_keys = {v["label"]: k for k, v in data["inputs"].items()}
192
+ steps = data["steps"]
193
+ source_id = str(steps[input_keys[input_label]]["id"])
194
+
195
+ step_ids = list(steps.keys())
196
+
197
+ for step_id in step_ids:
198
+ input_steps = steps[step_id].get("input_steps", {})
199
+ for input_name, input_details in input_steps.items():
200
+ if str(input_details.get("source_step")) == source_id:
201
+ if steps[step_id].get("type") == "tool":
202
+ input_mapping["target_tools"].append(
203
+ {
204
+ "input_name": input_name,
205
+ "tool_id": steps[step_id]["tool_id"],
206
+ }
207
+ )
208
+ input_mapping["has_subwf"] = False
209
+
210
+ elif steps[step_id].get("type") == "subworkflow":
211
+ if not input_mapping["has_subwf"]:
212
+ input_mapping["target_subwf"] = {
213
+ "input_name": input_name,
214
+ "workflow_id": steps[step_id]["workflow_id"],
215
+ }
216
+ input_mapping["has_subwf"] = True
217
+
218
+ return self._get_subworkflow_inputs(gi, input_mapping)
219
+
220
+ def get_workflow_inputs(self):
221
+ """
222
+ Retrieve detailed information about all inputs of a Galaxy workflow.
223
+
224
+ This method processes a `Workflow` instance from `django-to-galaxy` and returns
225
+ a dictionary describing each input, whether it is a `data_input` or a `parameter_input`.
226
+
227
+ For each input, the returned information includes:
228
+ - `label`: the human-readable label of the input
229
+ - `type`: the type of input (`data_input` or `parameter_input`)
230
+ - `tool_inputs`: the dictionary of tool inputs associated with the step
231
+ - `target_tools`: for parameter inputs, a list of tools that consume this input
232
+ - Each entry includes:
233
+ - `input_name`: the name of the input in the target tool
234
+ - `tool_id`: the Galaxy ID of the tool
235
+ - `tool_input`: the detailed tool input specification (retrieved later)
236
+ - `target_subwf`: for parameter inputs, the first subworkflow that consumes this input
237
+ - Includes:
238
+ - `input_name`: the name of the input in the subworkflow
239
+ - `workflow_id`: the ID of the subworkflow
240
+ - `has_tool`: boolean flag indicating if any tool consumes this input
241
+ - `has_subwf`: boolean flag indicating if any subworkflow consumes this input
242
+
243
+ The function also handles nested subworkflows and retrieves input information
244
+ for subworkflow parameters using `_get_subworkflow_inputs`. Tool-specific input
245
+ details are retrieved using `_get_tool_input`.
246
+
247
+ Args:
248
+ self: A workflow wrapper instance containing:
249
+ - `self.galaxy_workflow`: the Galaxy workflow object
250
+ - `self.galaxy_owner.obj_gi.gi`: Galaxy instance handle
251
+
252
+ Returns:
253
+ dict: A mapping of input IDs to detailed information, for example:
254
+
255
+ {
256
+ "0": {
257
+ "label": "Input dataset",
258
+ "type": "data_input",
259
+ "tool_inputs": {...},
260
+ },
261
+ "1": {
262
+ "label": "Threshold",
263
+ "type": "parameter_input",
264
+ "tool_inputs": {...},
265
+ "target_tools": [
266
+ {
267
+ "input_name": "param1",
268
+ "tool_id": "toolshed.g2.bx.psu.edu/repos/.../tool/1",
269
+ "tool_input": {...},
270
+ }
271
+ ],
272
+ "target_subwf": {
273
+ "input_name": "subwf_input",
274
+ "workflow_id": "wf_123",
275
+ },
276
+ "has_tool": True,
277
+ "has_subwf": True,
278
+ },
279
+ }
280
+
281
+ Known caveats:
282
+ - Cannot retrieve the tool input if the tool has sections (e.g., `tooldistillator`
283
+ tool).
284
+ - Only the first subworkflow consuming a parameter input is inspected.
285
+
286
+ """
287
+ gi = self.galaxy_owner.obj_gi.gi
288
+
289
+ inputs = self.galaxy_workflow.inputs
290
+ steps = self.galaxy_workflow.steps
291
+ steps = {k: v.wrapped for k, v in steps.items()}
292
+ steps_ids = list(steps.keys())
293
+
294
+ # Initialization
295
+ input_mapping = {}
296
+ parameter_input_ids = []
297
+
298
+ for input_id, input_dict in inputs.items():
299
+ input_mapping[input_id] = {}
300
+ input_mapping[input_id]["label"] = input_dict["label"]
301
+ input_mapping[input_id]["type"] = steps[input_id]["type"]
302
+ input_mapping[input_id]["tool_inputs"] = steps[input_id]["tool_inputs"]
303
+
304
+ if steps[input_id]["type"] == "parameter_input":
305
+ parameter_input_ids.append(input_id)
306
+ steps_ids.remove(input_id)
307
+ input_mapping[input_id]["target_tools"] = []
308
+ input_mapping[input_id]["target_subwf"] = None
309
+ input_mapping[input_id]["has_tool"] = False
310
+ input_mapping[input_id]["has_subwf"] = False
311
+
312
+ for target_id in parameter_input_ids:
313
+ for step_id in steps_ids:
314
+ input_steps = steps[step_id].get("input_steps", {})
315
+ for input_name, input_details in input_steps.items():
316
+ if input_details.get("source_step") == target_id:
317
+ if steps[step_id].get("type") == "tool":
318
+ input_mapping[target_id]["target_tools"].append(
319
+ {
320
+ "input_name": input_name,
321
+ "tool_id": steps[step_id]["tool_id"],
322
+ }
323
+ )
324
+ input_mapping[target_id]["has_tool"] = True
325
+ elif steps[step_id].get("type") == "subworkflow":
326
+ if not input_mapping[target_id]["has_subwf"]:
327
+ input_mapping[target_id]["target_subwf"] = {
328
+ "input_name": input_name,
329
+ "workflow_id": steps[step_id]["workflow_id"],
330
+ }
331
+ input_mapping[target_id]["has_subwf"] = True
332
+
333
+ # Then search for subworkflows
334
+ # For each input just search in the first subworkflow to get the parameters information
335
+ for k in input_mapping.keys():
336
+ if "target_subwf" in input_mapping[k].keys():
337
+ input_mapping[k] = self._get_subworkflow_inputs(gi, input_mapping[k])
338
+
339
+ # Then search input information in tools
340
+ for k in input_mapping.keys():
341
+ if "target_tools" in input_mapping[k].keys():
342
+ for kk in input_mapping[k]["target_tools"]:
343
+ tool_label = kk["input_name"]
344
+ tool = gi.tools.show_tool(
345
+ kk["tool_id"],
346
+ io_details=True,
347
+ link_details=True,
348
+ )
349
+ kk["tool_input"] = self._get_tool_input(tool_label, tool)
350
+
351
+ return input_mapping
352
+
353
+ def get_workflow_datamap_template(self):
354
+ """
355
+ Generate a template of the datamap required to invoke a Galaxy workflow.
356
+
357
+ This method inspects the workflow's inputs and steps, and constructs:
358
+ 1. `input_mapping`: a dictionary describing each input, including its label and type.
359
+ 2. `datamap_template`: a dictionary with default placeholders for input values
360
+ suitable for workflow invocation.
361
+
362
+ Input types are handled as follows:
363
+ - "parameter_input": the parameter type from the tool inputs is returned as default.
364
+ - "data_input": a dictionary with {"id": "", "src": "hda"}.
365
+ - "data_collection_input": a dictionary with {"id": "", "src": "hdca"}.
366
+
367
+ Returns:
368
+ dict: A dictionary containing two keys:
369
+ - "input_mapping" (dict): maps input IDs to dictionaries with:
370
+ - "label": human-readable label of the input
371
+ - "type": type of input ("parameter_input", "data_input", or
372
+ "data_collection_input")
373
+ - "datamap_template" (dict): maps input IDs to default values/placeholders
374
+ appropriate for workflow invocation.
375
+
376
+ Example:
377
+ {
378
+ "input_mapping": {
379
+ "0": {"label": "Input dataset", "type": "data_input"},
380
+ "1": {"label": "Threshold", "type": "parameter_input"}
381
+ },
382
+ "datamap_template": {
383
+ "0": {"id": "", "src": "hda"},
384
+ "1": "integer"
385
+ }
386
+ }
387
+ """
388
+
389
+ inputs = self.galaxy_workflow.inputs
390
+ steps = self.galaxy_workflow.steps
391
+ steps = {k: v.wrapped for k, v in steps.items()}
392
+
393
+ input_mapping = {}
394
+ datamap_template = {}
395
+
396
+ for input_id, input_dict in inputs.items():
397
+ input_mapping[input_id] = {}
398
+ input_mapping[input_id]["label"] = input_dict["label"]
399
+ input_mapping[input_id]["type"] = steps[input_id]["type"]
400
+
401
+ if steps[input_id]["type"] == "parameter_input":
402
+ datamap_template[input_id] = steps[input_id]["tool_inputs"][
403
+ "parameter_type"
404
+ ]
405
+ elif steps[input_id]["type"] == "data_input":
406
+ datamap_template[input_id] = {"id": "", "src": "hda"}
407
+ elif steps[input_id]["type"] == "data_collection_input":
408
+ datamap_template[input_id] = {"id": "", "src": "hdca"}
409
+
410
+ return {"input_mapping": input_mapping, "datamap_template": datamap_template}
411
+
53
412
  def invoke(self, datamap: dict, history: History) -> wrappers.Invocation:
54
413
  """
55
414
  Invoke workflow using bioblend.
@@ -1,3 +1,3 @@
1
1
  """Handle library versioning."""
2
- version_info = (0, 6, 9, 8)
2
+ version_info = (0, 6, 9, 9)
3
3
  __version__ = ".".join(str(c) for c in version_info)