当前位置: 首页>>代码示例>>Python>>正文


Python rdMolDescriptors.CalcExactMolWt方法代码示例

本文整理汇总了Python中rdkit.Chem.rdMolDescriptors.CalcExactMolWt方法的典型用法代码示例。如果您正苦于以下问题:Python rdMolDescriptors.CalcExactMolWt方法的具体用法?Python rdMolDescriptors.CalcExactMolWt怎么用?Python rdMolDescriptors.CalcExactMolWt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rdkit.Chem.rdMolDescriptors的用法示例。


在下文中一共展示了rdMolDescriptors.CalcExactMolWt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: evaluate_chem_mol

# 需要导入模块: from rdkit.Chem import rdMolDescriptors [as 别名]
# 或者: from rdkit.Chem.rdMolDescriptors import CalcExactMolWt [as 别名]
def evaluate_chem_mol(mol):
    try:
        Chem.GetSSSR(mol)
        clogp = Crippen.MolLogP(mol)
        mw = MolDescriptors.CalcExactMolWt(mol)
        tpsa = Descriptors.TPSA(mol)
        ret_val = [
            True,
            320 < mw < 420,
            2 < clogp < 3,
            40 < tpsa < 60
        ]
    except:
        ret_val = [False] * 4

    return ret_val



# Same as above but decodes and check if a cached value could be used. 
开发者ID:stan-his,项目名称:DeepFMPO,代码行数:22,代码来源:rewards.py

示例2: evaluate_chem_mol

# 需要导入模块: from rdkit.Chem import rdMolDescriptors [as 别名]
# 或者: from rdkit.Chem.rdMolDescriptors import CalcExactMolWt [as 别名]
def evaluate_chem_mol(mol):
    try:
        Chem.GetSSSR(mol)
        clogp = Crippen.MolLogP(mol)
        mw = MolDescriptors.CalcExactMolWt(mol)
        tpsa = Descriptors.TPSA(mol)
        ret_val = [
            True,
            320 < mw < 420,
            2 < clogp < 3,
            40 < tpsa < 60
        ]
    except:
        ret_val = [False] * 4
        
    return ret_val



# Same as above but decodes and check if a cached value could be used. 
开发者ID:stan-his,项目名称:DeepFMPO,代码行数:22,代码来源:rewards.py

示例3: __init__

# 需要导入模块: from rdkit.Chem import rdMolDescriptors [as 别名]
# 或者: from rdkit.Chem.rdMolDescriptors import CalcExactMolWt [as 别名]
def __init__(self, mol, atom_count=None, MW=None, Tb=None):
        if type(mol) == Chem.rdchem.Mol:
            self.rdkitmol = mol
        else:
            self.rdkitmol = Chem.MolFromSmiles(mol)
        if atom_count is None:
            self.rdkitmol_Hs = Chem.AddHs(self.rdkitmol)
            self.atom_count = len(self.rdkitmol_Hs.GetAtoms())
        else:
            self.atom_count = atom_count
        if MW is None:
            self.MW = rdMolDescriptors.CalcExactMolWt(self.rdkitmol_Hs)
        else:
            self.MW = MW
            
        self.counts, self.success, self.status = smarts_fragment(J_BIGGS_JOBACK_SMARTS_id_dict, rdkitmol=self.rdkitmol)
            
        if Tb is not None:
            self.Tb_estimated = self.Tb(self.counts)
        else:
            self.Tb_estimated = Tb 
开发者ID:CalebBell,项目名称:thermo,代码行数:23,代码来源:joback.py

示例4: reward_target_mw

# 需要导入模块: from rdkit.Chem import rdMolDescriptors [as 别名]
# 或者: from rdkit.Chem.rdMolDescriptors import CalcExactMolWt [as 别名]
def reward_target_mw(mol, target,ratio=40,max=4):
    """
    Reward for a target molecular weight
    :param mol: rdkit mol object
    :param target: float
    :return: float (-inf, max]
    """
    x = rdMolDescriptors.CalcExactMolWt(mol)
    reward = -1 * np.abs((x - target)/ratio) + max
    return reward

# TODO(Bowen): num rings is a discrete variable, so what is the best way to
# calculate the reward? 
开发者ID:bowenliu16,项目名称:rl_graph_generation,代码行数:15,代码来源:molecule.py

示例5: choose

# 需要导入模块: from rdkit.Chem import rdMolDescriptors [as 别名]
# 或者: from rdkit.Chem.rdMolDescriptors import CalcExactMolWt [as 别名]
def choose(self, mol):
        """Return the largest covalent unit.

        The largest fragment is determined by number of atoms (including hydrogens). Ties are broken by taking the
        fragment with the higher molecular weight, and then by taking the first alphabetically by SMILES if needed.

        :param mol: The molecule to choose the largest fragment from.
        :type mol: rdkit.Chem.rdchem.Mol
        :return: The largest fragment.
        :rtype: rdkit.Chem.rdchem.Mol
        """
        log.debug('Running LargestFragmentChooser')
        # TODO: Alternatively allow a list of fragments to be passed as the mol parameter
        fragments = Chem.GetMolFrags(mol, asMols=True)
        largest = None
        for f in fragments:
            smiles = Chem.MolToSmiles(f, isomericSmiles=True)
            log.debug('Fragment: %s', smiles)
            organic = is_organic(f)
            if self.prefer_organic:
                # Skip this fragment if not organic and we already have an organic fragment as the largest so far
                if largest and largest['organic'] and not organic:
                    continue
                # Reset largest if it wasn't organic and this fragment is organic
                if largest and organic and not largest['organic']:
                    largest = None
            # Count atoms
            atoms = 0
            for a in f.GetAtoms():
                atoms += 1 + a.GetTotalNumHs()
            # Skip this fragment if fewer atoms than the largest
            if largest and atoms < largest['atoms']:
                continue
            # Skip this fragment if equal number of atoms but weight is lower
            weight = rdMolDescriptors.CalcExactMolWt(f)
            if largest and atoms == largest['atoms'] and weight < largest['weight']:
                continue
            # Skip this fragment if equal atoms and equal weight but smiles comes last alphabetically
            if largest and atoms == largest['atoms'] and weight == largest['weight'] and smiles > largest['smiles']:
                continue
            # Otherwise this is the largest so far
            log.debug('New largest fragment: %s (%s)', smiles, atoms)
            largest = {'smiles': smiles, 'fragment': f, 'atoms': atoms, 'weight': weight, 'organic': organic}
        return largest['fragment'] 
开发者ID:mcs07,项目名称:MolVS,代码行数:46,代码来源:fragment.py

示例6: choose

# 需要导入模块: from rdkit.Chem import rdMolDescriptors [as 别名]
# 或者: from rdkit.Chem.rdMolDescriptors import CalcExactMolWt [as 别名]
def choose(self, mol):
        """Return the largest covalent unit.

        The largest fragment is determined by number of atoms (including hydrogens). Ties are broken by taking the
        fragment with the higher molecular weight, and then by taking the first alphabetically by SMILES if needed.

        :param mol: The molecule to choose the largest fragment from.
        :type mol: :rdkit:`Mol <Chem.rdchem.Mol-class.html>`
        :return: The largest fragment.
        :rtype: :rdkit:`Mol <Chem.rdchem.Mol-class.html>`
        """
        log.debug("Running LargestFragmentChooser")
        # TODO: Alternatively allow a list of fragments to be passed as the mol parameter
        fragments = Chem.GetMolFrags(mol, asMols=True)
        largest = None
        for f in fragments:
            smiles = Chem.MolToSmiles(f, isomericSmiles=True)
            log.debug("Fragment: %s", smiles)
            organic = is_organic(f)
            if self.prefer_organic:
                # Skip this fragment if not organic and we already have an organic fragment as the largest so far
                if largest and largest["organic"] and not organic:
                    continue
                # Reset largest if it wasn't organic and this fragment is organic
                if largest and organic and not largest["organic"]:
                    largest = None
            # Count atoms
            atoms = 0
            for a in f.GetAtoms():
                atoms += 1 + a.GetTotalNumHs()
            # Skip this fragment if fewer atoms than the largest
            if largest and atoms < largest["atoms"]:
                continue
            # Skip this fragment if equal number of atoms but weight is lower
            weight = rdMolDescriptors.CalcExactMolWt(f)
            if largest and atoms == largest["atoms"] and weight < largest["weight"]:
                continue
            # Skip this fragment if equal atoms and equal weight but smiles comes last alphabetically
            if (
                largest
                and atoms == largest["atoms"]
                and weight == largest["weight"]
                and smiles > largest["smiles"]
            ):
                continue
            # Otherwise this is the largest so far
            log.debug("New largest fragment: %s (%s)", smiles, atoms)
            largest = {
                "smiles": smiles,
                "fragment": f,
                "atoms": atoms,
                "weight": weight,
                "organic": organic,
            }
        return largest["fragment"]


# ==============================================================================
# from .normalize import NORMALIZATIONS, MAX_RESTARTS, Normalizer
# ============================================================================== 
开发者ID:gadsbyfly,项目名称:PyBioMed,代码行数:62,代码来源:PyPretreatMolutil.py


注:本文中的rdkit.Chem.rdMolDescriptors.CalcExactMolWt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。