Exemple #1
0
def main(argv=None):
    # Parse arguments
    parser = ap.build_getcontact_parser(__doc__, True)
    args = parser.parse_args(argv)

    top = args.topology
    traj = args.trajectory
    output = args.output
    cores = args.cores
    ligand = args.ligand
    solv = args.solv
    lipid = args.lipid
    sele1 = args.sele
    sele2 = args.sele2
    beg = args.beg
    end = args.end if args.end else sys.maxsize
    stride = args.stride
    distout = args.distout
    geom_criteria = process_geometric_criterion_args(args)

    # If sele2 is None set it to sele1
    if sele2 is None:
        sele2 = sele1

    # Check interaction types
    all_itypes = ["hp", "sb", "pc", "ps", "ts", "vdw", "hb"]
    if "all" in args.itypes:
        itypes = all_itypes
    else:
        for itype in args.itypes:
            if itype not in all_itypes:
                parser.error(itype + " is not a valid interaction type")

        itypes = args.itypes

    # Begin computation
    tic = datetime.datetime.now()
    compute_contacts(top, traj, output, itypes, geom_criteria, cores, beg, end,
                     stride, distout, ligand, solv, lipid, sele1, sele2)
    toc = datetime.datetime.now()
    total_time = (toc - tic).total_seconds()
    print("\nTotal computation time:", total_time, "seconds")

    print("topology=%s" % top)
    print("trajectory=%s" % traj)
    print("output=%s" % output)
    print("cores=%s" % cores)
    print("solv=%s" % solv)
    print("sele=%s" % sele1)
    print("sele2=%s" % sele2)
    print("stride=%s" % stride)
def main(argv=None):
    # Parse arguments
    parser = ap.build_getcontact_parser(__doc__, False)
    args, unknown = parser.parse_known_args(argv)

    top = args.structure
    traj = args.structure
    output = args.output
    cores = 1
    solv = args.solv
    lipids = args.lipids
    sele1 = args.sele
    sele2 = args.sele2
    beg = 0
    end = 0
    stride = 1
    geom_criteria = process_geometric_criterion_args(args)

    # If sele2 is None set it to sele1
    if sele2 is None:
        sele2 = sele1

    # Check interaction types
    all_itypes = ["hp", "sb", "pc", "ps", "ts", "vdw", "hb", "lhb"]
    if "all" in args.itypes:
        itypes = all_itypes
    else:
        for itype in args.itypes:
            if itype not in all_itypes:
                parser.error(itype + " is not a valid interaction type")

        itypes = args.itypes

    # Begin computation
    tic = datetime.datetime.now()
    compute_contacts(top, traj, output, itypes, geom_criteria, cores, beg, end,
                     stride, solv, lipids, sele1, sele2)
    toc = datetime.datetime.now()
    print("\nTotal computation time: " + str((toc - tic).total_seconds()) +
          " seconds")

    print("topology=%s" % top)
    print("trajectory=%s" % traj)
    print("output=%s" % output)
    print("solv=%s" % solv)
    print("sele=%s" % sele1)
    print("sele2=%s" % sele2)
def main(argv=None):
    # Parse arguments
    parser = ap.build_getcontact_parser(__doc__, False)
    args, unknown = parser.parse_known_args(argv)

    top = args.structure
    traj = args.structure
    output = args.output
    cores = 1
    ligand = args.ligand
    solv = args.solv
    sele = args.sele
    beg = 0
    end = 0
    stride = 1
    geom_criterion_values = process_geometric_criterion_args(args)

    # Check interaction types
    all_itypes = ["sb", "pc", "ps", "ts", "vdw", "hb", "lhb"]
    if "all" in args.itypes:
        itypes = all_itypes
    else:
        for itype in args.itypes:
            if itype not in all_itypes:
                parser.error(itype + " is not a valid interaction type")

        itypes = args.itypes

    # Begin computation
    tic = datetime.datetime.now()
    compute_contacts(top, traj, output, itypes, geom_criterion_values, cores,
                     beg, end, stride, solv, sele, ligand)
    toc = datetime.datetime.now()
    print("\nTotal computation time: " + str((toc - tic).total_seconds()) +
          " seconds")

    print("topology=%s" % top)
    print("trajectory=%s" % traj)
    print("output=%s" % output)
    print("cores=%s" % cores)
    print("ligand=%s" % ",".join(ligand))
    print("solv=%s" % solv)
    print("sele=%s" % sele)
    print("stride=%s" % stride)
Exemple #4
0
def main(traj_required=True):
    if "--help" in sys.argv or "-h" in sys.argv:
        print(HELP_STR)
        exit(1)

    # Parse required and optional arguments
    parser = argparse.ArgumentParser(add_help=False)
    parser.add_argument('--topology',
                        type=str,
                        required=True,
                        help='path to topology file ')
    parser.add_argument('--trajectory',
                        type=str,
                        required=traj_required,
                        default=None,
                        help='path to trajectory file')
    parser.add_argument('--output',
                        type=str,
                        required=True,
                        help='path to output file')
    parser.add_argument('--cores',
                        type=int,
                        default=6,
                        help='number of cpu cores to parallelize upon')
    parser.add_argument('--solv',
                        type=str,
                        default="TIP3",
                        help='resname of solvent molecule')
    parser.add_argument('--sele',
                        type=str,
                        default=None,
                        help='atom selection query in VMD')
    parser.add_argument('--stride',
                        type=int,
                        default=1,
                        help='skip frames with specified frequency')
    parser.add_argument('--ligand',
                        type=str,
                        nargs="+",
                        default=[],
                        help='resname of ligand molecule')

    # Parse geometric criterion arguments
    parser.add_argument(
        '--sb_cutoff_dist',
        type=float,
        default=4.0,
        help=
        'cutoff for distance between anion and cation atoms [default = 4.0 angstroms]'
    )
    parser.add_argument(
        '--pc_cutoff_dist',
        type=float,
        default=6.0,
        help=
        'cutoff for distance between cation and centroid of aromatic ring [default = 6.0 angstroms]'
    )
    parser.add_argument(
        '--pc_cutoff_ang',
        type=float,
        default=60,
        help=
        'cutoff for angle between normal vector projecting from aromatic plane and vector from aromatic center to cation atom [default = 60 degrees]'
    )
    parser.add_argument(
        '--ps_cutoff_dist',
        type=float,
        default=7.0,
        help=
        'cutoff for distance between centroids of two aromatic rings [default = 7.0 angstroms]'
    )
    parser.add_argument(
        '--ps_cutoff_ang',
        type=float,
        default=30,
        help=
        'cutoff for angle between the normal vectors projecting from each aromatic plane [default = 30 degrees]'
    )
    parser.add_argument(
        '--ps_psi_ang',
        type=float,
        default=45,
        help=
        'cutoff for angle between normal vector projecting from aromatic plane 1 and vector between the two aromatic centroids [default = 45 degrees]'
    )
    parser.add_argument(
        '--ts_cutoff_dist',
        type=float,
        default=5.0,
        help=
        'cutoff for distance between centroids of two aromatic rings [default = 5.0 angstroms]'
    )
    parser.add_argument(
        '--ts_cutoff_ang',
        type=float,
        default=30,
        help=
        'cutoff for angle between the normal vectors projecting from each aromatic plane minus 90 degrees [default = 30 degrees]'
    )
    parser.add_argument(
        '--ts_psi_ang',
        type=float,
        default=45,
        help=
        'cutoff for angle between normal vector projecting from aromatic plane 1 and vector between the two aromatic centroids [default = 45 degrees]'
    )
    parser.add_argument(
        '--hbond_cutoff_dist',
        type=float,
        default=3.5,
        help=
        'cutoff for distance between donor and acceptor atoms [default = 3.5 angstroms]'
    )
    parser.add_argument(
        '--hbond_cutoff_ang',
        type=float,
        default=70,
        help=
        'cutoff for angle between donor hydrogen acceptor [default = 70 degrees]'
    )
    parser.add_argument(
        '--vdw_epsilon',
        type=float,
        default=0.5,
        help=
        'amount of padding for calculating vanderwaals contacts [default = 0.5 angstroms]'
    )
    parser.add_argument(
        '--vdw_res_diff',
        type=int,
        default=2,
        help=
        'minimum residue distance for which to consider computing vdw interactions'
    )

    parser.add_argument(
        '--itypes',
        required=True,
        type=str,
        nargs="+",
        metavar="ITYPE",
        help='Compute only these interaction types. Valid choices are: \n'
        '* all (default), \n'
        '* sb (salt-bridges), \n'
        '* pc (pi-cation), \n'
        '* ps (pi-stacking), \n'
        '* ts (t-stacking), \n'
        '* vdw (van der Waals), \n'
        '* hb (hydrogen bonds)\n'
        '* lhb (ligand hydrogen bonds)')

    args, unknown = parser.parse_known_args()

    top = args.topology
    traj = args.trajectory
    output = args.output
    cores = args.cores
    ligand = args.ligand
    solv = args.solv
    sele = args.sele
    stride = args.stride
    geom_criterion_values = process_geometric_criterion_args(args)

    # Check interaction types
    all_itypes = ["sb", "pc", "ps", "ts", "vdw", "hb", "lhb"]
    if "all" in args.itypes:
        itypes = all_itypes
    else:
        for itype in args.itypes:
            if itype not in all_itypes:
                print("Error: " + itype + " is not a valid interaction type")
                exit(1)

        itypes = args.itypes

    # Begin computation
    tic = datetime.datetime.now()
    compute_contacts(top, traj, output, itypes, geom_criterion_values, cores,
                     stride, solv, sele, ligand)
    toc = datetime.datetime.now()
    print("Computation time: " + str((toc - tic).total_seconds()) + " seconds")

    print("topology=%s" % top)
    print("trajectory=%s" % traj)
    print("output=%s" % output)
    print("cores=%s" % cores)
    print("ligand=%s" % ",".join(ligand))
    print("solv=%s" % solv)
    print("sele=%s" % sele)
    print("stride=%s" % stride)