Interface for a generic database.
A typical database can be used to retrieve molecules by calling the get method:
water = db.get("molecule", "example.water")
A database can also provide custom functionalities to store or search for entries. Those are implemented in custom methods.
See the other implementations for more relevant examples.
Get a data entry from the database.
Subclasses are required to implement this method to provide access to the database.
Parameters
An identifier that represents the kind of data that we want to extract. Examples of such identifier are “system”, “molecule”, “data” etc.
The key associated with the database entry. By convention you can use dotted names to provide some kind of nested structure.
Custom extra arguments.
Chemlab default database.
This database contains some example molecules and some atomic data.
Retrieve a molecule from the database. The included molecule keys are:
Retrieve atomic data. The available data is:
Data was taken from the OpenBabel distribution.
Retrieve data from the online Chemspider database by passing an string identifier.
Parameters
The chemspider security token. When token is None, chemlab will try to retrieve the token from a configuration file in $HOME/.chemlabrc that has the entry:
[chemspider]
token=YOUR-SECURITY-TOKEN
The get method requires a key argument to retrieve a database entry. A valid key can be, for instance, the common name of a certain chemical, a SMILES string or an InChi identifier. This is just an adapter on the chemspipy library.
Retrieve the InChi string for the compound.
Retrieve the molecular formula as a LaTeX string.
Retrieve the url of a 2D image representation of the compound.
Retrieve the SMILES string for the compound.
Retrieve the average mass
Retrieve the nominal mass
Return the InChi key.
Predicted LogP (partition coefficient) using the ACD LogP algorithm.
Predicted LogP using the XLogP algorithm.
PNG image of the compound as a data string.
MOL mdl file containing 2D coordinates of the compound.
Retrieve the common name of the compound.
Store serialized molecules and systems in a directory tree.
See Having your own molecular database for an example of usage.
Directory where the database is located.
Get an entry from the database. Key is the filename without extension of the serialized molecule. Molecules are stored in the subdirectory.
Get an entry from the database. Key is the filename without extension of the serialized system.
Store a Molecule or a System passed as value in the directory structure. The objects are dumped to disk after being serialized to json.