23andme-node 中文文档教程

发布于 11年前 浏览 27 项目主页 更新于 3年前

23andme-node

欢迎提出请求和建议!

Index

Installation

npm install 23andme-node

Usage

var g23 = require('23andme-node');

g23.getProfiles({token: 'fdab6a6892b198e40c2484bf2121f761'}, function (err, data) {
  console.log(utils.inspect(err || data, false, null));
});

Documentation

所有方法都返回带有签名的回调 callback(error, data)

dataerror 是 JavaScript 对象。

所有方法都需要一个至少具有用户身份验证 tokenparams 对象。

无论 HTTP 谓词如何,所有方法都返回相同的 data 对象。

可能的错误消息:

invalid_request - 请求缺少必需的参数,或者包含不受支持或不正确的参数。

invalid_client - 客户端身份验证失败(例如未知客户端、未包含客户端凭据、包含多个客户端凭据或不支持的凭据类型)。

unauthorized_client - 客户端无权使用此方法请求授权代码。

access_denied - 资源所有者或授权服务器拒绝了请求。

invalid_scope - 请求的范围无效、未知或格式错误。

unsupported_response_type - 授权服务器不支持使用此方法获取授权代码。

官方 API 文档

getProfiles(params, callback(error, data))

params

  • None!

data

```javascript { 名字:“格雷戈尔”, 姓氏:“孟德尔”, 编号:“a42e94634e3f7683”, 简介:[ { 名字:“约翰”, 姓氏:“孟德尔”, 编号:c4480ba411939067 }, ... ] }

## getProfileNames(params, callback(error, data))

### params

* `profileId` - Optional. Filters names to just one profile.

### data

javascript { 编号:“c4480ba411939067”, urlsize4040: "https://…cfff05bbbT.00299299.jpg", urlsize6060: "https://…cfff05bbbS.00299299.jpg", url大小200200:“https://…ff05bbbM.00299_299.jpg” }

## getProfilePictures(params, callback(error, data))

### params

* `profileId`

### data

javascript { 编号:“c4480ba411939067”, urlsize4040: "https://…cfff05bbbT.00299299.jpg", urlsize6060: "https://…cfff05bbbS.00299299.jpg", url大小200200:“https://…ff05bbbM.00299_299.jpg” }

## getPublished(params, callback(error, data))

### params

* `profileId`
* `featureId` - Values are `'music'`, `'neanderthal'`, `'maternal'`, `'paternal'`, `'composition'`
* `linkId` - Optional. Filters results to just one link.

### data

javascript { 编号:“c4480ba411939067”, 网址:“https://www.23andme.com/published/…/”, 链接id:“925v3n92424g4”, 特征id:“尼安德特人”, 状态:“未发布” }

## getIntroduction(params, callback(error, data))

### params


* `profileId`
* `matchId`

### data

javascript { 介绍: { 状态:“收到”, 可见性:“基因组”, 消息文本:“嗨!想探索吗?” }, 可以发送:false }

## getGenotypes(params, callback(error, data))

### params


* `profileId`
* `locations` - An array of SNP strings. 
* `unfiltered` - Optional. Possible values are `true` or `false`

### data

javascript { i3000001:“二”, rs3094315:“AA” 编号:“c4480ba411939067” }

## getGenomes(params, callback(error, data))

### params

* `profileID`
* `unfiltered` - Optional. Possible values are `true` or `false`

### data

javascript { 编号:“c4480ba411939067”, 基因组:“ACTAGTAG__TTGADDAAIICCTT”// …(2MB 字符串!) }

## getHaplogroups(params, callback(error, data))

### params

* `profileId`

### data

javascript { 母体终端snps:[ { rsid: "i3001424", rcrs位置:“15874” }, { rsid: "i5050411", rcrs位置:“15874” } ], 父亲终端snps:[ { "rsid": "i3000015", “snp”:“M125” } ], 产妇:“D4e2”, 父亲:“D2a1”, 编号:“c4480ba411939067” }

## getAncestry(params, callback(error, data))

### params

* `profileId` 
* `threshold` - A number in the interval (0.5, 1.0) exclusive. Default is 0.75.

### data

javascript { ID:“7ad467ea509080fb” 祖先:{ 标签:“总计”, 比例:1.0, 未分配:0.0, 子人群:[ { 标签:“撒哈拉以南非洲”, 比例:0.8227 }, { 标签: "欧洲" 比例:0.1773, 未分配:0.0193, 子人群:[ { 标签:“北欧”, 比例:0.1579, 未分配:0.0725, 亚种群:[ { 标签:“法语和德语”, 比例:0.0676 }, ... ], }, ... ] }, ... ] } }

## getNeanderthal(params, callback(error, data))

### params

* `profileId` 

### data

javascript { ID:“7ad467ea509080fb” 尼安德特人:{ 比例:0.0310, } }

## getRelatives(params, callback(error, data))

### params

* `profileId`
* `filters` - An object with properties `limit`, `offset`, `since`, `share_status`, `intro_status`.

`share_status` can have the following values: `'Owned Profile'`, `'Sharing Genomes'`, `'Public Match'`

`intro_status` can have the following values: `'Introduction Sent'`, `'Introduction Received'`, `'Introduction Accepted'`, `'Introduction Declined'`, `'Introduction Cancelled'`

### data

脚本 { 编号:“18974891hh1f3h”, 计数:10, 亲戚们: [ { 匹配id: "48f2489h294hf", 名字:“Aodh”, 姓氏:“O'Donnell”, 性别男”, 出生年份:1977 年, 出生地:“美国”, 血统:“北欧”, 家庭地点:[ "弗吉尼亚州阿灵顿", "爱尔兰劳斯郡" ], 家庭姓氏:[ “林德尔”, “迪林厄姆”, “凯莉” ], 共享片段:23, 关系:“三表哥”, 预测的关系代码:32, 用户关系代码:空, 范围:[“三表哥”,“六表哥”], 相似度:0.24, 母体单倍群:“K1b1a1”, 父本单倍群:“G2a5”, 母方:假的, 父亲方面:是的, 注释:“我们有相同熟悉的姓氏”, 补充:1348699925, 更新:1348699975, 居住地:“北卡罗来纳州”, 介绍状态:“介绍已接受”, 共享状态:“共享基因组”, 个人资料图片网址:{ urlsize4040: "https://…cfff05bbbT.00299299.jpg", …… } }, ... ] }

## getRisks(params, callback(error, data))

### params

* `profileId`

### data

javascript { 编号:“c4480ba411939067”, 风险:[ { 描述:“心房颤动”, 报告id:“atrialfib”, 人群风险:0.2715, 风险:0.4164 }, { 描述:“前列腺癌”, 报告id:“前列腺”, 人群风险:0.1783, 风险:0.2585 }, ... ] }

## getCarriers(params, callback(error, data))

### params

* `profileId`

### data

javascript { 编号:“c4480ba411939067”, 药物反应:[ { 描述:“饮酒、吸烟和食道癌风险”, 报告id: "alcoholesophagealpgx", 状态:“典型” }, { 描述:“对丙型肝炎治疗的反应”, 报告id:“hepcpeginf_ribavirin”, 状态:“减少” }, ... ] }

## getTraits(params, callback(error, data))

### params

* `profileId`

### data

javascript { 我"d:"c4480ba411939067", 特征:[ { 描述:“肌肉表现”, 报告id:“肌肉表现”, 可能的特征:[ “可能的短跑运动员”, “不太可能的短跑运动员” ], 特征:“不太可能的短跑运动员” }, { 描述:“抵抗艾滋病毒/艾滋病”, 报告id: "hiv", 可能的特征:[ “不抗拒”, “部分抵抗” ], 特性:“不抵抗” }, ... ], } ```

postProfilePicture(params, callback(error, data))

params

  • profileId
  • image - A buffer.

postPublish(params, callback(error, data))

params

  • profileId
  • featureId - Values are 'music', 'neanderthal', 'maternal', 'paternal', 'composition'

putPublish(params, callback(error, data))

params

  • profileId
  • featureId - Values are 'music', 'neanderthal', 'maternal', 'paternal', 'composition'
  • linkId
  • status - Values are 'published' or 'unpublished'

patchIntroduction(params, callback(error, data))

params

  • profileId
  • matchId
  • status - Possible values are 'accepted', 'rejected', 'read', 'cancelled'.
  • visibility - Possible values are 'anonymous', 'profile', 'genome'

必须至少提供 statusvisibility 之一作为参数。

patchRelatives(params, callback(error, data))

params

  • profileId
  • matchId
  • notes - A string.
  • relationshipCode

relationshipCode 的可能值:

0

1 同卵双胞胎

2 父亲

3 母亲

< code>4 儿子

5 女儿

6 兄弟

7 姐姐

8 同父异母兄弟

9< /code> 半姐妹

10 祖父

11 祖母

12 孙子

13 孙女

14 叔叔

15 阿姨

16 侄子

17 侄女

18 曾祖父

19 曾孙

20 曾祖母

21 曾孙女

22 曾祖父

23

曾祖母 < code>24 曾侄

25 侄孙女

26 第一个堂兄弟

27 第一个堂兄弟,一次被移除

28 第一个堂兄弟,两次被移除

29 第二代表亲

30 第二代表亲,一次移除

31 第二代堂兄弟,两次移除

32 三代表亲

33 第三代 表亲,一次被移除

34 第三个堂兄弟,两次被移除

35 第四个堂兄弟

38 第五个堂兄弟

41 第六个堂兄弟

44 远亲

TODO

  • Tests

23andme-node

Pull requests and suggestions welcome!

Index

Installation

npm install 23andme-node

Usage

var g23 = require('23andme-node');

g23.getProfiles({token: 'fdab6a6892b198e40c2484bf2121f761'}, function (err, data) {
  console.log(utils.inspect(err || data, false, null));
});

Documentation

All methods return a callback with the signature callback(error, data).

data and error are JavaScript objects.

All methods expect a params object with at least the user's authentication token.

All methods return the same data object regardless of HTTP verb.

Possible error messages:

invalid_request - The request is missing a required parameter, or includes an unsupported or incorrect parameter.

invalid_client - Client authentication failed (e.g. unknown client, no client credentials included, multiple client credentials included, or unsupported credentials type).

unauthorized_client - The client is not authorized to request an authorization code using this method.

access_denied - The resource owner or authorization server denied the request.

invalid_scope - The requested scope is invalid, unknown, or malformed.

unsupported_response_type - The authorization server does not support obtaining an authorization code using this method.

Official API documentation.

getProfiles(params, callback(error, data))

params

  • None!

data

```javascript { firstname: "Gregor", lastname: "Mendel", id: "a42e94634e3f7683", profiles: [ { firstname: "Johann", lastname: "Mendel", id: c4480ba411939067 }, … ] }

## getProfileNames(params, callback(error, data))

### params

* `profileId` - Optional. Filters names to just one profile.

### data

javascript { id: "c4480ba411939067", urlsize4040: "https://…cfff05bbbT.00299299.jpg", urlsize6060: "https://…cfff05bbbS.00299299.jpg", urlsize200200: "https://…ff05bbbM.00299_299.jpg" }

## getProfilePictures(params, callback(error, data))

### params

* `profileId`

### data

javascript { id: "c4480ba411939067", urlsize4040: "https://…cfff05bbbT.00299299.jpg", urlsize6060: "https://…cfff05bbbS.00299299.jpg", urlsize200200: "https://…ff05bbbM.00299_299.jpg" }

## getPublished(params, callback(error, data))

### params

* `profileId`
* `featureId` - Values are `'music'`, `'neanderthal'`, `'maternal'`, `'paternal'`, `'composition'`
* `linkId` - Optional. Filters results to just one link.

### data

javascript { id: "c4480ba411939067", url: "https://www.23andme.com/published/…/", linkid: "925v3n92424g4", featureid: "neanderthal", status: "unpublished" }

## getIntroduction(params, callback(error, data))

### params


* `profileId`
* `matchId`

### data

javascript { introduction: { status: "received", visibility: "genome", messagetext: "Hi! Want to explore?" }, cansend: false }

## getGenotypes(params, callback(error, data))

### params


* `profileId`
* `locations` - An array of SNP strings. 
* `unfiltered` - Optional. Possible values are `true` or `false`

### data

javascript { i3000001: "II", rs3094315: "AA" id: "c4480ba411939067" }

## getGenomes(params, callback(error, data))

### params

* `profileID`
* `unfiltered` - Optional. Possible values are `true` or `false`

### data

javascript { id: "c4480ba411939067", genome: "ACTAGTAG__TTGADDAAIICCTT" // … (2MB string!) }

## getHaplogroups(params, callback(error, data))

### params

* `profileId`

### data

javascript { maternalterminalsnps: [ { rsid: "i3001424", rcrsposition: "15874" }, { rsid: "i5050411", rcrsposition: "15874" } ], paternalterminalsnps: [ { "rsid": "i3000015", "snp": "M125" } ], maternal: "D4e2", paternal: "D2a1", id: "c4480ba411939067" }

## getAncestry(params, callback(error, data))

### params

* `profileId` 
* `threshold` - A number in the interval (0.5, 1.0) exclusive. Default is 0.75.

### data

javascript { id: "7ad467ea509080fb" ancestry: { label: "Total", proportion: 1.0, unassigned: 0.0, subpopulations: [ { label: "Sub-Saharan African", proportion: 0.8227 }, { label: "European" proportion: 0.1773, unassigned: 0.0193, subpopulations: [ { label: "Northern European", proportion: 0.1579, unassigned: 0.0725, sub_populations: [ { label: "French and German", proportion: 0.0676 }, … ], }, … ] }, … ] } }

## getNeanderthal(params, callback(error, data))

### params

* `profileId` 

### data

javascript { id: "7ad467ea509080fb" neanderthal: { proportion: 0.0310, } }

## getRelatives(params, callback(error, data))

### params

* `profileId`
* `filters` - An object with properties `limit`, `offset`, `since`, `share_status`, `intro_status`.

`share_status` can have the following values: `'Owned Profile'`, `'Sharing Genomes'`, `'Public Match'`

`intro_status` can have the following values: `'Introduction Sent'`, `'Introduction Received'`, `'Introduction Accepted'`, `'Introduction Declined'`, `'Introduction Cancelled'`

### data

javacsript { id: "18974891hh1f3h", count: 10, relatives: [ { matchid: "48f2489h294hf", firstname: "Aodh", lastname: "O'Donnell", sex: "Male", birthyear: 1977, birthplace: "United States", ancestry: "Northern Europe", familylocations: [ "Arlington, VA", "County Louth, Ireland" ], familysurnames: [ "Lindell", "Dillingham", "Kelly" ], sharedsegments: 23, relationship: "3rd Cousin", predictedrelationshipcode: 32, userrelationshipcode: null, range: ["3rd Cousin", "6th Cousin"], similarity: 0.24, maternalhaplogroup: "K1b1a1", paternalhaplogroup: "G2a5", maternalside: false, paternalside: true, notes: "we have the same familiar surnames", added: 1348699925, updated: 1348699975, residence: "North Carolina", introstatus: "Introduction Accepted", sharestatus: "Sharing Genomes", profilepictureurls: { urlsize4040: "https://…cfff05bbbT.00299299.jpg", … } }, … ] }

## getRisks(params, callback(error, data))

### params

* `profileId`

### data

javascript { id: "c4480ba411939067", risks: [ { description: "Atrial Fibrillation", reportid: "atrialfib", populationrisk: 0.2715, risk: 0.4164 }, { description: "Prostate Cancer", reportid: "prostate", populationrisk: 0.1783, risk: 0.2585 }, … ] }

## getCarriers(params, callback(error, data))

### params

* `profileId`

### data

javascript { id: "c4480ba411939067", drugresponses: [ { description: "Alcohol Consumption, Smoking and Risk of Esophageal Cancer", reportid: "alcoholesophagealpgx", status: "typical" }, { description: "Response to Hepatitis C Treatment", reportid: "hepcpeginf_ribavirin", status: "reduced" }, … ] }

## getTraits(params, callback(error, data))

### params

* `profileId`

### data

javascript { i"d: "c4480ba411939067", traits: [ { description: "Muscle Performance", reportid: "muscleperformance", possibletraits: [ "Likely Sprinter", "Unlikely Sprinter" ], trait: "Unlikely Sprinter" }, { description: "Resistance to HIV/AIDS", reportid: "hiv", possibletraits: [ "Not Resistant", "Partially Resistant" ], trait: "Not Resistant" }, … ], } ```

postProfilePicture(params, callback(error, data))

params

  • profileId
  • image - A buffer.

postPublish(params, callback(error, data))

params

  • profileId
  • featureId - Values are 'music', 'neanderthal', 'maternal', 'paternal', 'composition'

putPublish(params, callback(error, data))

params

  • profileId
  • featureId - Values are 'music', 'neanderthal', 'maternal', 'paternal', 'composition'
  • linkId
  • status - Values are 'published' or 'unpublished'

patchIntroduction(params, callback(error, data))

params

  • profileId
  • matchId
  • status - Possible values are 'accepted', 'rejected', 'read', 'cancelled'.
  • visibility - Possible values are 'anonymous', 'profile', 'genome'

At least one of status and visibility has to be provided as parameters.

patchRelatives(params, callback(error, data))

params

  • profileId
  • matchId
  • notes - A string.
  • relationshipCode

Possible values for relationshipCode:

0 You

1 Identical Twin

2 Father

3 Mother

4 Son

5 Daughter

6 Brother

7 Sister

8 Half Brother

9 Half Sister

10 Grandfather

11 Grandmother

12 Grandson

13 Granddaughter

14 Uncle

15 Aunt

16 Nephew

17 Niece

18 Great Grandfather

19 Great Grandson

20 Great Grandmother

21 Great Granddaughter

22 Great Uncle

23 Great Aunt

24 Great Nephew

25 Great Niece

26 1st Cousin

27 1st Cousin, Once Removed

28 1st Cousin, Twice Removed

29 2nd Cousin

30 2nd Cousin, Once Removed

31 2nd Cousin, Twice Removed

32 3rd Cousin

33 3rd Cousin, Once Removed

34 3rd Cousin, Twice Removed

35 4th Cousin

38 5th Cousin

41 6th Cousin

44 Distant Cousin

TODO

  • Tests
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文