[Biopython-dev] Martel changes

Brad Chapman chapmanb at arches.uga.edu
Sat Dec 15 10:08:02 EST 2001


Andrew; 
Thanks for all the Martel changes -- the new additions look great.

> Changed "Integer" to "[+-]?\d+" (It had been the same
> as what Digits is now.)
> 
> Removed SignedInteger.

The only problem I noticed was that this broke Cayte's metatool
parser since it used SignedInteger. I updated metatool to use Digits
in place of Integer and Integer in place of SignedInteger. I think
this is right based on reading your e-mails, and all tests pass now.

Cayte, can you doublecheck and make sure I did the right thing? I
don't want to break any of your code. I attached a diff with the
changes I made.

Brad
-- 
PGP public key available from http://pgp.mit.edu/
-------------- next part --------------
Index: metatool_format.py
===================================================================
RCS file: /home/repository/biopython/biopython/Bio/MetaTool/metatool_format.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** metatool_format.py	2001/09/13 00:28:47	1.2
--- metatool_format.py	2001/12/15 14:56:05	1.3
***************
*** 18,24 ****
  import string
  
  # Martel
! from Martel import Opt, Alt, Integer, SignedInteger, Group, Str, MaxRepeat
  from Martel import Any, AnyBut, RepN, Rep, Rep1, ToEol, AnyEol
  from Martel import Expression
  from Martel import RecordReader
--- 18,24 ----
  import string
  
  # 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
***************
*** 32,40 ****
  lower_case_letter = Group( "lower_case_letter", Any( "abcdefghijklmnopqrstuvwxyz" ) )
  digits = "0123456789"
  
! enzyme = Group( "enzyme", optional_blank_space + Integer() +
      optional_blank_space + Str( ':' ) + ToEol() )
! reaction = Group( "reaction", optional_blank_space + Integer() +
      optional_blank_space + Str( ":" ) + ToEol() )
  not_found_line = Group( "not_found_line", optional_blank_space + Str( "- not found -" ) +
      ToEol() )
--- 32,40 ----
  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() )
***************
*** 54,61 ****
      reactions_list )
  
  rev = Group( "rev", Opt( lower_case_letter ) )
! version = Group( "version", Integer( "version_major") + Any( "." ) +
!     Integer( "version_minor") + rev )
  metatool_tag = Str( "METATOOL OUTPUT" )
  metatool_line = Group( "metatool_line", metatool_tag + blank_space +
      Str( "Version" ) + blank_space + version + ToEol() )
--- 54,61 ----
      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() )
***************
*** 66,85 ****
  
  metabolite_count_tag = Str( "INTERNAL METABOLITES:" )
  metabolite_count_line = Group( "metabolite_count_line",  metabolite_count_tag +
!     blank_space + Integer( "num_int_metabolites" ) + ToEol() )
  
  reaction_count_tag = Str( "REACTIONS:" )
  reaction_count_line = Group( "reaction_count_line", reaction_count_tag + blank_space +
!     Integer( "num_reactions" ) + ToEol() )
  
  type_metabolite = Group( "type_metabolite", Alt( Str( "int" ), \
      Str( "external" ) ) )
  metabolite_info = Group( "metabolite_info", optional_blank_space +
!     Integer() + 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 + Integer() +
      blank_space + Str( "metabolites" ) + ToEol() )
  metabolites_block = Group( "metabolites_block", Rep1( metabolite_line ) +
      metabolites_summary + Rep( blank_line ) )
--- 66,85 ----
  
  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 ) )
***************
*** 87,99 ****
  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 +
!     Integer( "edge_count" ) + blank_space + Integer( "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 +
!     Integer() + 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() )
--- 87,99 ----
  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() )
***************
*** 114,121 ****
  
  reduced_system_tag = Group( "reduced_system_tag", Str( "REDUCED SYSTEM" ) )
  reduced_system_line = Group( "reduced_system_line", reduced_system_tag +
!     Rep1(  AnyBut( digits ) ) + Integer( "branch_points" ) +
!     Rep1( AnyBut( digits ) ) + Integer() + ToEol() )
  
  kernel_tag = Group( "kernel_tag", Str( "KERNEL" ) )
  kernel_line = Group( "kernel_line", kernel_tag + ToEol() )
--- 114,121 ----
  
  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() )
***************
*** 134,146 ****
  elementary_modes_line = Group( "elementary_modes_line", \
      elementary_modes_tag + ToEol() )
  
! num_rows = Group( "num_rows", Integer() )
! num_cols = Group( "num_cols", Integer() )
  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", SignedInteger() )
  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" ) )
--- 134,146 ----
  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" ) )
***************
*** 166,175 ****
      blank_space + Str( "reactions" ) + ToEol() )
  branch_metabolite = Group( "branch_metabolite", optional_blank_space +
      Rep1( AnyBut( white_space ) ) + blank_space +
!     RepN( Integer() + blank_space, 3 ) + Rep1( Any( "ir" ) ) + ToEol() )
  non_branch_metabolite = Group( "non_branch_metabolite", optional_blank_space +
      Rep1( AnyBut( white_space ) ) + blank_space +
!     RepN( Integer() + blank_space, 3 ) + Rep1( Any( "ir" ) ) + ToEol() )
  branch_metabolite_block = Group( "branch_metabolite_block", \
      metabolite_roles_heading +
      metabolite_role_cols + Rep( branch_metabolite ) )
--- 166,175 ----
      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 ) )
***************
*** 235,238 ****
     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 )
\ No newline at end of file
--- 235,238 ----
     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 )


More information about the Biopython-dev mailing list