Skip to content
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

Remove --ignore_subject_consistency param from cubids validate #276

Merged
merged 3 commits into from
Jan 23, 2024
Merged
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 cubids/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,6 @@ def _parse_validate():
help="Disregard NIfTI header content during validation",
required=False,
)
parser.add_argument(
"--ignore_subject_consistency",
action="store_true",
default=True,
Comment on lines -66 to -67
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦

help=(
"Skip checking that any given file for one "
"subject is present for all other subjects"
),
required=False,
)
parser.add_argument(
"--sequential-subjects",
action="store",
Expand Down
2 changes: 1 addition & 1 deletion cubids/cubids.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def datalad_undo_last_commit(self):
Uses git reset --hard to revert to the previous commit.
"""
if not self.is_datalad_clean():
raise Exception("Untracked changes present. " "Run clear_untracked_changes first")
raise Exception("Untracked changes present. Run clear_untracked_changes first")
reset_proc = subprocess.run(["git", "reset", "--hard", "HEAD~1"], cwd=self.path)
reset_proc.check_returncode()

Expand Down
11 changes: 5 additions & 6 deletions cubids/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
logger = logging.getLogger("cubids-cli")


def build_validator_call(path, ignore_headers=False, ignore_subject=True):
def build_validator_call(path, ignore_headers=False):
"""Build a subprocess command to the bids validator."""
# build docker call
command = ["bids-validator", "--verbose", "--json"]
# CuBIDS automatically ignores subject consistency.
command = ["bids-validator", "--verbose", "--json", "--ignoreSubjectConsistency"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes much more sense

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


if ignore_headers:
command.append("--ignoreNiftiHeaders")
if ignore_subject:
command.append("--ignoreSubjectConsistency")

command.append(path)

Expand All @@ -39,7 +38,7 @@ def build_subject_paths(bids_dir):
subjects = glob.glob(bids_dir)

if len(subjects) < 1:
raise ValueError("Couldn't find any subjects " "in the specified directory:\n" + bids_dir)
raise ValueError("Couldn't find any subjects in the specified directory:\n" + bids_dir)

subjects_dict = {}

Expand Down Expand Up @@ -94,7 +93,7 @@ def parse_issue(issue_dict):
return_dict["files"] = [
get_nested(x, "file", "relativePath") for x in issue_dict.get("files", "")
]
return_dict["type"] = issue_dict.get("key" "")
return_dict["type"] = issue_dict.get("key", "")
return_dict["severity"] = issue_dict.get("severity", "")
return_dict["description"] = issue_dict.get("reason", "")
return_dict["code"] = issue_dict.get("code", "")
Expand Down
12 changes: 1 addition & 11 deletions cubids/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def validate(
sequential,
sequential_subjects,
ignore_nifti_headers,
ignore_subject_consistency,
):
"""Run the bids validator.

Expand All @@ -49,7 +48,6 @@ def validate(
sequential
sequential_subjects
ignore_nifti_headers
ignore_subject_consistency
"""
# check status of output_prefix, absolute or relative?
abs_path_output = True
Expand All @@ -69,7 +67,6 @@ def validate(
call = build_validator_call(
str(bids_dir),
ignore_nifti_headers,
ignore_subject_consistency,
)
ret = run_validator(call)

Expand Down Expand Up @@ -148,8 +145,7 @@ def validate(

# run the validator
nifti_head = ignore_nifti_headers
subj_consist = ignore_subject_consistency
call = build_validator_call(tmpdirname, nifti_head, subj_consist)
call = build_validator_call(tmpdirname, nifti_head)
ret = run_validator(call)
# parse output
if ret.returncode != 0:
Expand Down Expand Up @@ -228,9 +224,6 @@ def validate(
if ignore_nifti_headers:
cmd.append("--ignore_nifti_headers")

if ignore_subject_consistency:
cmd.append("--ignore_subject_consistency")

elif container_type == "singularity":
cmd = [
"singularity",
Expand All @@ -250,9 +243,6 @@ def validate(
if ignore_nifti_headers:
cmd.append("--ignore_nifti_headers")

if ignore_subject_consistency:
cmd.append("--ignore_subject_consistency")

if sequential:
cmd.append("--sequential")

Expand Down