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


Python frowns.Smiles类代码示例

本文整理汇总了Python中frowns.Smiles的典型用法代码示例。如果您正苦于以下问题:Python Smiles类的具体用法?Python Smiles怎么用?Python Smiles使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test2

def test2():

    smiles, id = "OC1=C(Cl)C=CC=C1[N+]", 1
    mol = Smiles.smilin(smiles)
    print mol.cansmiles()
    for atom in mol.atoms:
        print atom.index
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:7,代码来源:test_rings.py

示例2: cansmiles

    def cansmiles(self) :
        """
        affiche en canonical smiles une brique
        """
        # sys.stderr.write("Brique.cansmiles: will call molecule.cansmiles() ...\n")
        a = self.molecule.cansmiles()

        m = Smiles.smilin("".join(re.split("[\[\]+-]","".join(re.split("H[0-9]*",a)))))
        return m.cansmiles()
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:9,代码来源:Brique.py

示例3: checkSmiles

def checkSmiles(fname):
    from frowns import Smiles
    try:
        fSmiles = open(fname, "r")
        lines = fSmiles.readlines()
        fSmiles.close()
        asmiles = Smiles.smilin(lines[0].split()[0])
        return True
    except:
        return False
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:10,代码来源:www_iMolecule.py

示例4: test

def test():
    from frowns import Smiles
    import time
    smiles, id = "OC1=C(Cl)C=CC=C1[N+]C2CCC3CC3CCC2", 1
    mol = Smiles.smilin(smiles, transforms=[])

    t1 = time.time()
    for i in range(100):
        atoms, bonds = getAtomsBondsInRings(mol)
    print (time.time() - t1)/100
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:10,代码来源:InRings.py

示例5: test

def test():
    from frowns import Smiles
    import time
    smiles, id = "OC1=C(Cl)C=CC=C1[N+]C2CCC3CC3CCC2", 1
    mol = Smiles.smilin(smiles, transforms=[])
    assert frerejaqueNumber(mol) == 3
    t1 = time.time()
    for i in range(100):
        frerejaqueNumber(mol)
    print (time.time() - t1)/100    
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:10,代码来源:frerejaque.py

示例6: next

    def next(self):
        if not self.smiles:
            return None
        smile = self.smiles.pop()
        m = Smiles.smilin(smile)

        #addCoords(m)
        #toplevel = Toplevel(self.tk)
        if self.drawer:
            self.drawer.frame.pack_forget()
        drawer = self.drawer=TkMoleculeDrawer.MoleculeDrawer(self.tk, m, name=smile)
        drawer.pack(expand=1, fill=BOTH)
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:12,代码来源:test_graphviz.py

示例7: test

def test():
    from frowns import Smiles
    strings = ["Cl/C(F)=C(Br)/I",
               #"Cl\C)(F)=C(Br)\I", <- fix parsing bug
               #"Cl\C(\F)=C(/Br)\I",
               "Cl\C(F)=C(Br)\I",
               "Cl\C(F)=C(Br)/I",
               "Cl/C(F)=C(Br)\I"
               ]
    for s in strings:
        print s
        m = Smiles.smilin(s)
        assignStereo(m)
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:13,代码来源:test_double_bond_stereo.py

示例8: test

def test():
    from frowns import Smiles
    import time
    h = BuildMatcher()
    for smi in ["C",
                "CC",
                "c",
                "C(N)O",
                "[O]",
                "c1ccccc1",
                ]:
        matcher = compile(smi)
        print matcher.dump()
        smiles = Smiles.smilin(smi)
        pathset = matcher.match(smiles)
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:15,代码来源:Compiler.py

示例9: testPath

def testPath():
    from frowns import Smiles
    mol = Smiles.smilin("C1CCCC1CCCC2CCCC3CCC3CCC2")
    rings = {}
    spans = [Path(mol.atoms[0], rings)]
    while spans:
        new = []
        for span in spans:
            new += span.next()
            if len(rings) == 1:
                break
        if len(rings) == 1:
            break
        spans = new
    print rings
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:15,代码来源:rings.py

示例10: len

            atom.hybrid = SP2
            continue
        symbol = atom.symbol
        hcount = atom.valences[0] - atom.sumBondOrders()
        connections = len(atom.bonds) + hcount
        charge = atom.charge
        if atom.symbol in ["C", "N"] and connections == 2:
            charge = ANY

        atom.hybrid =  _hybrid.get((symbol, connections, charge), "")
        #print atom, `atom`, hcount, atom.hybrid

        
        
            
if __name__ == "__main__":
    from frowns import Smiles
    from frowns.perception import TrustedSmiles, sssr
    
    smiles = "CC(=O)OC1C(N(c2c(CC1c1ccc(OC)cc1)cc(cc2)Oc1ccccc1)CCN(C)C)=O"
    smiles = "O=C1NC(N)=NC2=C1N=CNC2"
    #smiles = "O=C1C=CC(=O)C=C1"

    print smiles
    mol = Smiles.smilin(smiles, [sssr.sssr])
            
    getHybridAtoms(mol)
    for cycle in mol.cycles:
        print [(atom, atom.symbol, atom.hybrid) for atom in cycle.atoms]

开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:29,代码来源:Hybrid.py

示例11:

from frowns import Smiles

print "*"*33
print "benzene with default transforms"
mol = Smiles.smilin("c1ccccc1")
print mol.cansmiles()

print "atoms"
for atom in mol.atoms:
    print "\tsymbol %s hcount %s aromatic %s"%(
        atom.symbol, atom.hcount, atom.aromatic)

print "bonds"
for bond in mol.bonds:
    print "\tbondorder %s, bondtype %s fixed %s"%(
        bond.bondorder, bond.bondtype, bond.fixed)

print "*"*33
print "benzene with no transforms"
mol = Smiles.smilin("c1ccccc1", transforms=[])
print mol.cansmiles()

print "atoms"
for atom in mol.atoms:
    print "\tsymbol %s hcount %s aromatic %s"%(
        atom.symbol, atom.hcount, atom.aromatic)

print "bonds"
for bond in mol.bonds:
    print "\tbondorder %s, bondtype %s fixed %s"%(
        bond.bondorder, bond.bondtype, bond.fixed)
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:31,代码来源:example3.py

示例12: len

import time
from frowns import Smiles
from frowns import Smarts
mol = Smiles.smilin("CCCCC(C)CCCC(C)CCCCCC(C)C(C)CCCCCC(C)CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCN")
pat = Smarts.compile("C*")
print len(pat.match(mol))

pat2 = Smarts.compile("[#6]")
t1 = time.time()
print len(pat2.match(mol))
t2 = time.time()
print t2-t1
t1 = time.time()
print len(pat2.match(mol))
t2 = time.time()
print t2-t1

print mol.vfgraph
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:18,代码来源:test_smarts_errors.py

示例13:

from frowns import Smiles

m = Smiles.smilin("N[[email protected]](C)(F)C(=O)O")
print "initial smiles:", m.arbsmiles(isomeric=1)
print "canonical smiles:", m.cansmiles(isomeric=1)

print
m = Smiles.smilin("[[email protected]](C)(F)(O)")
print "initial smiles:", m.arbsmiles(isomeric=1)
print "canonical smiles:", m.cansmiles(isomeric=1)
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:10,代码来源:test_chirality.py

示例14: generatePaths

            
        
def generatePaths(molecule, maxdepth=5,
                  name_atom=name_atom, name_bond=name_bond,
                  name_ring_atom=name_ring_atom, name_ring_bond=name_ring_bond,
                  make_rpath=0):
    """(molecule, maxdepth, *name_atom, *name_bond) -> linear paths
    Generate all linear paths through a molecule up to maxdepth
    change name_atom and name_bond to name the atoms and bonds
    in the molecule

    name_atom and name_bond must return a stringable value"""
    paths = {}
    for atom in molecule.atoms:
        _bfswalk(atom, {atom:1}, [name_atom(atom)], [name_ring_atom(atom)], paths, 1, maxdepth,
                 name_atom, name_bond, name_ring_atom, name_ring_bond, make_rpath)
    return paths.keys()

if __name__ == "__main__":
    from frowns import Smiles
    mol = Smiles.smilin("CCNc1cccc1")
    paths = generatePaths(mol)
    print len(paths)
    print paths
    
    ONE_STRING_PER_PATH = 1
    paths = generatePaths(mol)
    print len(paths)
    print paths
            
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:27,代码来源:SmartsLinearPaths.py

示例15:

from frowns import Smiles

mol = Smiles.smilin("C1CC=1")
print mol.arbsmiles()
开发者ID:MasaruFukuie,项目名称:Frog2,代码行数:4,代码来源:test_closures.py


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