getSTs
Description: Returns list of STs that contain all the alleles specified. Any number of loci can be included in a query - include all loci for an exact match.
Arguments
- database (string)
- n x [alleleNumber]
where alleleNumber is defined as {locus,id}
Sample Perl code
#!/usr/bin/perl #Written by Keith Jolley use SOAP::Lite; use strict; use warnings; #####Sample arguments######### my $database = 'neisseria'; my @profile = (2,3,4,3,8,4,6); ############################## my $soap = SOAP::Lite -> uri('http://pubmlst.org/MLST') -> proxy('http://pubmlst.org/cgi-bin/mlstdbnet/mlstFetch.pl'); #Get list of loci my $soapResponse = $soap->getLocusList($database); my @loci; for my $locus ($soapResponse->valueof('//locus')) { push @loci,$locus; } my @profileElements; my $i=0; foreach my $locus (@loci){ push @profileElements,SOAP::Data->name('alleleNumber' => \SOAP::Data->value( SOAP::Data->name('locus' => $locus), SOAP::Data->name('id' => $profile[$i]))); $i++; } $soapResponse = $soap->getSTs($database,@profileElements); unless ($soapResponse->fault){ print "Matching STs:\n"; for my $t ($soapResponse->valueof('//ST')) { print "$t\n"; } } else { print join ', ',$soapResponse->faultcode,$soapResponse->faultstring; }
Sample Java code
package org.pubmlst.mlstSOAP; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import javax.xml.namespace.QName; import java.util.ArrayList; import java.util.Vector; import java.util.HashMap; public class GetSTs { public static void main(String[] args) { //Sample arguments//////////////// String database = "neisseria"; Integer[] profile = {2,3,4,3,8,4,6}; ////////////////////////////////// try { String endpoint = "http://pubmlst.org/cgi-bin/mlstdbnet/mlstFetch.pl"; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(new java.net.URL(endpoint)); // Get list of loci call.setOperationName(new QName("http://pubmlst.org/MLST/", "getLocusList")); @SuppressWarnings("unchecked") ArrayList<String> loci = (ArrayList) call.invoke(new Object[] { database }); call.setOperationName(new QName("http://pubmlst.org/MLST/", "getSTs")); Vector<Object> callArgs = new Vector<Object>(); callArgs.add(database); for (int i=0; i<loci.size(); i++){ HashMap<String,Object> alleleNumber = new HashMap<String,Object>(); alleleNumber.put("locus", loci.get(i)); alleleNumber.put("id", profile[i]); callArgs.addElement(alleleNumber); } Object stList = call.invoke(callArgs.toArray()); if (stList instanceof ArrayList){ for (int i=0; i<((ArrayList)stList).size(); i++){ System.out.println(((ArrayList)stList).get(i)); } } else if (stList instanceof Integer) { System.out.println(stList); } } catch (Exception e) { System.err.println(e.toString()); } } }
Output
Matching STs: 11