[Bioperl-l] XML Blast parsing?
Aaron J Mackey
Aaron J. Mackey" <amackey@virginia.edu
Sun, 27 May 2001 20:43:19 -0400 (EDT)
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
--0-1078688315-991010599=:10920
Content-Type: TEXT/PLAIN; charset=US-ASCII
Attached is a "template" script that we use to get data out of XML blast
output. All this template does is build up some simple Perl
datastructures (list of lists of hits, etc) with minimal data, but gives
you the overall structure to get what you need, while also taking
advantage of Twig's purging features (so that you get rid of the pieces of
the XML document you've already handled).
I want to repeat that this is simply a template for more advanced usage -
the script itself does absolutely nothing useful (I'm actually pretty good
at writing those kind of scripts, but that's another story).
-Aaron
On Sat, 26 May 2001, Hilmar Lapp wrote:
> Aaron J Mackey wrote:
> >
> > I don't have the scripts handy at the moment, but I can post them later if
> > people are interested ...
> >
>
> Do post; we can put it somewhere (dist. or Wiki?), and if someone
> wants to extend it, he or she has got a head start.
>
> Hilmar
>
--
o ~ ~ ~ ~ ~ ~ o
/ Aaron J Mackey \
\ Dr. Pearson Laboratory /
\ University of Virginia \
/ (804) 924-2821 \
\ amackey@virginia.edu /
o ~ ~ ~ ~ ~ ~ o
--0-1078688315-991010599=:10920
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="blast-twig.pl"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.OSF.4.33.0105272043190.10920@alpha10.bioch.virginia.edu>
Content-Description: blast-twig.pl
Content-Disposition: attachment; filename="blast-twig.pl"
IyEvdXNyL2Jpbi9wZXJsIC13DQoNCnVzZSBzdHJpY3Q7DQp1c2UgWE1MOjpU
d2lnOw0KdXNlIEhUTUw6OkVudGl0aWVzOyAjIHRvIGdldCByaWQgb2YgIiZs
dDsgJmd0OyIgSFRNTCBhcnRpZmFjdHMNCg0KdXNlIERhdGE6OkR1bXBlcjsN
Cg0KbXkgQHF1ZXJpZXM7DQpteSBAaGl0czsNCm15ICRxdWVyeW51bSA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