Welcome to motifDB

The following motif sets are available
  • Rhamnaceae Plant Mass2Motifs (0.005 Da), Annotated Mass2Motifs from data set comprising 71 Rhamnaceae plant extracts, [31 motifs]
  • Urine derived Mass2Motifs (0.005 Da), Mass2Motifs annotated from positive ionisation mode mass spectra generated from extracts of urine samples., [134 motifs]
  • GNPS library derived Mass2Motifs (0.005 Da), MS/MS spectra obtained from reference compounds and isolated molecules from diverse sources with a focus on bacterial and plant related molecules - positive ionisation mode mass spectrometry on various instruments., [78 motifs]
  • Massbank library derived Mass2Motifs (0.005 Da), MS/MS spectra obtained from reference compounds and isolated molecules from diverse sources with a slight focus on plant related molecules - positive ionisation mode mass spectrometry on various instruments, [46 motifs]
  • Euphorbia Plant Mass2Motifs (0.005 Da), Annotated Mass2Motifs from data set comprising 43 Euphorbia plant extracts, [66 motifs]
  • Streptomyces and Salinispora Mass2Motifs (0.1 Da), Annotated Mass2Motif set from Streptomyces and Salinispora extracts with 0.1 Da binned features, [40 motifs]
  • Photorhabdus and Xenorhabdus Mass2Motifs (0.005 Da), Mass2Motifs discovered in Molecular Networking clustered positive ionisation mode mass spectra generated from bacterial extracts of nematode symbionts of the Photorhabdus and Xenorhabdus genera., [46 motifs]
API access

MotifDB is accessible via an API.

The following instructions demonstrate how to interact with the API

http://m2slda.org/motifdb/list_motifsets will return a json dictionary that gives the names of available motif sets and their IDs.

To access a particular motifset, there are two options. Send a get request to http://ms2lda.org/motifdb/get_motifset/ID, where ID is the ID obtained from the motifset list will return a json object including all of the motifs in that motifset. Replacing get_motifset with get_metadata will return the metadata for those motifs.

Alternatively, if you want to get the motifs and metadata together for multiple motifsets, you can send a POST request to http://ms2lda.org/motifdb/get_motifset. Within the payload dictionary you should include a field motifset_id_list which holds a list of the IDs of the motifsets you'd like.

In addition, you will need to include a field called csrfmiddlewaretoken which holds a valid token. You can get one by sending a GET request to http://ms2lda.org/motifdb/initialise_api.

This way of getting motifs also allows you to filter duplicates. Simply add the field filter with the value "True" to your payload. The default filter threshold (cosine score) is 0.95. To change this, add a field "filter_threshold" to your payload.

Example

import requests

server_url = "http://ms2lda.org"

# Get the list of motif sets
output = requests.get(server_url + '/motifdb/list_motifsets')
motifset_list = output.json()

# Get a token
url = server_url + '/motifdb/initialise_api'
client = requests.session()
token = client.get(url).json()['token']

url = server_url + '/motifdb/get_motifset/'
data = {'csrfmiddlewaretoken': token}

# specify the name of motifsets of interest in motifset_list
massbank_motifset = 'Massbank library derived Mass2Motifs'
gnps_motifset = 'GNPS library derived Mass2Motifs'

massbank_id = motifset_list[massbank_motifset]
gnps_id = motifset_list[gnps_motifset]

# example - get the massbank and gnps motifsets
data['motifset_id_list'] = [massbank_id, gnps_id]
data['filter'] = "True"
data['filter_threshold'] = 0.95 # Default value - not required
output = client.post(url, data=data).json()
print 'Retrieved', len(output['motifs']), 'motifs', len(output['metadata'])

# example - get the massbank metadata only
url = server_url + '/motifdb/get_motifset_metadata/{}/'.format(massbank_id)
output = requests.get(url)
motif_metadata = output.json()
for k in motif_metadata.keys()[:5]:
    print k
    print motif_metadata[k]