{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Intermine-Python: Tutorial 13: Query Manager" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This tutorial will tell you about the Query Manager and how to it can be used to make better use of queries. We hope at this stage you have the 'intermine' package installed " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We start by importing the module from InterMine package. " ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from intermine import query_manager as qm" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The next step will be to access the account whose query options we want to manage" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "qm.save_mine_and_token(\"flymine\",\"41v6bat743zf06jcXek5\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "There are now four functions that we can utilise:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "tags": [] }, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": "'test is posted'" }, "metadata": {}, "execution_count": 3 } ], "source": [ "qm.post_query('\\\n", " ')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "'''posts a query with name and other information as above'''" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": "'Organism_Sequence, test'" }, "metadata": {}, "execution_count": 4 } ], "source": [ "qm.get_all_query_names()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "'''returns the names of all the saved queries in user account'''" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": "''" }, "metadata": {}, "execution_count": 5 } ], "source": [ "qm.get_query('test')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "'''returns information about the query whose name is 'test'''" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": "'test is deleted'" }, "metadata": {}, "execution_count": 6 } ], "source": [ "qm.delete_query('test')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "'''deletes the query whose name is 'test' from user's account'''" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now that we have made dealing with queries easier, the next tutorial will have details of how we can visualise the data using Python client." ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.3-final" } }, "nbformat": 4, "nbformat_minor": 1 }