pantherapi-pyclient
Example client code for calling Panther API services
Installation
$ git clone https://github.com/pantherdb/pantherapi-pyclient.git
$ cd pantherapi-pyclient
$ python3 -m venv env
$ . env/bin/activate (bash) or source env/bin/activate.csh (C-shell or tcsh)
$ pip3 install -r requirements.txt
Running
$ python3 pthr_go_annots.py --service enrich --params_file params/enrich.json --seq_id_file resources/test_ids.txt
-
Currently, there are three options for --service.
- enrich -- This is the statistical overrepresentation test on a list of genes.
- geneinfo -- This call provides GO and pathway annnotations to the uploaded genes.
- ortholog -- This call returns the orthologs of the uploaded list. Maximum of 10 genes can be loaded. The orthologs can be from a specified genome, or from all genomes in the PANTHER database (132 total).
-
The json file in the params folder can be edited according to uploaded data and the type of call.
enrich.json
There are four items to be specified in this file.
"organism": "9606", --specify an organism with a taxon ID
"annotDataSet": "GO:0008150", --specify an annotation data set. See below for the supported data type
"enrichmentTestType": "FISHER", --enter either FISHER (for Fisher's Exact test) or BINOMIAL (for binomial distribution test)
"correction": "FDR" --specify the multi test correction method (FDR, BONFERRONI, or NONE)
geneinfo.json
The organism taxon ID needs to be specified to match the uploaded data.
ortholog.json
There are three items to be specified
"organism": "9606", -- specify the organism of the uploaded genes
"orthologType": "LDO" -- specify the type of ortholog, e.g., LDO (for least divergent ortholog), or all.
"targetOrganism": “10090,7227” -- specifiy the taxon ids for the target organisms, separated by a comma.
How to find a Taxon ID?
There are three ways to find the exact taxon IDs for genomes supported by PANTHER.
- Go to the PANTHER Open API site (http://pantherdb.org/services/tryItOut.jsp?url=%2Fservices%2Fapi%2Fpanther), and use the /supportedgenomes service.
- Go directly to the API link page (http://pantherdb.org/services/oai/pantherdb/supportedgenomes).
- Run the following command: curl -X POST "http://pantherdb.org/services/oai/pantherdb/supportedgenomes" -H "accept: application/json"
Use the taxon ID that corresponds to the genomes in the ‘name’ field.
How to find the ID for supported annotation dataset?
There are three similar ways to find the IDs or text needed for the supported annotation dataset.
- Go to the PANTHER Open API site (http://pantherdb.org/services/tryItOut.jsp?url=%2Fservices%2Fapi%2Fpanther), and use the /supportedannotdatasets service.
- Go directly to the API link page http://pantherdb.org/services/oai/pantherdb/supportedannotdatasets).
- Run the following command: curl -X POST "http://pantherdb.org/services/oai/pantherdb/supportedannotdatasets" -H "accept: application/json"
Use the text in the ‘id’ field for the parameter files.
Usage
$ python3 pthr_go_annots.py -h
usage: pthr_go_annots.py [-h] [-s SERVICE] [-p PARAMS_FILE] [-f SEQ_ID_FILE]
optional arguments:
-h, --help show this help message and exit
-s SERVICE, --service SERVICE
Panther API service to call (e.g. 'enrich',
'geneinfo', 'ortholog')
-p PARAMS_FILE, --params_file PARAMS_FILE
File path to request parameters JSON file
-f SEQ_ID_FILE, --seq_id_file SEQ_ID_FILE
File path to list of sequence identifiers
Dependencies
requests==2.22.0