Intermine-Python: Tutorial 13: Query Manager

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

We start by importing the module from InterMine package.

In [1]:
from intermine import query_manager as qm

The next step will be to access the account whose query options we want to manage

In [2]:
qm.save_mine_and_token("flymine","41v6bat743zf06jcXek5")

There are now four functions that we can utilise:

In [3]:
qm.post_query('<query name="test" model="genomic" view="Gene.length\
            Gene.symbol" longDescription="" sortOrder="Gene.length asc">\
            </query>')
Out[3]:
'test is posted'

'''posts a query with name and other information as above'''

In [4]:
qm.get_all_query_names()
Out[4]:
'Organism_Sequence, test'

'''returns the names of all the saved queries in user account'''

In [5]:
qm.get_query('test')
Out[5]:
'<saved-queries><query name="test" model="genomic" view="Gene.length Gene.symbol" longDescription="" sortOrder="Gene.length asc"></query></saved-queries>'

'''returns information about the query whose name is 'test'''

In [6]:
qm.delete_query('test')
Out[6]:
'test is deleted'

'''deletes the query whose name is 'test' from user's account'''

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.