Package: tribe-client
Tribe-client is a portable Python app to connect your bioinformatics server
or tool to the ‘Tribe’ web service (located athttps://tribe.greenelab.com).This package allows web servers created usingDjangoto connect directly
to Tribe and make use of its resources. Users of the client web server or tool
can access their Tribe resources via TribeOAuth2authentication.RequirementsIf you are using tribe-client in a web server that uses Django, we recommend
you use Django version 1.8 or newer.Download and InstallTribe-client is registered as “tribe-client” in PyPI and is pip
installable:pipinstalltribe-clientQuick Start with DjangoAddtribe_clientto yourINSTALLED_APPSsetting:INSTALLED_APPS=(...'tribe_client',)2. Include the tribe-client URLconf in your project’s URLconf (usuallyurls.py):fromdjango.conf.urlsimporturl,patterns,includeurlpatterns=patterns('',...(r'^tribe_client/',include('tribe_client.urls')),)3. Register your client server athttps://tribe.greenelab.com/oauth2/applications/. Make sure to:Be logged-in using your Tribe accountSelect “Confidential” underClient typeandSelect “Authorization Code” underAuthorization grant typeEnter your client server’s address plus “/tribe_client/get_token” in theRedirect urisbox. If your client server’s current address ishttp://example.com, enterhttp://example.com/tribe_client/get_tokenNoteCurrently, Tribe supports the followingAuthorization grant types:Authorization codeResource owner password-basedand does not support the following:ImplicitClient credentials4. Write down the Client ID in theTRIBE_IDsetting and the Client secret
in theTRIBE_SECRETsetting in yoursettings.pyfile like so:TRIBE_ID='*****Tribe Client ID*****'TRIBE_SECRET='*****Tribe Client Secret*****'5. TheTRIBE_REDIRECT_URIsetting should be the address of the client
server plus “/tribe_client/get_token”.TRIBE_REDIRECT_URI='http://example.com/tribe_client/get_token'6. Define in your settings the scope that your client server should have
for Tribe resources. The two options are: ‘read’ and ‘write’.The default
is ‘read’.Note:The ‘write’ scope includes the ‘read’ scope access.TRIBE_SCOPE='write'# Or 'read'7. (Optional) If you want to use tribe_client’s templates, make sure you have
a base template (which gets extended by your other templates and contains
the{% block content %}   {% endblock %}statements) that the tribe_client
templates can extend, and specify its name in your settings. The name of this
setting isTRIBE_CLIENT_BASE_TEMPLATE. By default, tribe_client will
look for a template calledbase.html.TRIBE_CLIENT_BASE_TEMPLATE='name_of_your_main_template.html'8. (Optional) If you want to use tribe_client’s built-in login templates and
urls, make a link that takes the user to theconnect_to_tribeurl in your
website. This url will show users the built-in Tribe login page.
Below is an example of this type of link in the webpage’s navbar:<divclass="collapse navbar-collapse"><ulclass="nav navbar-nav navbar-right"><li><ahref="{% url "connect_to_tribe"%}">Login with Tribe</a></li></ul></div>9. (Optional) If you want to redirect your users to somewhere other than
the/tribe_client/display_genesetsurl after they have logged in,
you can define this in theTRIBE_LOGIN_REDIRECTsetting in yoursettings.pyfile.Note:If you are not using the tribe-client
built-in templates (see above), you will need to define this setting so
your users have somewhere to go after they log in.TRIBE_LOGIN_REDIRECT='/place-to-go-after-login'10. (Optional) If you want to redirect your users to somewhere other than
the/tribe_clienturl after they log out, you can define this in theTRIBE_LOGOUT_REDIRECTsetting in yoursettings.pyfile.Note:If you are not using the tribe-client built-in templates (see above),
you will need to define this setting so your users have somewhere to go after
they log out.TRIBE_LOGOUT_REDIRECT='/place-to-go-after-logout'11. (Optional) If you want to download and pickle gene sets/collections from
Tribe by using thetribe_client_pickle_public_genesetsmanagement command,
you must customize the following setting insettings.py:# Location of folder where pickled gene set files will be saved to.# This can be a subdirectory in your server's path (as shown here),# or not.PUBLIC_GENESET_FOLDER=os.path.join(<serverdirectory>,<folderforpickledgenesetsfiles>)and run the following management command:pythonmanage.pytribe_client_pickle_public_genesetsThis will download and pickle all the public Tribe collections for every
organism in your database. This is handy in case you want to do many gene
set enrichment analyses across thousands of gene sets saved in Tribe, or any
other task that would require making frequent, large, time-consuming requests
for gene sets.A Closer LookUnder the hood, tribe-client has functions that:1) Get an access token (via theOAuth2protocol) that
allows users to access and create resources in Tribe.2) Retrieves public and private collections (and their versions) and displays
them on the client server using views and templates included in the package.3) Allows users to create new collections and versions remotely, from the
client server.