BioSimSpace.Align.generateNetwork¶
-
BioSimSpace.Align.
generateNetwork
(molecules, names=None, work_dir=None, plot_network=False, links_file=None, property_map={}, n_edges_forced=None)¶ Generate a perturbation network using Lead Optimisation Mappper (LOMAP).
- Parameters
molecules (:[class:
Molecule
], [rdkit.Chem.rdchem.Mol]) – A list of molecules. (Both BioSimSpace and RDKit molecule objects are supported.)names ([str]) – A list of names for the molecules. If None, then the index of each molecule will be used.
work_dir (str) – The working directory for the LOMAP process.
plot_network (bool) – Whether to plot the network when running from within a notebook. If using a ‘work_dir’, then a PNG image will be located in ‘work_dir/images/network.png’.
links_file (str) –
Path to a file providing links to seed the LOMAP graph with. Each record in the file must contain a minimum of two entries, i.e. the names of the ligands of interest, e.g.
ligA ligB
The third column can include a pre-computed score for the ligand pair, e.g.
ligA ligB score
A value of < -1 means ‘recompute’, but force the link to be included. A negative value (>= -1) means use the absolute value as the score, but force the link to be included. A positive means use this value as the score, but treat the link as normal in the LOMAP graph calculation. Finally, if the fourth column contains the string ‘force’, then the link is included, irrespective of its score.
property_map (dict) – A dictionary that maps “properties” in molecule0 to their user defined values. This allows the user to refer to properties with their own naming scheme, e.g. { “charge” : “my-charge” }
n_edges_forced (int) – An integer that forces the number of edges that should be used in the perturbation network. Must be in the range [1 .. (len(molecules)**2-len(molecules))/2]. In cases where n_edges_forced > the number of edges suggested by LOMAP, BioSimSpace will add the top scoring n edges parsed from the LOMAP output file and add them to the network. Conversely if n_edges_forced < the number of edges suggested by LOMAP, BioSimSpace will remove the bottom n edges parsed from the LOMAP output file. This last option is discouraged as it can cause network cycle breakage and disconnecting of ligands/clusters from the network.
- Returns
edges ([(int, int)]) – A tuple containing the edges of the network. Each edge is itself a tuple, containing the indices of the molecules that are connected by the edge.
scores ([float]) – The LOMAP score for each edge. The higher the score implies that a perturbation between molecules along an edge is likely to be more accurate.