Skip to content

Commit

Permalink
初次提交代码库
Browse files Browse the repository at this point in the history
  • Loading branch information
mahui-cn committed Nov 13, 2024
0 parents commit f81ddec
Show file tree
Hide file tree
Showing 12 changed files with 1,385 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__pycache__/*
data/*
indexes/*
haplotree/*
*.zip
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python 调试程序: 当前文件",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": [
"<",
"data/data.json"
]
}
]
}
5 changes: 5 additions & 0 deletions .weapp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"project": "weapp-haplotyping",
"language": "python3",
"markdown": 1
}
Binary file added cube.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions echarts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
import pyecharts.options as opts
from pyecharts.charts import Pie


# 使用祖源模型数据生成pie
def make_pie(admix_model):
# 生成pie的坐标数据
x_data = []
y_data = []
for admix in admix_model["admix"]:
if round(admix["ratio"] * 100, 2) > 0:
x_data.append(admix["name_cn"])
y_data.append(admix["ratio"])

data_pair = [list(z) for z in zip(x_data, y_data)]
data_pair.sort(key=lambda x: x[1])

(
Pie(init_opts=opts.InitOpts(bg_color="#4fb1f7"))
.add(
series_name="祖源成分",
data_pair=data_pair,
rosetype="radius",
radius="55%",
center=["50%", "50%"],
label_opts=opts.LabelOpts(is_show=False, position="center"),
)
.set_global_opts(
title_opts=opts.TitleOpts(
title=admix_model["name_cn"],
subtitle=admix_model["desc_cn"],
pos_left="center",
pos_top="20",
padding=5,
title_textstyle_opts=opts.TextStyleOpts(color="#fff"),
),
legend_opts=opts.LegendOpts(is_show=True),
)
.set_series_opts(
tooltip_opts=opts.TooltipOpts(trigger="item", formatter="{b}: {d}%"),
label_opts=opts.LabelOpts(color="rgba(255, 255, 255, 0.3)"),
)
.render("customized_pie.html")
)
Loading

0 comments on commit f81ddec

Please sign in to comment.