Skip to content

Commit

Permalink
seqspec check that the modalities are unique and that the first level…
Browse files Browse the repository at this point in the history
… of the assay spec corresponds to one of the modalities
  • Loading branch information
sbooeshaghi committed Nov 11, 2023
1 parent 982556b commit 91058e3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions seqspec/seqspec_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ def run_check(schema, spec, spec_fn):
f"[error {idx}] {error.message} in spec[{']['.join(repr(index) for index in error.path)}]"
)

# check that the modalities are unique
if len(spec.modalities) != len(set(spec.modalities)):
errors.append(
f"[error {idx}] modalities [{', '.join(spec.modalities)}] are not unique"
)
idx += 1

# check that region_ids of the first level of the spec correspond to the modalities
# one for each modality
modes = spec.modalities
rgns = spec.assay_spec
for r in rgns:
rid = r.region_id
if rid not in modes:
errors.append(
f"[error {idx}] region_id '{rid}' of the first level of the spec does not correspond to a modality [{', '.join(modes)}]"
)
idx += 1

# get all of the onlist files in the spec and check that they exist relative to the path of the spec
modes = spec.modalities
olrgns = []
Expand Down

0 comments on commit 91058e3

Please sign in to comment.