示例#1
0
    parser.add_argument('-o', '--out', default="single",
                        help="prefix of the output file")
    parser.add_argument('--gaff', default="gaff16",
                        help="the version of GAFF to use for ligand")
    return parser


#
# If this is run from the command-line
#
if __name__ == '__main__':

    args = get_arg_parser().parse_args()

    # Setup the logger
    logger = sim.setup_logger("make_single_py.log")

    if None in (args.tem0, args.tem1, args.pdb0, args.pdb1):
        sim.SetupError("Not all four necessary input files given. Cannot setup single-topology")

    eletem,vdwtem,combtem,cmap = make_single(args.tem0,args.tem1,args.pdb0,args.pdb1,args.map,gaffversion=args.gaff)
    eletem.write(args.out+"_ele.tem")
    vdwtem.write(args.out+"_vdw.tem")
    combtem.write(args.out+"_comb.tem")
    if args.map is None:
        write_map(cmap,args.out+"_cmap.dat")

      # Write out a summary
    summarize_single(eletem,vdwtem,logger.info)

 
示例#2
0
logger = logging.getLogger('protoms')


def get_arg_parser():
    import argparse
    # Setup a parser of the command-line arguments
    parser = argparse.ArgumentParser(
        description="Program make a dummy corresponding to a molecule")
    parser.add_argument('-f', '--file', help="the name of a PDB file")
    parser.add_argument(
        '-o',
        '--out',
        help="the name of the dummy PDB file",
        default="dummy.pdb")
    return parser


if __name__ == "__main__":

    args = get_arg_parser().parse_args()

    # Setup the logger
    logger = simulationobjects.setup_logger("make_dummy_py.log")

    if args.file is None:
        print("Nothing to do! Exiting.")

    dummy = make_dummy(args.file)
    dummy.write(args.out)
示例#3
0
    def tearDown(self):
        super(TestLigSetup, self).tearDown()

    def test_prep_ligand(self):
        try:
            self.prefix = _get_prefix("dcb.pdb")
            self.ligands.append(self.prefix)

            pref_lig = {}
            pref_lig["pdb"], pref_lig["obj"] = \
                _load_ligand_pdb(self.prefix,
                                 [os.path.join(proto_env, "tests/setup")])
            self.ligfiles[self.prefix] = pref_lig

            # Unmerged pdb object for single ligand
            self.ligobj = self.ligfiles[self.ligands[0]]["obj"]

            args = MockArgs()
            _prep_ligand(self.ligfiles[self.prefix], 0, 0, self.ligobj, [" "],
                         self.tarlist, args)

        except ImportError as e:
            print(e)
            print("Ligand file not found.")


if __name__ == '__main__':
    logger = simulationobjects.setup_logger('protoms_py.log')
    unittest.main()
    nose.runmodule()
示例#4
0
        default=None)
    parser.add_argument(
        '--setupseed',
        help="optional random number seed for generation of water coordinates",
        default=None,
        type=int)
    return parser


#
# -------------------------------------
# If this is run from the command-line
# -------------------------------------
#

if __name__ == "__main__":
    args = get_arg_parser().parse_args()

    # Setup the logger
    logger = simulationobjects.setup_logger("convertwater_py.log")
    if args.setupseed is not None:
        logger.debug("Setup seed = %d" % args.setupseed)
    np.random.seed(args.setupseed)

    pdb_in = simulationobjects.PDBFile(filename=args.pdb)
    pdb_out = convertwater(pdb_in,
                           args.model,
                           ignorH=args.ignoreh,
                           watresname=args.resname)
    pdb_out.write(args.out)
示例#5
0
    # Setup a parser of the command-line arguments
    parser = argparse.ArgumentParser(
        description="Program merge a series of ProtoMS template files")
    parser.add_argument('-f',
                        '--files',
                        nargs="+",
                        help="the name of the template files")
    parser.add_argument('-o',
                        '--out',
                        help="the name of the merged template file")
    return parser


if __name__ == "__main__":

    args = get_arg_parser().parse_args()

    # Setup the logger
    logger = simulationobjects.setup_logger("merge_templates_py.log")

    if args.files is None:
        raise simulationobjects.SetupError(
            "Nothing to do! No template files provided. Exiting.")
    if args.out is None:
        raise simulationobjects.SetupError(
            "A name for the merged template file needs to be provided!")

    tem = merge_templates(args.files)
    if isinstance(tem, simulationobjects.TemplateFile):
        tem.write(args.out)
示例#6
0
        '--alldihs',
        help='sample improper dihedrals',
        default=False,
        action='store_true')
    parser.add_argument(
        '--gaff',
        help='gaff version to use, gaff14 or gafff16',
        default='gaff16')
    return parser


if __name__ == '__main__':
    args = get_arg_parser().parse_args()

    # Setup the logger
    logger = sim.setup_logger("build_template_py.log")

    tem = build_template(
        temfile=args.out,
        prepifile=args.prepi,
        zmatfile=args.zmat,
        frcmodfile=args.frcmod,
        resname=args.name,
        translate=args.translate,
        rotate=args.rotate,
        alldihs=args.alldihs,
        gaffversion=args.gaff)
    tem.write(args.out)
    if args.zmat is None:
        tem.templates[0].write_zmat(os.path.splitext(args.out)[0] + ".zmat")
示例#7
0
        'up to two, space separated, strings of the form "N:AT1,AT2,-AT3"'
        '. N should be either "1" or "2" indicating the corresponding '
        'ligand. The comma separated list of atom names are added to the'
        ' softcore selection. A preceding dash for an atom name specifies'
        ' it should be removed from the softcore selection. The special '
        'value "auto" indictates that automatic softcore assignments '
        'should be accepted without amendment.')
    return parser


if __name__ == "__main__":

    args = get_arg_parser().parse_args()

    # Setup the logger
    logger = simulationobjects.setup_logger("generate_input_py.log")

    free_cmd, bnd_cmd, gas_cmd = generate_input(args.protein, args.ligands,
                                                args.templates, args.protwater,
                                                args.ligwater, args.ranseed,
                                                args)

    # protoMS cannot handle cmd files containing upper case letters
    args.out = args.out.lower()
    if free_cmd is not None:
        free_cmd.writeCommandFile(args.out + "_free.cmd")
    if bnd_cmd is not None:
        if args.simulation == "gcmc":
            bnd_cmd.writeCommandFile(args.out + "_gcmc.cmd")
        elif args.simulation in ["jaws1", "jaws2"]:
            bnd_cmd.writeCommandFile(args.out + "_jaws.cmd")
示例#8
0
        default='t4p')
    parser.add_argument(
        '--resname',
        help="Residue name of the molecules writen to output. Default='WAT'",
        default='WAT')
    parser.add_argument(
        '--number',
        help="Required number of molecules when it differs from the number"
        " of residues in the file.",
        default=None)
    parser.add_argument(
        '--setupseed',
        help="Optional random number seed for generation of water coordinates",
        default=None,
        type=int)
    return parser


if __name__ == "__main__":
    args = get_arg_parser().parse_args()

    logger = simulationobjects.setup_logger("distribute_waters_py.log")
    if args.setupseed is not None:
        logger.debug("Setup seed = %d" % args.setupseed)
    np.random.seed(args.setupseed)

    outobj = distribute_particles(args.box, args.molecules, args.model,
                                  args.resname, args.number)
    outobj.write(filename=args.outfile)
    print("\nMolecules printed in %s" % args.outfile)
示例#9
0
    # Setup a parser of the command-line arguments
    parser = argparse.ArgumentParser(
        description="Program convert atom names in a protein pdb-file to"
        " ProtoMS style")
    parser.add_argument('-p', '--protein', help="the protein PDB-file")
    parser.add_argument('-o',
                        '--out',
                        help="the output PDB-file",
                        default="protein_pms.pdb")
    parser.add_argument('-s',
                        '--style',
                        help="the style of the input PDB-file",
                        default="amber")
    parser.add_argument('-c',
                        '--conversionfile',
                        help="the name of the file with conversion rules",
                        default="atomnamesmap.dat")
    return parser


if __name__ == "__main__":

    args = get_arg_parser().parse_args()

    # Setup the logger
    logger = simulationobjects.setup_logger("convertatomnames_py.log")

    protein = simulationobjects.PDBFile(filename=args.protein)
    protein_out = pdb2pms(protein, args.style, args.conversionfile)
    protein_out.write(args.out)
示例#10
0
        " coordinates..",
        default=None)
    return parser


#
# -------------------------------------
# If this is run from the command-line
# -------------------------------------
#
if __name__ == '__main__':

    args = get_arg_parser().parse_args()

    # Setup the logger
    logger = simulationobjects.setup_logger("solvate_py.log")
    if args.setupseed is not None:
        logger.debug("Setup seed = %d" % args.setupseed)
    np.random.seed(args.setupseed)

    # Ask for input that is absolutely necessary and
    # that do not have any defaults
    if args.solute is None and args.protein is None:
        print("You haven't entered a protein or a solute to solvate!\n")
        print("Please enter a solute now (Return to skip):")
        args.solute = six.moves.input()
        print("Please enter a protein now (Return to skip):")
        args.protein = six.moves.input()
        if args.solute == "" and args.protein == "":
            print(
                "You still haven't entered a protein or a solute to solvate!",
示例#11
0
    parser.add_argument(
        '-b',
        '--box',
        nargs='+',
        help="Either the centre of the box (x,y,z), or the centre of box AND "
        "length (x,y,z,x,y,z). If the centre is specified and the length "
        "isn't, twice the 'padding' will be the lengths of a cubic box.",
        default=None)
    return parser


if __name__ == "__main__":
    args = get_arg_parser().parse_args()

    # Setup the logger
    logger = simulationobjects.setup_logger("make_gcmcbox_py.log")

    if args.solute is None and args.box is None:
        print("Nothing to do! Exiting.")

    if args.box is None:
        pdbobj = simulationobjects.PDBFile()
        pdbobj.read(args.solute)
        box = make_gcmcbox(pdbobj, args.out, args.padding)
    elif len(args.box) == 3:
        box = {
            "center":
            np.array(
                [float(args.box[0]),
                 float(args.box[1]),
                 float(args.box[2])]),
示例#12
0
        description="Program to run antechamber and parmchk"
        " for a series of PDB-files")
    parser.add_argument('-f',
                        '--files',
                        nargs="+",
                        help="the name of the PDB-files")
    parser.add_argument('-n',
                        '--name',
                        help="the name of the solute",
                        default="UNK")
    parser.add_argument('-c',
                        '--charge',
                        nargs="+",
                        type=float,
                        help="the net charge of each PDB-file")
    return parser


if __name__ == "__main__":
    args = get_arg_parser().parse_args()
    # Setup the logger
    logger = simulationobjects.setup_logger("ambertools_py.log")

    for i, filename in enumerate(args.files):
        if args.charge is None or i >= len(args.charge):
            charge = 0.0
        else:
            charge = args.charge[i]
        run_antechamber(filename, charge, args.name)
        run_parmchk(filename + "P")
示例#13
0
                        default="")
    parser.add_argument(
        '--jaws2box',
        action='store_true',
        help="whether to apply a header box for jaws2 to the pdb "
        "files of individual waters",
        default=False)
    return parser


if __name__ == "__main__":

    args = get_arg_parser().parse_args()

    # Setup the logger
    logger = simulationobjects.setup_logger("split_jawswater_py.log")

    if args.waters is None:
        print("Nothing to do! Exiting.")

    single_waters, other_waters = split_waters(args.waters)

    if args.jaws2box:
        set_jaws2_box(single_waters)

    single_waters.write([
        args.out + "wat%d.pdb" % (i + 1)
        for i in range(len(single_waters.pdbs))
    ])
    other_waters.write([
        args.out + "not%d.pdb" % (i + 1)
示例#14
0
def get_arg_parser():
    import argparse
    # Setup a parser of the command-line arguments
    parser = argparse.ArgumentParser(
        description="Program to remove water molecules from a GCMC/JAWS-1 box")
    parser.add_argument('-b',
                        '--box',
                        help="the name of the PDB-file containing the box.")
    parser.add_argument(
        '-s',
        '--solvation',
        help="the name of the PDB-file containing the solvation waters")
    parser.add_argument('-o',
                        '--out',
                        help="the name of the output PDB-file",
                        default="cleared_box.pdb")
    return parser


if __name__ == "__main__":
    args = get_arg_parser().parse_args()

    # Setup the logger
    logger = simulationobjects.setup_logger("clear_gcmcbox_py.log")

    if args.solvation is None:
        print("No pdb with solvent provided. Nothing to do! Exiting.")

    nrem, cleared_box = clear_gcmcbox(args.box, args.solvation)
    cleared_box.write(args.out)