getRelatedProfilesByProfile

Description: Returns profiles (and clonal complexes if defined) that match at at least the specified number of loci. Query is by profile.

Arguments

Sample Perl code

#!/usr/bin/perl
#Written by Keith Jolley

use SOAP::Lite;
use strict;
use warnings;

#####Sample arguments#########
my $database = 'neisseria';
my $match = 6;
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->getRelatedProfilesByProfile($database,$match,@profileElements);
unless ($soapResponse->fault){
    my $i=0;
    my @alleleNumbers = $soapResponse->dataof('//STDef/profile/alleleNumber');
    for my $soapData ($soapResponse->dataof('//STDef')) {
	print "ST-".$soapData->value->{'ST'}."\n";
	for (my $j=0; $j<scalar @loci; $j++){
	    print $alleleNumbers[$i]->value->{'locus'} . '-';
	    print $alleleNumbers[$i]->value->{'id'} . "\n";
	    $i++;
	}
	print $soapData->value->{'complex'}."\n" if $soapData->value->{'complex'} ;
	print "\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 org.apache.axis.description.OperationDesc;
import org.apache.axis.description.ParameterDesc;
import org.apache.axis.encoding.ser.*;
import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.Vector;
import java.util.HashMap;

public class GetRelatedProfilesByProfile {

    public static void main(String[] args) {
	//Sample arguments////////////////
	String database = "neisseria";
	int match = 6;
	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.registerTypeMapping(AlleleNumber.class, new QName(
			"http://pubmlst.org/MLST", "alleleNumber"),
		BeanSerializerFactory.class, BeanDeserializerFactory.class,
		false);
	    call.registerTypeMapping(StDefinition.class, new QName(
			"http://pubmlst.org/MLST", "stDefinition"),
		BeanSerializerFactory.class, BeanDeserializerFactory.class,
		false);
	    call.setOperationName(new QName("http://pubmlst.org/MLST",
		"getRelatedProfilesByProfile"));
	    OperationDesc oper = new OperationDesc();
	    oper.setName("getRelatedProfilesByProfile");
	    oper.addParameter(new ParameterDesc(new QName("", "database"),
		ParameterDesc.IN, new QName(
			"http://www.w3.org/2001/XMLSchema", "string"),
		String.class, false, false));
	    oper.addParameter(new ParameterDesc(new QName("", "match"),
		ParameterDesc.IN, new QName(
			"http://www.w3.org/2001/XMLSchema", "int"),
		int.class, false, false));
	    for (int i=0; i<profile.length; i++){
		oper.addParameter(new ParameterDesc(new QName("", "alleleNumber"),
			ParameterDesc.IN, new QName(
				"http://www.w3.org/2001/XMLSchema", "int"),
			AlleleNumber.class, false, false));
	    }
	    oper.setReturnType(new QName("http://pubmlst.org/MLST",
		"stDefinition"));
	    oper.setReturnClass(StDefinition[].class);
	    oper.setReturnQName(new QName("", "STDef"));
	    call.setOperation(oper);
	    Vector<Object> callArgs = new Vector<Object>();
	    callArgs.add(database);
	    callArgs.add(match);
	    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);
	    }
	    StDefinition[] defs = ((StDefinition[]) call.invoke(callArgs.toArray()));
	    for (int i=0; i<defs.length; i++){
		System.out.println("ST-" + defs[i].getST());
		AlleleNumber[] prof = defs[i].getProfile();
		for (int j=0; j<prof.length; j++){
		    System.out.println(prof[j].getLocus() + "-"
				       + prof[j].getId());
		}
		if (defs[i].getComplex() != null){
		    System.out.println(defs[i].getComplex());
		}
		System.out.println();
	    }
	} catch (Exception e) {
	    System.err.println(e.toString());
	}
    }

    protected static class AlleleNumber {
	private String locus;
	private int id;

	public AlleleNumber(String locus, int id) {
	    this.locus = locus;
	    this.id = id;
	}

	public java.lang.String getLocus() {return locus;}
	public void setLocus(String locus) {this.locus = locus;}
	public int getId() {return id;}
	public void setId(int id) {this.id = id;}
    }

    protected static class StDefinition {
	private int ST;
	private AlleleNumber[] profile;
	private String complex;

	public StDefinition() {
	}

	public StDefinition(int ST,AlleleNumber[] profile,String complex) {
	    this.ST = ST;
	    this.profile = profile;
	    this.complex = complex;
	}

	public int getST() {return ST;}
	public void setST(int ST) {this.ST = ST;}
	public AlleleNumber[] getProfile() {return profile;}
	public void setProfile(AlleleNumber[] profile) {this.profile = profile;}
	public String getComplex() {return complex;}
	public void setComplex(String complex) {this.complex = complex;}
    }
}

Output

ST-11
abcZ-2
adk_-3
aroE-4
fumC-3
gdh_-8
pdhC-4
pgm_-6
ST-11 complex/ET-37 complex

ST-50
abcZ-2
adk_-3
aroE-19
fumC-3
gdh_-8
pdhC-4
pgm_-6
ST-11 complex/ET-37 complex
etc ...

Navigation

- PubMLST+ PubMLST
MLST Home
Search / site map
- Software+ Software
Bio-Linux
Web tools
Software
- Bacteria+ Bacteria
A. baumannii
Arcobacter
B. cereus
Bordetella
Brachyspira
B. cepacia
C. fetus
C. helveticus
C. insulaenigrae
C. jejuni & C. coli
C. lari
C. upsaliensis
Chlamydiales
H. pylori
L. monocytogenes
Neisseria
P. aeruginosa
P. gingivalis
S. agalactiae
S. uberis
S. zooepidemicus
Streptomyces
V. parahaemolyticus
V. vulnificus
Wolbachia
- Eukaryotes+ Eukaryotes
A. fumigatus
C. krusei
C. tropicalis
- Other dbases+ Other dbases
B. burgdorferi MLSA
Plasmid MLST
- Mirrors+ Mirrors
About our mirrors Primary |UK1 |UK2 |US1
- Developers+ Developers
SOAP API