Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ def get_params():
return params


def file_name_match(file_name, target_file_type):
"""Judge the file type match, considering floating point precision issue"""
try:
parts1 = file_name.rsplit("_", 1)
parts2 = target_file_type.rsplit("_", 1)
if len(parts1) == 2 and len(parts2) == 2 and parts1[0] == parts2[0]:
num1 = float(parts1[1])
num2 = float(parts2[1])
return abs(num1 - num2) < 1e-4
except (ValueError, IndexError):
pass

return file_name == target_file_type


def pytest_configure(config):
"""
Prepare path and report file for accuracy tests
Expand Down Expand Up @@ -78,6 +93,12 @@ def pytest_terminal_summary(terminalreporter):
"metafounder_dosage",
"metafounder_geno_prob",
"metafounder_phased_geno_prob",
"x_chr_dosage",
"x_chr_geno_0.3333333333333333",
"x_chr_hap_0.5",
"x_chr_geno_prob",
"x_chr_phased_geno_prob",
"x_chr_seg_prob",
]
columns = (
"Test Name",
Expand Down Expand Up @@ -111,27 +132,18 @@ def pytest_terminal_summary(terminalreporter):
for file_type in file_types:
mkr_accu_file[file_type] = list(
filter(
lambda x: x["File Name"] == file_type,
lambda x: file_name_match(x["File Name"], file_type),
mkr_accu,
)
)
ind_accu_file[file_type] = list(
filter(
lambda x: x["File Name"] == file_type,
lambda x: file_name_match(x["File Name"], file_type),
ind_accu,
)
)

test_names = list(
map(
lambda x: x["Test Name"],
filter(
lambda x: x["File Name"] == file_types[0]
or x["File Name"] == file_types[6],
mkr_accu,
),
)
)
test_names = list(set(x["Test Name"] for x in mkr_accu))
test_nums = {}
count = 0
for test_name in test_names:
Expand Down
2,000 changes: 1,000 additions & 1,000 deletions tests/accuracy_tests/sim_for_alphapeel_accu_test/X_chr_geno_file.txt

Large diffs are not rendered by default.

Loading