Esempio n. 1
0
def parsegene_hbonds_site_reference(c, ref=None):

    if ref is None:
        ref = c.structures[0]

    # First, calculate molecules, molecule sites and hydrogen bonds
    MoleculeSites.get(ref)
    HydrogenBonds.get(ref)

    MoleculeSites.get(c)
    HydrogenBonds.get(c)

    # Now for the actual comparison we need to compile a list of Hbonds
    # for each structure, expressed in terms of molecular sites

    reflabels = HydrogenBondTypes.get(ref)
    hblabels = HydrogenBondTypes.get(c)

    # And now to actually create a comparison
    distL = []

    for hb_lab in hblabels:
        distL.append(list_distance(hb_lab, reflabels))

    return np.array(distL)
Esempio n. 2
0
def parsegene_hbonds_site_compare(c):

    # First, calculate molecules, molecule sites and hydrogen bonds
    MoleculeSites.get(c)
    HydrogenBonds.get(c)

    # Now for the actual comparison we need to compile a list of Hbonds
    # for each structure, expressed in terms of molecular sites

    hblabels = HydrogenBondTypes.get(c)

    # And now to actually create a comparison
    distM = np.zeros((c.length, c.length))

    for hb_i1, hb_lab1 in enumerate(hblabels):
        for hb_i2, hb_lab2 in enumerate(hblabels[hb_i1 + 1:]):
            d = list_distance(hb_lab1, hb_lab2)
            d /= (len(hb_lab1) + len(hb_lab2)) * 0.5
            distM[hb_i1, hb_i1 + hb_i2 + 1] = d
            distM[hb_i1 + hb_i2 + 1, hb_i1] = d

    return distM