microberx.MetabolitePredictor

This is a module that provides the main classes to predicted metabolites using MicrobeRX.

The module contains the following classes:

  • MetabolitePredictor: A class for predicting metabolites using reaction rules.

  • RunPredictionRule: A class for predicting metabolites based on a single reaction rule.

Classes

MetabolitePredictor

A class for predicting metabolites using reaction rules.

RunPredictionRule

A class for predicting reactions based on reaction rules.

Module Contents

class microberx.MetabolitePredictor.MetabolitePredictor(query, query_name='metabolite', cut_off=0.6, biosystem='all')[source]

A class for predicting metabolites using reaction rules.

Parameters:
  • rules_table (str) – The path to a table containing reaction rules and associated information.

  • query (rdkit.Chem.Mol) –

  • query_name (str) –

  • cut_off (float) –

  • biosystem (str) –

predicted_metabolites[source]

A DataFrame to store predicted metabolites and associated information.

Type:

pd.DataFrame

query[source]

The query molecule for metabolite prediction.

Type:

Chem.Mol

query_name[source]

The name associated with the query molecule.

Type:

str

query_atoms_num[source]

The number of heavy atoms in the query molecule.

Type:

int

reacting_atoms[source]

A list to store reacting atom indices.

Type:

list

reacting_atoms_in_unique_metabolites[source]

A list to store reacting atom indices in unique metabolites.

Type:

list

run_prediction(query: Chem.Mol, name: str = 'metabolite')[source]

Run the metabolite prediction using the provided query molecule and name.

biosystem = 'all'[source]
predicted_metabolites[source]
query[source]
query_name = 'metabolite'[source]
query_atoms_num[source]
reacting_atoms = [][source]
reacting_atoms_in_unique_metabolites = [][source]
cut_off = 0.6[source]
run_prediction()[source]

This method performs metabolite prediction using reaction rules from the rules table. It calculates confidence scores for predicted metabolites and stores the results in the ‘predicted_metabolites’ attribute.

Parameters:
  • query (Chem.Mol) – The query molecule for metabolite prediction.

  • query_name (str, optional) – The name associated with the query molecule. Default is “metabolite”.

Return type:

None

Example

>>> predictor = MetabolitePredictor(rules_table)
>>> query_molecule = Chem.MolFromSmiles("CC(=O)O")
>>> predictor.run_prediction(query_molecule, "acetate")
>>> predicted_metabolites_df = predictor.predicted_metabolites
class microberx.MetabolitePredictor.RunPredictionRule(query, rule_smarts, real_product, real_substrate)[source]

A class for predicting reactions based on reaction rules.

Parameters:
  • query (Chem.Mol) – The query molecule for prediction.

  • rule_smarts (str) – The reaction rule in SMARTS format.

  • real_product (str) – The SMILES representation of the real product.

  • real_substrate (str) – The SMILES representation of the real substrate.

query[source]

The query molecule for prediction.

Type:

Chem.Mol

rule_smarts[source]

The reaction rule in SMARTS format.

Type:

str

reaction[source]

The reaction object created from the reaction rule.

Type:

AllChem.Reaction

real_product[source]

The real product molecule.

Type:

Chem.Mol

real_substrate[source]

The real substrate molecule.

Type:

Chem.Mol

unique_products

A dictionary to store information about unique predicted products.

Type:

dict

predict()[source]

Predict reaction products and populate the ‘unique_products’ attribute.

query[source]
rule_smarts[source]
reaction[source]
real_product[source]
real_substrate[source]
predict()[source]

This method predicts reaction products based on the provided query molecule, reaction rule, real product, and real substrate. It calculates various properties and stores the results in the ‘unique_products’ dictionary.

Return type:

None

__get_product_atom_indexes(product)[source]
Parameters:

product (rdkit.Chem.Mol) –

__get_mol_substructure(mol_target, atom_indexes_to_keep)[source]

Get the reaction substructure from the input molecule. :return: The reaction substructure

Parameters:

mol_target (rdkit.Chem.Mol) –

__get_substructure_neighbors(mol_target, atom_indexes_to_keep)[source]

Get the substructure neighbors of the input molecule. :return: The substructure neighbors

Parameters:

mol_target (rdkit.Chem.Mol) –

__trim_mol(mol_target, atom_indexes_to_remove)[source]

Trim the input molecule to get the desired substructure. :param atoms_to_remove: The atoms to remove from the input molecule :return: The trimmed molecule

Parameters:

mol_target (rdkit.Chem.Mol) –

__compute_similarity(mol1, mol2, fingerPrintModel='maccskey')[source]
Parameters:
  • mol1 (rdkit.Chem.Mol) –

  • mol2 (rdkit.Chem.Mol) –

  • fingerPrintModel (str) –