The stand-alone programs listed in the left frame are written in TRIMpl. All of them are designed to run on client computers except chemcop, which runs on the Daylight server. The client programs connect to chemcop and pass it instructions and data as parameters. Chemcop reads the instructions and calls the appropriate 'Daylight program' running on the server and passes it the data (i.e. a SMILES). The 'Daylight program' uses the data to access Merlin, Thor or the Daylight toolkit. Data generated by the 'Daylight program' are returned to chemcop which sends it back to the client.
Each of the TRIMpl programs is preceded with a description explaining its use. They are presented here as examples of remote procedure calls for you to edit and use as you please. The server programs and scripts were taken from the Daylight collection of contributed software and sometimes modified to fit the RPC system. The following table summarizes the current Daylight capabilities.
|
Objective |
Client Program |
Client Parameter |
Daylight Program |
|
Get list of open Merlin pools |
merlin_open.pl |
None |
listmerlin script |
|
Get list of USMILES, Structure numbers, Similarity indexes from Merlin pool |
minimer.pl |
Name of Merlin pool, SMILES, Number of hits |
minimer.c |
|
Get list of USMILES, Structure numbers, Similarity indexes, MF, MW, CAS from Merlin pool |
merlin_search.pl |
Name of Merlin pool, Search type, Search column, Search value, Number of hits. |
minimer_gen.c |
|
Ping a Merlin pool |
merlin_ping.pl |
Name of Merlin pool |
pingmerlin script |
|
Is SMILES in Thor? |
smi_in_thor.pl |
SMILES |
is_smi_in_db.c |
|
Generate USMILES |
smi_unique.pl |
SMILES |
unique_smile.c |
|
Get USMILES, MF, MW, CAS from Thor |
thor_getdat.pl |
SMILES, Structure number or CAS |
get_data_from_cis.c |
|
Get list of SMILES |
thor_getlist.pl |
List of Structure Numbers |
wrno_list_from_cis.c |
|
Insert TDT into Thor |
thor_load.pl |
TDT |
load_cis script |
|
Get list of open Thor Dbs |
thor_open.pl |
None |
listthor script |
|
Ping a Thor Db |
thor_ping.pl |
Name of Thor Db |
pingthor script |
|
Purge TDT from Thor |
thor_purge.pl |
TDT |
purge_tdt script |
|
Get USMILES, Structure number, MF, MW, CAS, TDT from a Thor Db |
thor_search.pl |
Name of Thor Db, Search field, Search value |
search_foreign.c |
|
SMILES to molfile |
smi2mol.pl |
SMILES |
smi2mol.c |
To create a TRIMrpc system, work from the server to the client. First write a 'Daylight Program' that accesses Thor, Merlin or the Daylight toolkit. As a starting point, search the Daylight contributed programs for one that suits your needs, modify it to fit your situation, and run it on your server. Next add a new module to chemcop that receives parameters from the client and calls your executable file. Finally, modify one of the client programs listed in the left frame so that it connects to your chemcop, passes the parameters required to run your 'Daylight Program' and processes the data that is returned.
Once your client program is working, you can paste it into your ChemBio applications. For example, the following code is a trigger associated with a SMILES field in a window called 'start'. This trigger was copied from the stand-alone program called thor_getdat.pl. Each time the value in the WRNO field (= structure number) is changed, this trigger is executed. This trigger instructs chemcop to run the 'Daylight program' get_data_from_cis.c which queries Thor on WRNO and returns its SMILES, molecular formula, molecular weight and CAS number in a memory list. These values are parsed from the list and assigned to their respective fields.
int c[4]; /* store position of comma delimiters */
int i; /* counter */
list chem_list;
...
/* _________________________ GET DATA FROM THOR __________________________ */
if (p.wrno && p.wrno < "700000" && !p.smile){
chem_list= getchemdat(p.wrno); /* get SMILES,MWbase,MF from Thor */
if (list_rows(chem_list)==2){
p.smile= list_curr(chem_list,0); /* assign SMILES */
list_next(chem_list); /* move to data row */
for(i=1;i<=3;i++) /* find pos of commas */
c[i]= instr(list_curr(chem_list,0),",",1,i);
p.mf= substr(list_curr(chem_list,0),
c[1]+1, c[2]-c[1]-1); /* parse/assign MF */
p.mw= substr(list_curr(chem_list,0),
c[2]+1,c[3]-c[2]-1); /* parse/assign MW */
p.cas=substr(list_curr(chem_list,0),
c[3]+1); /* parse/assign CAS*/
}
else
p.smile= "SMILES not in Thor";/* need fld entry to stop RPC call on re-entry*/
...