diff --git a/cis_proc.py b/cis_proc.py index 3f0baee..c51b016 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".') @@ -95,6 +82,21 @@ 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 +161,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 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", 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