Skip to content

Commit e0b958a

Browse files
committed
update mapping check to allow pure annotation
1 parent d1482da commit e0b958a

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

petab/v2/lint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,8 @@ def run(self, problem: Problem) -> ValidationIssue | None:
945945
new_petab_ids = {
946946
m.petab_id
947947
for m in problem.mappings
948-
# Ignore identity mappings used for annotation
949-
if m.petab_id != m.model_id
948+
# Ignore identity mappings and annotation-only rows
949+
if m.model_id and m.petab_id != m.model_id
950950
}
951951
old_petab_ids = (
952952
{c.id for c in problem.conditions}

tests/v2/test_lint.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ def test_check_mapping_table(uses_pysb):
146146
check = CheckMappingTable()
147147
assert check.run(problem) is None
148148

149+
# Valid: mapping table is used purely for annotation
150+
# petabEntityId appears elsewhere in the problem
151+
problem.add_mapping(petab_id="c1", model_id=None, name="Condition 1")
152+
problem.add_condition("c1", p2="1")
153+
154+
check = CheckMappingTable()
155+
assert check.run(problem) is None
156+
149157
# Invalid: petabEntityId is referenced in the model
150158
pysb.SelfExporter.cleanup()
151159
pysb_model_invalid = pysb.Model("test_model_invalid")

0 commit comments

Comments
 (0)