API¶
- HVBase API基于GA4GH标准设计,采用RESTful框架开发。
- 所有方法的链接地址为:http://bigdata.genomics.cn:5000
getVariantSetsIDList()¶
方法描述:查询VariantSet的ID列表
方法参数:None
结果类型:array<string>
- 结果描述:
- variantSetID
VariantSet ID
getVariantSet(id)¶
方法描述:通过ID获取VariantSet
方法参数:id(string) - VariantSet ID
结果类型:array<map<string, string>>
- 结果描述:
- id(string)
VariantSet ID
- name(null|string)
VariantSet名称
- dataSetID(string)
DataSet ID
- referenceSetID(string)
referenceSet ID
- metadata(array<map<string, string>>)
- key(string)
键
- value(string)
值
- id(string)
ID
- description(string)
此元数据的描述信息
- info(map<string, string>)
键值对结构的信息
getVariantSetCallSetsIDList(VariantSetID)¶
GET
/VariantSetCallSetsIDList/{VariantSetID}
方法描述:通过ID获取VariantSet
方法参数:id(string) - VariantSet ID
结果类型:array<map<string, string>>
- 结果描述:
- variantSetID(string)
VariantSet ID
- callSetsIDList(array<map<string, string>>)
- key(string)
callSetID
- value(string)
callSetName
getVariant(id)¶
GET
/Variants/{id}
方法描述:通过ID获取VariantSet
方法参数:id(string) - 变异ID,格式为:chr-position。示例:chr1-1000002
结果类型:map<string, string>
- 结果描述:
- id(string)
Variant ID
- variantSetId(string)
VariantSet ID
- names(array<string>)
Variant名称。示例:RefSNP ID
- created(null|long)
创建时间,格式为时间戳
- updated(null|long)
最后更新时间,格式为时间戳
- referenceName(string)
染色体名称
- start(long)
染色体起始坐标,0-起始
- end(long)
染色体终止坐标
- referenceBases(string)
参考序列碱基
- alternateBases(array<string>)
变异序列碱基
- info(map<string, string>)
变异信息
- calls(array<string>)
基因型
getCallSetsIDList()¶
GET
/CallSetsIDList
方法描述:查询CallSet的ID列表
方法参数:None
结果类型:array<string>
- 结果描述:
- callSetID
CallSet ID
getCallSet(id)¶
GET
/CallSets/{id}
方法描述:查询VariantSet的ID列表
方法参数:id(string) - VariantSet ID
结果类型:array<map<string, string>>
- 结果描述:
- id(string)
CallSet ID
- name(string)
CallSet名称
- sampleID(string)
样本ID
- variantionSetIDs(array<string>)
VariationSet ID列表
- created(null|long)
创建时间,格式为时间戳
- updated(null|long)
最后更新时间,格式为时间戳
- info(map<string, string>)
变异信息
getCall(id)¶
GET
/Calls/{id}
方法描述:通过ID获取VariantSet
方法参数:id(string) - Call ID,格式为:chr-position-sampleID。示例:chr1-1000002-10733
结果类型:map<string, string>
- 结果描述:
- callSetID
CallSet ID
- callSetName
CallSet名称
- genotype(array<int>)
基因型,格式参照VCF
- phaseset(null|string)
基因型状态
- genotypeLikelihood(array<double>)
基因型频率
- info(map<string, string>)
变异信息
getEthnicityList()¶
GET
/EthnicityList
方法描述:查询种族列表
方法参数:None
结果类型:array<string>
- 结果描述:
- Ethnicity
种族
getPhenotype()¶
GET
/Phenotypes/<id>
方法描述:查询样本表型
方法参数:id(string) - 样本ID
结果类型:map<string, string>
- 结果描述:
参见 http://hvbase.readthedocs.io/zh_CN/latest/schema.html 样本表型
Python 示例¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #!/usr/bin/env python
#encoding=utf-8
import urllib;
import time;
host = '192.168.3.155';
port = 5000;
urlPrefix = 'http://' + host + ':' + str(port);
def clock(log):
log = str(log).strip();
print "=> " + log + " at " + str(time.asctime());
def main():
chromosome = 'chr1';
pos = 1000002;
sampleID = 10733;
variantID = chromosome + '-' + str(pos);
callID = variantID + '-' + str(sampleID);
variantSetID = '1000genomes';
clock('start');
# getVariantSetsIDList()
url = urlPrefix + '/VariantSetsIDList';
clock('getVariantSetsIDList() - ' + url);
content = urllib.urlopen(url);
result = content.read();
# getVariantSetCallSetsIDList()
url = urlPrefix + '/VariantSetCallSetsIDList/' + variantSetID;
clock('getVariantSetsIDList() - ' + url);
content = urllib.urlopen(url);
result = content.read();
print result;
# getVariant(id)
url = urlPrefix + '/Variants/' + variantID;
clock('getVariant() - ' + url);
content = urllib.urlopen(url);
result = content.read();
print result;
# getCallSetsIDList()
url = urlPrefix + '/CallSetsIDList';
clock('getCallSetsIDList() - ' + url);
content = urllib.urlopen(url);
result = content.read();
# print result;
# getCall()
url = urlPrefix + '/Calls/' + callID;
clock('getCall() - ' + url);
content = urllib.urlopen(url);
result = content.read();
print result;
# getEthnicityList()
url = urlPrefix + '/EthnicityList';
clock('getEthnicityList() - ' + url);
content = urllib.urlopen(url);
result = content.read();
print result;
# getPhenotype()
url = urlPrefix + '/Phenotypes/' + str(sampleID);
clock('getPhenotype() - ' + url);
content = urllib.urlopen(url);
result = content.read();
print result;
clock('end');
if __name__ == '__main__':
main();
|