7.1. Compound I/O

Compound_io.py: Functions to load MINE databases from and dump compounds into common cheminformatics formats

minedatabase.compound_io.export_inchi_rxns(mine_db: MINE, target: str, rxn_ids: Optional[List[str]] = None) None

Export reactions from a MINE db to a .tsv file.

Parameters
mine_dbMINE

Name of MongoDB to export reactions from.

targetstr

Path to folder to save .tsv export file in.

rxn_idsUnion[List[str], None], optional

Only export reactions with these ids, by default None.

minedatabase.compound_io.export_kbase(mine_db: MINE, target: str) None

Exports MINE compound and reaction data as tab-separated values files amenable to use in ModelSEED.

Parameters
mine_dbMINE

The database to export.

targetstr

Directory in which to place the files.

minedatabase.compound_io.export_mol(mine_db: MINE, target: str, name_field: str = '_id') None

Exports compounds from the database as a MDL molfiles

Parameters
mine_dbMINE

MINE object that contains the database.

targetstr

Directory in which to place the files.

name_fieldstr, optional

FIeld to provide names for the mol files. Must be unique and universal. By default, “_id”.

minedatabase.compound_io.export_sdf(mine_db: MINE, dir_path: str, max_compounds: Optional[int] = None) None

Exports compounds from the database as an MDL SDF file.

Parameters
mine_dbMINE

MINE object that contains the database.

dir_pathstr

Directory for files.

max_compoundsint, optional

Maximum number of compounds per file, by default None.

minedatabase.compound_io.export_smiles(mine_db: MINE, dir_path: str, max_compounds: Optional[int] = None) None

Exports compounds from the database as a SMILES file.

Parameters
mine_dbMINE

MINE object that contains the database.

dir_pathstr

Directory for files.

max_compoundsint, optional

Maximum number of compounds per file, by default None.

minedatabase.compound_io.export_tsv(mine_db: MINE, target: str, compound_fields: Tuple[str] = ('_id', 'Names', 'Model_SEED', 'Formula', 'Charge', 'Inchi'), reaction_fields: Tuple[str] = ('_id', 'SMILES_rxn', 'C_id_rxn')) None

Exports MINE compound and reaction data as tab-separated values files amenable to use in ModelSEED.

Parameters
mine_dbMINE

The database to export.

targetstr

Directory, in which to place the files.

compound_fieldsTuple[str], optional

Fields to export in the compound table, by default (‘_id’, ‘Names’, ‘Model_SEED’, ‘Formula’, ‘Charge’, ‘Inchi’).

reaction_fieldsTuple[str], optional

Fields to export in the reaction table, by default (‘_id’, ‘SMILES_rxn’, ‘C_id_rxn’).

minedatabase.compound_io.import_mol_dir(mine_db: MINE, target: str, name_field: str = 'Name', overwrite: bool = False) None

Imports a directory of molfiles as a MINE database.

Parameters
mine_dbMINE

The database to export.

targetstr

Directory in which to place the files.

name_fieldstr, optional

Field for the compound name, by default “Name”.

overwritebool, optional

Replace old compounds with new ones if a collision happens, by default False.

minedatabase.compound_io.import_sdf(mine_db: MINE, target: str) None

Imports a SDF file as a MINE database.

Parameters
mine_dbMINE

The database to export.

targetstr

Directory in which to place the files.

minedatabase.compound_io.import_smiles(mine_db: MINE, target: str) None

Imports a smiles file as a MINE database.

Parameters
mine_dbMINE

The database to export.

targetstr

Directory in which to place the files.