FEV_KEGG.lib.Biopython.KEGG.KGML.KGML_pathway module

Classes to represent a KGML Pathway Map.

The KGML definition is as of release KGML v0.7.1 (http://www.kegg.jp/kegg/xml/docs/)

Classes:
  • Pathway - Specifies graph information for the pathway map
  • Relation - Specifies a relationship between two proteins or KOs, or protein and compound. There is an implied direction to the relationship in some cases.
  • Reaction - A specific chemical reaction between a substrate and a product.
  • Entry - A node in the pathway graph
  • Graphics - Entry subelement describing its visual representation
class FEV_KEGG.lib.Biopython.KEGG.KGML.KGML_pathway.Component(parent)[source]

Bases: object

An Entry subelement used to represents a complex node.

A subelement of the Entry element, used when the Entry is a complex node, as described in release KGML v0.7.1 (http://www.kegg.jp/kegg/xml/docs/)

The Component acts as a collection (with type ‘group’, and typically its own Graphics subelement), having only an ID.

element

Return the Component as a valid KGML element.

id

The pathway graph node ID for the Entry

class FEV_KEGG.lib.Biopython.KEGG.KGML.KGML_pathway.Entry[source]

Bases: object

Represent an Entry from KGML.

Each Entry element is a node in the pathway graph, as described in release KGML v0.7.1 (http://www.kegg.jp/kegg/xml/docs/)

Variables:
  • id - The ID of the entry in the pathway map (-) –
  • names - List of KEGG IDs for the entry (-) –
  • type - The type of the entry (-) –
  • link - URL of information about the entry (-) –
  • reaction - List of KEGG IDs of the corresponding reactions (-) – (integer)
  • graphics - List of Graphics objects describing the Entry's visual (-) – representation
  • components - List of component node ID for this Entry (-) –
  • alt - List of alternate names for the Entry (-) –

NOTE: The alt attribute represents a subelement of the substrate and product elements in the KGML file

__str__()[source]

Return readable descriptive string.

add_component(element)[source]

Add an element to the entry.

If the Entry is already part of a pathway, make sure the component already exists.

add_graphics(entry)[source]

Add the Graphics entry.

bounds

Coordinate bounds for all Graphics elements in the Entry.

Return the [(xmin, ymin), (xmax, ymax)] co-ordinates for the Entry Graphics elements.

element

Return the Entry as a valid KGML element.

id

The pathway graph node ID for the Entry.

is_reactant

Does this Entry participate in any reaction in parent pathway?

Returns True if the Entry participates in any reaction of its parent Pathway

name

List of KEGG identifiers for the Entry.

reaction

List of reaction KEGG IDs for this Entry.

remove_component(value)[source]

Remove the entry with the passed ID from the group.

remove_graphics(entry)[source]

Remove the Graphics entry with the passed ID from the group.

class FEV_KEGG.lib.Biopython.KEGG.KGML.KGML_pathway.Graphics(parent)[source]

Bases: object

An Entry subelement used to represents the visual representation.

A subelement of Entry, specifying its visual representation, as described in release KGML v0.7.1 (http://www.kegg.jp/kegg/xml/docs/)

Variables:
  • name Label for the graphics object (-) –
  • x X-axis position of the object (-) –
  • y Y-axis position of the object (-) –
  • coords polyline co-ordinates, list of (-) –
  • type object shape (-) –
  • width object width (-) –
  • height object height (-) –
  • fgcolor object foreground color (-) –
  • bgcolor object background color (-) –

Some attributes are present only for specific graphics types. For example, line types do not (typically) have a width. We permit non-DTD attributes and attribute settings, such as

dash List of ints, describing an on/off pattern for dashes

bgcolor

Background color.

bounds

Coordinate bounds for the Graphics element.

Return the bounds of the Graphics object as an [(xmin, ymin), (xmax, ymax)] tuple. Co-ordinates give the centre of the circle, rectangle, roundrectangle elements, so we have to adjust for the relevant width/height.

centre

Return the centre of the Graphics object as an (x, y) tuple.

coords

Polyline coordinates for the graphics element.

element

Return the Graphics as a valid KGML element.

fgcolor

Foreground color.

height

The height of the graphics element.

width

The width of the graphics element.

x

The X coordinate for the graphics element.

y

The Y coordinate for the graphics element.

class FEV_KEGG.lib.Biopython.KEGG.KGML.KGML_pathway.Pathway[source]

Bases: object

Represents a KGML pathway from KEGG.

Specifies graph information for the pathway map, as described in release KGML v0.7.1 (http://www.kegg.jp/kegg/xml/docs/)

Variables:
  • name - KEGGID of the pathway map (-) –
  • org - ko/ec/[org prefix] (-) –
  • number - map number (-) –
  • title - the map title (-) –
  • image - URL of the image map for the pathway (-) –
  • link - URL of information about the pathway (-) –
  • entries - Dictionary of entries in the pathway, keyed by node ID (-) –
  • reactions - Set of reactions in the pathway (-) –

The name attribute has a restricted format, so we make it a property and enforce the formatting.

The Pathway object is the only allowed route for adding/removing Entry, Reaction, or Relation elements.

Entries are held in a dictionary and keyed by the node ID for the pathway graph - this allows for ready access via the Reaction/Relation etc. elements. Entries must be added before reference by any other element.

Reactions are held in a dictionary, keyed by node ID for the path. The elements referred to in the reaction must be added before the reaction itself.

__str__()[source]

Returns a readable summary description string.

add_entry(entry)[source]

Add an Entry element to the pathway.

add_reaction(reaction)[source]

Add a Reaction element to the pathway.

add_relation(relation)[source]

Add a Relation element to the pathway.

bounds

Coordinate bounds for all Graphics elements in the Pathway.

Returns the [(xmin, ymin), (xmax, ymax)] coordinates for all Graphics elements in the Pathway

compounds

Get a list of entries of type compound.

element

Return the Pathway as a valid KGML element.

genes

Get a list of entries of type gene.

get_KGML()[source]

Return the pathway as a string in prettified KGML format.

maps

Get a list of entries of type map.

name

The KEGGID for the pathway map.

number

The KEGG map number.

orthologs

Get a list of entries of type ortholog.

reaction_entries

List of entries corresponding to each reaction in the pathway.

reactions

Get a list of reactions in the pathway.

relations

Get a list of relations in the pathway.

remove_entry(entry)[source]

Remove an Entry element from the pathway.

remove_reaction(reaction)[source]

Remove a Reaction element from the pathway.

remove_relation(relation)[source]

Remove a Relation element from the pathway.

class FEV_KEGG.lib.Biopython.KEGG.KGML.KGML_pathway.Reaction[source]

Bases: object

A specific chemical reaction with substrates and products.

This describes a specific chemical reaction between one or more substrates and one or more products.

Variables:
  • id Pathway graph node ID of the entry (-) –
  • names List of KEGG identifier (-) –
  • type String (-) – reversible or irreversible
  • substrate Entry object of the substrate (-) –
  • product Entry object of the product (-) –
__str__()[source]

Return an informative human-readable string.

add_product(product_id)[source]

Add a product, identified by its node ID, to the reaction.

add_substrate(substrate_id)[source]

Add a substrate, identified by its node ID, to the reaction.

element

Return KGML element describing the Reaction.

entry

Return the Entry corresponding to this reaction.

id

Node ID for the reaction.

name

List of KEGG identifiers for the reaction.

products

Return list of product Entry elements.

reactant_ids

Return a list of substrate and product reactant IDs.

substrates

Return list of substrate Entry elements.

class FEV_KEGG.lib.Biopython.KEGG.KGML.KGML_pathway.Relation[source]

Bases: object

A relationship between to products, KOs, or protein and compound.

This describes a relationship between two products, KOs, or protein and compound, as described in release KGML v0.7.1 (http://www.kegg.jp/kegg/xml/docs/)

Variables:
  • entry1 - The first Entry object node ID defining the (-) – relation (int)
  • entry2 - The second Entry object node ID defining the (-) – relation (int)
  • type - The relation type (-) –
  • subtypes - List of subtypes for the relation, as a list of (-) – (name, value) tuples
__str__()[source]

A useful human-readable string.

element

Return KGML element describing the Relation.

entry1

Entry1 of the relation.

entry2

Entry2 of the relation.

FEV_KEGG.lib.Biopython.KEGG.KGML.KGML_pathway._as_string(s)

Turn byte string or unicode string into a unicode string.

FEV_KEGG.lib.Biopython.KEGG.KGML.KGML_pathway._as_unicode(s)[source]

Turn byte string or unicode string into a unicode string.

FEV_KEGG.lib.Biopython.KEGG.KGML.KGML_pathway._is_int_or_long(i)[source]

Check if the value is an integer.

Note there are no longs on Python 3.