Skip to content

ligandmap

Classes:

  • LigandMap

    Work on a list of morphs and use their information to generate a each to each map.

LigandMap

LigandMap(ligands, morphs)

Work on a list of morphs and use their information to generate a each to each map. This class then uses the information for * clustering, * path finding (traveling salesman, minimum spanning tree) * visualisation, etc.

Methods:

  • generate_map

    Use the underlying morphs to extract the each to each cases.

Source code in ties/ligandmap.py
26
27
28
29
30
31
32
def __init__(self, ligands, morphs):
    self.morphs = morphs
    self.ligands = ligands
    # similarity map
    self.map = None
    self.map_weights = None
    self.graph = None

generate_map

generate_map()

Use the underlying morphs to extract the each to each cases.

Source code in ties/ligandmap.py
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
def generate_map(self):
    """
    Use the underlying morphs to extract the each to each cases.
    """
    # a simple 2D map of the ligands
    self.map = [list(range(len(self.ligands))) for l1 in range(len(self.ligands))]

    # weights based on the size of the superimposed topology
    self.map_weights = numpy.zeros([len(self.ligands), len(self.ligands)])
    for morph in self.morphs:
        self.map[morph.ligA.index][morph.ligZ.index] = morph
        self.map[morph.ligZ.index][morph.ligA.index] = morph

        matched_left, matched_right, disappearing_atoms, appearing_atoms = morph.overlap_fractions()
        # use the average number of matched fractions in both ligands
        weight = 1 - (matched_left + matched_right) / 2.0
        self.map_weights[morph.ligA.index][morph.ligZ.index] = weight
        self.map_weights[morph.ligZ.index][morph.ligA.index] = weight

        # update also the morph
        morph.set_distance(weight)