Permalink
Browse files

Removing deprecated Martel dependent module Bio.MetaTool

  • Loading branch information...
1 parent 585ac9c commit 02ac9db409979bb671f344ce0b80366c29d57f8f @peterjc peterjc committed Apr 27, 2009
Showing with 2 additions and 873 deletions.
  1. +0 −130 Bio/MetaTool/Input.py
  2. +0 −126 Bio/MetaTool/Record.py
  3. +0 −379 Bio/MetaTool/__init__.py
  4. +0 −236 Bio/MetaTool/metatool_format.py
  5. +2 −2 DEPRECATED
View
130 Bio/MetaTool/Input.py
@@ -1,130 +0,0 @@
-# Copyright 2001 by Tarjei Mikkelsen. All rights reserved.
-# This code is part of the Biopython distribution and governed by its
-# license. Please see the LICENSE file that should have been included
-# as part of this package.
-
-"""
-This module provides code to convert Bio.Pathway.System objects into
-a text file that can be used as input for the MetaTool program.
-
-For more information on MetaTool, please refer to:
-
-http://www2.bioinf.mdc-berlin.de/metabolic/metatool/
-
-"""
-
-from Bio.Pathway import Reaction
-from Bio.Pathway import System
-
-
-# NOTE: Change enzyme name creation to allow for a function to be passed
-# in that can be applied to r.data to extract a name
-
-def system_to_metatool(system, metext = [], metint = [], generate_names = 1):
- """Converts a Bio.Pathway.System object to a MetaTool input string.
-
- Note that to be a valid input string, the enzyme names of the reactions
- in the system must conform to the MetaTool requirements.
-
- Enzyme names are automatically genrated from the catalys attribute of
- each reaction using the following scheme:
-
- enzyme_name = "_".join([str(x[0]) for x in r.catalysts])
-
- If an enzyme name has already been used, a positive integer will be
- appended to this name to meet the MetaTool input requirements. If this
- behaviour is undesired, set the optional parameter 'generate_names' to
- false. All enzyme names will the be 'E_x', where x is an unique integer.
-
- The optional parameters metext and metint can be used to specify the
- external and internal metabolites according to the following rules:
-
- 1. If metext is set, the species in it will be considered external.
- All other species will be considered internal.
-
- 2. Otherwise, if metint is set, the species in it will be considered
- internal. All other species will be considered external.
-
- 3. Otherwise, all species will be considered external.
-
- If specified, metext and metint must not contains species that are not
- contained in the input system.
- """
- if not isinstance(system, System):
- raise TypeError("Input is not a System object")
- # Build the ENZREV and ENZIRREV strings:
- enzrev = []
- enzirrev = []
- enz_names = {}
- enz_map = {}
- for r in system.reactions():
- # build an unique enzyme name
- enz_name = ""
- if r.catalysts and generate_names:
- enz_name += "_".join([str(x[0]) for x in r.catalysts])
- else:
- enz_name += "E"
- if enz_name in enz_names:
- enz_names[enz_name] += 1
- enz_name += "_" + str(enz_names[enz_name])
- else:
- enz_names[enz_name] = 0
- # keep (name, reaction) pair for later
- enz_map[enz_name] = r
- # add to the corresponding list
- if r.reversible:
- enzrev.append(enz_name)
- else:
- enzirrev.append(enz_name)
- # create the actual strings:
- enzrev_str = "-ENZREV\n" + " ".join(enzrev) + "\n"
- enzirrev_str = "-ENZIRREV\n" + " ".join(enzirrev) + "\n"
- # Build the METINT and METEXT strings:
- metabolites = system.species()
- metint_str = "-METINT\n"
- metext_str = "-METEXT\n"
- if metext:
- for m in metext:
- if m in metabolites:
- metabolites.remove(m)
- else:
- raise ValueError("metext contains an unknown metabolite")
- for m in metint:
- if not m in metabolites:
- raise ValueError("metint contains an unknown metabolite")
- metext_str += " ".join([str(m) for m in metext]) + "\n"
- metint_str += " ".join([str(m) for m in metabolites]) + "\n"
- elif metint:
- for m in metint:
- if m in metabolites:
- metabolites.remove(m)
- else:
- raise ValueError("metint contains an unknown metabolite")
- for m in metext:
- if not m in metabolites:
- raise ValueError("metext contains an unknown metabolite")
- metint_str += " ".join([str(m) for m in metint]) + "\n"
- metext_str += " ".join([str(m) for m in metabolites]) + "\n"
- else:
- metext_str += " ".join([str(m) for m in metabolites]) + "\n"
- metint_str += "\n"
- # Build the CAT string
- cat_str = "-CAT\n"
- for e in enz_map.keys():
- r = enz_map[e]
- cat_str += e + " : "
- # change the reaction string rep to the MetaTool format
- reaction_str = str(r)
- reaction_str = reaction_str.replace("-->","=")
- reaction_str = reaction_str.replace("<=>","=")
- cat_str += reaction_str + " .\n"
- # Return the complete MetaTool input string:
- return enzrev_str + "\n" + \
- enzirrev_str + "\n" + \
- metint_str + "\n" + \
- metext_str + "\n" + \
- cat_str + "\n"
-
-
-
-
View
126 Bio/MetaTool/Record.py
@@ -1,126 +0,0 @@
-"""Hold MetaTool data in a straightforward format.
-"""
-
-# standard modules
-import numpy.oldnumeric.matrix as Matrix
-
-# local stuff
-import Bio.MetaTool
-
-class Metabolite( dict ):
-
- def __init__( self, reaction_count, metabolite_name ):
- self.reaction_count = reaction_count
- self.metabolite_name = metabolite_name
-
- def __str__( self ):
- out = '%d %s\n' % ( self.reaction_count, self.metabolite_name )
- return out
-
-class MetaboliteRole( dict ):
-
- def __init__( self, met, consumed, built, irreversible_vector ):
- self.met = met
- self.consumed = consumed
- self.built = built
- self.irreversible_vector = irreversible_vector
-
- def __str__( self ):
- out = '%s\n' % self.met
- out = out + 'consumed in %d reactions\n' % self.consumed
- out = out + 'built in %d reactions\n' % self.built
- out = out + str( self.irreversible_vector )
- out = out + '\n'
- return out
-
-
-
-class PathwayTransform:
-
- def __init__( self ):
- self.matrix = None
- self.enzymes = []
- self.reactions = []
- self.irreversible_vector = []
-
- def __str__( self ):
- out = ''
- out = out + '\nMatrix\n'
- out = out + str( self.matrix )
- if( len( self.enzymes ) > 0 ):
- out = out + '\n Enzymes\n'
- for enzyme in self.enzymes:
- out = out + '%s\n' % enzyme
- if( len( self.reactions ) > 0 ):
- out = out + '\n Reactions\n'
- for reaction in self.reactions:
- out = out + '%s\n' % reaction
- if( len( self.irreversible_vector ) > 0 ):
- out = out + '\n\nIrreversible\n\n'
- for scalar in self.irreversible_vector:
- out = out + '%03d ' % int( scalar )
- out = out + '\n'
- return out
-
-
-
-class Record:
-
- """Hold MetaTool output information.
- """
-
- def __init__( self ):
- self.external_metabolites = []
- self.internal_metabolites = []
- self.unbalanced_metabolites = []
- self.branch_metabolites = []
- self.non_branch_metabolites = []
- self.sum_is_constant_lines = []
- self.stochiometric = PathwayTransform()
- self.kernel = PathwayTransform()
- self.subsets = PathwayTransform()
- self.reduced_system = PathwayTransform()
- self.convex_basis = PathwayTransform()
- self.conservation_relations = PathwayTransform()
- self.elementary_modes = PathwayTransform()
-
- def __str__( self ):
- out = ''
- out = out + 'Input file name: %s\n' % self.input_file_name
- out = out + 'Number of internal metabolites: %d\n' % self.num_int_metabolites
- out = out + 'Number of reactions: %d\n' % self.num_reactions
- out = out + '\n\nExternal Metabolites\n\ncount name\n\n'
- for metabolite in self.external_metabolites:
- out = out + str( metabolite )
- out = out + '\n\nInternal Metabolites\n\ncount name\n\n'
- for metabolite in self.internal_metabolites:
- out = out + str( metabolite )
- out = out + '\n\nBranch Metabolites\n\n'
- for metabolite in self.branch_metabolites:
- out = out + str( metabolite )
- out = out + '\n\nNon Branch Metabolites\n\n'
- for metabolite in self.non_branch_metabolites:
- out = out + str( metabolite )
- out = out + '\n\nStochiometric\n\n'
- out = out + str( self.stochiometric )
- if( len( self.unbalanced_metabolites ) > 0 ):
- out = out + '\n\nUnbalanced Metabolites\n\n'
- for metabolite in self.unbalanced_metabolites:
- out = out + '%s\n' % metabolite
- out = out + '\n\nKernel\n\n'
- out = out + str( self.kernel )
- out = out + '\n\nSubsets\n\n'
- out = out + str( self.subsets )
- out = out + '\n\nReduced System\n\n'
- out = out + str( self.reduced_system )
- out = out + '\n\nConvex Basis\n\n'
- out = out + str( self.convex_basis )
- out = out + '\n\nConservation Relations\n\n'
- out = out + str( self.conservation_relations )
- out = out + '\n'
- for line in self.sum_is_constant_lines:
- out = out + '%s\n' % line
- out = out + '\n\nElementary Modes\n\n'
- out = out + str( self.elementary_modes )
- return out
-
View
379 Bio/MetaTool/__init__.py
@@ -1,379 +0,0 @@
-# Copyright 2001 by Katharine Lindner. All rights reserved.
-# This code is part of the Biopython distribution and governed by its
-# license. Please see the LICENSE file that should have been included
-# as part of this package.
-"""Parser for output from MetaTool 3.5 (DEPRECATED).
-
-MetaTool is a program which defines metabolic routes within networks.
-This parser does not support the current version, MetaTool 5.0.
-
-http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubMed&
-list_uids=10222413&dopt=Abstract
-"""
-
-import warnings
-warnings.warn("Bio.MetalTool was deprecated, as it only supported the obsolete"
- +"MetaTool 3.5 output.")
-
-# standard library
-import string
-
-import numpy.oldnumeric.matrix as Matrix
-
-# XML from python 2.0
-from xml.sax import handler
-
-# Martel
-import Martel
-from Martel import RecordReader
-
-from Bio.ParserSupport import EventGenerator
-from Bio import File
-import metatool_format
-import Record
-
-class Iterator:
- """Iterator interface to move over a file of MetaTool entries one at a time.
- """
- def __init__(self, handle, parser = None):
- """Initialize the iterator.
-
- Arguments:
- o handle - A handle with Kabat entries to iterate through.
- o parser - An optional parser to pass the entries through before
- returning them. If None, then the raw entry will be returned.
- """
- self._reader = RecordReader.StartsWith(handle, "METATOOL")
-# self._reader = RecordReader.EndsWith(handle, "RECEND|\n")
- self._parser = parser
-
- def next(self):
- """Return the next MetaTool record from the handle.
-
- Will return None if we ran out of records.
- """
- data = self._reader.next()
-
- if self._parser is not None:
- if data:
- return self._parser.parse(File.StringHandle(data))
-
- return data
-
- def __iter__(self):
- return iter(self.next, None)
-
-class _RecordConsumer:
- """Create a MetaTool Record object from scanner generated information.
- """
- def __init__(self):
- self.data = Record.Record()
- self.data.internal_metabolites = []
- self.data.external_metabolites = []
-
- def input_file_name( self, content ):
- self.data.input_file_name = content[ 0 ]
-
- def input_file_tag( self, content ):
- self.state = "input_file_state"
-
- def metabolite_count_tag( self, content ):
- self.state = "metabolite_count_state"
-
- def reaction_count_tag( self, content ):
- self.state = "reaction_count_state"
-
- def matrix_row( self, matrix_rows ):
- for matrix_row in matrix_rows:
- elements = matrix_row.split()
- vector = []
- for element in elements:
- vector.append( int( element ) )
- self._vectors.append( vector )
-
- def unbalanced_metabolite( self, content ):
- for metabolite in content:
- self.data.unbalanced_metabolites.append( metabolite )
-
- def branch_metabolite( self, content ):
- for metabolite in content:
- items = metabolite.split()
- name = items[ 0 ]
- consumed = int( items[ 1 ] )
- built = int( items[ 2 ] )
- vector = items[ 4 ].replace( 'r', '0' )
-
- vector = vector.replace( 'i', '1' )
- vector = list( vector )
- map( int, vector )
- entry = Record.MetaboliteRole( name, consumed, built, vector )
- self.data.branch_metabolites.append( entry )
-
- def non_branch_metabolite( self, content ):
- for metabolite in content:
- items = metabolite.split()
- name = items[ 0 ]
- consumed = int( items[ 1 ] )
- built = int( items[ 2 ] )
- vector = items[ 4 ].replace( 'r', '0' )
- vector = vector.replace( 'i', '1' )
- vector = list( vector )
- entry = Record.MetaboliteRole( name, consumed, built, vector )
- self.data.non_branch_metabolites.append( entry )
-
- def stoichiometric_tag( self, content ):
- self.state = "stoichiometry_state"
- self._vectors = []
- self._enzymes = []
- self._reactions = []
-
- def kernel_tag( self, kernel_tag ):
- self.state = "kernel_state"
- self._vectors = []
- self._enzymes = []
- self._reactions = []
-
- def subsets_tag( self, content ):
- self.state = "subsets_state"
- self._vectors = []
- self._enzymes = []
- self._reactions = []
-
- def reduced_system_tag( self, content ):
- self.state = "reduced_system_state"
- self._vectors = []
- self._enzymes = []
- self._reactions = []
-
- def convex_basis_tag( self, content ):
- self.state = "convex_basis_state"
- self._vectors = []
- self._enzymes = []
- self._reactions = []
-
- def conservation_relations_tag( self, content ):
- self.state = "conservation_relations_state"
- self._vectors = []
- self._enzymes = []
- self._reactions = []
-
- def elementary_modes_tag( self, content ):
- self.state = "elementary_modes_state"
- self._vectors = []
- self._enzymes = []
- self._reactions = []
-
- def metabolite_line( self, content ):
- self.data.external_metabolites = []
- self.data.internal_metabolites = []
- for metabolite in content:
- items = metabolite.split()
- entry = Record.Metabolite( int( items[ 0 ] ), items[ 2 ] )
-
- if( items[ 1 ] == "external" ):
- self.data.external_metabolites.append( entry )
- else:
- self.data.internal_metabolites.append( entry )
-
-
- def num_int_metabolites( self, content ):
- num_int_metabolites = content[ 0 ]
- self.data.num_int_metabolites = int( num_int_metabolites )
-
- def num_reactions( self, content ):
- num_reactions = content[ 0 ]
- self.data.num_reactions = int( num_reactions )
-
- def irreversible_vector( self, content ):
- self._irreversible_vector = content[ 0 ].split()
-
- def reaction( self, reactions ):
- for reaction in reactions:
- items = reaction.split()
- item = ' '.join( items[ 1: ] )
- self._reactions.append(item)
-
- def enzyme( self, enzymes ):
- for enzyme in enzymes:
- items = enzyme.split()
- item = ' '.join( items[ 1: ] )
- self._enzymes.append(item)
-
- def sum_is_constant_line( self, lines ):
- for line in lines:
- items = line.split( ':')
- items = items[ 1 ].split( '=' )
- self.data.sum_is_constant_lines.append( items[ 0 ] )
-
- def num_rows( self, num_rows ):
- pass
-
- def num_cols( self, num_cols ):
- pass
-
- def metabolite_roles( self, content ):
- for metabolite_role in content:
- cols = metabolite_role.split()
-
- def end_stochiometric( self, content ):
- if( self._vectors != [] ):
- self.data.stochiometric.matrix = Matrix.Matrix( self._vectors )
- self.data.stochiometric.enzymes = []
- for enzyme in self._enzymes:
- self.data.stochiometric.enzymes.append( enzyme )
- self.data.stochiometric.enzymes = []
- for reaction in self._reactions:
- self.data.stochiometric.reactions.append( reaction )
- for col in self._irreversible_vector:
- self.data.stochiometric.irreversible_vector.append( col )
-
- def end_kernel( self, content ):
- if( self._vectors != [] ):
- self.data.kernel.matrix = Matrix.Matrix( self._vectors )
- self.data.kernel.enzymes = []
- for enzyme in self._enzymes:
- self.data.kernel.enzymes.append( enzyme )
- for reaction in self._reactions:
- self.data.kernel.reactions.append( reaction )
-
- def end_subsets( self, content ):
- if( self._vectors != [] ):
- self.data.subsets.matrix = Matrix.Matrix( self._vectors )
- self.data.subsets.enzymes = []
- for enzyme in self._enzymes:
- self.data.subsets.enzymes.append( enzyme )
- for reaction in self._reactions:
- self.data.subsets.reactions.append( reaction )
-
-
- def end_reduced_system( self, content ):
- if( self._vectors != [] ):
- self.data.reduced_system.matrix = Matrix.Matrix( self._vectors[:14] )
- self.data.reduced_system.enzymes = []
- for enzyme in self._enzymes:
- self.data.reduced_system.enzymes.append( enzyme )
- for reaction in self._reactions:
- self.data.reduced_system.reactions.append( reaction )
- for col in self._irreversible_vector:
- self.data.reduced_system.irreversible_vector.append( col )
-
-
- def end_convex_basis( self, content ):
- if( self._vectors != [] ):
- self.data.convex_basis.matrix = Matrix.Matrix( self._vectors )
- self.data.convex_basis.enzymes = []
- for enzyme in self._enzymes:
- self.data.convex_basis.enzymes.append( enzyme )
- for reaction in self._reactions:
- self.data.convex_basis.reactions.append( reaction )
-
- def end_conservation_relations( self, content ):
- if( self._vectors != [] ):
- self.data.conservation_relations.matrix = Matrix.Matrix( self._vectors )
- self.data.conservation_relations.enzymes = []
- for enzyme in self._enzymes:
- self.data.conservation_relations.enzymes.append( enzyme )
- for reaction in self._reactions:
- self.data.conservation_relations.reactions.append( reaction )
-
-
- def end_elementary_modes( self, content ):
- if( self._vectors != [] ):
- self.data.elementary_modes.matrix = Matrix.Matrix( self._vectors )
- self.data.elementary_modes.enzymes = []
- for enzyme in self._enzymes:
- self.data.elementary_modes.enzymes.append( enzyme )
- for reaction in self._reactions:
- self.data.elementary_modes.reactions.append( reaction )
-
-class _Scanner:
- """Start up Martel to do the scanning of the file.
-
- This initialzes the Martel based parser and connects it to a handler
- that will generate events for a Feature Consumer.
- """
- def __init__(self, debug = 0):
- """Initialize the scanner by setting up our caches.
-
- Creating the parser takes a long time, so we want to cache it
- to reduce parsing time.
-
- Arguments:
- o debug - The level of debugging that the parser should
- display. Level 0 is no debugging, Level 2 displays the most
- debugging info (but is much slower). See Martel documentation
- for more info on this.
- """
- # a listing of all tags we are interested in scanning for
- # in the MartelParser
- self.interest_tags = [ "input_file_name", "num_int_metabolites", \
- "num_reactions", "metabolite_line", "unbalanced_metabolite", \
- "num_rows", "num_cols", "irreversible_vector", \
- "branch_metabolite", "non_branch_metabolite", \
- "stoichiometric_tag", "kernel_tag", "subsets_tag", \
- "reduced_system_tag", "convex_basis_tag", \
- "conservation_relations_tag", "elementary_modes_tag", \
- "reaction", "enzyme", "matrix_row", "sum_is_constant_line", \
- "end_stochiometric", "end_kernel", "end_subsets", \
- "end_reduced_system", "end_convex_basis", \
- "end_conservation_relations", "end_elementary_modes" ]
-
- # make a parser that returns only the tags we are interested in
- expression = Martel.select_names( metatool_format.metatool_record,
- self.interest_tags)
- self._parser = expression.make_parser(debug_level = debug)
-
- def feed(self, handle, consumer):
- """Feeed a set of data into the scanner.
-
- Arguments:
- o handle - A handle with the information to parse.
- o consumer - The consumer that should be informed of events.
- """
- self._parser.setContentHandler(EventGenerator(consumer,
- self.interest_tags ))
-# _strip_and_combine ))
- self._parser.setErrorHandler(handler.ErrorHandler())
-
- self._parser.parseFile(handle)
-
-class RecordParser:
- """Parse MetaTool files into Record objects
- """
- def __init__(self, debug_level = 0):
- """Initialize the parser.
-
- Arguments:
- o debug_level - An optional argument that species the amount of
- debugging information Martel should spit out. By default we have
- no debugging info (the fastest way to do things), but if you want
- you can set this as high as two and see exactly where a parse fails.
- """
- self._scanner = _Scanner(debug_level)
-
- def parse(self, handle):
- """Parse the specified handle into a MetaTool record.
- """
- self._consumer = _RecordConsumer()
- self._scanner.feed(handle, self._consumer)
- return self._consumer.data
-
-def _strip_and_combine(line_list):
- """Combine multiple lines of content separated by spaces.
-
- This function is used by the EventGenerator callback function to
- combine multiple lines of information. The lines are first
- stripped to remove whitepsace, and then combined so they are separated
- by a space. This is a simple minded way to combine lines, but should
- work for most cases.
- """
- # first strip out extra whitespace
- stripped_line_list = map(string.strip, line_list)
-
- # now combine everything with spaces
- return ' '.join(stripped_line_list)
-
-
-
-
-
View
236 Bio/MetaTool/metatool_format.py
@@ -1,236 +0,0 @@
-# Copyright 2001 by Katharine Lindner. All rights reserved.
-# This code is part of the Biopython distribution and governed by its
-# license. Please see the LICENSE file that should have been included
-# as part of this package.
-
-"""Martel based parser to read MetaTool output files.
-
-This is a huge regular regular expression for MetaTool 3.5 output, built using
-the 'regular expressiona on steroids' capabilities of Martel.
-
-http://www2.bioinf.mdc-berlin.de/metabolic/metatool/
-
-
-This helps us have endlines be consistent across platforms.
-
-"""
-
-# Martel
-from Martel import Opt, Alt, Digits, Integer, Group, Str, MaxRepeat
-from Martel import Any, AnyBut, RepN, Rep, Rep1, ToEol, AnyEol
-from Martel import Expression
-from Martel import RecordReader
-
-blank = ' '
-tab = '\t'
-blank_space = MaxRepeat( Any( blank + tab), 1, 80 )
-optional_blank_space = Rep( Any( blank + tab ) )
-white_space = " \t" + chr( 10 ) + chr( 13 )
-blank_line = optional_blank_space + AnyEol()
-lower_case_letter = Group( "lower_case_letter", Any( "abcdefghijklmnopqrstuvwxyz" ) )
-digits = "0123456789"
-
-enzyme = Group( "enzyme", optional_blank_space + Digits() +
- optional_blank_space + Str( ':' ) + ToEol() )
-reaction = Group( "reaction", optional_blank_space + Digits() +
- optional_blank_space + Str( ":" ) + ToEol() )
-not_found_line = Group( "not_found_line", optional_blank_space + Str( "- not found -" ) +
- ToEol() )
-
-enzymes_header = Group( "enzymes_header", optional_blank_space + Str( "enzymes" ) +
- ToEol() )
-enzymes_list = Group( "enzymes_list", Alt( Rep1( enzyme ), \
- not_found_line ) )
-enzymes_block = Group( "enzymes_block", enzymes_header + Rep( blank_line ) +
- enzymes_list )
-
-reactions_header = Group( "reactions_header", optional_blank_space +
- Str( "overall reaction" ) + ToEol() )
-reactions_list = Group( "reactions_list", Alt( Rep1( reaction ), \
- not_found_line ) )
-reactions_block = Group( "reactions_block", reactions_header + Rep( blank_line ) +
- reactions_list )
-
-rev = Group( "rev", Opt( lower_case_letter ) )
-version = Group( "version", Digits( "version_major") + Any( "." ) +
- Digits( "version_minor") + rev )
-metatool_tag = Str( "METATOOL OUTPUT" )
-metatool_line = Group( "metatool_line", metatool_tag + blank_space +
- Str( "Version" ) + blank_space + version + ToEol() )
-
-input_file_tag = Str( "INPUT FILE:" )
-input_file_line = Group( "input_file_line", input_file_tag + blank_space +
- ToEol( "input_file_name" ) )
-
-metabolite_count_tag = Str( "INTERNAL METABOLITES:" )
-metabolite_count_line = Group( "metabolite_count_line", metabolite_count_tag +
- blank_space + Digits( "num_int_metabolites" ) + ToEol() )
-
-reaction_count_tag = Str( "REACTIONS:" )
-reaction_count_line = Group( "reaction_count_line", reaction_count_tag + blank_space +
- Digits( "num_reactions" ) + ToEol() )
-
-type_metabolite = Group( "type_metabolite", Alt( Str( "int" ), \
- Str( "external" ) ) )
-metabolite_info = Group( "metabolite_info", optional_blank_space +
- Digits() + blank_space + type_metabolite + blank_space +
-# Integer() + blank_space + Rep1( lower_case_letter ) +
- Rep1( AnyBut( white_space ) ) )
-metabolite_line = Group( "metabolite_line", metabolite_info + ToEol() )
-metabolites_summary = Group( "metabolites_summary", optional_blank_space + Digits() +
- blank_space + Str( "metabolites" ) + ToEol() )
-metabolites_block = Group( "metabolites_block", Rep1( metabolite_line ) +
- metabolites_summary + Rep( blank_line ) )
-
-graph_structure_heading = Group( "graph_structure_heading", optional_blank_space +
- Str( "edges" ) + blank_space + Str( "frequency of nodes" ) + ToEol() )
-graph_structure_line = Group( "graph_structure_line", optional_blank_space +
- Digits( "edge_count" ) + blank_space + Digits( "num_nodes" ) + ToEol() )
-graph_structure_block = Group( "graph_structure_block", \
- graph_structure_heading + Rep( blank_line ) +
- Rep1( graph_structure_line ) + Rep( blank_line ) )
-
-sum_is_constant_line = Group( "sum_is_constant_line", optional_blank_space +
- Digits() + optional_blank_space + Any( ":" ) + optional_blank_space +
- Rep1( AnyBut( white_space ) ) +
- Rep( blank_space + Any( "+" ) + blank_space + Rep1( AnyBut( white_space ) ) ) +
- optional_blank_space + Str( "=" ) + ToEol() )
-sum_is_constant_block = Group( "sum_is_constant_block", Rep( sum_is_constant_line ) )
-
-
-stoichiometric_tag = Group( "stoichiometric_tag", Str( "STOICHIOMETRIC MATRIX" ) )
-stoichiometric_line = Group( "stoichiometric_line", stoichiometric_tag +
- ToEol() )
-
-not_balanced_tag = Group( "not_balanced_tag", Str( "NOT BALANCED INTERNAL METABOLITES" ) )
-not_balanced_line = Group( "not_balanced_line", not_balanced_tag +
- ToEol() )
-
-subsets_tag = Group( "subsets_tag", Str( "SUBSETS OF REACTIONS" ) )
-subsets_line = Group( "subsets_line", \
- subsets_tag + ToEol() )
-
-reduced_system_tag = Group( "reduced_system_tag", Str( "REDUCED SYSTEM" ) )
-reduced_system_line = Group( "reduced_system_line", reduced_system_tag +
- Rep1( AnyBut( digits ) ) + Digits( "branch_points" ) +
- Rep1( AnyBut( digits ) ) + Digits() + ToEol() )
-
-kernel_tag = Group( "kernel_tag", Str( "KERNEL" ) )
-kernel_line = Group( "kernel_line", kernel_tag + ToEol() )
-
-convex_basis_tag = Group( "convex_basis_tag", Str( "CONVEX BASIS" ) )
-convex_basis_line = Group( "convex_basis_line", convex_basis_tag +
- ToEol() )
-
-conservation_relations_tag = Group( "conservation_relations_tag", \
- Str( "CONSERVATION RELATIONS" ) )
-conservation_relations_line = Group( "conservation_relations_line", \
- conservation_relations_tag + ToEol() )
-
-elementary_modes_tag = Group( "elementary_modes_tag", \
- Str( "ELEMENTARY MODES" ) )
-elementary_modes_line = Group( "elementary_modes_line", \
- elementary_modes_tag + ToEol() )
-
-num_rows = Group( "num_rows", Digits() )
-num_cols = Group( "num_cols", Digits() )
-matrix_header = Group( "matrix_header", optional_blank_space +
- Str( "matrix dimension" ) + blank_space + Any( "r" ) +
- num_rows + blank_space + Any( "x" ) + blank_space +
- Any( "c" ) + num_cols + optional_blank_space + AnyEol() )
-matrix_element = Group( "matrix_element", Integer() )
-matrix_row = Group( "matrix_row", MaxRepeat( optional_blank_space + matrix_element, \
- "num_cols", "num_cols" ) + ToEol() )
-matrix = Group( "matrix", MaxRepeat( matrix_row, "num_rows", "num_rows" ) )
-
-matrix_block = Group( "matrix_block", matrix_header + matrix )
-irreversible_vector = Group( "irreversible_vector", \
- MaxRepeat( blank_space + matrix_element, "num_cols", "num_cols" ) +
- ToEol() )
-
-little_gap = Str( " " )
-big_gap = Alt( Str( "\t" ), MaxRepeat( Str( " " ), 2, 80 ) )
-unbalanced_metabolite = Group( "unbalanced_metabolite", \
- Rep1( AnyBut( white_space ) ) + Opt( little_gap +
- Rep1( AnyBut( white_space ) ) ) )
-not_balanced_data = Group( "not_balanced_data", optional_blank_space +
- unbalanced_metabolite + Rep( big_gap + unbalanced_metabolite ) + ToEol() )
-
-metabolite_roles_heading = Group( "metabolite_roles_heading", \
- Str( "->" ) + ToEol() )
-metabolite_role_cols = Group( "metabolite_role_cols", \
- optional_blank_space + Str( "met" ) + blank_space + Str( "cons" ) +
- blank_space + Str( "built" ) +
- blank_space + Str( "reactions" ) + ToEol() )
-branch_metabolite = Group( "branch_metabolite", optional_blank_space +
- Rep1( AnyBut( white_space ) ) + blank_space +
- RepN( Digits() + blank_space, 3 ) + Rep1( Any( "ir" ) ) + ToEol() )
-non_branch_metabolite = Group( "non_branch_metabolite", optional_blank_space +
- Rep1( AnyBut( white_space ) ) + blank_space +
- RepN( Digits() + blank_space, 3 ) + Rep1( Any( "ir" ) ) + ToEol() )
-branch_metabolite_block = Group( "branch_metabolite_block", \
- metabolite_roles_heading +
- metabolite_role_cols + Rep( branch_metabolite ) )
-non_branch_metabolite_block = Group( "non_branch_metabolite_block", \
- metabolite_roles_heading +
- metabolite_role_cols + Rep( non_branch_metabolite ) )
-
-end_stoichiometric = Group( "end_stochiometric", \
- Rep( Expression.Assert( not_balanced_tag, 1 ) +
- Expression.Assert( kernel_tag, 1 ) + ToEol() ) )
-end_not_balanced = Group( "end_not_balanced", \
- Rep( Expression.Assert( kernel_tag, 1 ) + ToEol() ) )
-end_kernel = Group( "end_kernel", \
- Rep( Expression.Assert( subsets_tag, 1 ) + ToEol() ) )
-end_subsets = Group( "end_subsets", \
- Rep( Expression.Assert( reduced_system_tag, 1 ) + ToEol() ) )
-end_reduced_system = Group( "end_reduced_system", \
- Rep( Expression.Assert( convex_basis_tag, 1 ) + ToEol() ) )
-end_convex_basis = Group( "end_convex_basis", \
- Rep( Expression.Assert( conservation_relations_tag, 1 ) + ToEol() ) )
-end_conservation_relations = Group( "end_conservation_relations", \
- Rep( Expression.Assert( elementary_modes_tag, 1 ) + ToEol() ) )
-end_elementary_modes = Group( "end_elementary_modes", Rep( ToEol() ) )
-# Rep1( AnyBut( '.') ) + Str( "." ) )
-
-input_file_block = Group( "input_file_block", input_file_line +
- Rep( blank_line ) )
-metatool_block = Group( "metatool_block", metatool_line + Rep1( blank_line ) )
-
-metabolite_count_block = Group( "metabolite_count_block", \
- metabolite_count_line + Rep( blank_line ) )
-reaction_count_block = Group( "reaction_count_block", reaction_count_line +
- Rep( blank_line ) + metabolites_block + Rep( blank_line ) +
- graph_structure_block + Rep( blank_line ) )
-stoichiometric_block = Group( "stoichiometric_block", stoichiometric_line +
- Rep( blank_line ) + matrix_block + ToEol() + irreversible_vector +
- end_stoichiometric )
-not_balanced_block = Group( "not_balanced_block", not_balanced_line +
- Rep( blank_line ) + not_balanced_data + Rep( blank_line ) )
-kernel_block = Group( "kernel_block", kernel_line + Rep( blank_line ) +
- matrix_block + ToEol() + Rep( blank_line ) + enzymes_block +
- Rep( blank_line ) + reactions_block + end_kernel )
-subsets_block = Group( "subsets_block", subsets_line + Rep( blank_line ) +
- matrix_block + ToEol() + Rep( blank_line ) + enzymes_block +
- Rep( blank_line ) + reactions_block + end_subsets )
-reduced_system_block = Group( "reduced_system_block", reduced_system_line +
- Rep( blank_line ) + matrix_block + ToEol() + irreversible_vector +
- Rep( blank_line ) + branch_metabolite_block + Rep( blank_line ) +
- non_branch_metabolite_block + end_reduced_system )
-convex_basis_block = Group( "convex_basis_block", convex_basis_line +
- Rep( blank_line ) + matrix_block + Opt( ToEol() ) + Rep( blank_line ) +
- enzymes_block + Rep( blank_line ) + reactions_block + end_convex_basis )
-conservation_relations_block = Group( "conservation_relations_block", \
- conservation_relations_line + Rep( blank_line ) + matrix_block +
- Rep( blank_line ) + sum_is_constant_block +
- end_conservation_relations )
-elementary_modes_block = Group( "elementary_modes_block", elementary_modes_line +
- Rep( blank_line ) + matrix_block + Opt( ToEol() ) + Rep( blank_line ) +
- enzymes_block + Rep( blank_line ) + reactions_block + end_elementary_modes )
-
-
-metatool_record = Group( "metatool_record", metatool_block + input_file_block +
- metabolite_count_block + reaction_count_block + stoichiometric_block +
- Opt( not_balanced_block ) + kernel_block + subsets_block +
- reduced_system_block + convex_basis_block + conservation_relations_block +
- elementary_modes_block )
View
4 DEPRECATED
@@ -90,8 +90,8 @@ and Bio.Emboss.PrimerSearch instead.
Bio.MetaTool
============
-Deprecated in Release 1.48, this was a parser for the output of MetaTool 3.5
-which is now obsolete.
+Deprecated in Release 1.48, and removed in Release 1.51, this was a parser
+for the output of MetaTool 3.5 which is now obsolete.
Bio.GenBank
===========

0 comments on commit 02ac9db

Please sign in to comment.