Skip to content

feat(schema): Rewrite PHENOTYPE_SUBJECTS_MISSING to run on each phenotype file #2107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
10 changes: 0 additions & 10 deletions src/schema/meta/context.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ properties:
type: array
items:
type: string
phenotype:
description: 'The union of participant_id columns in phenotype files'
type: array
items:
type: string
subject:
description: 'Properties and contents of the current subject'
type: object
Expand All @@ -109,11 +104,6 @@ properties:
type: array
items:
type: string
phenotype:
description: 'The union of session_id columns in phenotype files'
type: array
items:
type: string

# Properties of the current file
path:
Expand Down
18 changes: 0 additions & 18 deletions src/schema/rules/checks/dataset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,6 @@ ParticipantIDMismatch:
sorted(dataset.subjects.sub_dirs)
)

# 51
PhenotypeSubjectsMissing:
issue:
code: PHENOTYPE_SUBJECTS_MISSING
message: |
A phenotype/ .tsv file lists subjects that were not found in
the participant_id column found in the participants.tsv file.
level: error
selectors:
- path == '/participants.tsv'
- type(dataset.subjects.phenotype) != 'null'
checks:
- |
allequal(
sorted(intersects(columns.participant_id, dataset.subjects.phenotype)),
sorted(dataset.subjects.phenotype)
)

# 214
SamplesTSVMissing:
issue:
Expand Down
21 changes: 21 additions & 0 deletions src/schema/rules/checks/phenotype.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Rules for phenotype files
---

# 51
PhenotypeSubjectsMissing:
issue:
code: PHENOTYPE_SUBJECTS_MISSING
message: |
A phenotype/ .tsv file lists subjects that were not found in
the participant_id column found in the participants.tsv file.
level: error
selectors:
- datatype == 'phenotype'
- suffix == '.tsv'
- type(dataset.subjects.participant_id) != 'null'
checks:
- |
allequal(
sorted(intersects(columns.participant_id, dataset.subjects.participant_id)),
sorted(dataset.subjects.participant_id)
)