konnektor.utils#

konnektor.utils.toy_data.build_n_random_mst_network(n_compounds=30, rand_seed=42, sub_networks: int = 2, overlap: int = 1, uni_score: bool = False) tuple[LigandNetwork, LigandNetwork]#

This function returns a randomized toy mst graph.

Parameters:
  • n_compounds (int) – number of artificial compounds

  • rand_seed (int) – random seed number

  • uni_score

  • mapping (whether to use always the score of 1 for an atom)

Returns:

the toy mst network

Return type:

LigandNetwork

konnektor.utils.toy_data.build_random_dataset(n_compounds: int = 20, rand_seed: int = None)#

This function builds a random dataset of n_compounds artificial molecules. Additionally the generic scorer and mapper matching the compounds is returned.

Parameters:
  • n_compounds (int) – number of artificial molecules to build

  • rand_seed (int) – random number seed.

Returns:

compounds, mapper, scorer

Return type:

(Iterable[SmallMoleculeComponent], AtomMapper, AtomMappingScorer)

konnektor.utils.toy_data.build_random_fully_connected_network(n_compounds=30, rand_seed=42, uni_score: bool = False) LigandNetwork#

This function returns a randomized toy fully connected graph.

Parameters:
  • n_compounds (int) – number of artificial compounds

  • rand_seed (int) – random seed number

  • uni_score – whether to use always the score of 1 for an atom mapping

Returns:

the toy fully connected network

Return type:

LigandNetwork

konnektor.utils.toy_data.build_random_mst_network(n_compounds=30, rand_seed=42, uni_score: bool = False) LigandNetwork#

This function returns a randomized toy mst graph.

Parameters:
  • n_compounds (int) – number of artificial compounds

  • rand_seed (int) – random seed number

  • uni_score

  • mapping (whether to use always the score of 1 for an atom)

Returns:

the toy mst network

Return type:

LigandNetwork

class konnektor.utils.toy_data.genMapper#

Bases: AtomMapper

Build a generic Mapper, that only has use for dummy mappings. Generates empty mappings

suggest_mappings(molA, molB) AtomMapping#

Suggests possible mappings between two Components

Suggests zero or more AtomMapping objects, which are possible atom mappings between two Component objects.

class konnektor.utils.toy_data.genScorer(n_scores: int, rand_seed: int = None)#

Bases: object

Builds a scorer that contains a predefined sequence of scores, n_scores long and each score is initially randomly uniformly picked between 1 and 0. The scorer repeats the score sequence after n_scoresth time, calling the scorer obj. The use of this class is currently envisioned for toydata and testing.

Parameters:
  • n_scores (int) – number of scores to build

  • rand_seed (int) – random number seed for the random scores.

get_score(mapping: AtomMapping) float#

return the score, at position self.i

Parameters:

mapping (AtomMapping) – the score will not be depending on the mapping! this mimics only classical scorer use.

Returns:

score to be returned.

Return type:

float