<commit_before>"""
Calculate MUV descriptors with the RDKit.
"""

__author__ = "<NAME>"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"

import numpy as np

from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import ChiralType


class MUVDescriptors(object):
    """
    Calculate MUV descriptors:
    * Atom counts: all, heavy, B, Br, C, Cl, F, I, N, O, P, S
    * Number of hydrogen bond acceptors / donors
    * cLogP
    * Number of chiral centers
    * Number of ring systems
    """
    def __call__(self, mol):
        return self.calculate_descriptors(mol)

    def calculate_descriptors(self, mol):
        """
        Calculate MUV descriptors for a molecule.

        Parameters
        ----------
        mol : Mol
            Molecule.
        """
        d = []

        # prep
        mol = Chem.AddHs(mol)
        mol = Chem.AssignStereochemistry(mol, cleanIt=True, force=True,
                                         flagPossibleStereoCenters=True)
<commit_msg>Fix bad assignment<commit_after>"""
Calculate MUV descriptors with the RDKit.
"""

__author__ = "<NAME>"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"

import numpy as np

from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import ChiralType


class MUVDescriptors(object):
    """
    Calculate MUV descriptors:
    * Atom counts: all, heavy, B, Br, C, Cl, F, I, N, O, P, S
    * Number of hydrogen bond acceptors / donors
    * cLogP
    * Number of chiral centers
    * Number of ring systems
    """
    def __call__(self, mol):
        return self.calculate_descriptors(mol)

    def calculate_descriptors(self, mol):
        """
        Calculate MUV descriptors for a molecule.

        Parameters
        ----------
        mol : Mol
            Molecule.
        """
        d = []

        # prep
        mol = Chem.AddHs(mol)
        Chem.AssignStereochemistry(mol, cleanIt=True, force=True,
                                   flagPossibleStereoCenters=True)

{'fraction_non_alphanumeric': 0.09771511910549344, 'fraction_numerical': 0.004861448711716091, 'mean_word_length': 2.2006220839813375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2926212', 'n_tokens_mistral': 654, 'n_tokens_neox': 590, 'n_words': 189}