Exemple #1
0
print smarts

pat = Smarts.compile(smarts)
assert pat.match(m)

smiles = []

file = open("F:\\Chemical Libraries\\Libraries to Purchase\\Nat_425.sdf")

reader = MDL.mdlin(file)
mol = reader.next()

print "reading natural products"
i = 0
while mol:
    fp = Fingerprint.generateFingerprint(mol)
    smile = mol.cansmiles()
    mol = removeTerminalAtoms(mol)
    smiles.append(
        (len(mol.atoms), len(mol.bonds), smile, mol.arbsmarts(), i, fp))
    i += 1
    mol = reader.next()

search = smiles
search.sort()

smiles = []

print "processing"

dict = {}
Exemple #2
0
from bsddb3 import dbshelve
from frowns import Smiles, Smarts, Fingerprint

# ################################################################
# load database (this only needs to be done once
# you can comment this out at a later data
# ################################################################
# this is a persistent disk cache
cache = dbshelve.open("FOO.shelve")
molecules = ["CCCN", "c1ccccc1CCN", "C#C(N)CCc1ccccc1CCc1ccccc1"]

for m in molecules:
    mol = Smiles.smilin(m)
    fp = Fingerprint.generateFingerprint(mol)
    # cache the fingerprint using the canonical smiles
    # as the key and the fingerprint object as the value
    # shelves can store any picklable object!
    cache[mol.cansmiles()] = fp

cache.close()

# ##################################################################
# Iterate through database to see which molecules we need to
# do a full substructure search on
# ##################################################################
cache = dbshelve.open("FOO.shelve", 'r')

query = "CCCN" # this should reject molecule #2 above

testFP = Fingerprint.generateFingerprint(Smiles.smilin(query))
Exemple #3
0
from bsddb3 import dbshelve
from frowns import Smiles, Smarts, Fingerprint

# ################################################################
# load database (this only needs to be done once
# you can comment this out at a later data
# ################################################################
# this is a persistent disk cache
cache = dbshelve.open("FOO.shelve")
molecules = ["CCCN", "c1ccccc1CCN", "C#C(N)CCc1ccccc1CCc1ccccc1"]

for m in molecules:
    mol = Smiles.smilin(m)
    fp = Fingerprint.generateFingerprint(mol)
    # cache the fingerprint using the canonical smiles
    # as the key and the fingerprint object as the value
    # shelves can store any picklable object!
    cache[mol.cansmiles()] = fp

cache.close()

# ##################################################################
# Iterate through database to see which molecules we need to
# do a full substructure search on
# ##################################################################
cache = dbshelve.open("FOO.shelve", 'r')

query = "CCCN"  # this should reject molecule #2 above

testFP = Fingerprint.generateFingerprint(Smiles.smilin(query))
Exemple #4
0
print smarts

pat = Smarts.compile(smarts)
assert pat.match(m)

smiles = []

file = open("F:\\Chemical Libraries\\Libraries to Purchase\\Nat_425.sdf")

reader = MDL.mdlin(file)
mol = reader.next()

print "reading natural products"
i = 0
while mol:
    fp = Fingerprint.generateFingerprint(mol)
    smile = mol.cansmiles()
    mol = removeTerminalAtoms(mol)
    smiles.append((len(mol.atoms), len(mol.bonds), smile, mol.arbsmarts(), i, fp))
    i += 1
    mol = reader.next()

search = smiles
search.sort()

smiles = []


print "processing"

dict = {}