This section features use cases that show EDB Postgres Advanced Server can be used with Chemaxon JChem PostgreSQL Cartridge.
Create Table with MOLECULE datatype column
Execute the following SQL Statement to create the table where a column has the MOLECULE datatype to store and process chemical data:
View the structure of the above created table using the following statement:
Insert/Update/Delete Chemical Data
Execute the following SQL Statements to insert data including chemical data into the table:
Execute the following SELECT Statement to retrieve the data from the table including the chemical data in the column mo1:
Execute the following SQL Statements to update and delete data from the table including the chemical data:
Create Indexes in Molecule Columns
For indexing a column containing chemical structures the following indextypes are provided:
The following example creates indexes in the Molecule columns on the Table:
Searching for data from the Molecule Column
Substructure Search:
Substructure search finds all structures that contain the query structure as a subgraph. Sometimes the chemical subgraph is not the only thing that is provided, but certain query features that further restrict the structure are also provided as well. If special molecular features are present on the query (eg. stereochemistry, charge, etc.), then only those targets match the ones which also contain the feature. However, if a feature is missing from the query, it is not required to be missing (by default).
Substructure search is performed using the symmetrical sub-/super-structure search operator: |<|.
Execute the following SQL Statement to create a table and insert data:
Execute the following SQL Statements to search data from the Molecule Column:
Duplicate Search:
Duplicate searches are mainly used before database inserts to check whether the given molecule is already contained in the database or not.
Duplicate searches are performed using the |=| operator.
Execute the following SQL Statement to search data from the Molecule Column:
Superstructure Search:
Superstructure searches find all molecules where the query is the superstructure of the target.
Superstructure searches are performed using the sub-/super-structure search operator: |>|.
Execute the following SQL Statement to search data from the Molecule Column:
Full Fragment (exact fragment) Search:
Full Fragment searches are between Substructure searches and Full searches; the query must fully match to a whole fragment of the target. Other fragments may be present in the target, but they are ignored.
Execute the following SQL Statement to search data from the Molecule Column:
Import Data using COPY command
Data can be imported into the table that has a Molecule column using the COPY Command.
Create a .csv File containing the comma separate data for the example below to work:
Execute the following SQL Statement to create the table:
Execute the COPY statement to load data into the table: COPY public.chemical_data FROM '/home/edb/Desktop/m_data.csv' (FORMAT csv);
Once the COPY statement is executed successfully, then execute the following SQL Statement to fetch data from the table: