merenlab / anvio

An analysis and visualization platform for 'omics data
http://merenlab.org/software/anvio
GNU General Public License v3.0
439 stars 145 forks source link

Simple API to push data to an anvi-server instance #335

Closed meren closed 7 years ago

meren commented 8 years ago

OK. Once I was on Chris' server, and had lots of files that I wanted to submit to anvi-server.org. You know what happened? I had to upload those files to another server (because reasons), then from there download to my own computer, and finally upload manually to anvi-server. It was awful.

So here we will solve this once and for all, by first implementing a tiny API that does not depend on any anvi'o modules (so can be imported from web through a CDN) and used from within Python wrappers. I will also put a binary into our codebase to play with it.

meren commented 8 years ago

With previous two commits, this is now possible:

from anvio.serverAPI import AnviServerAPI, AnviServerError
server = AnviServerAPI(args)
server.login()
server.push()

For args, see bin/anvi-push. What follows is a tiny demo.

start the mock server

cd tests/server
./start_server.sh mock

This is how my user's projects page looks like:

image

push your project

(password is test in the mock server for meren).

cd -
cd tests/sandbox/files_for_manual_interactive

anvi-push --user meren \
          --host localhost \
          --port-number 8080 \
          --tree tree.txt \
          --projeect-name 'test project from the terminal' \
          -d view_data.txt \
          -f fasta.fa \
          -D samples-information.txt \
          -R samples-order.txt

Enter your password for the server: ****

* The user "meren" (A. Murat Eren) has succesfully logged in.
* Your project "test project from the terminal" has been created on the remote server!

check the server

So my user's page on the server looks like this now:

image

And here is a screenshot from the recently pushed project:

image

Sweet!

This was only possible thanks to @ozcanesen and @paczian! Time to write the paper!

ozcan commented 8 years ago

Wow awesome Meren, this was a missing piece!

It gives us plenty of new opportunities, What about something like server.share(public=True) ? and new commands like anvi-pull/anvi-get? or even collaborative projects and versioning in future?

Ability to say something like "Hey just checkout my new project with anvi-get ozcan/project1" would be cool.

Best,

meren commented 8 years ago

Absolutely. We will be able to expand towards many directions from here. Think about a button on the anvi-interactive interface, when you click you get to enter your username and password, and send whatever you are seeing on your screen (with the proper state) to an anvi-server instance online optionally with public=True :)