Skip to content

Commit bfd5834

Browse files
committed
Update the bids_import script logic to explicitely add the --no-copy option
1 parent a12d199 commit bfd5834

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

python/bids_import.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ def main():
3737
nocopy = False
3838

3939
long_options = [
40-
"help", "profile=", "directory=",
41-
"createcandidate", "createsession", "idsvalidation", "nobidsvalidation", "type=", "verbose"
40+
"help", "profile=", "directory=",
41+
"createcandidate", "createsession", "idsvalidation",
42+
"nobidsvalidation", "nocopy", "type=",
43+
"verbose"
4244
]
4345
usage = (
4446
'\n'
@@ -51,6 +53,7 @@ def main():
5153
'\t-s, --createsession : to create BIDS sessions in LORIS (optional)\n'
5254
'\t-i, --idsvalidation : to validate BIDS directory for a matching pscid/candid pair (optional)\n'
5355
'\t-b, --nobidsvalidation : to disable BIDS validation for BIDS compliance\n'
56+
'\t-a, --nocopy : to disable dataset copy in data assembly_bids\n'
5457
'\t-t, --type : raw | derivatives. Specify the dataset type.'
5558
'If not set, the pipeline will look for both raw and derivatives files.\n'
5659
'Required if no dataset_description.json is found.\n'
@@ -81,6 +84,8 @@ def main():
8184
idsvalidation = True
8285
elif opt in ('-n', '--nobidsvalidation'):
8386
nobidsvalidation = True
87+
elif opt in ('-a', '--nocopy'):
88+
nocopy = True
8489
elif opt in ('-t', '--type'):
8590
type = arg
8691

@@ -107,10 +112,6 @@ def main():
107112
# making sure that there is a final / in data_dir
108113
data_dir = data_dir if data_dir.endswith('/') else data_dir + "/"
109114

110-
assembly_bids_path = os.path.join(data_dir, 'assembly_bids')
111-
if bids_dir.strip('/').startswith(assembly_bids_path.strip('/')):
112-
nocopy = True
113-
114115
# read and insert BIDS data
115116
read_and_insert_bids(
116117
bids_dir,

python/extract_eeg_bids_archive.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def main():
2525
" EXTRACT EEG ARCHIVES\n"
2626
"********************************************************************\n"
2727
"The program gets an archive associated with an upload ID, extract it and push its content "
28-
"to EEGS3DataPath, an Amazon S3 bucket or {dataDirBasepath}/assembly_bids.\n\n"
28+
"to EEGS3DataPath, an Amazon S3 bucket or EEGAssemblyBIDS.\n\n"
2929

3030
"usage : extract_eeg_bids_archive.py -p <profile> -u <upload_id> ...\n\n"
3131

@@ -214,7 +214,12 @@ def main():
214214
)
215215
error = True
216216
else:
217-
data_eeg_modality_path = os.path.join(data_dir, 'assembly_bids', eeg_session_rel_path, modality)
217+
assembly_bids_path = config_db_obj.get_config("EEGAssemblyBIDS")
218+
if not assembly_bids_path:
219+
data_dir = config_db_obj.get_config("dataDirBasepath")
220+
assembly_bids_path = os.path.join(data_dir, 'assembly_bids')
221+
222+
data_eeg_modality_path = os.path.join(assembly_bids_path, eeg_session_rel_path, modality)
218223

219224
"""
220225
If the suject/session/modality BIDS data already exists

python/ingest_eeg_bids_datasets.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ def main():
7373
# Get tmp dir from loris_getopt object
7474
# and create the log object (their basename being the name of the script run)
7575
# ---------------------------------------------------------------------------------------------
76-
data_dir = config_db_obj.get_config("dataDirBasepath")
77-
assembly_bids_path = os.path.join(data_dir, 'assembly_bids')
76+
assembly_bids_path = config_db_obj.get_config("EEGAssemblyBIDS")
77+
if not assembly_bids_path:
78+
data_dir = config_db_obj.get_config("dataDirBasepath")
79+
assembly_bids_path = os.path.join(data_dir, 'assembly_bids')
7880

7981
# ---------------------------------------------------------------------------------------------
8082
# Get all EEG upload with status = Extracted
@@ -145,8 +147,9 @@ def main():
145147
continue
146148

147149
script = os.environ['LORIS_MRI'] + '/python/bids_import.py'
150+
# Assume eeg and raw data for now
148151
eeg_path = os.path.join(path, 'eeg')
149-
command = 'python ' + script + ' -p ' + profile + ' -d ' + eeg_path + ' --nobidsvalidation --type raw'
152+
command = 'python ' + script + ' -p ' + profile + ' -d ' + eeg_path + ' --nobidsvalidation --nocopy --type raw'
150153

151154
try:
152155
result = subprocess.run(command, shell = True, capture_output=True)

0 commit comments

Comments
 (0)