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


Python Chem.MolFromMolFile方法代码示例

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


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

示例1: parse_molecule_to_smiles

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFromMolFile [as 别名]
def parse_molecule_to_smiles(target):
    '''
    Parse a molecular type (smiles, rdkit mol or mol file) into smiles format)
    '''
    try:
        mol = Chem.MolFromSmiles(target)
        if mol:
            #This in order to canonicalize the molecule
            return Chem.MolToSmiles(mol)
    except Exception as e:
        try:
            smiles = Chem.MolToSmiles(target, isomericSmiles = gc.USE_STEREOCHEMISTRY)
            if smiles:
                return smiles
        except Exception as e:
            try:
                mol = Chem.MolFromMolFile(target)
                if mol:
                    return Chem.MolToSmiles(mol, isomericSmiles = gc.USE_STEREOCHEMISTRY)
            except Exception as e:
                MyLogger.print_and_log('Unable to parse target molecule format. Parsing Only available for: Smiles, RDKIT molecule and mol files. Returning "None"', parsing_loc, level = 1)
    return None 
开发者ID:connorcoley,项目名称:ASKCOS,代码行数:24,代码来源:parsing.py

示例2: ReadMolFromMol

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFromMolFile [as 别名]
def ReadMolFromMol(self, filename=""):
        """
        #################################################################
        Read a molecule with mol file format.

        Usage:

            res=ReadMolFromMol(filename)

            Input: filename is a file name.

            Output: res is a molecule object.
        #################################################################
        """
        self.mol = Chem.MolFromMolFile(filename)
        return self.mol 
开发者ID:gadsbyfly,项目名称:PyBioMed,代码行数:18,代码来源:Pymolecule.py

示例3: ReadMolFromMol

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFromMolFile [as 别名]
def ReadMolFromMol(filename=""):
    """
    #################################################################
    Read a molecule with mol file format.

    Usage:

        res=ReadMolFromMol(filename)

        Input: filename is a file name.

        Output: res is a molecule object.
    #################################################################
    """
    mol = Chem.MolFromMolFile(filename)
    return mol


############################################################################# 
开发者ID:gadsbyfly,项目名称:PyBioMed,代码行数:21,代码来源:Getmol.py

示例4: GetMolFromNCBI

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFromMolFile [as 别名]
def GetMolFromNCBI(cid=""):
    """
    Downloading the molecules from http://pubchem.ncbi.nlm.nih.gov/ by cid (cid).
    """
    cid = string.strip(cid)
    localfile = urlopen(
        "http://pubchem.ncbi.nlm.nih.gov/summary/summary.cgi?cid="
        + cid
        + "&disopt=SaveSDF"
    )
    temp = localfile.readlines()
    f = file("temp.sdf", "w")
    f.writelines(temp)
    f.close()
    localfile.close()
    m = Chem.MolFromMolFile("temp.sdf")
    os.remove("temp.sdf")
    temp = Chem.MolToSmiles(m, isomericSmiles=True)
    return temp 
开发者ID:gadsbyfly,项目名称:PyBioMed,代码行数:21,代码来源:Getmol.py

示例5: GetMolFromDrugbank

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFromMolFile [as 别名]
def GetMolFromDrugbank(dbid=""):
    """
    Downloading the molecules from http://www.drugbank.ca/ by dbid (dbid).
    """
    dbid = string.strip(dbid)

    localfile = urlopen("http://www.drugbank.ca/drugs/" + dbid + ".sdf")
    temp = localfile.readlines()
    f = file("temp.sdf", "w")
    f.writelines(temp)
    f.close()
    localfile.close()
    m = Chem.MolFromMolFile("temp.sdf")
    os.remove("temp.sdf")
    temp = Chem.MolToSmiles(m, isomericSmiles=True)
    return temp 
开发者ID:gadsbyfly,项目名称:PyBioMed,代码行数:18,代码来源:Getmol.py

示例6: loadMolFile

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFromMolFile [as 别名]
def loadMolFile(self, filename):
        self.fileName = filename
        mol = Chem.MolFromMolFile(str(self.fileName), sanitize=False, strictParsing=False)
        self.editor.mol = mol
        self.statusBar().showMessage("File opened") 
开发者ID:EBjerrum,项目名称:rdeditor,代码行数:7,代码来源:rdEditor.py

示例7: monomer1_from_molfile

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFromMolFile [as 别名]
def monomer1_from_molfile(self, molfile, opt=True, removeHs=False):
        self.monomer1 = Chem.MolFromMolFile(molfile, removeHs=removeHs) 
开发者ID:Mishima-syk,项目名称:psikit,代码行数:4,代码来源:sapt.py

示例8: monomer2_from_molfile

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFromMolFile [as 别名]
def monomer2_from_molfile(self, molfile, opt=True, removeHs=False):
        self.monomer2 = Chem.MolFromMolFile(molfile, removeHs=removeHs) 
开发者ID:Mishima-syk,项目名称:psikit,代码行数:4,代码来源:sapt.py

示例9: read_from_molfile

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFromMolFile [as 别名]
def read_from_molfile(self, molfile, opt=True, removeHs=False):
        self.mol = Chem.MolFromMolFile(molfile, removeHs=removeHs)
        if opt:
            self.rdkit_optimize() 
开发者ID:Mishima-syk,项目名称:psikit,代码行数:6,代码来源:psikit.py

示例10: ReadMolFromMOL

# 需要导入模块: from rdkit import Chem [as 别名]
# 或者: from rdkit.Chem import MolFromMolFile [as 别名]
def ReadMolFromMOL(filename=""):
    """
    Read a  molecule by mol file format.

    Usage:

        res=ReadMolFromMOL(filename)

        Input: filename is a file name with path.

        Output: res is a  molecular object.

    """
    mol = Chem.MolFromMolFile(filename)
    return mol 
开发者ID:gadsbyfly,项目名称:PyBioMed,代码行数:17,代码来源:Getmol.py


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