Package: naga-gwas-rest
naga-gwas-restREST service forNetwork Assisted Genomic Analysis (NAGA)For more information please click here to visit our wikiThis service is currently running here:http://nbgwas.ucsd.eduCompatibilityTested with Python 3.6 inAnacondaDependencies to runnaga-gwasndex2python-daemonflaskflask-restplusnumpyAdditional dependencies to buildGNU makewheelsetuptoolsInstallationIt is highly reccommended one useAnacondafor Python environmentgitclonehttps://github.com/idekerlab/naga-gwas-rest.gitcdnaga-gwas-restmakeinstallRunning service in development modeNOTE:Example below runs the REST service and not the task runner.# It is assumed the application has been installed as described aboveexportFLASK_APP=nbgwas_restflaskrun# --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 terminalClick here for information on launching service via Vagrant VMExample usage of serviceBelow is a small script that leverages the nbgwas_rest service to run NAGA on the
compressednagadata/schizophrenia.txt.gzpassed into the script on the command line#!/usr/bin/env pythonimportsysimportgzipimporttimeimportrequests# pass the gzipped schizophrenia.txt.gznetworkfile=sys.argv[1]# set parametersdata_dict={}data_dict['protein_coding']='hg18'data_dict['window']=10000data_dict['ndex']='f93f402c-86d4-11e7-a10d-0ac135e8bacf'# set snp filefiles={'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 202ifr.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 resultif'Location'notinr.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()whilegetres.status_code!=200orjson_res['status']=='submitted'orjson_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 namedfoo.pyand run from base directory of this source tree./foo.pynagadata/schizophrenia.txt.gzExample 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'}BugsPlease report themhereAcknowledgementsOriginal implementation bySamson FongInitial template created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.7.1 (2021-02-03)Minor changes to enable naga_taskrunner.py to run as a systemd service on centos7 boxes0.7.0 (2019-07-01)Added dm6 in list of valid protein coding region files0.6.0 (2019-05-06)Added mm10 and rn6 in list of valid protein coding region files0.5.0 (2019-03-07)Replace infinite heat values returned from NAGA bugissue #24Add naga version used in processing to result jsonissue #23Rename to naga-gwas-restissue #22Add input parameters snp_analyzer/get endpoint enhancementissue #20Modify naga_taskrunner.py to run in a daemon modeissue #30.4.1 (2018-12-20)Replace Association with Analysis in REST service description bugissue #190.4.0 (2018-12-19)Enabled DELETE rest endpointissue #16Fixed problems including numpy and running under apache modwsgi bugissue #15nbgwas_taskrunner.py should remove snp level summary file after job runsissue #50.1.1 (2018-11-30)First release onto github