Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/planemo/runnable_resolve.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
| author | shellac |
|---|---|
| date | Mon, 22 Mar 2021 18:12:50 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:4f3585e2f14b |
|---|---|
| 1 import os | |
| 2 | |
| 3 from planemo.galaxy.profiles import translate_alias | |
| 4 from planemo.galaxy.workflows import GALAXY_WORKFLOWS_PREFIX | |
| 5 from planemo.tools import uri_to_path | |
| 6 from .runnable import ( | |
| 7 for_path, | |
| 8 for_uri, | |
| 9 ) | |
| 10 | |
| 11 | |
| 12 def for_runnable_identifier(ctx, runnable_identifier, kwds, temp_path=None, return_all=False): | |
| 13 """Convert URI, path, or alias into Runnable.""" | |
| 14 # could be a URI, path, or alias | |
| 15 current_profile = kwds.get('profile') | |
| 16 runnable_identifier = translate_alias(ctx, runnable_identifier, current_profile) | |
| 17 if not runnable_identifier.startswith(GALAXY_WORKFLOWS_PREFIX): | |
| 18 runnable_identifier = uri_to_path(ctx, runnable_identifier) | |
| 19 if os.path.exists(runnable_identifier): | |
| 20 runnable = for_path(runnable_identifier, temp_path=temp_path, return_all=return_all) | |
| 21 else: # assume galaxy workflow id | |
| 22 if not runnable_identifier.startswith(GALAXY_WORKFLOWS_PREFIX): | |
| 23 runnable_identifier = f"{GALAXY_WORKFLOWS_PREFIX}{runnable_identifier}" | |
| 24 runnable = for_uri(runnable_identifier) | |
| 25 return runnable | |
| 26 | |
| 27 | |
| 28 def for_runnable_identifiers(ctx, runnable_identifiers, kwds, temp_path=None): | |
| 29 """Convert lists of URIs, paths, and/or aliases into Runnables.""" | |
| 30 runnables = [] | |
| 31 for r in runnable_identifiers: | |
| 32 runnable = for_runnable_identifier(ctx, r, kwds, temp_path=temp_path, return_all=True) | |
| 33 if isinstance(runnable, list): | |
| 34 runnables.extend(runnable) | |
| 35 else: | |
| 36 runnables.append(runnable) | |
| 37 return runnables |
