chemicalchecker.database.molecule.Molecule

class Molecule(**kwargs)[source]

Bases: Base

Molecule Table class.

Parameters:
  • inchikey (str) – primary key, simple unique name for the Datasource.

  • inchi (str) – the download link.

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

Methods

add

Method to add a new row to the table.

add_bulk

Add lot of rows to the table.

add_missing_only

Add data to the table if not already present.

get

Method to query table.

get_inchikey_inchi_mapping

get_missing_from_set

Attributes

inchi

inchikey

metadata

registry

static add(kwargs)[source]

Method to add a new row to the table.

Parameters:

kwargs (dict) – The data in dictionary format .

static add_bulk(data, chunk=1000, on_conflict_do_nothing=True)[source]

Add lot of rows to the table.

This method allows to load a big amount of rows in one instruction

Parameters:
  • data (list) – The data in list format. Each list member is a new row. The order is important.

  • chunk (int) – The size of the chunks to load data to the database.

static add_missing_only(data)[source]

Add data to the table if not already present.

Parameters:

data (dict) – The data in dict format, containing inchikey, inchi.

static get(key)[source]

Method to query table.