[Biopython-dev] Proposed addition to Standalone BLAST

Jeffrey Chang jchang at SMI.Stanford.EDU
Wed Nov 8 20:40:43 EST 2000

Thanks for the updates.

One more thing: Passing the results around as a string would be
essentially the same as doing deepcopies of a StringHandle.  It would save
the overhead of doing a deep copy of an object, and then reading the
results.  The copy module is nice for arbitrary objects that we don't know
about a-priori, but when we only deal with StringHandle's, it's OK to just
create one directly when we need it.

+     def parse(self, handle):
+         """Parse a handle, attempting to diagnose errors.
+         """
+         if isinstance(handle, File.StringHandle):
+             shandle = handle
+         else:
+             shandle = File.StringHandle(handle.read())

would be:

results = handle.read()

+         try:
+             return self._b_parser.parse(shandle)

    return self._b_parser.parse(File.StringHandle(results))

+         except SyntaxError, msg:
+             # if we have a bad_report_file, save the info to it first
+             if self._bad_report_handle:
+                 # copy the handle so we can write it
+                 error_handle = copy.deepcopy(copy_handle)
+                 # send the info to the error handle
+                 self._bad_report_handle.write(error_handle.read())

    if self._bad_report_handle:



More information about the Biopython-dev mailing list