def run_predictions(input_path, output_path, thresholds_file, num_skip, check_existing): """Creates thread pool which will concurrently run the prediction for every protein map in the 'input_path' Parameters ---------- input_path: str Path of the input directory where the different protein directories are located output_path: str Path of the folder where all generated files will be stored thresholds_file: str Path of the JSON file which contains the threshold values for the input files num_skip: int The number of prediction steps that should be skipped check_existing: bool If set prediction steps are only executed if their results are not existing in the output path yet """ # Create list of parameters for every prediction params_list = [ (emdb_id, input_path, output_path, thresholds_file, num_skip, check_existing) for emdb_id in filter( lambda d: os.path.isdir(input_path + d), os.listdir(input_path)) ] start_time = time() pool = Pool(min(cpu_count(), len(params_list))) results = pool.map(run_prediction, params_list) # Filter 'None' results results = filter(lambda r: r is not None, results) evaluator = Evaluator(input_path) for emdb_id, predicted_file, gt_file, execution_time in results: evaluator.evaluate(emdb_id, predicted_file, gt_file, execution_time) evaluator.create_report(output_path, time() - start_time)