From 9af04c74d6e487b5f2feb338434d2b4d46cf55dc Mon Sep 17 00:00:00 2001 From: adbartni Date: Tue, 30 Mar 2021 10:27:43 -0400 Subject: [PATCH] Cleaning up --- .gitignore | 0 .vscode/settings.json | 0 LICENSE | 0 README.md | 0 __init__.py | 0 activate | 2 +- collect_raw_data/__init__.py | 0 collect_raw_data/collect_raw_data.py | 2 +- connectome_analyses/FunctionalConnectivity.py | 4 ++-- connectome_analyses/__init__.py | 0 main.py | 12 ++++++------ match_function_by_name.py | 1 + preprocessing/Melodic.py | 2 +- preprocessing/PostMelodicProcessing.py | 0 preprocessing/PreMelodicProcessing.py | 4 ++-- preprocessing/StructuralProcessing.py | 0 preprocessing/__init__.py | 0 quality_control/init_reports_directory.py | 2 +- quality_control/registration_report.py | 5 ++++- requirements.in | 0 20 files changed, 19 insertions(+), 15 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 .vscode/settings.json mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md mode change 100644 => 100755 __init__.py mode change 100644 => 100755 collect_raw_data/__init__.py mode change 100644 => 100755 collect_raw_data/collect_raw_data.py mode change 100644 => 100755 connectome_analyses/FunctionalConnectivity.py mode change 100644 => 100755 connectome_analyses/__init__.py mode change 100644 => 100755 preprocessing/Melodic.py mode change 100644 => 100755 preprocessing/PostMelodicProcessing.py mode change 100644 => 100755 preprocessing/PreMelodicProcessing.py mode change 100644 => 100755 preprocessing/StructuralProcessing.py mode change 100644 => 100755 preprocessing/__init__.py mode change 100644 => 100755 quality_control/registration_report.py mode change 100644 => 100755 requirements.in diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.vscode/settings.json b/.vscode/settings.json old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/__init__.py b/__init__.py old mode 100644 new mode 100755 diff --git a/activate b/activate index 22be106..7a7abde 100755 --- a/activate +++ b/activate @@ -1,3 +1,3 @@ #!/bin/bash -source /shared/studies/nonregulated/connectome/fmri/preprocessing_pipeline/venv/bin/activate +source /shared/nonrestricted/connectome/fmri/preprocessing_pipeline/venv/bin/activate diff --git a/collect_raw_data/__init__.py b/collect_raw_data/__init__.py old mode 100644 new mode 100755 diff --git a/collect_raw_data/collect_raw_data.py b/collect_raw_data/collect_raw_data.py old mode 100644 new mode 100755 index b82db97..7cbb4b5 --- a/collect_raw_data/collect_raw_data.py +++ b/collect_raw_data/collect_raw_data.py @@ -15,7 +15,7 @@ def init_fmri_subject_dir(subjectID, path_fmri, path_HCP): ## Copy QSM data to fmri subject directory strippedID = subjectID[2:] - path_QSM = os.path.join("/shared/studies/nonregulated/qsm_repo/data/", strippedID + "/recon/") + path_QSM = os.path.join("/shared/nonrestricted/qsm_repo/data/", strippedID + "/recon/") if os.path.isdir(path_QSM) and not os.path.exists(path_fmri + subjectID + "/phase_combined.nii.gz"): for qsm_file in ["magnitude_combined.nii.gz", "phase_combined.nii.gz"]: copyfile(os.path.join(path_QSM, qsm_file), os.path.join(path_fmri, subjectID + "/" + qsm_file)) diff --git a/connectome_analyses/FunctionalConnectivity.py b/connectome_analyses/FunctionalConnectivity.py old mode 100644 new mode 100755 index 5b5017a..e569fe5 --- a/connectome_analyses/FunctionalConnectivity.py +++ b/connectome_analyses/FunctionalConnectivity.py @@ -14,8 +14,8 @@ class FunctionalConnectome: def __init__(self, subjectID): self.subjectID = subjectID - self.path_fmri = "/shared/studies/nonregulated/connectome/fmri/subjects/" + subjectID + "/" - self.path_HCP = "/shared/studies/nonregulated/connectome/Subjects/" + subjectID + "/T1w/" + self.path_fmri = "/shared/nonrestricted/connectome/fmri/subjects/" + subjectID + "/" + self.path_HCP = "/shared/nonrestricted/connectome/Subjects/" + subjectID + "/T1w/" def create_functional_connectivity_matrix(self): """ Performs functional connectivity analysis on a subject diff --git a/connectome_analyses/__init__.py b/connectome_analyses/__init__.py old mode 100644 new mode 100755 diff --git a/main.py b/main.py index 73c417d..cb22bef 100755 --- a/main.py +++ b/main.py @@ -58,8 +58,8 @@ def pipeline(self): try: if self.phase == "premelodic": init_fmri_subject_dir(subjectID, - "/shared/studies/nonregulated/connectome/fmri/subjects/", - "/shared/studies/nonregulated/connectome/Subjects/" + subjectID + "/T1w/") + "/shared/nonrestricted/connectome/fmri/subjects/", + "/shared/nonrestricted/connectome/Subjects/" + subjectID + "/T1w/") processing = Preprocessing(subjectID) structproc = StructuralProcessing(processing) @@ -112,8 +112,8 @@ def pipeline(self): <<< DON'T USE THIS UNTIL FIX IS WORKING >>> """ init_fmri_subject_dir(subjectID, - "/shared/studies/nonregulated/connectome/fmri/subjects/", - "/shared/studies/nonregulated/connectome/Subjects/" + subjectID + "/T1w/") + "/shared/nonrestricted/connectome/fmri/subjects/", + "/shared/nonrestricted/connectome/Subjects/" + subjectID + "/T1w/") processing = Preprocessing(subjectID) structproc = StructuralProcessing(processing) @@ -173,10 +173,10 @@ def starting_files_present(subjectID): before beginning processing """ - path_conntectome = "/shared/studies/nonregulated/connectome/" + path_conntectome = "/shared/nonrestricted/connectome/" functional_data = path_conntectome + "fmri/subjects/" + subjectID + "/rawfunc.nii.gz" structural_data = path_conntectome + "Subjects/" + subjectID + "/T1w/T1w_acpc_dc_restore_brain.nii.gz" - QSM_path = "/shared/studies/nonregulated/qsm_repo/data/" + subjectID.replace("EX","") + "/recon/" + QSM_path = "/shared/nonrestricted/qsm_repo/data/" + subjectID.replace("EX","") + "/recon/" if (not os.path.exists(functional_data) or not os.path.exists(structural_data) diff --git a/match_function_by_name.py b/match_function_by_name.py index 7e7e7b5..feb86e0 100755 --- a/match_function_by_name.py +++ b/match_function_by_name.py @@ -42,3 +42,4 @@ def match(subjectID, function): if __name__ == "__main__": function = match("EX54589", "epi_distortion_correction") print(function) + diff --git a/preprocessing/Melodic.py b/preprocessing/Melodic.py old mode 100644 new mode 100755 index 18298d8..1b9ddd6 --- a/preprocessing/Melodic.py +++ b/preprocessing/Melodic.py @@ -32,7 +32,7 @@ def init_melodic_directory(self): copyfile(self.path_fmri + cp_file, self.path_fmri + "denoise.ica/" + cp_file) if not os.path.exists(self.path_fmri + "denoise.ica/design.fsf"): - copyfile("/shared/studies/nonregulated/connectome/fmri/subjects/design.fsf", + copyfile("/shared/nonrestricted/connectome/fmri/subjects/design.fsf", self.path_fmri + "denoise.ica/design.fsf") for cp_dir in dirs: diff --git a/preprocessing/PostMelodicProcessing.py b/preprocessing/PostMelodicProcessing.py old mode 100644 new mode 100755 diff --git a/preprocessing/PreMelodicProcessing.py b/preprocessing/PreMelodicProcessing.py old mode 100644 new mode 100755 index 0a17cf7..33bbec3 --- a/preprocessing/PreMelodicProcessing.py +++ b/preprocessing/PreMelodicProcessing.py @@ -21,8 +21,8 @@ class Preprocessing: def __init__(self, subjectID): self.subjectID = subjectID - self.path_fmri = "/shared/studies/nonregulated/connectome/fmri/subjects/" + subjectID + "/" - self.path_HCP = "/shared/studies/nonregulated/connectome/Subjects/" + subjectID + "/T1w/" + self.path_fmri = "/shared/nonrestricted/connectome/fmri/subjects/" + subjectID + "/" + self.path_HCP = "/shared/nonrestricted/connectome/Subjects/" + subjectID + "/T1w/" self.mc_path = "/shared/software/vendor/freesurfer/freesurfer-5.3.0_x86_64/bin/" self.ants_path = "/usr/lib/ants/" diff --git a/preprocessing/StructuralProcessing.py b/preprocessing/StructuralProcessing.py old mode 100644 new mode 100755 diff --git a/preprocessing/__init__.py b/preprocessing/__init__.py old mode 100644 new mode 100755 diff --git a/quality_control/init_reports_directory.py b/quality_control/init_reports_directory.py index e67755e..88960aa 100755 --- a/quality_control/init_reports_directory.py +++ b/quality_control/init_reports_directory.py @@ -8,7 +8,7 @@ with open(subject_list_file) as infile: subject_list = infile.read().splitlines() -path_fmri = '/shared/studies/nonregulated/connectome/fmri/subjects/' +path_fmri = '/shared/nonrestricted/connectome/fmri/subjects/' if not os.path.isdir('reports'): os.mkdir('reports') diff --git a/quality_control/registration_report.py b/quality_control/registration_report.py old mode 100644 new mode 100755 index 18f21a6..049392b --- a/quality_control/registration_report.py +++ b/quality_control/registration_report.py @@ -4,11 +4,13 @@ import os +# Creates a string of all the filenames of T1 and registered functional images +# to feed into ImageMagick subjects_as_string = "" for subjectID in subject_list: reg_func_file = path_fmri + subjectID + "/ants/epi2braints.nii.gz" - t1_file = "/shared/studies/nonregulated/connectome/Subjects/" + subjectID + \ + t1_file = "/shared/nonrestricted/connectome/Subjects/" + subjectID + \ "/T1w/T1w_acpc_dc_restore_brain_2.00.nii.gz" if os.path.exists(reg_func_file) and os.path.exists(t1_file): @@ -33,5 +35,6 @@ #break +# Creates a pdf of functional images overlaid on T1 for all subjects os.system("convert " + subjects_as_string + " reports/missing_subs_epi2struct.pdf") diff --git a/requirements.in b/requirements.in old mode 100644 new mode 100755