locusQuery

Description: Finds a database match to an allele sequence. The sequence must be trimmed to the start and end of the locus with no extraneous bases. If an exact match is not found, the id of the nearest sequence will be returned along with a list of nucleotide differences.

Arguments

Sample Perl code

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

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

#####Sample arguments#########
my $database = 'neisseria';
my $locus = 'abcZ';
my $sequence = 'TTTGATACCGTTGCCGAAGGCTTGGGCGTAA
TCCGCGATTTGTTGCGCCGTTATCATCATGTCAGCCAGGAGTTGGAA
AACGGTTCGGGTGAGATTTTGTTGAAAGAACTCAACGAATTGCAACT
TGAAATCGAAGCGAAGGACGGCTGGAAGCTAGATGCGGCAGTCAAGC
AGACTTTGGGGGAACTCGGTTTGCCGGAAAACGAAAAAATCGGCAAC
CTCTCCGGCGGCCAGAAAAAGCGTGTCGCTTTGGCGCAGGCTTGGGT
GCAGAAGCCCGACGTATTGCTGCTGGACGAACCGACCAACCATTTGG
ATATCGACGCGATTATCTGGTTGGAAAACCTGCTCAAGGCGTTTGAA
GGCAGCCTGGTTGTGATTACCCACGACCGCCGTTTTTTGGACAATAT
CGCCACGCGCATTGTCGAACTCGATC';
##############################

my $soap = SOAP::Lite
	-> uri('http://pubmlst.org/MLST')
	-> proxy('http://pubmlst.org/cgi-bin/mlstdbnet/mlstFetch.pl');
my $soapResponse = $soap->locusQuery($database,$locus,$sequence);
unless ($soapResponse->fault){
   my @diffs;
   for my $t ($soapResponse->valueof('//substitution')) {
  	push @diffs, "Pos: " .
	    $t->{'position'} . ": " .
	    $t->{'nucleotide1'} . "->" .
	    $t->{'nucleotide2'};
   }
   if (@diffs){
       print "Nearest match: allele " . $soapResponse->result()."\n";
       print "Differences: " . scalar @diffs ."\n";
       print "$_\n" foreach (@diffs);
   } else {
       print "Exact match: allele ". $soapResponse->result()."\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.*;
import org.apache.axis.encoding.ser.*;
import javax.xml.namespace.QName;
import java.util.Map;

public class LocusQuery {

    public static void main(String[] args) {
	// Sample arguments//////////////////////////////////////////////
	String database = "neisseria";
	String locus = "abcZ";
	String sequence = "TTTGATACCGTTGCCGAAGGCTTGGGCGTAAT"
	      + "CCGCGATTTGTTGCGCCGTTATCATCATGTCAGCCAGGAGTT"
	      + "GGAAAACGGTTCGGGTGAGATTTTGTTGAAAGAACTCAACGA"
	      + "ATTGCAACTTGAAATCGAAGCGAAGGACGGCTGGAAGCTAGA"
	      + "TGCGGCAGTCAAGCAGACTTTGGGGGAACTCGGTTTGCCGGA"
	      + "AAACGAAAAAATCGGCAACCTCTCCGGCGGCCAGAAAAAGCG"
	      + "TGTCGCTTTGGCGCAGGCTTGGGTGCAGAAGCCCGACGTATT"
	      + "GCTGCTGGACGAACCGACCAACCATTTGGATATCGACGCGAT"
	      + "TATCTGGTTGGAAAACCTGCTCAAGGCGTTTGAAGGCAGCCT"
	      + "GGTTGTGATTACCCACGACCGCCGTTTTTTGGACAATATCGC"
	      + "CACGCGCATTGTCGAACTCGATC";
	//////////////////////////////////////////////////////////////////

	try {
	    String endpoint = "http://pubmlst.org/cgi-bin/mlstdbnet/mlstFetch.pl";
	    Service service = new Service();
	    Call call = (Call) service.createCall();
	    call.registerTypeMapping(Substitution.class, new QName(
		       "http://pubmlst.org/MLST", "substitution"),
		 BeanSerializerFactory.class, BeanDeserializerFactory.class,
		 false);
	    call.setTargetEndpointAddress(new java.net.URL(endpoint));
	    OperationDesc oper = new OperationDesc();
	    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("", "locus"),
		 ParameterDesc.IN, new QName(
			"http://www.w3.org/2001/XMLSchema", "string"),
		 String.class, false, false));
	    oper.addParameter(new ParameterDesc(new QName("", "sequence"),
		 ParameterDesc.IN, new QName(
			"http://www.w3.org/2001/XMLSchema", "string"),
		 String.class, false, false));
	    oper.addParameter(new ParameterDesc(new QName("", "allele"),
		 ParameterDesc.OUT, new QName(
			"http://www.w3.org/2001/XMLSchema", "int"),
		 int.class, false, false));
	    ParameterDesc param = new ParameterDesc(
		 new QName("", "differences"), ParameterDesc.OUT, new QName(
			"http://pubmlst.org/MLST", "differenceList"),
		 Substitution[].class, false, false);
	    param.setItemQName(new QName("", "substitution"));
	    param.setOmittable(true);
	    oper.addParameter(param);
	    oper.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
	    call.setOperation(oper);
	    call.setOperationName(new QName("http://pubmlst.org/MLST",
		        "locusQuery"));
	    call.invoke(new Object[] { database, locus, sequence });
	    Map output = call.getOutputParams();
	    int allele = ((Integer) output.get(new QName("", "allele")))
		.intValue();
	    Substitution[] differences = (Substitution[]) output.get(new QName(
			"", "differences"));
	    if (differences == null) {
		System.out.println("Exact match: allele " + allele);
	    } else {
		System.out.println("Nearest match: allele " + allele);
		System.out.println("Differences: " + differences.length);
		for (int i = 0; i < differences.length; i++) {
		    System.out.println("Pos: " + differences[i].getPosition()
				       + ": " + differences[i].getNucleotide1() + "->"
				       + differences[i].getNucleotide2());
		}
	    }
	} catch (Exception e) {
	    System.err.println(e.toString());
	}
    }

    protected static class Substitution {
	private int pos;
	private String nuc1;
	private String nuc2;

	public Substitution(int position, String nuc1, String nuc2) {
	    this.pos = position;
	    this.nuc1 = nuc1;
	    this.nuc2 = nuc2;
	}

	public int getPosition() {return pos;}
	public void setPosition(int pos) {this.pos = pos;}
	public String getNucleotide1() {return nuc1;}
	public void setNucleotide1(String nuc1) {this.nuc1 = nuc1;}
	public String getNucleotide2() {return nuc2;}
	public void setNucleotide2(String nuc2) {this.nuc2 = nuc2;}
    }
}

Output

Nearest match: allele 73
Differences: 2
Pos: 29: A->T
Pos: 69: T->G

Navigation

- PubMLST+ PubMLST
MLST Home
Search / site map
Download data
Databases
News
- Software+ Software
Web tools
Software
- Recently updated+ Recently updated
A. baumannii (Oxford)
A. baumannii (Pasteur)
Arcobacter
B. cepacia
B. hampsonii
B. hyodysenteriae
B. intermedia
B. licheniformis
B. pilosicoli
Bordetella
Brachyspira
C. albicans
C. difficile
C. jejuni
C. krusei
C. tropicalis
Chlamydiales
Cronobacter
E. faecium
H. influenzae
H. parasuis
Leptospira#2
Leptospira#3
M. plutonius
Neisseria
P. acnes
P. aeruginosa
P. multocida (RIRDC)
P. multocida (multi)
S. agalactiae
S. gallolyticus
S. maltophilia
S. pneumoniae
S. pseudintermedius
S. uberis
V. cholerae
V. parahaemolyticus
V. vulnificus
Wolbachia
- Mirrors+ Mirrors
About our mirrors Primary | DK1 | NO1 | UK2 | UK3 | UK4 | US1 | US2
- Developers+ Developers
SOAP API