Ejemplo n.º 1
0
    def __init__(self, target, fp_type, score_modifier: ScoreModifier = None) -> None:
        """
        Args:
            target: target molecule
            fp_type: fingerprint type
            score_modifier: score modifier
        """
        super().__init__(score_modifier=score_modifier)

        self.target = target
        self.fp_type = fp_type
        target_mol = smiles_to_rdkit_mol(target)
        if target_mol is None:
            raise RuntimeError(f'The similarity target {target} is not a valid molecule.')

        self.ref_fp = get_fingerprint(target_mol, self.fp_type)
Ejemplo n.º 2
0
 def score_mol(self, mol: Chem.Mol) -> float:
     fp = get_fingerprint(mol, self.fp_type)
     return TanimotoSimilarity(fp, self.ref_fp)