def main():
    parser = argparse.ArgumentParser(description='Perform chunking in preparation for dynamic undocking')
    parser.add_argument('-p', '--protein', help='Apoprotein in PDB format')
    parser.add_argument('-l', '--ligand', help='Ligand in mol format')
    # parser.add_argument('-o', '--output', help="PDB output")
    parser.add_argument('-c', '--cutoff', type=float, help='Cutoff for chunk calculation')
    parser.add_argument('-b', '--ignore-buffers', action='store_true', help='Do not remove buffers (solvent, ions etc.)')
    parser.add_argument('-i', '--interaction', help='Protein atom to use for ligand interaction.')

    args = parser.parse_args()

    # A couple of file name
    orig_file = prot_file = args.protein
    chunk_protein = "protein_out.pdb"
    chunk_protein_prot = "protein_out_prot.pdb"
    # Do the removal of buffer mols and alt locs
    if not args.ignore_buffers:
        prot_file = remove_prot_buffers_alt_locs(prot_file)
    # Do the chunking and the protonation
    chunk_with_amber(
        args.ligand, prot_file, args.interaction, chunk_protein, args.cutoff, orig_file
    )
    # Protonate
    disulfides = find_disulfides(chunk_protein)
    do_tleap(chunk_protein, chunk_protein_prot, disulfides)
Exemple #2
0
def main(prot_file, mol_file, interaction, cutoff):
    # A couple of file name
    orig_file = prot_file
    chunk_protein = "protein_out.pdb"
    chunk_protein_prot = "protein_out_prot.pdb"
    # Do the removal of buffer mols and alt locs
    prot_file = remove_prot_buffers_alt_locs(prot_file)
    # Do the chunking and the protonation
    # Chunk
    chunk_with_amber(mol_file, prot_file, interaction, chunk_protein, cutoff,
                     orig_file)
    # Protontate
    disulfides = find_disulfides(chunk_protein)
    do_tleap(chunk_protein, chunk_protein_prot, disulfides)
def run_simulation(
    prot_file,
    mol_file,
    prot_code,
    prot_int,
    cutoff,
    init_velocity,
    num_smd_cycles,
    gpu_id,
    md_len,
    params,
):
    if not os.path.isfile("equil.chk"):
        # A couple of file name
        orig_file = prot_file
        chunk_protein = "protein_out.pdb"
        chunk_protein_prot = "protein_out_prot.pdb"
        # Do the removal of buffer mols and alt locs
        if params.get("remove_buffers", True):
            prot_file = remove_prot_buffers_alt_locs(prot_file)
        # Do the chunking and the protonation
        if params.get("prep_chunk", True):
            # Chunk
            chunk_with_amber(mol_file, prot_file, prot_int, chunk_protein,
                             cutoff, orig_file)
            # Protontate
            disulfides = find_disulfides(chunk_protein)
            do_tleap(chunk_protein, chunk_protein_prot, disulfides)
        else:
            chunk_protein_prot = prot_file
        # Paramaterize the ligand
        mol2_file = params.get("mol2_file_prepped", None)
        if not mol2_file:
            results = prep_lig(mol_file, prot_code)
            mol2_file = results[0]
        prepare_system(mol2_file, chunk_protein_prot)
        # Now find the interaction and save to a file
        results = find_interaction(prot_int, orig_file)
        startdist = params.get("distance", results[2])
        # Now do the equlibration
        do_equlibrate(gpu_id=gpu_id)
    else:
        # Now find the interaction and save to a file
        results = find_interaction(prot_int, prot_file)
        startdist = params.get("distance", results[2])
    # Open the file and check that the potential is stable and negative
    if not check_if_equlibrated("density.csv", 1):
        print("SYSTEM NOT EQUILIBRATED")
        sys.exit()
    if params.get("just_equilib", False):
        print("SYSTEM FENISHED EQULIBRATING")
        return
    # Now do the MD
    for i in range(num_smd_cycles):
        if i == 0:
            md_start = "equil.chk"
        else:
            md_start = "md_" + str(i - 1) + ".chk"
        log_file = "md_" + str(i) + ".csv"
        perform_md(
            md_start,
            "md_" + str(i) + ".chk",
            log_file,
            "md_" + str(i) + ".pdb",
            md_len=md_len,
            gpu_id=gpu_id,
        )
        # Open the file and check that the potential is stable and negative
        if not check_if_equlibrated(log_file, 3):
            print("SYSTEM NOT EQUILIBRATED")
            sys.exit()
        # Now find the interaction and save to a file
        run_steered_md(
            300,
            "md_" + str(i) + ".chk",
            "smd_" + str(i) + "_300.csv",
            "smd_" + str(i) + "_300.dat",
            "smd_" + str(i) + "_300.pdb",
            "smd_" + str(i) + "_300.dcd",
            startdist,
            init_velocity=init_velocity,
            gpu_id=gpu_id,
        )
        run_steered_md(
            325,
            "md_" + str(i) + ".chk",
            "smd_" + str(i) + "_325.csv",
            "smd_" + str(i) + "_325.dat",
            "smd_" + str(i) + "_325.pdb",
            "smd_" + str(i) + "_325.dcd",
            startdist,
            init_velocity=init_velocity,
            gpu_id=gpu_id,
        )