Chemistry Reference
In-Depth Information
try:
assert match
return True
except:
return False
$EOPY$ Language plpythonu Immutable;
Create Or Replace Function frowns.count_matches(smi Text, sma Text)
Returns Integer As $EOPY$
from frowns import Smiles
from frowns import Smarts
mol = Smiles.smilin(smi)
pat = Smarts.compile(sma)
match = pat.match(mol)
try:
assert match
imatch = 0
for path in match:
imatch += 1
return imatch
except:
return 0
$EOPY$ Language plpythonu Immutable;
Create Or Replace Function frowns.list_matches(smi Text, sma Text,
imatch Integer, istart Integer) Returns Integer[] As $EOPY$
from frowns import Smiles
from frowns import Smarts
mol = Smiles.smilin(smi)
pat = Smarts.compile(sma)
try:
match = pat.match(mol)
assert match
except:
return '{null}'
all_matches = list()
nmatch = 0
for path in match:
nmatch += 1
matches = [a.index+1 for a in path.atoms]
pgarray = "{" + ",".join([str(i-1+istart) for i in matches]) + "}"
if (nmatch == imatch):
return pgarray
all_matches.append(pgarray)
return "{"+ ",".join(all_matches)+ "}"
$EOPY$ Language plpythonu Immutable;
Create Or Replace Function frowns.list_matches(Text, Text) Returns
Integer[] As $EOSQL$
Select frowns.list_matches($1, $2, 1, 0);
$EOSQL$ Language SQL Immutable;
Search WWH ::




Custom Search