Example #1
0
    collectlib.check_sizes(unboundsizes, unboundfiles)

    rmsdlib.check_pdbs(unbounds, bounds)

    allboundatoms = []
    for p in bounds:
        for c in p.coordinates():
            allboundatoms.append(c)
    allboundatoms = numpy.array(allboundatoms)

    sel = numpy.array([True] * len(allboundatoms))
    if not opt_allresidues:
        imask = rmsdlib.build_interfacemask(bounds, thresh)
        sel = (sel & imask)
    if not opt_allatoms:
        amask = rmsdlib.build_atommask(bounds, atomnames)
        sel = (sel & amask)
    allboundatoms = numpy.array(allboundatoms)
    fboundatoms = numpy.array(allboundatoms[sel])
    icom = numpy.sum(fboundatoms, axis=0) / float(len(fboundatoms))
    fboundatoms = fboundatoms - icom

    nstruc = 0
    f1 = sys.stdout
    if output is not None:
        f1 = open(output, 'w')
    print >> f1, "\n".join(struc_header)
    for structure in structures:
        ligands = structure[1]
        assert len(ligands) == len(pivots), (len(ligands), len(pivots))
        sys.stdout.flush()
Example #2
0
if imodefile: initargs += ["--imodes", imodefile]
ens_receptor = 0
for nr, ensfile in ensfiles:
    if nr == "1": ens_receptor = 1
    initargs += ["--ens", nr, ensfile]

collectlib.collect_init(initargs)
unboundsizes = [len(list(p.atoms())) for p in unbounds]
receptor_offset = collectlib.ieins[0]
collectlib.check_sizes([receptor_offset] + unboundsizes,
                       [receptor] + unboundfiles)

if opt_allatoms:
    unbound_amask = rmsdlib.build_hydrogenmask(unbounds)
else:
    unbound_amask = rmsdlib.build_atommask(unbounds, atomnames)

unbound_amasks_ligand = []
for unr, u in enumerate(unbounds):
    if opt_allatoms:
        uu = rmsdlib.build_hydrogenmask([u])
    else:
        uu = rmsdlib.build_atommask([u], atomnames)
    offset = 0
    if unr: offset = sum(unboundsizes[:unr])
    offsetmask = numpy.zeros(offset, dtype="bool")
    uu = numpy.concatenate((offsetmask, uu), axis=0)
    unbound_amasks_ligand.append(uu)

for p in unbounds + bounds:
    if opt_allatoms: