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
- 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