本文整理汇总了Python中dataset.DataSet.get_region方法的典型用法代码示例。如果您正苦于以下问题:Python DataSet.get_region方法的具体用法?Python DataSet.get_region怎么用?Python DataSet.get_region使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dataset.DataSet
的用法示例。
在下文中一共展示了DataSet.get_region方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_region
# 需要导入模块: from dataset import DataSet [as 别名]
# 或者: from dataset.DataSet import get_region [as 别名]
def get_region(region):
"""
The main endpoint to get the information on the given region
:param region: The genomic region who's data is to be extracted. ( chrom:start-end )
:type: str
ADDITIONAL PARAMETERS of the endpoint :
These parameters are to be added to the query url as so : /region/<string:region> **?param=<string>**
:param dataset: Name of the dataset in which the region's data is to be fetched.
:type: str
:return: A JSONify dict with the the formated data under the "response" key.
:rtype: dict
"""
return_data = defaultdict(list)
query_string = request.query_string.decode("utf-8")
querys = query_string.split("&")
datasets = []
r = Region(region.split(":")[0], region.split(":")[1].split("-")[0],region.split("-")[1])
for query in querys:
if query.split("=")[0] == "dataset":
dataset = DataSet(query.split("=")[1])
data = dataset.get_region(r)
dataset_name = os.path.splitext(os.path.basename(query.split("=")[1]))[0]
return_data[dataset_name] = data
return jsonify({"response":return_data, "sucess": 1})