demo2-接口文档¶
接口调用函数¶
import requests
API_HOST = "http://localhost:8000"
TOKEN = "970e8f84a06dfxxxxxx6f0356050ba"
def call_api(method:str, api_path:str, params:any):
#print(params)
url = f"{API_HOST}{api_path}"
headers = {"content-type": "application/json",
"Authorization": f"Token {TOKEN}"}
response = requests.request(method, url, json=params, headers=headers)
if response.status_code not in [200, 201]:
print(f"调用{url}失败,返回信息如下:")
if response.status_code:
print(f"状态码:{response.status_code}")
if response.text:
print(response.text.encode('utf-8'))
return 0
return response.json()
run的QC完成状态接口¶
输入run即可返回其QC是否完成
def QC_status(run):
# Call the API
res = call_api("get", f"/Intermediate/common_fastp/{run}","")
if 0 == res or not "run" in res:
return False
return True
样本的mapping完成状态和深度接口¶
输入样本id即可返回其样本mapping步骤是否完成,同时返回样本有效深度
def mapping_status(sample_id):
# Call the API
res = call_api("get", f"/Intermediate/srWGS_mapping/{sample_id}","")
if 0 == res or not "sample_id" in res:
return (False,-1)
return (True,float(res['mean_depth']))
样本的calling完成状态接口¶
输入样本id即可返回其样本calling步骤是否完成
def calling_status(sample_id):
# Call the API
res = call_api("get", f"/Intermediate/srWGS_calling/{sample_id}","")
if 0 == res or not "sample_id" in res:
return False
return True
本站总访问量 次
Authors: