Question: How do I develop an application through the use of Galaxy API
0
gravatar for jchen015
3.5 years ago by
jchen01580
Singapore
jchen01580 wrote:

Dear all seniors members,

I just got Galaxy successfully installed and i'm now moving on to the next phase of my research project.

Referencing from : https://wiki.galaxyproject.org/Learn/API , I am unable to figure out on the procedures and steps needed to develop my own application through the usage of Galaxy's API.

May I ask how should I go about doing it ?

Regards,

Julius

researchproject student api new • 1.2k views
ADD COMMENTlink modified 3.5 years ago by Martin Čech ♦♦ 4.8k • written 3.5 years ago by jchen01580
1
gravatar for Bjoern Gruening
3.5 years ago by
Bjoern Gruening5.1k
Germany
Bjoern Gruening5.1k wrote:

Hi,

have a look at http://bioblend.readthedocs.org/en/latest/. This will for your kickstart your project :)

Cheers,

Bjoern

ADD COMMENTlink written 3.5 years ago by Bjoern Gruening5.1k

Hi Bjoern, glad to see you again.

After reading the documents, I am still kinda lost in the development of my own application using Galaxy's API.

For example, if i wrote a simple program in python to print "Hello World" , how do I use Galaxy's API ? How does that relates to my program? is there like some steps procedures?

ADD REPLYlink written 3.5 years ago by jchen01580

Hi,

here you can find an examaple script of getting and transferring data to a Galaxy history.

https://github.com/bgruening/docker-ipython-notebook/blob/master/galaxy.py

Also have a look at Matrin's great answer!

Cheers,

Bjoern

ADD REPLYlink written 3.5 years ago by Bjoern Gruening5.1k
1
gravatar for Martin Čech
3.5 years ago by
Martin Čech ♦♦ 4.8k
United States
Martin Čech ♦♦ 4.8k wrote:

Expanding on Bjoern's answer, and the fact you seem to want to use Python you might want to install the bioblend library on your machine with

$ pip install bioblend

and then you can use the following in your Python script to run a workflow

from bioblend.galaxy import GalaxyInstance
gi = GalaxyInstance('<Galaxy IP>', key='your API key')
libs = gi.libraries.get_libraries()
gi.workflows.show_workflow('workflow ID')
gi.workflows.run_workflow('workflow ID', input_dataset_map)

Details are covered in the link Bjoern shared. In short Bioblend makes it easier for you to work with Galaxy's internals. By using the Bioblend library you can avoid contructing the HTTP requests yourself.

API documentation for Galaxy itself is avalable here: http://galaxy-central.readthedocs.org/en/latest/lib/galaxy.webapps.galaxy.api.html

If the above still looks confusing try reading a bit about the generic work with APIs e.g.: http://www.codecademy.com/en/tracks/apis-python

ADD COMMENTlink modified 3.5 years ago • written 3.5 years ago by Martin Čech ♦♦ 4.8k

Hi Martin

Thanks for all the information.

I would like to clarify with you on the first example of reference (http://galaxy-central.readthedocs.org/en/latest/lib/galaxy.webapps.galaxy.api.html), which is on display.py

Here's what I did:

1) I opened 2 terminal; 1 for hosting the galaxy and the other to run ./display.py

2) in the terminal of /.display.py, here's what I did.

  • I already generated an API key previously (assuming it is 4esa945d0463a4348b096059320a5084)
  • Then I cd to the directory where all display.py is in
  • Afterwhich, i execute the below command

./display.py 4esa945d0463a4348b096059320a5084 http://localhost:8080/api/histories

The error showed

HTTP Error 500: Internal Server Error
{"traceback": "No traceback available.", "err_msg": "Provided API key is not valid.", "err_code": 0}


However, I am sure that the API key is correct as shown on the screen below

 

What do you think is the problem? and what should I expect if it is working fine?

ADD REPLYlink modified 3.5 years ago • written 3.5 years ago by jchen01580

When I tried further again, it then prompts this error.

julius@julius-Aspire-4755:~/galaxy-dist/galaxy-dist/scripts/api$ ./display.py 4esa945d0463a4348b096059320a5084 http://10.0.2.2:8080/api/histories
<urlopen error [Errno 110] Connection timed out>

 

ADD REPLYlink written 3.5 years ago by jchen01580
1

Are you sure your Galaxy instance is running on that port and is accepting external connections?  Test this in your web browser first.

ADD REPLYlink written 3.5 years ago by Dannon Baker3.7k

Yeah. I got it. thanks alot for the reminder.
 

ADD REPLYlink written 3.5 years ago by jchen01580

Great!  For future reference, the API also supports Session validation.  So, if you're logged into a galaxy server (in your browser) you can just change the url to something like "localhost:8080/api/histories" and so on, and browse the contents there.  If you're using Chrome, there's also a nice extension called Postman (https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm) that I use quite often for testing requests.

ADD REPLYlink written 3.5 years ago by Dannon Baker3.7k
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: 108 users visited in the last hour