Reactions
- class hippo.reaction.Reaction(db: Database, id: int, type: str, product: int, product_yield: float)[source]
A
Reactionis a simplified representation of a synthetic pathway to create a productCompound. Reactants (alsoCompoundobjects) as well as a reaction type are required.Attention
Reactionobjects should not be created directly. Instead useHIPPO.register_reaction()orHIPPO.reactions()- check_chemistry(debug: bool = False) bool[source]
Sanity check the chemistry of this reaction
- Parameters:
debug – increase verbosity (Default value = False)
- check_reactant_availability(supplier: None | str = None, debug: bool = False) bool[source]
Check the availability of reactant compounds
- Parameters:
supplier – Limit to quotes from this supplier (Default value = None)
debug – increase verbosity (Default value = False)
- get_dict(smiles: bool = True, mols: bool = True) dict[str][source]
Returns a dictionary representing this
Reaction- Parameters:
smiles – include smiles string (Default value = True)
mols – include
rdkit.Chem.Mol(Default value = True)
- get_reactant_amount_pairs(compound_object: bool = True) list[tuple][source]
Returns pairs of reactants and their amounts
- get_reactant_ids() list[int][source]
Returns list of reactants
CompoundIDs- Returns:
list of
CompoundIDs
- get_recipes(amount: float = 1, debug: bool = False, pick_cheapest: bool = False, permitted_reactions: None | ReactionSet = None, supplier: str | None = None) Recipe | list[Recipe][source]
Get a
Recipedescribing how to make the product- Parameters:
amount – Amount in
mg, defaults to1debug – Increase verbosity, (Default value = False)
pick_cheapest – pick the cheapest
Recipe, (Default value = False)permitted_reactions – Limit the reactions to consider to members of this set, (Default value = None)
supplier – Limit to reactants from this supplier (Default value = None)
- Returns:
Recipeobject or list thereof
- property plain_repr: str
Unformatted long string representation
- property product_yield: float
Returns the reaction’s product yield (fraction)
- property reactant_ids: set[int]
Returns a set of reactant ID’s
- property reactants: CompoundSet
Returns a
CompoundSetof the reactants
- property reaction_str: str
Returns a string representing the reaction
- class hippo.rset.ReactionSet(db: Database, indices: list = None, *, sort: bool = True, name: str | None = None)[source]
Object representing a subset of the ‘reaction’ table in the
Database.Attention
ReactionSetobjects should not be created directly. Instead use theHIPPO.reactions()property. See Getting started with HIPPO and Adding data into HIPPO.Use as an iterable
Iterate through
Reactionobjects in the set:rset = animal.reactions[:100] for reaction in rset: ...
Check membership
To determine if a
Reactionis present in the set:is_member = reaction in cset
Selecting compounds in the set
The
ReactionSetcan be indexed like standard Python lists by their indicesrset = animal.reactions[1:100] # indexing individual compounds reaction = rset[0] # get the first reaction reaction = rset[1] # get the second reaction reaction = rset[-1] # get the last reaction # getting a subset of compounds using a slice rset2 = rset[13:18] # using a slice
- copy() ReactionSet[source]
Return a copy of this set
- get_df(smiles=True, mols=True, **kwargs) pandas.DataFrame[source]
Construct a pandas.DataFrame of this ReactionSet
- Parameters:
smiles – Include smiles column (Default value = True)
mols – Include rdkit.Chem.Mol column (Default value = True)
kwargs – keyword arguments are passed on to :meth:`.Reaction.get_dict:
- get_recipes(amounts: float | list[float] = 1.0, **kwargs) Recipe | list[Recipe][source]
Get the
Recipeobject(s) from this set of recipes- Parameters:
amounts – float or list/generator of product amounts in mg, (Default value = 1.0)
kwargs – keyword arguments are passed on to :meth:`.Recipe.from_reactions:
- property ids: list[int]
Returns the ids of poses in this set
- property indices: list[int]
Returns the ids of poses in this set
- property intermediates: CompoundSet
Get all intermediate compounds that can be synthesised with these reactions
- property name: str | None
Returns the name of set
- property products: CompoundSet
Get all product compounds that can be synthesised with these reactions (no intermediates)
- property reactants: CompoundSet
Get all reactant compounds that are used by these reactions
- property types: list[str]
Returns the types of poses in this set