Sections
You are here: Home » Development » API » API 1.0 - archived version » Interfaces Discussion

Interfaces Discussion

Section for posting experiences, proposals and discussion related to OpenTox interfaces

General:

  • I would like to see YAML support (in addition to XML) - it is so straightforward to (de)serialize datastructures in YAML (also easier to read and less markup).
  • Requested MIME type should be set in the requests "Accept" header, e.g. curl -X GET -H "Accept:chemical/x-daylight-smiles" http://{server}/compound/{id}
  • Submitted MIME type should be set in the requests "Content-Type" header, e.g. curl -X POST -H "Content-Type:chemical/x-daylight-smiles" -d "structure={smiles} http://{server}/compounds
  • GET URIs for collections should be in plural (e.g GET /datasets) to reflect common English wording (my personal preference)
  • GET result for collections (e.g. datasets) could be simply a list of URIs (delimited by newlines), no urgent need for XML
  • POST URIs that creates a new instance of the same class should be in plural (e.g. POST /compounds, POST /datasets) to reflect common English wording (my personal preference)
  • POST URIs that create a new instance of another class should be in singular (e.g. POST /prediction_model)
  • PUT should be optional (DELETE/POST can do the same job)

Compound:

  • DELETE is only applicable, if compounds are stored permanently
  • Chemical MIME priorities:
I would prefer the following priorities:
  • smiles
  • inchi
  • sdf
  • ...
  • Conformers: should be optional
  • Features:
I would move this proposal with slight modifications into the *dataset* API (in my understanding a dataset is a collection of compounds together with their features)

Proposal:

Chemical compound

Component description

A chemical compound that has a unique and defined chemical structure.

REST operations

Description Method URI Parameters Result Status codes
Get the representation of a compound GET /compound/{id} - Compound representation in one of the supported MIME formats 200,404,503
Create a new chemical compound POST /compounds - URI for new compound 200,400,503

HTTP status codes

Interpretation Nr Name
Success 200 OK
Compound not found 404 Not Found
Incorrect MIME type 400 Bad request
Service not available 503 service unavailable

Compound representation:

Supported MIME formats (http://www.ch.ic.ac.uk/chemime/), sorted according to priority

  • chemical/x-daylight-smiles
  • chemical/x-inchi
  • chemical/x-mdl-sdfile
  • chemical/x-mdl-molfile
  • chemical/x-mol2
  • chemical/x-cml

Feature:

I would reduce the API to:

GET /feature returns feature representation
POST /features returns URI for the new feature
DELETE is only applicable, if features are stored permanently
  • The feature definition part should be moved into the feature ontology API
  • The feature service part is redundant with the dataset API
  • The feature reference part should be moved into the feature ontology API

Proposal:

Feature

Component description

A feature is a (chemical, structural, biological, toxicological, ...) property of a chemical compound.

REST operations

Description Method URI Parameters Result Status codes
Get the representation of a feature GET /feature/{id} - XML or YAML representation of a feature 200,404,503
Create a new feature POST /features name, value (single value or hash)
URI of feature representation 200,404,400,503

HTTP status codes

Interpretation Nr Name
Success 200 OK
Feature with {id} not found 404 Not Found
Incorrect feature value 400 Bad request
Service not available 503 Service unavailable

Feature XML representation

See XML schema definition for Feature object

Dataset:

  • Dataset queries should be performed through ontologies
  • HEAD: I think we should stick to the standard GET, POST, DELETE and PUT to keep things simple
  • Compounds and features in a dataset:
I would prefer the proposal in the current compound API with the following URI modifications:
  • GET /dataset/{dataset_id}/compounds set of compounds
  • GET /dataset/{dataset_id}/features set of features
  • GET /dataset/{dataset_id}/compound/{compound_id}/features set of features of a compound
and their corresponding POST and DELETE methods

At present I do not need the reverse lookup (i.e. finding compounds for features) which would correspond to URIs like /dataset/{dataset_id}/feature/{feature_id}/compounds
  • Set operations:
I would make them optional, because they can be performed also on the client side. Maybe they should go into the algorithm component, even if they are implemented in a dataset webservice. The same is true for similarity calculations.

Proposal:

Dataset

Component description

A set of chemical compounds and assigned features

REST operations

Dataset

Description Method URI Parameters Result Status codes
Get a list of all available datasets
GET /datasets - List of dataset URIs 200,404,503
Get a dataset representation
GET /dataset/{id} - Representation in one of the supported MIME formats 200,404,503
Get all compounds of a dataset
GET /dataset/{id}/compounds - List of compound URIs
200,404,503
Get all features of a dataset
GET /dataset/{id}/features - List of feature URIs
200,404,503
Get all features of a compound GET /dataset/{id}/compound/{compound_id}/features -
List of feature URIs 200,404,503
Create a new dataset POST /datasets/ name
Dataset URI 200,404,503
Import data into a dataset PUT /dataset/{id}/ XML|YAML string or file in one of the supported MIME types Task URI 200,404,503

Algorithm:

IMHO most of the proposed methods should be part of the algorithm ontology API, the most important (and the only requested) method should be

POST /algorithm/{algorithm_id}

It would return an URI for a new resource (e.g. model URI for learning algorithms, dataset URI for feature calculation/selection algorithms)

Proposal:

Algorithm

Component description

REST operations

Description Method URI Parameters Result Status codes
Get URIs of all available algorithms
GET /algorithms - List of algorithm URIs 200,404,503
Get the representation of an algorithm GET /algorithm/{id} - XMl representation of the algorithm
200,404,503

 

Model:

o.k.

Other APIs:

Up to now I have no practical experience with the other APIs (ontologies, validation, asynchronous tasks).
Document Actions