[Biopython-dev] ToEol in Martel

Cayte katel at worldpath.net
Fri Mar 30 03:28:07 EST 2001


----- Original Message -----
From: "Brad Chapman" <chapmanb at arches.uga.edu>
> Cayte:
> > >  ToEol is apparently stripping leading white space?
>
> Andrew:
> > That's not what I get.  Here's my test:
> [...Some convincing test results...]
>
> This is just a random thought, but if Cayte is using the EventGenerator
> class which I recently moved to Bio.ParserSupport, this *does* strip
> whitespace before sending an event:
>

  Yes, I use EventGenerator.
> # strip off whitespace and call the consumer
> callback_function = eval('self._consumer.' + name)
> info_to_pass = string.strip(self.info[name])
>     callback_function(info_to_pass)
>
> I guess whether I should do this or not is up for debate. I know Jeff has
> some differing opinions (and a good example of why this can be bad), but I
> took this approach since I was already dealing with enough of a mess with
> GenBank that I didn't want to fight with whitespace as well... If this is
> really a problem here, I can look at fixing it.
>
>

    Some of the Kabat reference fields have a 1 in column 6.  There isn't
much documentation, but it looks like  a continuation flag to indicate that
the field is not the last field in the reference.  I like to preserve the
column structure because its possible, though unlikely, for the field
contents to start with 1.

  One option is for me to subclass EventHandler and rewrite _make_callback.
But this is inelegant because of the convention that a leading underscore
means a private function.  An alternative solution is a flag, with a default
of false, that bypasses the code to strip whitespace.  This leaves the
interface along but requires changes to the code

  Just some ideas.

                                                        Cayte




More information about the Biopython-dev mailing list