-
Notifications
You must be signed in to change notification settings - Fork 0
/
TomoPrep_v1.4.py
executable file
·596 lines (469 loc) · 24.7 KB
/
TomoPrep_v1.4.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
"""
Version Date : 15th October, 2024
Author : Miles Graham
Institution : University of Oxford / Diamond Light Source
Description: This script has a list of functions which are called in the execution script in order to enact tomography
preprocessing steps (soft linking relevant files, motion correcting movies, ctf estimation, stacking tilt series,
aligning tilt series) and then writing out the star files and soft linking the required files for relion import.
"""
import os
import pandas as pd
import json
import subprocess
import time
import multiprocessing
import random
from functions import readmdoc
from functions import Color
from functions import print_colored
from functions import get_position_name
from functions import queue_submit
from functions import modify_tltfile
from functions import parse_config
'''
File sorter reads an mdoc and for all of the files listed under 'SubFramePath' will create a soft link under directories
with the position name. E.g. If processing a position labelled "Position_1_3", a directory will be created and all of
the tilt movies relating to this position will be soft linked within this directory.
'''
def file_sorter(mdoc_file, config):
get_position_name(mdoc_file, config)
position_prefix, position_directory = get_position_name(mdoc_file, config)
mdoc_df = readmdoc(mdoc_file)
mdoc_directory = config.get('mdoc_directory')
# Create a directory for this position in the processing directory if it doesn't exist
os.makedirs(position_directory, exist_ok=True)
# Create symbolic links to the files listd in SubFramePath column in the newly made folder
linked_files_count = 0 # Counter for linked files
for _, row in mdoc_df.iterrows():
subframe_path = row["SubFramePath"]
if not pd.isnull(subframe_path):
subframe_file = os.path.basename(subframe_path)
source_path = os.path.join(mdoc_directory, subframe_file)
link_path = os.path.join(position_directory, subframe_file)
os.symlink(source_path, link_path)
linked_files_count += 1
print_colored(f'{position_prefix} : {linked_files_count} relevant files found.',
Color.GREEN)
return position_prefix, position_directory
'''
rawtlt_maker makes the basic rawtlt files required for AreTomo tilt series alignment to describe the tilt scheme used.
This currently does not include any dose information for dose weighting and could potentially be added in future
versions.
'''
def rawtlt_maker(mdoc_file, config):
# Generate mdoc DataFrame and use it to define the target prefix and folder path
mdoc_df = readmdoc(mdoc_file)
position_prefix, position_directory = get_position_name(mdoc_file, config)
# Sort the DataFrame by the 'TiltAngle' column in ascending order (from most negative to positive)
sorted_df = mdoc_df.sort_values(by='TiltAngle')
# Extract the 'TiltAngle' and the 'ImageFile' information from the mdoc
tilt_angles = sorted_df['TiltAngle']
# Create a text file and write the sorted tilt angles to it
rawtlt_file = f"{position_directory}/{position_prefix}.rawtlt"
with open(rawtlt_file, 'w') as file:
file.write(tilt_angles.to_string(index=False))
print_colored(f'{position_prefix} : Tilt information written to {rawtlt_file}.', Color.GREEN)
'''
Newstacker creates the input file required for Imod's newstack.
'''
def newstacker(mdoc_file, config):
mdoc_df = readmdoc(mdoc_file)
sorted_df = mdoc_df.sort_values(by='TiltAngle')
position_prefix, position_directory = get_position_name(mdoc_file, config)
file_type = config['file_type']
# write out newstack input using the dataframe sorted according to tilt angle.
output_file = f'{position_directory}/{position_prefix}_newstack.txt'
with open(output_file, "w") as file:
file.write(str(len(sorted_df)) + "\n")
for _, row in sorted_df.iterrows():
subframe_path = row["SubFramePath"]
modified_path = subframe_path.replace(".", "_", 1) # Replace only the first occurrence
modified_path = modified_path.replace(".{}".format(file_type), ".mrc")
file.write("MotionCorr/job002/" + modified_path + "\n")
file.write("0\n")
'''
motioncorr feeds the parameters obtained from the readmdoc function and the configuration file (user input), in order
to modify a template submission script with the desired parameters for RELION's implementation of MotionCor.
'''
def motioncorr(mdoc_file, config):
position_prefix, position_directory = get_position_name(mdoc_file, config)
# Extract the parameters required for the motion correction and newstack.
relion_module = config['relion_module']
imod_module = config['imod_module']
MOTIONCORR_SLURM_TEMPLATE = config['MOTIONCORR_SLURM_TEMPLATE']
file_type = config['file_type']
pixel_size = config['pixel_size']
partition = config['partition']
MPIs = config['MPIs']
threads = config['threads']
Cs = config['Cs']
Q0 = config['Q0']
frame_dose = config['frame_dose']
motioncorr_patches = config['motioncorr_patches']
eer_grouping = config['eer_grouping']
gainref = config['gainref']
voltage = config['voltage']
# Read the template file
with open(MOTIONCORR_SLURM_TEMPLATE, "r") as f:
slurm_template = f.read()
slurm_script = slurm_template.format(processing_directory=processing_directory, relion_module=relion_module,
imod_module=imod_module, partition=partition, MPIs=MPIs, threads=threads,
position_directory=position_directory, pixel_size=pixel_size,
voltage=voltage, Cs=Cs, Q0=Q0, file_type=file_type,
position_prefix=position_prefix,
frame_dose=frame_dose, motioncorr_patches=motioncorr_patches,
eer_grouping=eer_grouping, gainref=gainref)
slurm_script_path = f"motioncorr_slurm_{position_prefix}.sh"
slurm_script_path = os.path.join(position_directory, slurm_script_path)
# Write the modified SLURM script to a new file
with open(slurm_script_path, "w") as f:
f.write(slurm_script)
job_name = "Motion Correction"
queue_submit(position_prefix, job_name, slurm_script_path, config)
'''
aretomo feeds the parameters obtained from the readmdoc function and the configuration file (user input), in order
to modify a template submission script with the desired parameters for AreTomo (UCSF).
'''
def aretomo(mdoc_file, config):
position_prefix, position_directory = get_position_name(mdoc_file, config)
# extract the remaining relevant parameters required for the AreTomo job.
ARETOMO_SLURM_TEMPLATE = config['ARETOMO_SLURM_TEMPLATE']
partition = config['partition']
MPIs = config['MPIs']
threads = config['threads']
aretomo_thickness = config['aretomo_thickness']
aretomo_volume_binning = config['aretomo_volume_binning']
aretomo_DarkTol = config['aretomo_DarkTol']
aretomo_AliZ = config['aretomo_AliZ']
aretomo_module = config['aretomo_module']
# Read the template submission script file
with open(ARETOMO_SLURM_TEMPLATE, "r") as f:
slurm_template = f.read()
slurm_script = slurm_template.format(aretomo_module=aretomo_module, partition=partition, MPIs=MPIs,
aretomo_DarkTol=aretomo_DarkTol,
aretomo_volume_binning=aretomo_volume_binning,
threads=threads, aretomo_thickness=aretomo_thickness,
position_directory=position_directory, aretomo_AliZ=aretomo_AliZ,
position_prefix=position_prefix)
slurm_script_path = f"aretomo_slurm_{position_prefix}.sh"
slurm_script_path = os.path.join(position_directory, slurm_script_path)
# Write the modified SLURM script to a new file
with open(slurm_script_path, "w") as f:
f.write(slurm_script)
# pause until inputs are ready
exit_success = f'{position_directory}/MotionCorr/job002/RELION_JOB_EXIT_SUCCESS'
message_printed = False
job_name = "AreTomo"
while not os.path.exists(exit_success):
if not message_printed:
print_colored(
f"{position_prefix} : {job_name} is waiting for motion corrected movies...",
Color.YELLOW)
message_printed = True
# pause to make sure stack has been made before submitting
time.sleep(60)
queue_submit(position_prefix, job_name, slurm_script_path, config)
'''
ctffind feeds the parameters obtained from the readmdoc function and the configuration file (user input), in order
to modify a template submission script with the desired parameters for CtfFind4, run through RELION.
'''
def ctffind(mdoc_file, config):
job_name = "CtfFind"
position_prefix, position_directory = get_position_name(mdoc_file, config)
# extract the remaining relevant parameters required for the Ctffind job.
CTFFIND_SLURM_TEMPLATE = config['CTFFIND_SLURM_TEMPLATE']
pixel_size = config['pixel_size']
partition = config['partition']
ctffind_module = config['ctffind_module']
Cs = config['Cs']
Q0 = config['Q0']
lowest_defocus_search = config['lowest_defocus_search']
highest_defocus_search = config['highest_defocus_search']
voltage = config['voltage']
max_ctf_fit_resolution = config['max_ctf_fit_resolution']
min_ctf_fit_resolution = config['min_ctf_fit_resolution']
# convert the defocus units
min_defocus_search = abs(lowest_defocus_search * 10000)
max_defocus_search = abs(highest_defocus_search * 10000)
# Read the template file
with open(CTFFIND_SLURM_TEMPLATE, "r") as f:
slurm_template = f.read()
slurm_script = slurm_template.format(processing_directory=processing_directory, ctffind_module=ctffind_module,
partition=partition, position_directory=position_directory,
position_prefix=position_prefix, Cs=Cs, Q0=Q0,
max_ctf_fit_resolution=max_ctf_fit_resolution,
min_ctf_fit_resolution=min_ctf_fit_resolution,
min_defocus_search=min_defocus_search,
max_defocus_search=max_defocus_search, pixel_size=pixel_size,
voltage=voltage)
slurm_script_path = f"ctffind_slurm_{position_prefix}.sh"
slurm_script_path = os.path.join(position_directory, slurm_script_path)
# Write the modified SLURM script to a new file
with open(slurm_script_path, "w") as f:
f.write(slurm_script)
exit_success = f'{position_directory}/MotionCorr/job002/RELION_JOB_EXIT_SUCCESS'
message_printed = False
while not os.path.exists(exit_success):
if not message_printed:
print_colored(
f"{position_prefix} : {job_name} is waiting for motion corrected movies...",
Color.YELLOW)
message_printed = True
time.sleep(60) #to ensure newstack has finished running
queue_submit(position_prefix, job_name, slurm_script_path, config)
def tomo_order_list_maker(mdoc_file, config):
# extract relevant information from mdoc
mdoc_df = readmdoc(mdoc_file)
position_prefix, position_directory = get_position_name(mdoc_file, config)
# stating the name/location of the csv file to be generated
order_list_path = f"{position_prefix}_order_list.csv"
order_list_path = os.path.join(position_directory, order_list_path)
# saving tilt angles from unsorted dataframe
tilt_angles = mdoc_df['TiltAngle']
# Create a new DataFrame with two columns: Index and TiltAngle
order_list_df = pd.DataFrame({
"Index": range(1, len(tilt_angles) + 1),
"TiltAngle": tilt_angles
})
# write out the order list file
order_list_df.to_csv(order_list_path, index=False, header=False)
def relion_setup(mdoc_file, config):
position_prefix, position_directory = get_position_name(mdoc_file, config)
# Make the RELION_PROCESSING directory and the position directories within the tomograms folder
relion_processing_path = os.path.join(processing_directory, "RELION_PROCESSING")
tomograms_directory = os.path.join(relion_processing_path, "tomograms")
relion_position_directory = os.path.join(tomograms_directory, position_prefix)
os.makedirs(relion_position_directory, exist_ok=True)
# soft link in the unaligned stack
unaligned_stack = f"{position_prefix}_unaligned.mrc"
source_path = os.path.join(position_directory, unaligned_stack)
message_printed = False
while not os.path.exists(source_path):
if not message_printed:
print_colored(
f"{position_prefix} : RELION is waiting for the unaligned stack...",
Color.YELLOW)
message_printed = True
link_path = os.path.join(relion_position_directory, unaligned_stack)
os.symlink(source_path, link_path)
print_colored(f'{position_prefix} : {unaligned_stack} has been soft linked to the RELION processing directory.',
Color.GREEN)
# soft link in the ctf file
ctf_list = f"{position_prefix}.txt"
ctf_directory = os.path.join(position_directory, "CTF")
source_path = os.path.join(ctf_directory, ctf_list)
message_printed = False
while not os.path.exists(source_path):
if not message_printed:
print_colored(
f"{position_prefix} : RELION is waiting for CTF files...",
Color.YELLOW)
message_printed = True
link_path = os.path.join(relion_position_directory, ctf_list)
os.symlink(source_path, link_path)
print_colored(f'{position_prefix} : {ctf_list} has been soft linked to the RELION processing directory.',
Color.GREEN)
# soft link in 'imod' files
source_imod_directory = f"{processing_directory}/{position_prefix}/{position_prefix}_Imod"
tiltcom_file = f"{source_imod_directory}/tilt.com"
newstcom_file = f"{source_imod_directory}/newst.com"
tlt_file = f"{source_imod_directory}/{position_prefix}.tlt"
st_file = f"{source_imod_directory}/{position_prefix}.st"
xf_file = f"{source_imod_directory}/{position_prefix}.xf"
xtilt_file = f"{source_imod_directory}/{position_prefix}.xtilt"
source_path = source_imod_directory
message_printed = False
while not os.path.exists(source_path) or not os.path.exists(tiltcom_file) or not os.path.exists(
tlt_file) or not os.path.exists(newstcom_file) or not os.path.exists(xtilt_file) or not os.path.exists(
xf_file) or not os.path.exists(st_file):
if not message_printed:
print_colored(
f"{position_prefix} : RELION is waiting for IMOD files from AreTomo...",
Color.YELLOW)
message_printed = True
for file in os.listdir(source_imod_directory):
source_path = os.path.join(source_imod_directory, file)
link_path = os.path.join(relion_position_directory, file)
os.symlink(source_path, link_path)
print_colored(f'{position_prefix} : {file} has been soft linked to the RELION processing directory.',
Color.GREEN)
# soft link the order list
order_list = f"{position_prefix}_order_list.csv"
source_path = os.path.join(position_directory, order_list)
link_path = os.path.join(relion_position_directory, order_list)
message_printed = False
while not os.path.exists(source_path):
if not message_printed:
print_colored(
f"{position_prefix} : RELION is waiting for the Tomo Order List...",
Color.YELLOW)
message_printed = True
os.symlink(source_path, link_path)
print_colored(f'{position_prefix} : {order_list} has been soft linked to the RELION processing directory.',
Color.GREEN)
tlt_file_path = os.path.join(relion_position_directory, f"{position_prefix}.tlt")
tiltcom_file = os.path.join(relion_position_directory, "tilt.com")
modify_tltfile(tlt_file_path, tiltcom_file)
class RelionStarFile:
def __init__(self, file_path):
self.file_path = file_path
def write_header(self):
star_header = """data_
loop_
_rlnTomoName
_rlnTomoTiltSeriesName
_rlnTomoImportCtfFindFile
_rlnTomoImportImodDir
_rlnTomoImportFractionalDose
_rlnTomoImportOrderList
_rlnTomoImportCulledFile
"""
with open(self.file_path, 'w') as f:
f.write(star_header)
def write_line(self, tomo_name, tilt_series_path, ctf_file_path, relion_imod_directory, fractional_dose,
order_list_path, import_tomo_culled_file):
with open(self.file_path, 'a') as f:
f.write(
f"{tomo_name} {tilt_series_path} {ctf_file_path} {relion_imod_directory} {fractional_dose} {order_list_path} {import_tomo_culled_file}\n")
def relion_import_star_maker(mdoc_file, config):
# extract relevant information from mdoc
mdoc_df = readmdoc(mdoc_file)
number_of_frames = mdoc_df.loc[1, "NumSubFrames"]
position_prefix, position_directory = get_position_name(mdoc_file, config)
# Remove the file extension from position name in order to get position prefix and its relevant processing directory.
dose_per_frame = config['frame_dose']
relion_processing_path = os.path.join(processing_directory, "RELION_PROCESSING")
tilt_series_path = f"tomograms/{position_prefix}/{position_prefix}.st"
ctf_file_path = f"tomograms/{position_prefix}/{position_prefix}.txt"
relion_imod_directory = f"tomograms/{position_prefix}"
fractional_dose = number_of_frames * dose_per_frame
order_list_path = f"tomograms/{position_prefix}/{position_prefix}_order_list.csv"
import_tomo_culled_file = f"tomograms/{position_prefix}/{position_prefix}_culled_file.mrc"
relion_star_file_path = os.path.join(relion_processing_path, "tomograms_descr.star")
relion_star_file = RelionStarFile(relion_star_file_path)
# If the STAR file doesn't exist, write the header first
if not os.path.exists(relion_star_file_path):
relion_star_file.write_header()
# Call the write_line method for each entry
relion_star_file.write_line(position_prefix, tilt_series_path, ctf_file_path, relion_imod_directory, fractional_dose,
order_list_path, import_tomo_culled_file)
def relion_import(config):
relion_module = config['relion_module']
processing_directory = config['processing_directory']
RELION_IMPORT_TEMPLATE = config['IMPORT_SLURM_TEMPLATE']
pixel_size = config['pixel_size']
partition = config['partition']
Cs = config['Cs']
Q0 = config['Q0']
voltage = config['voltage']
relion_directory = f"{processing_directory}/RELION_PROCESSING"
# Read the template file
with open(RELION_IMPORT_TEMPLATE, "r") as f:
slurm_template = f.read()
slurm_script = slurm_template.format(relion_module=relion_module, partition=partition,
relion_directory=relion_directory, pixel_size=pixel_size,
voltage=voltage, Cs=Cs, Q0=Q0)
slurm_script_path = "relion_import.sh"
slurm_script_path = os.path.join(relion_directory, slurm_script_path)
# Write the modified SLURM script to a new file
with open(slurm_script_path, "w") as f:
f.write(slurm_script)
job_name = "RELION Import"
queue_submit("Full Dataset", job_name, slurm_script_path, config)
def relion_tomo_reconstruct(mdoc_file, config):
position_prefix, position_directory = get_position_name(mdoc_file, config)
# extract the remaining relevant parameters required for the Ctffind job.
TOMO_RECONSTRUCT_SLURM_TEMPLATE = config['TOMO_RECONSTRUCT_SLURM_TEMPLATE']
partition = config['partition']
relion_module = config['relion_module']
relion_directory = f"{processing_directory}/RELION_PROCESSING"
max_jobs = config['max_jobs']
tomo_reconstruct_binning = config['tomo_reconstruct_binning']
tomo_reconstruct_threads = config['tomo_reconstruct_threads']
# Read the template file
with open(TOMO_RECONSTRUCT_SLURM_TEMPLATE, "r") as f:
slurm_template = f.read()
slurm_script = slurm_template.format(relion_module=relion_module, partition=partition,
tomo_reconstruct_threads=tomo_reconstruct_threads,
position_directory=position_directory,
tomo_reconstruct_binning=tomo_reconstruct_binning,
relion_directory=relion_directory, position_prefix=position_prefix)
slurm_script_path = f"relion_tomo_reconstruct_{position_prefix}.sh"
slurm_script_path = os.path.join(position_directory, slurm_script_path)
# Write the modified SLURM script to a new file
with open(slurm_script_path, "w") as f:
f.write(slurm_script)
exit_success = f'{relion_directory}/ImportTomo/job001/RELION_JOB_EXIT_SUCCESS'
message_printed = False
while not os.path.exists(exit_success):
if not message_printed:
print_colored(
f"{position_prefix} : Waiting for import to finish...",
Color.YELLOW)
message_printed = True
print(f"{position_prefix} : Import finished. Requesting tomogram reconstruction in RELION")
job_name = "Relion Tomo Reconstruct"
queue_submit(position_prefix, job_name, slurm_script_path, config)
def process_mdoc_file(mdoc_file):
try:
# Read the configuration file
with open('config_TomoPrep.json', 'r') as f:
config_data = f.read()
# Parse the contents of the JSON file
config = json.loads(config_data)
processing_directory = config["processing_directory"]
mdoc_directory = config["mdoc_directory"]
mdoc_absolute_path = os.path.join(mdoc_directory, mdoc_file)
file_sorting = config["file_sorting"]
motion_correction = config["motion_correction"]
ctf_estimation = config["ctf_estimation"]
aretomo_alignment = config["aretomo_alignment"]
if file_sorting == "YES":
# Call functions with error handling
file_sorter(mdoc_absolute_path, config)
rawtlt_maker(mdoc_absolute_path, config)
newstacker(mdoc_absolute_path, config)
tomo_order_list_maker(mdoc_absolute_path, config)
if motion_correction == "YES":
motioncorr(mdoc_absolute_path, config)
if aretomo_alignment == "YES":
aretomo(mdoc_absolute_path, config)
if ctf_estimation == "YES":
ctffind(mdoc_absolute_path, config)
except Exception as e:
print(f"An error occurred during processing: {e}")
if __name__ == '__main__':
# Read the configuration file
with open('config_TomoPrep.json', 'r') as f:
config_data = f.read()
# Parse the contents of the JSON file
config = json.loads(config_data)
processing_directory = config["processing_directory"]
mdoc_directory = config["mdoc_directory"]
relion_tomogram_reconstruction = config["relion_tomogram_reconstruction"]
relion_tomo_import = config['relion_tomo_import']
# Get a list of all mdoc files in the directory
mdoc_files = [filename for filename in os.listdir(mdoc_directory) if
filename.endswith(".mdoc") and "_override" not in filename]
# Create a separate process for each mdoc file
processes = []
for mdoc_file in mdoc_files:
sleep_time = random.randint(1, 5)
time.sleep(sleep_time)
p = multiprocessing.Process(target=process_mdoc_file, args=(mdoc_file,))
processes.append(p)
p.start()
# Wait for all processes to complete
for p in processes:
p.join()
if relion_tomo_import == "YES":
for mdoc_file in mdoc_files:
mdoc_absolute_path = os.path.join(mdoc_directory, mdoc_file)
relion_setup(mdoc_absolute_path, config)
relion_import_star_maker(mdoc_absolute_path, config)
relion_import(config)
if relion_tomogram_reconstruction == "YES":
for mdoc_file in mdoc_files:
mdoc_absolute_path = os.path.join(mdoc_directory, mdoc_file)
relion_tomo_reconstruct(mdoc_absolute_path, config)
print("All jobs submitted. Check for their completion!")