当前位置: 首页 > article >正文

GWAS数据库ieugwasr包最新配置API用户Token方法

1. 最新的 API 授权要求

https://api.opengwas.io/api/#authentication
image.png

官方说明:

To be deprecated soon - Token obtained from Google OAuth
The documentation provides a list of endpoints, the parameters they require, descriptions of the data that is returned, and an interactive way to try out each of the endpoints.
The database of GWAS summary data mostly contains public data, however there are some ‘private’ datasets, which can only be accessed by authorised users.
Authentication is managed using Google OAuth 2.0. In order to authenticate, you will need to generate a ‘token’ for each session in which private access is required.
The simplest way to obtain an authentication token is to use a browser to authenticate with your gmail account at this link.
The access token can also be obtained using the ieugwasr::get_access_token() function, more information about that here.


Now rolling out - JSON Web Token (JWT) issued by us

From Wednesday 1st May 2024, you need to prove your identity (authenticate) to use our service, even if you are querying a public dataset.
JSON Web Token (JWT) is used for authentication. The token is required for most endpoints. To obtain a token, sign in to the account page. You will be prompted to generate a token, which is valid for 14 days. To use your token, add it into your request header under the key Authorization with value Bearer your_token. Note that there is a whitespace between Bearer and your token.
The API documentation provides a list of endpoints, whether they are protected (require authentication), the parameters and responses, and an interactive way to try out. To try the protected endpoints, click the green ‘Authorize’ button in API docs and provide your token as instructed.


2. GWAS 数据库注册 API

  • 地址:https://api.opengwas.io/
  • 你可以使用不同的账户登录,额度不一样
  • 建议用微软账户或者 GitHub

image.png

  • 登录过后,创建一个 API token
  • 只显示一次,务必记得复制保存
  • 注意,每个token有效期为14天!!!

image.png


3. 设置 R(ieugwasr 包)

3.1 创建.Renviron文件

  • 可以在用户目录
  • 也可以创建在工作目录

3.1.1 在用户目录进行创建

  • 比如我的用户名是 bio,因此我的用户目录是 home/bio

image.png

3.1.2 修改.Renviron文件内容

  • 内容是:OPENGWAS_JWT=

image.png

3.2 重启 R session

  • 记得一定要重启 R session
  • 不知道怎么重启的建议直接重启电脑或者虚拟机

3.3 运行测试

 首先需要更新一下ieugwasr包
install.packages("ieugwasr")

# 或者你用github安装开发版:
# remotes::install_github("mrcieu/ieugwasr")

# 载入包
library(dplyr) #这个包提供管道符号支持
library(ieugwasr)

# 查看是否识别到token
ieugwasr::get_opengwas_jwt()
# 返回你的token,说明成功

# user(),查看token对应的用户信息
ieugwasr::user()

# api_status()
ieugwasr::api_status()


参考资料

  1. 最新 API 说明:https://api.opengwas.io/api/#authentication
  2. GWAS API 注册后台:https://api.opengwas.io/profile/
  3. GWAS API 官方文档:https://api.opengwas.io/api/docs
  4. ieugwaspy:https://mrcieu.github.io/ieugwaspy/index.html
  5. ieugwas 最新 API 配置:https://mrcieu.github.io/ieugwasr/articles/guide.html#authentication
  6. GWAS 数据库官网:https://gwas.mrcieu.ac.uk/

http://www.kler.cn/a/416211.html

相关文章:

  • 中国科学院大学研究生学术英语读写教程 Unit7 Materials Science TextA 原文和翻译
  • 循环神经网络:从基础到应用的深度解析
  • 使用PyTorch在AMD GPU上进行INT8量化实现精简化的LLM推理
  • python找出Excel文件大于2048个字符长度的数据
  • JiaJia-CP-1,2,3的WP(1)
  • mybatis-plus 对于属性为null字段不更新
  • JavaScript异步编程和与之相关的概念
  • 音视频入门基础:MPEG2-TS专题(10)——PAT简介
  • hdlbits系列verilog解答(Exams/m2014 q4a)-86
  • 使用vcpkg自动链接tinyxml2时莫名链接其他库(例如boost)
  • 基于单片机的温度控制系统设计
  • 【IEEE出版】2024年大数据、神经网络与深度学习研讨会(BDNNDL 2024,12月13日-15日)
  • 重装系统后恢复matlab和anaconda的方法
  • 嵌入式Qt使用ffmpeg视频开发记录
  • 穿越机与无人机的区别:深入解析
  • 【Leetcode 每日一题】3250. 单调数组对的数目 I
  • 【C#】C# resx方式实现多语言切换(静态切换)
  • RAG架构类型
  • 物联网客户端在线服务中心(客服功能/私聊/群聊/下发指令等功能)
  • 【视频】OpenCV:读写视频文件VideoCapture和VideoWriter