We'll revisit several of the contrib programs. We'll see if they handle reactions as written, and make modifications if necessary for those which don't work correctly.
showparts.c ($DY_ROOT/contrib/src/c/smiles
)
% cd
% pwd
/home/mug
% cd jane_doe/toolkit
% mkdir showparts
% cd showparts
% cp $DY_ROOT/contrib/src/c/smiles/showparts.c .
% cp $DY_ROOT/contrib/src/c/smiles/makefile .
% make showparts
% showparts
C.CO
molecule has 2 parts
part 1 atom C
part 2 atom C
part 2 atom O
part 2 bond C-O
C.CO>>CCO
molecule has 3 parts
part 1 atom C
part 2 atom C
part 2 atom O
part 3 atom C
part 3 atom C
part 3 atom O
part 2 bond C-O
part 3 bond C-C
part 3 bond C-O
^D
dt_getrole()
). Compile and test.
Add to variable declarations in showparts():
int role;
Revise the atom loop to:
while (NULL_OB != (atom = dt_next(atoms))) {
sy = dt_symbol(&lensy, atom);
role = dt_getrole(atom,mol);
printf("part %d atom %.*s", du_part(atom), lensy, sy);
if (role == DX_ROLE_REACTANT) printf("(REACTANT)\n");
else if (role == DX_ROLE_AGENT) printf("(AGENT)\n");
else if (role == DX_ROLE_PRODUCT) printf("(PRODUCT)\n");
else printf("(unknown role=%d)\n",role);
}
smarts_filter.c ($DY_ROOT/contrib/src/c/smarts
)
smarts_filter
and run it.
Give a molecule SMARTS (eg. "CCC") and see the results
when entering both molecule and reaction SMILES.
$ smarts_filter "CCC" C1CCCCC1 C1CCCCC1 CO C1CCCCC1>>CCCO C1CCCCC1>>CCCO $ smarts_filter "CCC>>CCO" C1CCCCC1 CO C1CCCCC1>>CCCO C1CCCCC1>>CCCO
dt_count(pathset,TYP_PATH)
). For reaction queries,
identify where the matches occur (eg. in the reactant, product, agent,
or combination thereof).
Revise the appropriate section of code to:
if (NULL_OB != pathset) {
printf("%s\n", buf);
printf("\tnumber of matches = %d\n",dt_count(pathset,TYP_PATH));
}