7.7. Rules

Generate rules to use in pickaxe runs.

minedatabase.rules.BNICE() Tuple[Path, Path, str]

Generate BNICE rules.

Generate the original BNICE rules that were use before the improved MetaCyc rules were generated.

Returns
Tuple[Path, Path, str]

The path to the rules and coreactants and the rule name.

minedatabase.rules.metacyc_generalized(n_rules: Optional[int] = None, fraction_coverage: Optional[float] = None, anaerobic: float = False, include_containing: Optional[List[str]] = None, exclude_containing: Optional[List[str]] = None, **kwargs) Tuple[StringIO, StringIO, str]

Generate generalize metacyc rule subsets.

Generate subsets of the metacyc generalized reaction opreators by specifying the number of rules of the fraction coverage of metacyc desired. Rules are chosen in the order of rules that map the most reactions to least. For fractional coverage the lowest number of rules that give a coverage less than or equal to the specified coverage is given.

Specific groups can be specified to be excluded or used as well to prune to specific rules. This is a two step process:

  1. Select rules by include_containing. If none specified, use all rules.

  2. Remove rules by excluded_containing.

Parameters
n_rulesint, optional

Number of rules to use. If excluded rules result in less than specified number then all rules are taken, by default None.

fraction_coveragefloat, optional

The fraction of coverage desired. This may be impossible to reach depending on which rules are excluded, by default None.

anaerobic: float, optional

Whether to remove oxygen requiring reactions.

include_containing: List[str], optional
A list containing features to include. Valid features are:
  • aromatic

  • aromatic_oxygen

  • carbonyl

  • halogen

  • nitrogen

  • oxygen

  • phosphorus

  • sulfur

  • fluorine

  • chlorine

  • bromine

  • iodine

sending None gives all groups, by default None.

exclude_containing: List[str], optional
A list containing features to exclude.
  • aromatic

  • aromatic_oxygen

  • carbonyl

  • halogen

  • nitrogen

  • oxygen

  • phosphorus

  • sulfur

  • fluorine

  • chlorine

  • bromine

  • iodine

By default None.

Returns
Tuple[StringIO, StringIO, str]

A tuple containing two streams (reaction rules and cofactor) and the rule name.

minedatabase.rules.metacyc_generalized_as_df(n_rules: Optional[int] = None, fraction_coverage: Optional[float] = None, anaerobic: float = False, include_containing: Optional[List[str]] = None, exclude_containing: Optional[List[str]] = None) DataFrame

Generate generalized metacyc rule subsets as Pandas Dataframe

Generate subsets of the metacyc intermediate reaction opreators by specifying the number of rules of the fraction coverage of metacyc desired. Coverage and number of rules are taken from the generalized operators and their intermediate operators are chosen.

Parameters
n_rulesint, optional

Number of rules to use, by default None.

fraction_coveragefloat, optional

The fraction of coverage desired, by default None.

anaerobic: float, optional

Whether to remove oxygen requiring reactions.

include_containing: List[str], optional
A list containing features to include. Valid features are:
  • aromatic

  • aromatic_oxygen

  • carbonyl

  • halogen

  • nitrogen

  • oxygen

  • phosphorus

  • sulfur

  • fluorine

  • chlorine

  • bromine

  • iodine

sending None gives all groups, by default None.

exclude_containing: List[str], optional
A list containing features to exclude. Valid features are:
  • aromatic

  • aromatic_oxygen

  • carbonyl

  • halogen

  • nitrogen

  • oxygen

  • phosphorus

  • sulfur

  • fluorine

  • chlorine

  • bromine

  • iodine

by default None

Returns
pd.DataFrame

A Pandas DataFrame containig the ruleset.

minedatabase.rules.metacyc_intermediate(n_rules: Optional[int] = None, fraction_coverage: Optional[float] = None, anaerobic: float = False, include_containing: Optional[List[str]] = None, exclude_containing: Optional[List[str]] = None) Tuple[StringIO, StringIO, str]

Generate intermediate metacyc rule subsets.

Generate subsets of the metacyc intermediate reaction opreators by specifying the number of rules of the fraction coverage of metacyc desired. Coverage and number of rules are taken from the generalized operators and their intermediate operators are chosen.

Parameters
n_rulesint, optional

Number of rules to use, by default None.

fraction_coveragefloat, optional

The fraction of coverage desired, by default None.

anaerobic: float, optional

Whether to remove oxygen requiring reactions.

include_containing: List[str], optional
A list containing features to include. Valid features are:
  • aromatic

  • aromatic_oxygen

  • carbonyl

  • halogen

  • nitrogen

  • oxygen

  • phosphorus

  • sulfur

  • fluorine

  • chlorine

  • bromine

  • iodine

sending None gives all groups, by default None.

exclude_containing: List[str], optional
A list containing features to exclude. Valid features are:
  • aromatic

  • aromatic_oxygen

  • carbonyl

  • halogen

  • nitrogen

  • oxygen

  • phosphorus

  • sulfur

  • fluorine

  • chlorine

  • bromine

  • iodine

by default None

Returns
Tuple[StringIO, StringIO, str]

A tuple containing two streams that contain the reaction rule information and the rule name.