Question: Bioblend - toolClient.run_tool does not work with more than one params ?
0
gravatar for lindfors.erno
4.1 years ago by
Germany
lindfors.erno • 30 wrote:

Hi all,

My purpose is to run a Galaxy tool with two parameters from command line via BioBlend.

More specifically I am running the following code:

from bioblend.galaxy import GalaxyInstance
from bioblend.galaxy.histories import HistoryClient
from bioblend.galaxy.tools import ToolClient
from bioblend.galaxy.datasets import DatasetClient

galaxyInstance = GalaxyInstance(url=GALAXY_URL, key=API_KEY)
historyClient = HistoryClient(galaxyInstance)
toolClient = ToolClient(galaxyInstance)
datasetClient = DatasetClient(galaxyInstance)
history = historyClient.create_history('tmp')
inputFile1 = toolClient.upload_file(pathName1, history['id'], type='txt')
inputFile2 = toolClient.upload_file(pathName2, history['id'], type='txt')
params = {TOOL_ID_IN_GALAXY: {'input_numbers_001':{'src': 'hda', 'id': inputFile1['outputs'][0]['id']},'input_numbers_002':{'src': 'hda', 'id': inputFile2['outputs'][0]['id']}}}
output = toolClient.run_tool(history_id=history['id'], tool_id=TOOL_ID, tool_inputs=params)

This does not work properly - Galaxy server's log says that both input parameters 'input_numbers_001' and 'input_numbers_002' have the content of inputFile2.
But my purpose is of course to have the content of inputFile1 in 'input_numbers_001'.

I have a strong intuition that maybe I am not setting parameters correctly in
params = {TOOL_ID_IN_GALAXY: {...}".
I have done this by following the high-level instructions given in in https://github.com/afgane/bioblend/issues/71.

Does anybody know how to set the parameters correctly?
Or do you think the source of the error is somewhere else?

Thanks in advance,
Erno Lindfors

bioblend software error galaxy • 1.7k views
ADD COMMENT • link • modified 4.1 years ago by jmchilton ♦ 1.1k • written 4.1 years ago by lindfors.erno • 30
3
gravatar for jmchilton
4.1 years ago by
jmchilton ♦ 1.1k
United States
jmchilton ♦ 1.1k wrote:

I believe you are defining params incorrectly here - the reason input_numbers_001 and input_numbers_002 are the same is that the API doesn't think you are attempting to set either so that field is defaulting to the newest history item (like the UI). I assume input_numbers_001 and input_numbers_002 are just data parameters at the top level of the tool? If so, then params should just be 

{
'input_numbers_001':{'src': 'hda', 'id': inputFile1['outputs'][0]['id']},
'input_numbers_002':{'src': 'hda', 'id': inputFile2['outputs'][0]['id']}
}

 

ADD COMMENT • link modified 4.1 years ago by Martin Čech ♦♦ 4.9k • written 4.1 years ago by jmchilton ♦ 1.1k

Thanks, this solved the problem!
And yes, they are just data parameters at the top level of the tool.

With best regards,
Erno Lindfors

ADD REPLY • link written 4.1 years ago by lindfors.erno • 30
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 167 users visited in the last hour