[MISC] [MOBY-l] Processing MOBY responses: MOBYSHoundGetGenBankff as an example

Mark Wilkinson markw at illuminae.com
Thu Apr 8 22:41:20 UTC 2004


Hi Frank, 

It is best to use the provided libraries (or add to them) to do the
parsing, since that allows us to change the "guts" of the messaging
structure without it affecting you on either the service or client side.

There is only one ~useful client-side method call "extract response
articles", that is available in the MOBY::CommonSubs module.

my $result = $SERVICE->execute(XMLinputlist => 	[['',$OBJECT]]); #
execute the service 
unless ($result){
        print h3("Service returned no response");
        exit 0;
}
my ($collections, $simples) =extractResponseArticles($result);

This (unfortunately) returns the individual responses as XML::DOM
objects, rather than having a MOBY-specific API to access the
information in these objects.  Ken has some code that does a much nicer
job of creating Perl objects from MOBY Object XML, but at the moment it
isn't 100% API compliant. I'm hoping this will one day this will migrate
into this CommonSubs routine so that all of the libraries are in one
place...

A complete example of a client-side parsing is available in the
gbrowse_moby 'execute' subroutine.  I attach the code here (it will get
to you, but it will probably get stripped off of the copy that goes to
the mailing list).  It will show you how the existing CGI client (the
one you see when you browse MOBY from the website) parses the response
message into its component parts using calls to the XML::DOM library.

Let me know if I can help some more - the need for tooling is becoming
quite urgent, I know!  Just a couple more grants to write and then I
will have a ~month clear to attack the code again :-)

M




On Thu, 2004-04-08 at 14:03, Frank Gibbons wrote:
> Mark,
> 
> One topic which I'm having great difficulty with, and for which I can find 
> no obvious examples, is how to parse the response from a service. As was 
> discussed at the MOBY meeting in CSHL,  there's a somewhat different syntax 
> for queries and responses. The examples I have found describe how to 
> provide a service (how to handle incoming requests). None talks about how 
> to parse incoming responses.
> 
> Now perhaps I'm just being really dense here: the difference really 
> couldn't be that big. I've tried running your MOBYSHoundGetGetBankff with 
> NCBI_gi:431260 as the query, I get back a nice fat response. But I'm really 
> having difficulty extracting the information. Do you (or anyone else on the 
> list) have an example you could post, showing how to deal with the response 
> from a query? Maybe there are examples out there already - if so, I'd 
> really appreciate someone pointing them out to me.
> 
> Thanks for that, and thanks to yourself and the other CSHL::MOBYers for a 
> great introduction to things MOBY.
> 
> -Frank
> 
> PhD, Computational Biologist,
> Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA.
> Tel: 617-432-3555       Fax: 
> 617-432-3557       http://llama.med.harvard.edu/~fgibbons
> 
> _______________________________________________
> moby-l mailing list
> moby-l at biomoby.org
> http://biomoby.org/mailman/listinfo/moby-l
-- 
Mark Wilkinson (mwilkinson at mrl.ubc.ca)
University of British Columbia iCAPTURE Centre


More information about the moby-l mailing list