def customize_catfam(architect_location, parameter_values, project_name,
                     output_dir, i_to_num_split):

    current_folder = output_dir + "/" + project_name + "/CatFam"
    mkdir_if_not_exists(current_folder)
    num_to_new_line = {}
    num_to_new_line[4] = "#SBATCH --job-name=CatFam_" + project_name
    num_to_new_line[7] = "PATH=$PATH:" + parameter_values["BLAST_DIR"]
    num_to_new_line[10] = "cd " + current_folder
    num_to_new_line[13] = "CATFAM_DIR=" + parameter_values["CATFAM_DIR"]
    utils.copy_and_replace(architect_location + "/scripts/individual_enzyme_annotation/CatFam/run_catfam.sh", \
        current_folder + "/run_catfam.sh", num_to_new_line)

    mkdir_if_not_exists(current_folder + "/Split_seqs", True)
    write_split_seqs(current_folder + "/Split_seqs", i_to_num_split,
                     parameter_values["SEQUENCE_FILE"])
def customize_detect(architect_location, parameter_values, project_name,
                     output_dir, time):

    current_folder = output_dir + "/" + project_name + "/DETECT"
    mkdir_if_not_exists(current_folder)
    num_to_new_line = {}
    num_to_new_line[3] = "#SBATCH --time=" + str(time) + ":00:00"
    num_to_new_line[4] = "#SBATCH --job-name=DETECT_" + project_name
    num_to_new_line[
        7] = "DETECT_TOOL=" + parameter_values["DETECT_DIR"] + "/detect.py"
    num_to_new_line[
        10] = "export PATH=" + parameter_values["DETECT_DIR"] + "/:$PATH"
    num_to_new_line[
        11] = "export PATH=" + parameter_values["EMBOSS_DIR"] + "/:$PATH"
    num_to_new_line[22] = "cd " + current_folder
    num_to_new_line[28] = "SEQ_NAME=" + parameter_values["SEQUENCE_FILE"]
    utils.copy_and_replace(architect_location + "/scripts/individual_enzyme_annotation/DETECT/run_detect.sh", \
        current_folder + "/run_detect.sh", num_to_new_line)
def customize_priam(architect_location, parameter_values, project_name,
                    output_dir, time):

    current_folder = output_dir + "/" + project_name + "/PRIAM"
    mkdir_if_not_exists(current_folder)

    num_to_new_line = {}
    num_to_new_line[3] = "#SBATCH --time=" + str(time) + ":00:00"
    num_to_new_line[4] = "#SBATCH --job-name=PRIAM_" + project_name
    num_to_new_line[7] = "my_WORKDIR=" + current_folder
    num_to_new_line[8] = "TEST=" + parameter_values["SEQUENCE_FILE"]
    num_to_new_line[9] = "PRIAM_SEARCH=" + parameter_values["PRIAM_DIR"]
    num_to_new_line[
        10] = "PRIAM_profiles_library=" + parameter_values["PRIAM_db"]
    num_to_new_line[22] = "BLAST_BIN=" + parameter_values["BLAST_DIR"]
    utils.copy_and_replace(
        architect_location +
        "/scripts/individual_enzyme_annotation/PRIAM/run_priam.sh",
        current_folder + "/run_priam.sh", num_to_new_line)
def customize_enzdp(architect_location, parameter_values, project_name,
                    output_dir, i_to_num_split):

    current_folder = output_dir + "/" + project_name + "/EnzDP"
    mkdir_if_not_exists(current_folder)
    utils.copy_and_replace(
        architect_location +
        "/scripts/individual_enzyme_annotation/EnzDP/individualize_project.sh",
        current_folder + "/individualize_project.sh", {})

    num_to_new_line = {}
    num_to_new_line[
        3] = "FASTA_FILE='" + current_folder + "/Split_seqs/SEQ_NAME'"
    num_to_new_line[
        5] = "OUTPUT_FILE='" + current_folder + "/Results/SEQ_NAME.out'"
    utils.copy_and_replace(
        architect_location +
        "/scripts/individual_enzyme_annotation/EnzDP/TEMPLATE_project.py",
        current_folder + "/TEMPLATE_project.py", num_to_new_line)

    num_to_new_line = {}
    num_to_new_line[4] = "#SBATCH --job-name=EnzDP_" + project_name
    num_to_new_line[7] = "ENZDP_TOOL=" + parameter_values["EnzDP_DIR"]
    num_to_new_line[11] = "folder=" + current_folder
    utils.copy_and_replace(
        architect_location +
        "/scripts/individual_enzyme_annotation/EnzDP/run_enzdp.sh",
        current_folder + "/run_enzdp.sh", num_to_new_line)

    mkdir_if_not_exists(current_folder + "/Split_seqs", True)
    write_split_seqs(current_folder + "/Split_seqs", i_to_num_split,
                     parameter_values["SEQUENCE_FILE"])
def customize_eficaz(architect_location, parameter_values, project_name,
                     output_dir, i_to_num_split):

    current_folder = output_dir + "/" + project_name + "/EFICAz"
    mkdir_if_not_exists(current_folder)
    utils.copy_and_replace(
        architect_location +
        "/scripts/individual_enzyme_annotation/EFICAz/individualize.sh",
        current_folder + "/individualize.sh", {})

    num_to_new_line = {}
    num_to_new_line[
        4] = "#SBATCH --job-name=EFICAz_" + project_name + "_SEQUENCE_FILENAME_X1"
    num_to_new_line[7] = "EFICAz25_PATH=" + parameter_values["EFICAz_DIR"]
    num_to_new_line[14] = "cd " + current_folder
    num_to_new_line[105] = "\tmy_scratch=" + current_folder + "/Results"
    utils.copy_and_replace(architect_location + "/scripts/individual_enzyme_annotation/EFICAz/TEMPLATE_eficaz.sh", \
        current_folder + "/TEMPLATE_eficaz.sh", num_to_new_line)

    mkdir_if_not_exists(current_folder + "/Split_seqs", True)
    write_split_seqs(current_folder + "/Split_seqs", i_to_num_split,
                     parameter_values["SEQUENCE_FILE"])
            "--ec_preds_file ${ENZ_ANNOTATION_results} --database ${DATABASE} --output_folder ${OUTPUT_FOLDER} " +\
                "--penalty_exchange " + str(penalty_deadend)
        line_to_new_text[44] = new_create_scores_command

    perform_gap_fill_command = "python3.7 " + gapfill_script + " " + \
        temp_folder + "/SIMULATION_high_confidence_reactions_plus_essentials.xml -m M9 -o " + \
            temp_folder + "/model_gapfilled_multi_" + str(num_solns) + ".lst --scoredb " + \
                temp_folder + "/SIMULATION_reaction_scores.out " + \
                "--universe-file " + temp_folder + "/SIMULATED_reduced_universe_with_fva.xml " + \
                    "--pool-size ${NUM_SOLNS} --pool-gap " + str(pool_gap)
    if integrality_tolerance != "":
        perform_gap_fill_command = perform_gap_fill_command + " --integrality-tolerance " + str(
            integrality_tolerance)
    line_to_new_text[49] = perform_gap_fill_command
    template_file = architect_path + "/scripts/model_reconstruction/TEMPLATE_run_reconstruction.sh"
    file_to_run = main_folder_with_recon_results + "/make_reconstruction.sh"
    utils.copy_and_replace(template_file, file_to_run, line_to_new_text)

    subprocess.call(["sh", file_to_run])
    status_writer.write("Step 5: " + str(datetime.datetime.now()) +
                        ": Gap-filling done.\n")

    status_writer.close()
    if not within_docker:
        utils.print_with_colours(
            "Architect: Thank you for using our tool today! Reconstruction is now done. Find your results under: "
            + final_output_folder)
    else:
        utils.print_with_colours(
            "Architect: Thank you for using our tool today! Reconstruction is now done."
        )