I have a workflow with output files that are renamed using workflow_parameters specified by putting things like ${sample_id} in the workflow editor. I can get the workflow to run but it is not clear to me how to access and assign the sample_id from workflowClient params or replacement_params seem likely but several tests have not turned up results. The renaming is happening but it is renaming it literally "${sample_id}" rather than string assigned to that. Is it better to just go through post run and rename the output files after they are created?
Hi Tom,
I am working with Enis Afgan (Bioblend author) to troubleshoot this. The method you are using should work - but perhaps something is a bit off with the syntax. Would you be able to share what you are using? You can post it here or send it direct. We can post a generalized answer/syntax solution once solved, if we go the direct route.
Just to let you know, "sample_id" is used as a config variable for another API call. I am not certain if that would cause a conflict if used inside of a variable or not. I noticed it, but we haven't gone that far in testing yet over time zones - but perhaps give it one try as a test, with a variable name that is slightly altered to be novel, just to rule it out as an issue.
And you have probably seen this and are working from it, but I'll share the link anyway for others that may be following: http://bioblend.readthedocs.org/en/latest/api_docs/galaxy/all.html
Thanks, Jen, Galaxy team
Here is an example that works but does not pass the sampleName variable through, not suprising since I am just guessing on syntax
from bioblend.galaxy import GalaxyInstance
from bioblend.galaxy.histories import HistoryClient
from bioblend.galaxy.tools import ToolClient
from bioblend.galaxy.workflows import WorkflowClient
from bioblend.galaxy.datasets import DatasetClient
import time
import sys
import os.path
api_key = 'XXXXXXXXXXXXXXXXXXX' #galaxy.hpc api key
galaxy_host = 'https://XXXXXXXXXXX'
oto_wf_id = 'c50592c2d5f1990d' #real oto workflow
#oto_wf_id = '7576cb7f105ca501' #simple workflow for testing
platform_design = '808d5b008d7b5283'
known_variants = 'd631f0584da64e36'
oto_custom_data = '6cc40868de00e622'
report_template = '1492d625c8ec5538'
custom_quality_metrics = '682e7654ec211682'
R1 = sys.argv[1]
R2 = sys.argv[2]
sampleName = 'oto_API_test'
galaxyInstance = GalaxyInstance(galaxy_host,key=api_key)
historyClient = HistoryClient(galaxyInstance)
toolClient = ToolClient(galaxyInstance)
workflowClient = WorkflowClient(galaxyInstance)
dataSetClient = DatasetClient(galaxyInstance)
workflow = workflowClient.show_workflow(oto_wf_id)
history = historyClient.create_history(sampleName)
R1 = toolClient.upload_file(R1,history['id'],file_type='fastqsanger')
R2 = toolClient.upload_file(R2,history['id'],file_type='fastqsanger')
#Have files in place need to set up workflow
print workflow['inputs']
datamap = {workflow['inputs'].keys()[0]: {'id': platform_design, 'src': 'hda'},
workflow['inputs'].keys()[1]: {'id': known_variants, 'src': 'hda'},
workflow['inputs'].keys()[2]: {'id': R1['outputs'][0]['id'], 'src': 'hda'},
workflow['inputs'].keys()[3]: {'id': oto_custom_data, 'src': 'hda'},
workflow['inputs'].keys()[4]: {'id': report_template, 'src': 'hda'},
workflow['inputs'].keys()[5]: {'id': R2['outputs'][0]['id'], 'src': 'hda'},
workflow['inputs'].keys()[6]: {'id': custom_quality_metrics, 'src': 'hda'},
}
params = {}
rep_params = {'SAMPLE_ID':sampleName}
rwf = workflowClient.run_workflow(workflow['id'],datamap,history_id=history['id'],import_inputs_to_history=True,replacement_params=rep_params)