Skip to content

Commit c4be6a9

Browse files
committed
update ans
1 parent d3296d7 commit c4be6a9

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

examples/get_result_web.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from sympy import im
1111
from tqdm import tqdm
1212

13-
from dance.settings import METADIR
13+
from dance.settings import ATLASDIR, METADIR
1414
from dance.utils import try_import
1515

1616
# get yaml of best method
@@ -282,7 +282,7 @@ def get_new_ans(tissue):
282282
return new_df
283283

284284

285-
def write_ans(tissue, new_df):
285+
def write_ans(tissue, new_df, output_file=None):
286286
"""Process and write results for a specific tissue type to CSV.
287287
288288
Parameters
@@ -300,7 +300,8 @@ def write_ans(tissue, new_df):
300300
301301
"""
302302
# 检查是否存在现有文件
303-
output_file = f"atlas/sweep_results/{tissue}_ans.csv"
303+
if output_file is None:
304+
output_file = ATLASDIR / f"sweep_results/{tissue}_ans.csv"
304305
if os.path.exists(output_file):
305306
existing_df = pd.read_csv(output_file, index_col=0)
306307

tests/test_get_result_web.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def test_write_ans(tmp_path):
8989

9090
# 测试写入新数据
9191
from examples.get_result_web import write_ans
92-
write_ans("heart", new_data)
92+
write_ans("heart", new_data, output_file)
9393

9494
# 读取合并后的结果
9595
merged_df = pd.read_csv(output_file, index_col=0)

0 commit comments

Comments
 (0)