[BioPython] Question about Martel

Brad Chapman chapmanb@arches.uga.edu
Thu, 22 Mar 2001 12:43:27 -0500 (EST)


Hi Deanne!

> Can't find the Martel's developer's contact on the docs, so I'm going to
> send this here...

Martel is Andrew's baby -- so he's the one to contact if you want to talk
to him directly. Sending questions here is fine as well, at least with me
:-)

> Anyone know how to make Martel's parser NOT forward non-named events? Such
> as found in, say, Martel.Str(). I'm finding that building parse trees with
> included strings will feed (for example) saxutils.XMLGenerator the strings
> in Martel.Str and give you strings with no enclosing tag (since they are
> non-named events) . Is this something that anyone's dealt with, yet, to get
> the Martel parser to parse something but not forward it out?

I'm not sure if I exactly understand your question, but Martel does have a
function called select_names, which allows you to specify only the
callbacks you want. I think the following snippet from the Tutorial

http://www.biopython.org/~dalke/Martel/Martel-0.5/doc/writing_a_format.txt

might be what you are looking for.

"""
(As a side note, group_names will always remove unnamed groups, which
occur with regular expressions "(like)(this)".  To remove unnamed
group without affecting named groups, you can use
    new_format = select_names(format, format.group_names)

or just use the underlying function, which is
    from Martel import optimize
    new_format = optimize.optimize_unnamed_groups(format.copy())
)
"""

Hope this helps!
Brad