From 9beeb4cd6b4a01574c853be807d80f464f7e1c51 Mon Sep 17 00:00:00 2001 From: Adam Kimbler Date: Thu, 20 Sep 2018 09:39:55 -0400 Subject: [PATCH 1/3] Removed --project flag and moved to config file --- cis_proc.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/cis_proc.py b/cis_proc.py index 3f0baee..c21aeaa 100755 --- a/cis_proc.py +++ b/cis_proc.py @@ -47,8 +47,6 @@ def get_parser(): 'subfolder in dset_dir.') parser.add_argument('--config', required=True, dest='config', help='Path to the config json file.') - parser.add_argument('--project', required=True, dest='project', - help='The name of the project to analyze.') parser.add_argument('--sub', required=True, dest='sub', help='The label of the subject to analyze.') parser.add_argument('--ses', required=False, dest='ses', @@ -68,17 +66,6 @@ def main(argv=None): if args.work_dir is None: args.work_dir = CIS_DIR - if args.ses is None: - scan_work_dir = op.join(args.work_dir, - '{0}-{1}'.format(args.project, args.sub)) - else: - scan_work_dir = op.join(args.work_dir, - '{0}-{1}-{2}'.format(args.project, args.sub, - args.ses)) - - if not scan_work_dir.startswith('/scratch'): - raise ValueError('Working directory must be in scratch.') - if not op.isfile(args.tar_file) or not args.tar_file.endswith('.tar'): raise ValueError('Argument "tar_file" must be an existing file with ' 'the suffix ".tar".') @@ -94,7 +81,20 @@ def main(argv=None): with open(args.config, 'r') as fo: config_options = json.load(fo) + if 'project' not in config_options.keys(): + raise Exception('Config File must be updated with project field' + 'See Sample Config File for More information') + if args.ses is None: + scan_work_dir = op.join(args.work_dir, + '{0}-{1}'.format(config_options['project'], args.sub)) + else: + scan_work_dir = op.join(args.work_dir, + '{0}-{1}-{2}'.format(config_options['project'], args.sub, + args.ses)) + if not scan_work_dir.startswith('/scratch'): + raise ValueError('Working directory must be in scratch.') + bidsifier_file = op.join('/home/data/cis/singularity-images/', config_options['bidsifier']) mriqc_file = op.join('/home/data/cis/singularity-images/', @@ -159,7 +159,7 @@ def main(argv=None): cmd = ('{sing} -d {work} --heuristics {heur} --project {proj} --sub {sub} ' '--ses {ses}'.format(sing=scratch_bidsifier, work=scan_work_dir, heur=op.join(scan_work_dir, 'heuristics.py'), - sub=args.sub, ses=args.ses, proj=args.project)) + sub=args.sub, ses=args.ses, proj=config_options['project'])) run(cmd) # Check if BIDSification ran successfully From 0012cb32a647bb48da2d8e216d72679e556cd03f Mon Sep 17 00:00:00 2001 From: Adam Kimbler Date: Thu, 20 Sep 2018 09:57:30 -0400 Subject: [PATCH 2/3] Added Whitespace, updated config files --- cis_proc.py | 4 +++- config/Dick_AHEAD.json | 1 + config/Mattfeld_RTV.json | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cis_proc.py b/cis_proc.py index c21aeaa..c51b016 100755 --- a/cis_proc.py +++ b/cis_proc.py @@ -81,9 +81,11 @@ def main(argv=None): with open(args.config, 'r') as fo: config_options = json.load(fo) + if 'project' not in config_options.keys(): raise Exception('Config File must be updated with project field' 'See Sample Config File for More information') + if args.ses is None: scan_work_dir = op.join(args.work_dir, '{0}-{1}'.format(config_options['project'], args.sub)) @@ -94,7 +96,7 @@ def main(argv=None): if not scan_work_dir.startswith('/scratch'): raise ValueError('Working directory must be in scratch.') - + bidsifier_file = op.join('/home/data/cis/singularity-images/', config_options['bidsifier']) mriqc_file = op.join('/home/data/cis/singularity-images/', diff --git a/config/Dick_AHEAD.json b/config/Dick_AHEAD.json index e8c132c..89c46d6 100644 --- a/config/Dick_AHEAD.json +++ b/config/Dick_AHEAD.json @@ -1,4 +1,5 @@ { + "project": "Dick_AHEAD", "bidsifier": "cis_bidsify_v0.0.1-2018-08-24-04f91fa82d17.img", "heuristics": "heuristics/Dick_AHEAD.py", "mriqc": "poldracklab_mriqc_0.10.4-2018-03-23-8fb5f5e9184f.img", diff --git a/config/Mattfeld_RTV.json b/config/Mattfeld_RTV.json index 9a50a2c..c165bda 100644 --- a/config/Mattfeld_RTV.json +++ b/config/Mattfeld_RTV.json @@ -1,4 +1,5 @@ { + "project": "Mattfeld_RTV", "bidsifier": "cis_bidsify_v0.0.1-2018-08-24-04f91fa82d17.img", "heuristics": "heuristics/Mattfeld_RTV.py", "mriqc": "poldracklab_mriqc_0.10.4-2018-03-23-8fb5f5e9184f.img", From 7f9b4a5568728a33ffbd5b3f3f4f5808fdcf6ef6 Mon Sep 17 00:00:00 2001 From: Adam Kimbler Date: Thu, 20 Sep 2018 12:24:23 -0400 Subject: [PATCH 3/3] Updated Sample LSF Job --- example_lsf_job.sub | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example_lsf_job.sub b/example_lsf_job.sub index 4747822..c53fc83 100755 --- a/example_lsf_job.sub +++ b/example_lsf_job.sub @@ -28,5 +28,5 @@ module load singularity ########################################################## python cis_proc.py -d [/path/to/tarfile] -w [/scratch/path/to/working/directory/] \ - -b [/path/to/bids/dataset/] --config [/path/to/config/file] --project [PROJECT] \ - --sub [SUBJECTID] --ses [SESSION] --n_procs $NPROCS + -b [/path/to/bids/dataset/] --config [/path/to/config/file] --sub [SUBJECTID] \ + --ses [SESSION] --n_procs $NPROCS