cgexplore.utilities.AtomliteDatabase

class cgexplore.utilities.AtomliteDatabase(db_file)[source]

Bases: object

Holds an atomlite database with some useful methods.

Methods

add_entries

Add molecules to database as entry.

add_molecule

Add molecule to database as entry.

add_properties

Add properties to an entry by key.

get_database

Access the atomlite Database object.

get_entries

Get all entries.

get_entry

Get specific entry.

get_entry_list

Get all entries.

get_molecule

Get a molecule.

get_num_entries

Get the number of molecular entries in the database.

get_num_property_entries

Get the number of property entries in the database.

get_property

Get the properties of an entry.

get_property_df

Get a DataFrame of the properties in the database.

get_property_entries

Get all property entries.

get_property_entry

Get specific entry.

has_molecule

Check if database has a molecule by key.

keep_if

Filter database entries by properties.

remove_entry

Remove an entry by key.

remove_property

Add properties to an entry by key.

set_property

Add properties to an entry by key.

Parameters:

db_file (Path)

add_entries(entries)[source]

Add molecules to database as entry.

Parameters:

entries (Sequence[Entry])

Return type:

None

add_molecule(molecule, key)[source]

Add molecule to database as entry.

Parameters:
  • molecule (Molecule)

  • key (str)

Return type:

None

add_properties(key, property_dict)[source]

Add properties to an entry by key.

Parameters:
Return type:

None

get_database()[source]

Access the atomlite Database object.

Return type:

Database

get_entries()[source]

Get all entries.

Return type:

Iterator[Entry]

get_entry(key)[source]

Get specific entry.

Parameters:

key (str)

Return type:

Entry

get_entry_list()[source]

Get all entries.

Return type:

list[Entry]

get_molecule(key)[source]

Get a molecule.

Parameters:

key (str)

Return type:

Molecule

get_num_entries()[source]

Get the number of molecular entries in the database.

Return type:

int

get_num_property_entries()[source]

Get the number of property entries in the database.

Return type:

int

get_property(key, property_key, property_type)[source]

Get the properties of an entry.

Parameters:
  • key (str)

  • property_key (str)

  • property_type (type)

Return type:

bool | float | str | None | list[Json] | dict[str, Json]

get_property_df(properties, allow_missing=False)[source]

Get a DataFrame of the properties in the database.

Parameters:
  • properties (Sequence[str]) – The paths of the properties to retrieve. Valid paths are described in the atomlite docs.

  • allow_missing (bool) – If True, rows with some missing properties will be included in the DataFrame and hold null values.

Returns:

A DataFrame of the property entries in the database.

Return type:

DataFrame

get_property_entries()[source]

Get all property entries.

Return type:

Iterator[PropertyEntry]

get_property_entry(key)[source]

Get specific entry.

Parameters:

key (str)

Return type:

PropertyEntry

has_molecule(key)[source]

Check if database has a molecule by key.

Parameters:

key (str)

Return type:

bool

keep_if(column, value)[source]

Filter database entries by properties.

Parameters:
Return type:

Iterator[Entry]

remove_entry(key)[source]

Remove an entry by key.

Parameters:

key (str)

Return type:

None

remove_property(key, property_path)[source]

Add properties to an entry by key.

Parameters:
  • key (str)

  • property_path (str)

Return type:

None

set_property(key, property_path, value)[source]

Add properties to an entry by key.

Parameters:
Return type:

None