Hi all,
Is there a way to access a content of Galaxy's output file without opening a web browser?
I have implemented a simple test on Galaxy server that just writes a string to an output file.
I have the following configuration file.
<tool id="ReadOutputTest_R" name="ReadOutputTest" version="1.1.0">
<description>This is a simple test for reading a content of output file.</description>
<command interpreter="Rscript">ReadOutputTest.R $out_file</command>
<outputs>
<data format="txt" name="out_file" />
</outputs>
<requirements>
<requirement type="set_environment">R_SCRIPT_PATH</requirement>
<requirement type="package" version="3.2.3">R</requirement>
</requirements>
<help></help>
</tool>
And below is the content of ReadOutputTest.R.
args = commandArgs(T)
out_fname = args[1]
outputMatrix <- matrix(1,1)
outputMatrix[1,1] <- "Content of output file"
write.table(outputMatrix, row.names=FALSE, col.names=FALSE, file=out_fname, quote=FALSE)
Below is a python script that I have been using to access the output of ReadOutputTest.
from bioblend.galaxy import GalaxyInstance
from bioblend.galaxy.histories import HistoryClient
from bioblend.galaxy.tools import ToolClient
from bioblend.galaxy.datasets import DatasetClient
TOOL_CATEG_ID = 'my_tools'
TOOL_ID = 'ReadOutputTest_R'
galaxyInstance = GalaxyInstance(url=GALAXY_URL, key=API_KEY)
historyClient = HistoryClient(galaxyInstance)
toolClient = ToolClient(galaxyInstance)
datasetClient = DatasetClient(galaxyInstance)
history = historyClient.create_history('tmp')
output = toolClient.run_tool(history_id=history['id'], tool_id=TOOL_ID, tool_inputs={})
outputDatasetId = output['outputs'][0]['id']
outputId = datasetClient.show_dataset(outputDatasetId, hda_ldda='hda')['id']
outputUrl = GALAXY_URL + '/datasets/' + outputId + '/display/?preview=True'
print outputUrl
I can access the content of Galaxy output by giving the outputUrl on web browser.
But I would like to access this content in python (i.e. store it in a python variable).
My intuition says perhaps the following method could be helpful.
datasetOutput = datasetClient.show_stdout(outputDatasetId)
print "datasetOutput: %s" % datasetOutput
But for some reason it returns:
datasetOutput: None
Heads up! This is a static archive of our support site. Please go to help.galaxyproject.org if you want to reach the Galaxy community. If you want to search this archive visit the Galaxy Hub search
Question: Bioblend - Accessing a content of Galaxy output without opening a web browser ?
0
lindfors.erno • 30 wrote:
ADD COMMENT
• link
•
modified 2.8 years ago
by
Martin Čech ♦♦ 4.9k
•
written
2.8 years ago by
lindfors.erno • 30
1
Martin Čech ♦♦ 4.9k wrote:
If you want to download a dataset you can use bioblend.galaxy.datasets.DatasetClient.download_dataset method described here: bioblend docs
Please log in to add an answer.
Use of this site constitutes acceptance of our User
Agreement
and Privacy
Policy.
Powered by Biostar
version 16.09
Traffic: 171 users visited in the last hour