REST service for Network Assisted Genomic Analysis (NAGA)
Project description
naga-gwas-rest
REST service for Network Assisted Genomic Analysis (NAGA)
For more information please click here to visit our wiki
This service is currently running here: http://nbgwas.ucsd.edu
Compatibility
Tested with Python 3.6 in Anaconda
Dependencies to run
Additional dependencies to build
GNU make
Installation
It is highly reccommended one use Anaconda for Python environment
git clone https://github.com/idekerlab/naga-gwas-rest.git
cd naga-gwas-rest
make install
Running service in development mode
NOTE: Example below runs the REST service and not the task runner.
# It is assumed the application has been installed as described above
export FLASK_APP=nbgwas_rest
flask run # --host=0.0.0.0 can be added to allow all access from interfaces
# Service will be running on http://localhost:5000
# NOTE: To have tasks processed naga_taskrunner.py must be started in
# another terminal
Click here for information on launching service via Vagrant VM
Example usage of service
Below is a small script that leverages the nbgwas_rest service to run NAGA on the compressed nagadata/schizophrenia.txt.gz passed into the script on the command line
#!/usr/bin/env python
import sys
import gzip
import time
import requests
# pass the gzipped schizophrenia.txt.gz
networkfile = sys.argv[1]
# set parameters
data_dict = {}
data_dict['protein_coding']='hg18'
data_dict['window']=10000
data_dict['ndex']='f93f402c-86d4-11e7-a10d-0ac135e8bacf'
# set snp file
files = {'snp_level_summary': gzip.open(networkfile, 'rb')}
url = 'http://nbgwas.ucsd.edu/rest/v1/snp_analyzer'
r = requests.post(url, data=data_dict, files=files,
timeout=30)
# If successful the previous POST will return 202
if r.status_code != 202:
sys.stderr.write('Submission failed with code: ' + str(r.status_code) +
'\n')
sys.stderr.write('Message: ' + str(r.text) + '\n')
sys.exit(1)
# If successful Location will be set to a URL that can
# be polled for result
if 'Location' not in r.headers:
sys.stderr.write('Expected Location in Header, ' +
'but its not there: ' + str(r.headers) + '\n')
sys.exit(2)
resulturl = r.headers['Location']
getres = requests.get(resulturl, timeout=30)
json_res = getres.json()
while getres.status_code != 200 or json_res['status'] == 'submitted' or json_res['status'] == 'processing':
sys.stderr.write('.')
sys.stderr.flush()
time.sleep(5)
getres = requests.get(resulturl, timeout=30)
json_res = getres.json()
sys.stderr.write('\n')
sys.stdout.write(str(json_res) + '\n')
Assuming the above is saved in a file named foo.py and run from base directory of this source tree
./foo.py nagadata/schizophrenia.txt.gz
Example output:
{'result': {'A1BG': 1.818739214334769, 'A1CF': 2.9679830980888413,
'A2M': 3.9294999566765174, 'A2ML1': 1.4379620790934335, 'A3GALT2': 1.9918435374785632,
'A4GALT': 1.8734641163972634, 'A4GNT': 1.335302470858104, 'AAAS': 2.384799543926567,
'AACS': 2.965792987307328, 'AADAC': 1.455957465785784, 'AADACL2': 1.0156608351922358,
'AADACL3': 0.895944981993654, 'AADACL4': 1.2458363441128992, 'AADAT': 2.689141678947707,
'AAED1': 0.12364477699188797, 'AAGAB': 0.14237051805828474, 'AAK1': 5.652340641567231,
'AAMDC': 0.1647736242197245, 'AAMP': 3.2927511707526884, 'AANAT': 5.654764562774087,
'AAR2': 0.9427896961129361,
.
.
, 'status': 'done'}
Bugs
Please report them here
Acknowledgements
Original implementation by Samson Fong
Initial template created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.7.1 (2021-02-03)
Minor changes to enable naga_taskrunner.py to run as a systemd service on centos7 boxes
0.7.0 (2019-07-01)
Added dm6 in list of valid protein coding region files
0.6.0 (2019-05-06)
Added mm10 and rn6 in list of valid protein coding region files
0.5.0 (2019-03-07)
0.4.1 (2018-12-20)
Replace Association with Analysis in REST service description bug issue #19
0.4.0 (2018-12-19)
0.1.1 (2018-11-30)
First release onto github
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file naga-gwas-rest-0.7.1.tar.gz
.
File metadata
- Download URL: naga-gwas-rest-0.7.1.tar.gz
- Upload date:
- Size: 32.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dba711885ac7938fd0037a65287dfc7c7884c739ee636e7399bf9653941cc7ed |
|
MD5 | 318f50f60f9ae90f79194e20eb53808c |
|
BLAKE2b-256 | bf9f045c673f7623c0f8d780f5b79ea7a6b221959f87cd8bffbeb59ab550251a |
File details
Details for the file naga_gwas_rest-0.7.1-py2.py3-none-any.whl
.
File metadata
- Download URL: naga_gwas_rest-0.7.1-py2.py3-none-any.whl
- Upload date:
- Size: 26.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e32112184b96a22a91e6d864c2fdc8129d7cd5da1714784fce1197c6f76518b |
|
MD5 | 328da26257b0fc24b6ab3f889cd44da2 |
|
BLAKE2b-256 | fad6c255cd7c396998da174603a317feed9f8846363e818c1c7e62ed05516bde |