Skip to content

[REF] Update SessionPath -> SessionFilePath #242

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 1 commit into
base: main
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
6 changes: 3 additions & 3 deletions cohort_creator/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def create_tsv_participant_session_in_datasets(output_dir: Path, dataset_paths:
"DatasetID": [],
"SubjectID": [],
"SessionID": [],
"SessionPath": [],
"SessionFilePath": [],
}

for dataset in dataset_paths:
Expand All @@ -60,7 +60,7 @@ def create_tsv_participant_session_in_datasets(output_dir: Path, dataset_paths:
ses += "/"
else:
ses = ""
content["SessionPath"].append(f"{dataset.name}/sub-{sub}/{ses}")
content["SessionFilePath"].append(f"{dataset.name}/sub-{sub}/{ses}")

df = pd.DataFrame(content)
output_file = output_dir.parent / "code" / "participants.tsv"
Expand Down Expand Up @@ -153,7 +153,7 @@ def check_tsv_content(tsv_file: Path | str) -> pd.DataFrame:


def check_participant_listing(participant_listing: pd.DataFrame) -> None:
for col in ["SubjectID", "SessionPath"]:
for col in ["SubjectID", "SessionFilePath"]:
if col not in participant_listing.columns:
raise ValueError(
f"Column '{col}' not found in participants listing data.\n"
Expand Down
2 changes: 1 addition & 1 deletion docs/visualize_neurobagel.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def wrangle(df: pd.DataFrame) -> pd.DataFrame:
present.append(i)
df = df[mask]

df["dataset_name"] = df["SessionPath"].apply(lambda x: x.split("/")[1])
df["dataset_name"] = df["SessionFilePath"].apply(lambda x: x.split("/")[1])

df["missing_age"] = df["Age"].isnull()

Expand Down
2 changes: 1 addition & 1 deletion inputs/participant-results.tsv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DatasetID SubjectID Age Sex Diagnosis Assessment SessionID SessionPath NumSessions Modality
DatasetID SubjectID Age Sex Diagnosis Assessment SessionID SessionFilePath NumSessions Modality
http://neurobagel.org/vocab/0f2f957a-7979-442c-92fc-b1f68c0d3b50 sub-01 38.0 http://purl.bioontology.org/ontology/SNOMEDCT/248153007 , , ses-1 /ds001454/sub-01/ses-1 2 http://purl.org/nidash/nidm#FlowWeighted, http://purl.org/nidash/nidm#T1Weighted
http://neurobagel.org/vocab/0f2f957a-7979-442c-92fc-b1f68c0d3b50 sub-01 38.0 http://purl.bioontology.org/ontology/SNOMEDCT/248153007 , , ses-2 /ds001454/sub-01/ses-2 2 http://purl.org/nidash/nidm#FlowWeighted, http://purl.org/nidash/nidm#T1Weighted
http://neurobagel.org/vocab/15abcd42-0f61-4b44-81bf-7b51ba15b14e sub-control05 36.0 http://purl.bioontology.org/ontology/SNOMEDCT/248153007 , , ses-1preEEG /ds001408/sub-control05/ses-1preEEG 2 http://purl.org/nidash/nidm#FlowWeighted, http://purl.org/nidash/nidm#T1Weighted
Expand Down
2 changes: 1 addition & 1 deletion tests/data/participants.tsv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DatasetID SubjectID Age Sex Diagnosis SessionID SessionPath NumSessions Modality
DatasetID SubjectID Age Sex Diagnosis SessionID SessionFilePath NumSessions Modality
ds000001 sub-03 26 Female PD n/a 1 [T1,T2,bold]
ds000001 sub-17 25 Female CTL n/a 1 [T1,T2,bold]
ds000002 sub-12 25 Female n/a 1 [T1,T2,bold]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test_create_tsv_participant_session_in_datasets(bids_examples, tmp_path):
assert tsv_file.exists()
df = pd.read_csv(tsv_file, sep="\t")

assert df.columns.tolist() == ["DatasetID", "SubjectID", "SessionID", "SessionPath"]
assert df.columns.tolist() == ["DatasetID", "SubjectID", "SessionID", "SessionFilePath"]

assert df["DatasetID"].unique().tolist() == ["ds001", "ds006"]

Expand Down
Loading