网络辅助基因组分析的rest服务(naga)
naga-gwas-rest的Python项目详细描述
Naga Gwas休息区
Network Assisted Genomic Analysis (NAGA)的rest服务
For more information please click here to visit our wiki
此服务当前正在此处运行:http://nbgwas.ucsd.edu
兼容性
- Tested with Python 3.6 in Anaconda
要构建的其他依赖项
- GNU make
- wheel
- setuptools
安装
建议在python环境中使用Anaconda一次
git clone https://github.com/idekerlab/naga-gwas-rest.git
cd naga-gwas-rest
make install
以开发模式运行服务
注意:下面的示例运行rest服务,而不是任务运行器。
# It is assumed the application has been installed as described above exportFLASK_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
服务使用示例
下面是一个小脚本,它利用nbgwas_rest服务在 压缩的nagadata/splitarity.txt.gz传递到命令行的脚本中
#!/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')
假设上述文件保存在名为foo.py的文件中,并从该源树的基目录运行
./foo.py nagadata/schizophrenia.txt.gz
示例输出:
{'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'}
虫子
请报告他们here
确认
- 由Samson Fong 执行的原始实现
- 使用Cookiecutter和audreyr/cookiecutter-pypackage项目模板创建的初始模板。
历史记录
0.7.0(2019-07-01)
- 在有效蛋白质编码区文件列表中添加了DM6
0.6.0(2019-05-06)
- 在有效蛋白质编码区文件列表中添加了mm10和rn6
0.5.0(2019-03-07)
0.4.1(2018-12-20)
- 用rest服务描述错误中的分析替换关联 issue #19
0.4.0(2018-12-19)
0.1.1(2018-11-30)
- github上的第一个版本