Chemistry Reference
In-Depth Information
Consider a Web application to allow a user to sketch in a structure,
perform a substructure search, and fetch experimental data for the result-
ing structures. The general structure of the program is:
Present the Web form.
Provide for structure input (drawing).
Provide for table search requirements.
Process the Web form.
Construct the appropriate SQL.
Connect to database and select results.
Present results to user.
Graphical input and output is essential to any chemical Web application.
One common method to provide this is using Marvin or another sketch-
ing tool. Rather than have each application generate the javascript needed to
present the sketcher or viewer, consider storing this code in the database and
selecting it when needed. The marvin _ sketch function returns javascript
that will cause a marvin sketch applet to appear on a Web page.
Create Or Replace Function marvin_sketch() Returns Text As $EOSQL$
Select '
<script LANGUAGE="JavaScript1.1">
msketch_name = "MSketch";
msketch_begin("/marvin", 200, 200);
msketch_param("background", "#EEFFDD");
msketch_param("menubar", "false");
msketch_param("molFormat", "smiles");
msketch_param("importConv", "-a");
msketch_param("detach", "hide");
msketch_end();
function get_smiles() {
smi = MSketch.getMol("smiles:a");
return smi;
}
</script>
'::Text;
$EOSQL$ Language SQL;
This SQL function can then be used by any application that needs to
include a Marvin sketcher. For example, a php application would include
this code.
<HTML>
<HEAD>
<TITLE>Sample PHP web app example</TITLE>
<SCRIPT SRC="http://www.chemaxon.com/marvin/marvin.js"></SCRIPT>
</HEAD>
<BODY>
<?php print marvin_sketch(); ?>
Search WWH ::




Custom Search