[Biopython-dev] 0.90-d04 coming soon...

Brad Chapman chapmanb at arches.uga.edu
Sat Nov 11 07:17:17 EST 2000


Hi Jeff!

> I'm getting ready to make a 0.90-d04 release of Biopython.  

Great! Do you need any help with anything (besides the points below,
of course :-)? Also, what is the deadline for rolling this? I just
wanted to write some more docs (PubMed and SwissProt are next on the
list, I think). I'm not going to hold you up on this, but if I can get 
them done before the deadline, I'll try to do it.

Also, can we name it '0.90d04' and not '0.90-d04' (ie. no dash in
there). When I was playing with making rpms, rpm was complaining about 
the dash in the name.

> - Brad, I've checked in your BlastErrorParser.  I'm saving the results as
> a string instead of a StringHandle.  Could you please look this over and
> let me know if this is working and acceptable to you?  Thanks.

This looks great, Jeff, thanks much for checking it in! I definately
agree that using the results directly instead of making them into a
StringHandle is much cleaner looking. Thanks again for all of your
suggestions on this.
 
Jeff:
> - The test_gobase regression tests are failing.  The output from the
> test_gobase.py file doesn't match the golden output.  Cayte, could you
> look into this? 

Cayte:
>  I ran test_gobase.py and then ran a diff between the output and 
> the file, test_gobase in output.  The diff didn't show any
> differences.

test_gobase in the regression test also fails for me (although just
running test_gobase.py works fine). My output/test_gobase file (which
should be exactly what is in CVS) looks like:

testing G405967.htm

And that's it, which explains why the regressiont test fails for
me. Cayte, perhaps you have a more recent copy of output/test_gobase 
then what is in CVS?

> - The test_align regression tests are failing for me.  It complains that
> saxlib is missing.  Do we need to install xmllib for this?  I'm using
> Python 2.0.  I thought this came with a SAX api?

I think the saxlib errors are coming from Martel, which is not 2.0
friendly, yet. I attached a patch to Martel-0.3/Martel/Parser.py which 
should make Martel work with only the 2.0 libraries (ie. no need to
install the PyXML package). I believe this should also work with 1.5.2 
with PyXML 0.6.1 installed, but I haven't verified this.

If this patch doesn't fix anything and you still get errors from
test_align, could you send me your trace? I definately want to fix
any problems with it!

> - Brad, is your new similarity matrix code ready to check in?

Well, actually this is all Iddo's code (substitution matrices) --
we've just been talking back and forth about things and working on it
together. But, it is ready to go in. It is sitting in my local copy
working without a problem -- it also has working tests and
documentation (already in Tutorial.tex).

Do you want this to go in the next release? I think the code is
good to go (it gets the Brad-seal-of-approval :-), but it is up to
you. Just give me the word and I can check it in.

Thanks again for getting this together!

Brad


-------------- next part --------------
*** Parser.py.orig	Mon Oct  9 06:41:10 2000
--- Parser.py	Thu Oct 12 20:16:35 2000
***************
*** 30,36 ****
  """
  
  import urllib, pprint
! from xml.sax import saxlib
  import TextTools
  
  try:
--- 30,38 ----
  """
  
  import urllib, pprint
! from xml.sax import xmlreader
! from xml.sax import _exceptions
! from xml.sax import handler
  import TextTools
  
  try:
***************
*** 55,61 ****
  # The SAX startElements take an AttributeList as the second argument.
  # Martel's attributes are always empty, so make a simple class which
  # doesn't do anything and which I can guarantee won't be modified.
! class MartelAttributeList(saxlib.AttributeList):
      def getLength(self):
          return 0
      def getName(self, i):
--- 57,63 ----
  # The SAX startElements take an AttributeList as the second argument.
  # Martel's attributes are always empty, so make a simple class which
  # doesn't do anything and which I can guarantee won't be modified.
! class MartelAttributeList(xmlreader.AttributesImpl):
      def getLength(self):
          return 0
      def getName(self, i):
***************
*** 83,89 ****
          return alternative
  
  # singleton object shared amoung all startElement calls
! _attribute_list = MartelAttributeList()
  
  
  def _do_callback(s, begin, end, taglist, doc_handler):
--- 85,91 ----
          return alternative
  
  # singleton object shared amoung all startElement calls
! _attribute_list = MartelAttributeList([])
  
  
  def _do_callback(s, begin, end, taglist, doc_handler):
***************
*** 128,134 ****
          doc_handler.characters(s, begin, end-begin)
  
  # These exceptions are liable to change in the future
! class StateTableException(saxlib.SAXException):
      """used when a parse cannot be done"""
      pass
  
--- 130,136 ----
          doc_handler.characters(s, begin, end-begin)
  
  # These exceptions are liable to change in the future
! class StateTableException(_exceptions.SAXException):
      """used when a parse cannot be done"""
      pass
  
***************
*** 156,162 ****
  
      # Special case text for the base DocumentHandler since I know that
      # object does nothing and I want to test the method call overhead.
!     if doc_handler.__class__ != saxlib.DocumentHandler:
          # Send any tags to the client (there can be some even if there
          _do_callback(s, 0, pos, taglist, doc_handler)
  
--- 158,164 ----
  
      # Special case text for the base DocumentHandler since I know that
      # object does nothing and I want to test the method call overhead.
!     if doc_handler.__class__ != handler.ContentHandler:
          # Send any tags to the client (there can be some even if there
          _do_callback(s, 0, pos, taglist, doc_handler)
  
***************
*** 168,178 ****
          return None
  
  # This needs an interface like the standard XML parser
! class Parser(saxlib.Parser):
      """Parse the input data all in memory"""
  
      def __init__(self, tagtable, want_groupref_names = 0):
!         saxlib.Parser.__init__(self)
  
          assert type(tagtable) == type( () ), "mxTextTools only allows a tuple tagtable"
          self.tagtable = tagtable
--- 170,180 ----
          return None
  
  # This needs an interface like the standard XML parser
! class Parser(xmlreader.XMLReader):
      """Parse the input data all in memory"""
  
      def __init__(self, tagtable, want_groupref_names = 0):
!         xmlreader.XMLReader.__init__(self)
  
          assert type(tagtable) == type( () ), "mxTextTools only allows a tuple tagtable"
          self.tagtable = tagtable
***************
*** 206,239 ****
          XXX will be removed with the switch to Python 2.0, where parse()
          takes an 'InputSource'
          """
!         self.doc_handler.startDocument()
  
          if self.want_groupref_names:
              _match_group.clear()
  
          # parse the text and send the SAX events
!         result = _parse_elements(s, self.tagtable, self.doc_handler)
  
          if result is None:
              # Successful parse
!             self.doc_handler.endDocument()
!             return
  
!         elif isinstance(result, saxlib.SAXException):
              # could not parse record, and wasn't EOF
!             self.err_handler.fatalError(result)
!             return
          
          else:
              # Reached EOF
              pos = result
!             self.err_handler.fatalError(StateTableEOFException(pos))
!             return
  
      def close(self):
          pass
  
! class RecordParser(saxlib.Parser):
      """Parse the input data a record at a time"""
      def __init__(self, format_name, record_tagtable, want_groupref_names,
                   make_reader, reader_args = ()):
--- 208,241 ----
          XXX will be removed with the switch to Python 2.0, where parse()
          takes an 'InputSource'
          """
!         self._cont_handler.startDocument()
  
          if self.want_groupref_names:
              _match_group.clear()
  
          # parse the text and send the SAX events
!         result = _parse_elements(s, self.tagtable, self._cont_handler)
  
          if result is None:
              # Successful parse
!             pass
  
!         elif isinstance(result, _exceptions.SAXException):
              # could not parse record, and wasn't EOF
!             self._err_handler.fatalError(result)
          
          else:
              # Reached EOF
              pos = result
!             self._err_handler.fatalError(StateTableEOFException(pos))
! 
!         # send an endDocument event even after errors
!         self._cont_handler.endDocument()
  
      def close(self):
          pass
  
! class RecordParser(xmlreader.XMLReader):
      """Parse the input data a record at a time"""
      def __init__(self, format_name, record_tagtable, want_groupref_names,
                   make_reader, reader_args = ()):
***************
*** 249,255 ****
          reader_args - optional arguments to pass to make_reader after the
                input file object
          """
!         saxlib.Parser.__init__(self)
          
          self.format_name = format_name
          assert type(record_tagtable) == type( () ), \
--- 251,257 ----
          reader_args - optional arguments to pass to make_reader after the
                input file object
          """
!         xmlreader.XMLReader.__init__(self)
          
          self.format_name = format_name
          assert type(record_tagtable) == type( () ), \
***************
*** 272,305 ****
          """
          reader = apply(self.make_reader, (fileobj,) + self.reader_args)
  
!         self.doc_handler.startDocument()
          
          if self.want_groupref_names:
              _match_group.clear()
          
!         self.doc_handler.startElement(self.format_name, _attribute_list)
          filepos = 0  # XXX can get mixed up with DOS style "\r\n"
          while 1:
              record = reader.next()  # XXX what if an exception is raised?
              if record is None:
                  break
!             result = _parse_elements(record, self.tagtable, self.doc_handler)
              if result is None:
                  # Successfully read the record
                  continue
!             elif isinstance(result, saxlib.SAXException):
                  # Wrong format
!                 self.err_handler.fatalError(result)
                  return
              else:
                  # did not reach end of string
                  pos = filepos + result
!                 self.err_handler.fatalError(StateTableEOFException(pos))
  
              filepos = filepos + len(record)
  
!         self.doc_handler.endElement(self.format_name)
!         self.doc_handler.endDocument()
  
      def parse(self, systemId):
          """parse using the URL"""
--- 274,307 ----
          """
          reader = apply(self.make_reader, (fileobj,) + self.reader_args)
  
!         self._cont_handler.startDocument()
          
          if self.want_groupref_names:
              _match_group.clear()
          
!         self._cont_handler.startElement(self.format_name, _attribute_list)
          filepos = 0  # XXX can get mixed up with DOS style "\r\n"
          while 1:
              record = reader.next()  # XXX what if an exception is raised?
              if record is None:
                  break
!             result = _parse_elements(record, self.tagtable, self._cont_handler)
              if result is None:
                  # Successfully read the record
                  continue
!             elif isinstance(result, _exceptions.SAXException):
                  # Wrong format
!                 self._err_handler.fatalError(result)
                  return
              else:
                  # did not reach end of string
                  pos = filepos + result
!                 self._err_handler.fatalError(StateTableEOFException(pos))
  
              filepos = filepos + len(record)
  
!         self._cont_handler.endElement(self.format_name)
!         self._cont_handler.endDocument()
  
      def parse(self, systemId):
          """parse using the URL"""


More information about the Biopython-dev mailing list