2.1.1.2.1.2. enkie.dbs.metanetx

Methods for accessing the MetaNetX namespace.

2.1.1.2.1.2.1. Module Contents

class enkie.dbs.metanetx.MetaboliteFormat[source]

Bases: enum.Enum

Format of a metabolite query.

IDENTIFIER = 0[source]
NAME = 1[source]
class enkie.dbs.metanetx.MnxFile[source]

Bases: str, enum.Enum

The MetaNetX data files accessible in ENKIE.

CHEM_XREF = 'chem_xref'[source]
CHEM_PROP = 'chem_prop'[source]
REAC_XREF = 'reac_xref'[source]
REAC_PROP = 'reac_prop'[source]
class enkie.dbs.metanetx.Metanetx[source]

Singleton class for mapping metabolite and reaction identifiers using MetaNetX.

property chem_xref: pandas.DataFrame[source]

Get the CHEM_XREF MetaNetX table.

property chem_prop: pandas.DataFrame[source]

Get the CHEM_PROP MetaNetX table.

property reac_xref: pandas.DataFrame[source]

Get the REAC_XREF MetaNetX table.

property reac_prop: pandas.DataFrame[source]

Get the REAC_PROP MetaNetX table.

property rxn_id_to_mnx_id: Dict[str, str][source]

Dictionary mapping from reaction identifiers to MetaNetX identifiers.

property cmp_id_to_mnx_id: Dict[str, str][source]

Dictionary mapping from metabolite identifiers to MetaNetX identifiers.

property name_to_mnx_compound_map: Dict[str, Set[str]][source]

A dictionary mapping from (lower case) compound names to metanetx compound identifiers.

property mnx_id_to_mass: Dict[str, int][source]

Dictionary mapping from MetaNetX metabolite identifiers to masses.

property mnx_id_to_formula_map: Dict[str, str][source]

Dictionary mapping from MetaNetX reaction identifiers to reaction formulas.

COLUMNS[source]
MNX_URL_PREFIX = 'https://www.metanetx.org/cgi-bin/mnxget/mnxref/'[source]
REACTIONS_CURATION_FILE = 'data/reaction_mappings_curation.csv'[source]
METABOLITES_CURATION_FILE = 'data/metabolite_mappings_curation.csv'[source]
static get_data_path() path.Path[source]

Get the path to the folder containing the cached mapping files.

to_mnx_reaction(query_id: str, substrates: Set[str] = None, products: Set[str] = None, metabolite_format: MetaboliteFormat = MetaboliteFormat.IDENTIFIER, default: str = None) Tuple[str, bool][source]

Map the given reaction identifier to a MetaNetX identifier, checking whether the mapping preserves directionality.

Parameters:
  • query_id (str) – The query identifier, in the form <namespace>:<identifier>.

  • substrates (Set[str], optional) – The reaction substrates, by default None

  • products (Set[str], optional) – The reaction products, by default None

  • metabolite_format (MetaboliteFormat, optional) – Specifies the format of the substrate and products, by default MetaboliteFormat.IDENTIFIER

  • default (str, optional) – Value to return if no mapping is found, by default None

Returns:

The MetaNetX identifier of the reaction, and a flag denoting whether the MetaNetX reaction is defined in the same direction as the input reaction.

Return type:

Tuple[str, bool]

to_mnx_compound(query_id: str, default: str = None) Optional[str][source]

Map the given compound identifier to a MetaNetX compound.

Parameters:
  • query_id (str) – The query identifier, in the format <namespace>:<identifier>.

  • default (str, optional) – Value to return if no mapping is found, by default None

Returns:

The MetaNetX identifier.

Return type:

Optional[str]

get_compound_mass(mnx_id: str) float[source]

Get the mass of the given compound.

Parameters:

mnx_id (str) – The MetaNetX identifier of the query compound.

Returns:

The mass of the compound, in g/mol.

Return type:

float

is_forward(reaction_formula: Optional[str], substrate_ids: Set[str], product_ids: Set[str]) Optional[bool][source]

Detects whether the reaction formula is defined in the forward direction with respect to the given substrates and products.

Parameters:
  • reaction_formula (Optional[str]) – The MetaNetX reaction formula.

  • substrate_ids (Set[str]) – The identifiers fo teh substrates.

  • product_ids (Set[str]) – The identifiers fo the products.

Returns:

True if the formula and the substrate/products show the same direction.

Return type:

Optional[bool]