17 lines
603 B
Python
17 lines
603 B
Python
from pathlib import Path
|
|
|
|
from genomic_consultant.panels.aggregate import merge_mappings
|
|
import json
|
|
|
|
|
|
def test_merge_mappings(tmp_path: Path):
|
|
a = tmp_path / "a.json"
|
|
b = tmp_path / "b.json"
|
|
a.write_text('{"source":"A","phenotype_to_genes":{"HP:1":["G1","G2"]}}')
|
|
b.write_text('{"source":"B","phenotype_to_genes":{"HP:1":["G2","G3"],"HP:2":["G4"]}}')
|
|
out = tmp_path / "out.json"
|
|
merge_mappings([a, b], out)
|
|
data = json.loads(out.read_text())
|
|
assert sorted(data["phenotype_to_genes"]["HP:1"]) == ["G1", "G2", "G3"]
|
|
assert data["phenotype_to_genes"]["HP:2"] == ["G4"]
|