Bio.Pathway package

Subpackages

Module contents

BioPython Pathway module.

Bio.Pathway is a lightweight class library designed to support the following tasks:

  • Data interchange and preprocessing between pathway databases and analysis software.

  • Quick prototyping of pathway analysis algorithms

The basic object in the Bio.Pathway model is Interaction, which represents an arbitrary interaction between any number of biochemical species.

Network objects are used to represent the connectivity between species in pathways and reaction networks.

For applications where it is not necessary to explicitly represent network connectivity, the specialized classes Reaction and System should be used in place of Interacton and Network.

The Bio.Pathway classes, especially Interaction, are intentionally designed to be very flexible. Their intended use are as wrappers around database specific records, such as BIND objects. The value-added in this module is a framework for representing collections of reactions in a way that supports graph theoretic and numeric analysis.

Note: This module should be regarded as a prototype only. API changes are likely.

Comments and feature requests are most welcome.

class Bio.Pathway.Reaction(reactants=None, catalysts=(), reversible=0, data=None)

Bases: object

Abstraction for a biochemical transformation.

This class represents a (potentially reversible) biochemical transformation of the type:

a S1 + b S2 + ... --> c P1 + d P2 + ...
where:
  • a, b, c, d … are positive numeric stochiometric coefficients,

  • S1, S2, … are substrates

  • P1, P2, … are products

A Reaction should be viewed as the net result of one or more individual reaction steps, where each step is potentially facilitated by a different catalyst. Support for ‘Reaction algebra’ will be added at some point in the future.

Attributes:
  • reactants – dict of involved species to their stochiometric coefficients: reactants[S] = stochiometric constant for S

  • catalysts – list/tuple of tuples of catalysts required for this reaction

  • reversible – true iff reaction is reversible

  • data – reference to arbitrary additional data

Invariants:
  • for all S in reactants: reactants[S] != 0

  • for all C in catalysts: catalysts[C] != 0

__init__(self, reactants=None, catalysts=(), reversible=0, data=None)

Initialize a new Reaction object.

__eq__(self, r)

Return true iff self is equal to r.

__hash__(self)

Return a hashcode for self.

__repr__(self)

Return a debugging string representation of self.

__str__(self)

Return a string representation of self.

reverse(self)

Return a new Reaction that is the reverse of self.

species(self)

Return a list of all Species involved in self.

class Bio.Pathway.System(reactions=())

Bases: object

Abstraction for a collection of reactions.

This class is used in the Bio.Pathway framework to represent an arbitrary collection of reactions without explicitly defined links.

Attributes:
  • None

__init__(self, reactions=())

Initialize a new System object.

__repr__(self)

Return a debugging string representation of self.

__str__(self)

Return a string representation of self.

add_reaction(self, reaction)

Add reaction to self.

remove_reaction(self, reaction)

Remove reaction from self.

reactions(self)

Return a list of the reactions in this system.

Note the order is arbitrary!

species(self)

Return a list of the species in this system.

stochiometry(self)

Compute the stoichiometry matrix for self.

Returns (species, reactions, stoch) where:
  • species = ordered list of species in this system

  • reactions = ordered list of reactions in this system

  • stoch = 2D array where stoch[i][j] is coef of the jth species in the ith reaction, as defined by species and reactions above

class Bio.Pathway.Interaction

Bases: object

An arbitrary interaction between any number of species.

This class definition is intended solely as a minimal wrapper interface that should be implemented and extended by more specific abstractions.

Attributes:
  • data – reference to arbitrary additional data

__hash__(self)

Return a hashcode for self.

__repr__(self)

Return a debugging string representation of self.

__str__(self)

Return a string representation of self.

class Bio.Pathway.Network(species=())

Bases: object

A set of species that are explicitly linked by interactions.

The network is a directed multigraph with labeled edges. The nodes in the graph are the biochemical species involved. The edges represent an interaction between two species, and the edge label is a reference to the associated Interaction object.

Attributes:
  • None

__init__(self, species=())

Initialize a new Network object.

__repr__(self)

Return a debugging string representation of this network.

__str__(self)

Return a string representation of this network.

add_species(self, species)

Add species to this network.

add_interaction(self, source, sink, interaction)

Add interaction to this network.

source(self, species)

Return list of unique sources for species.

source_interactions(self, species)

Return list of (source, interaction) pairs for species.

sink(self, species)

Return list of unique sinks for species.

sink_interactions(self, species)

Return list of (sink, interaction) pairs for species.

species(self)

Return list of the species in this network.

interactions(self)

Return list of the unique interactions in this network.