Exact Structure Search with Chemcaster
Chemcaster now supports exact structure queries, both through the graphical administrative interface and through the Web API.
The new capability can be tested using the curl HTTP client. As an example, prepare a file called query.xml in your working directory with this content - representing an exact structure search for benzene:
<?xml version="1.0" encoding="UTF-8"?>
<query>
<molfile>[NO NAME]
CHEMWRIT 2D
Created with ChemWriter - http://metamolecular.com/chemwriter
6 6 0 0 0 0 0 0 0 0 0 V2000
-1.2400 1.0200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.3740 0.5200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.4921 1.0200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.4921 2.0200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.3740 2.5200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2400 2.0200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 2 2 0 0 0 0
2 3 1 0 0 0 0
3 4 2 0 0 0 0
4 5 1 0 0 0 0
5 6 2 0 0 0 0
6 1 1 0 0 0 0
M END</molfile>
</query>
We can now issue a POST request, assuming a registry id of 1, to create a new query:
$ curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' -F upload=@query.xml -u you@example.com:password https://chemcaster.com/registries/1/queries
This responds with the following xml and a code of 201 (Created):
<?xml version="1.0" encoding="UTF-8"?>
<query>
<id type="integer">2</id>
<molfile>[NO NAME]
CHEMWRIT 2D
Created with ChemWriter - http://metamolecular.com/chemwriter
6 6 0 0 0 0 0 0 0 0 0 V2000
-1.2400 1.0200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.3740 0.5200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.4921 1.0200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.4921 2.0200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.3740 2.5200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2400 2.0200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 2 2 0 0 0 0
2 3 1 0 0 0 0
3 4 2 0 0 0 0
4 5 1 0 0 0 0
5 6 2 0 0 0 0
6 1 1 0 0 0 0
M END</molfile>
</query>
We can read the Query ID ('2') and then retrieve our search results with:
$ curl -H 'Accept: application/xml' -u you@example.com:secret https://chemcaster.com/queries/2
The response contains the original query in molfile format as well as the name and id of the matching structure:
<query>
<id type="integer">2</id>
<registry-id type="integer">1</registry-id>
<molfile>[NO NAME]
CHEMWRIT 2D
Created with ChemWriter - http://metamolecular.com/chemwriter
6 6 0 0 0 0 0 0 0 0 0 V2000
-1.2400 1.0200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.3740 0.5200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.4921 1.0200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.4921 2.0200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-0.3740 2.5200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-1.2400 2.0200 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1 2 2 0 0 0 0
2 3 1 0 0 0 0
3 4 2 0 0 0 0
4 5 1 0 0 0 0
5 6 2 0 0 0 0
6 1 1 0 0 0 0
M END</molfile>
<results type="array">
<structure>
<id>16</id>
<name>benzene</name>
</structure>
</results>
</query>
Chemcaster is the Web service for sites with rich chemical content. Request your testing invitation today and see how easy it can be to create your next chemistry Web application.


From another blog post:
"The same API can be used to perform exact structure queries. Just replace the mode element content with "Exact Structure". If not specified, the mode defaults to "Substructure."
Doesn't this mean that the query here is a substructure search, as Exact Structure is not specificed above?
@Noel, you are correct. The documentation here was written before the addition of the substructure search capability. Update is on the way.