#!/usr/bin/perl # # Retrieves Nucleotide Sequences and associated annotated features # from the EMBL/Genbank/DDBJ database and returns it in either # BSML XML or AGAVE XML format. # # Author: J.J.M. Riethoven (Sep 2001) - European Bioinformatics Institute # pow@ebi.ac.uk # # Disclaimer: this is a demo script - actual WSDL file and function parameters # may change without prior notification. # # Prerequisites: Perl 5.004 and up, SOAP::Lite, XML::Parser # For compression to be enabled, requires Compress::Zlib and zlib libraries. use SOAP::Lite; # SOAP API use Getopt::Long; # Command line options module my $result = GetOptions ("format=s" => \$FORMAT); # The default option of this program is the Bsml format $FORMAT = (($FORMAT eq "Bsml") || ($FORMAT eq "sciobj")) ? $FORMAT : "Bsml"; @IDLIST = @ARGV; # anything left on the commandline is treated as sequence id # If we have sequence ID's on the command line continue and process them if (@IDLIST) { # The next code puts all accession numbers (ID's) in a single # string spaced by a space, required for the server. # (next version of server will accept the array as a whole) my $acc_nrs = join " ", @IDLIST; # Initialise the web service using the definition file that can be # found at the below url. my $service = SOAP::Lite -> service('http://www.ebi.ac.uk/xembl/XEMBL.wsdl'); # if compression should be used on returned objects > 10Kb, the following # line enables it. (Requires: Compress::Zlib and zlib libraries) $service->proxy('http://fake/', options => {compress_threshold => 10240}); # We can now use the service as an object, and retrieve our information. $result = $service->getNucSeq($FORMAT, $acc_nrs); # If we get some results back we print it, if not something went wrong. if ($result) { print $result; } else { print "No result received - server possibly down.\n"; print "Exact errors: " . $service->call->faultcode . ":" . $service->call->faultstring; } } else { # .. if no ID's were given show a quick overview of the usage. print "\nUsage: SOAP-client.pl [--format (Bsml|sciobj)] id1 id2 id3 .. idn\n"; print "\t --format : Bsml (Labbook) or sciobj (AGAVE) format. Default: Bsml\n\n"; print "E.g. XEMBL-SOAP-client.pl HSERPG U83300\n\n"; }