KnnResource Resource

KNN analysis results JAX-RS resource.

GET /knn-results

Description of available KNN results.

Response Body
media type data type description
application/json KnnsInfo (JSON) Available knn results.

Example

Request
GET /knn-results
Content-Type: */*
Accept: application/json

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "knns" : [ {
    "querycount" : 12345,
    "minneighborcount" : 12345,
    "maxneighborcount" : 12345,
    "allneighborcount" : 12345,
    "querymolecules" : {
      "size" : 12345,
      "time" : 12345,
      "description" : "...",
      "absentmols" : 12345,
      "absentids" : 12345,
      "url" : "...",
      "name" : "...",
      "propnames" : [ "...", "..." ],
      "props" : [ { }, { } ]
    },
    "targetmolecules" : {
      "size" : 12345,
      "time" : 12345,
      "description" : "...",
      "absentmols" : 12345,
      "absentids" : 12345,
      "url" : "...",
      "name" : "...",
      "propnames" : [ "...", "..." ],
      "props" : [ { }, { } ]
    },
    "context" : "...",
    "qmolsurl" : "...",
    "tmolsurl" : "...",
    "queryindexproj" : "...",
    "targetindexproj" : "...",
    "self" : true,
    "mindissim" : 12345.0,
    "maxdissim" : 12345.0,
    "minneighborindex" : 12345,
    "maxneighborindex" : 12345,
    "url" : "...",
    "name" : "...",
    "time" : 12345
  }, {
    "querycount" : 12345,
    "minneighborcount" : 12345,
    "maxneighborcount" : 12345,
    "allneighborcount" : 12345,
    "querymolecules" : {
      "size" : 12345,
      "time" : 12345,
      "description" : "...",
      "absentmols" : 12345,
      "absentids" : 12345,
      "url" : "...",
      "name" : "...",
      "propnames" : [ "...", "..." ],
      "props" : [ { }, { } ]
    },
    "targetmolecules" : {
      "size" : 12345,
      "time" : 12345,
      "description" : "...",
      "absentmols" : 12345,
      "absentids" : 12345,
      "url" : "...",
      "name" : "...",
      "propnames" : [ "...", "..." ],
      "props" : [ { }, { } ]
    },
    "context" : "...",
    "qmolsurl" : "...",
    "tmolsurl" : "...",
    "queryindexproj" : "...",
    "targetindexproj" : "...",
    "self" : true,
    "mindissim" : 12345.0,
    "maxdissim" : 12345.0,
    "minneighborindex" : 12345,
    "maxneighborindex" : 12345,
    "url" : "...",
    "name" : "...",
    "time" : 12345
  } ]
}
                
              

GET /knn-results/{res}

Description of a knn result.

Request Parameters
name type description
res path Knn results name
Response Body
media type data type description
application/json KnnInfo (JSON) Description of a knn result.

Example

Request
GET /knn-results/{res}
Content-Type: */*
Accept: application/json

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "querycount" : 12345,
  "minneighborcount" : 12345,
  "maxneighborcount" : 12345,
  "allneighborcount" : 12345,
  "querymolecules" : {
    "size" : 12345,
    "time" : 12345,
    "description" : "...",
    "absentmols" : 12345,
    "absentids" : 12345,
    "url" : "...",
    "name" : "...",
    "propnames" : [ "...", "..." ],
    "props" : [ {
      "name" : "...",
      "type" : "...",
      "numeric" : true,
      "extractor" : "..."
    }, {
      "name" : "...",
      "type" : "...",
      "numeric" : true,
      "extractor" : "..."
    } ]
  },
  "targetmolecules" : {
    "size" : 12345,
    "time" : 12345,
    "description" : "...",
    "absentmols" : 12345,
    "absentids" : 12345,
    "url" : "...",
    "name" : "...",
    "propnames" : [ "...", "..." ],
    "props" : [ {
      "name" : "...",
      "type" : "...",
      "numeric" : true,
      "extractor" : "..."
    }, {
      "name" : "...",
      "type" : "...",
      "numeric" : true,
      "extractor" : "..."
    } ]
  },
  "context" : "...",
  "qmolsurl" : "...",
  "tmolsurl" : "...",
  "queryindexproj" : "...",
  "targetindexproj" : "...",
  "self" : true,
  "mindissim" : 12345.0,
  "maxdissim" : 12345.0,
  "minneighborindex" : 12345,
  "maxneighborindex" : 12345,
  "url" : "...",
  "name" : "...",
  "time" : 12345
}
                
              

GET /knn-results/{res}/get-sizeinfo

Experimental endpoint to estimate allocated size. Please note that this endpoint is under construction, use with caution: execution might fail and execution might have significant memory/cpu impact. The availability/functionality of this endpoint might change in any of the subsequent releases.

Request Parameters
name type description constraints
res path Knn results name  
method query Size info method to use. "CALCULATED" or "JAVAAGENT"
Response Body
media type data type description
application/json SizeInfoDto (JSON) Size info description

Example

Request
GET /knn-results/{res}/get-sizeinfo
Content-Type: */*
Accept: application/json

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "size" : 12345,
  "details" : [ {
    "size" : 12345,
    "name" : "..."
  }, {
    "size" : 12345,
    "name" : "..."
  } ]
}
                
              

GET /knn-results/{res}/knndata

Knn data.

Request Parameters
name type description
res path Knn results name
Response Body
media type data type description
application/json KnnData (JSON) Knn data.

Example

Request
GET /knn-results/{res}/knndata
Content-Type: */*
Accept: application/json

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "dissimilarities" : [ 12345.0, 12345.0 ],
  "targets" : [ 12345, 12345 ],
  "queries" : [ 12345, 12345 ],
  "querycount" : 12345,
  "minneighborcount" : 12345,
  "maxneighborcount" : 12345,
  "allneighborcount" : 12345,
  "querymolecules" : {
    "size" : 12345,
    "time" : 12345,
    "description" : "...",
    "absentmols" : 12345,
    "absentids" : 12345,
    "url" : "...",
    "name" : "...",
    "propnames" : [ "...", "..." ],
    "props" : [ {
      "name" : "...",
      "type" : "...",
      "numeric" : true,
      "extractor" : "..."
    }, {
      "name" : "...",
      "type" : "...",
      "numeric" : true,
      "extractor" : "..."
    } ]
  },
  "targetmolecules" : {
    "size" : 12345,
    "time" : 12345,
    "description" : "...",
    "absentmols" : 12345,
    "absentids" : 12345,
    "url" : "...",
    "name" : "...",
    "propnames" : [ "...", "..." ],
    "props" : [ {
      "name" : "...",
      "type" : "...",
      "numeric" : true,
      "extractor" : "..."
    }, {
      "name" : "...",
      "type" : "...",
      "numeric" : true,
      "extractor" : "..."
    } ]
  },
  "context" : "...",
  "qmolsurl" : "...",
  "tmolsurl" : "...",
  "queryindexproj" : "...",
  "targetindexproj" : "...",
  "self" : true,
  "mindissim" : 12345.0,
  "maxdissim" : 12345.0,
  "minneighborindex" : 12345,
  "maxneighborindex" : 12345,
  "url" : "...",
  "name" : "...",
  "time" : 12345
}
                
              

GET /knn-results/{res}/neighbor-png-or-placeholder

Get molecule image for a specific neighbor in PNG format or a placeholder image for absent molecules. When the given molecule is absent then a placeholder image is generated. This call delegates to the target molecule sets GET MoleculesResource with translation to the actual neighbor target.

Request Parameters
name type description default constraints
res path Knn results name    
aromatize query Aromatize options, use source, aromatize or dearomatize source  
h query Image height in pixels 100 int
hydrogenize query Hydrogenize options. use source, hydrogenize or dehydrogenize source  
neighbor query Neighbor index   int
query query Qurery index   int
w query Image width in pixels 100 int
Response Body
media type data type description
image/png (custom) Molecule in SDF format with ID set to SDF property "id".

Example

Request
GET /knn-results/{res}/neighbor-png-or-placeholder
Content-Type: */*
Accept: image/png

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: image/png

                
...
                
              

GET /knn-results/{res}/neighborcounts

Stored neighbor count for each record.

Request Parameters
name type description
res path Knn results name
Response Body
media type data type description
application/json MoleculePropRange (JSON) Neighbor count for all queries

Example

Request
GET /knn-results/{res}/neighborcounts
Content-Type: */*
Accept: application/json

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "start" : 12345,
  "count" : 12345,
  "presentcount" : 12345,
  "missingcount" : 12345,
  "missingvalue" : { },
  "values" : [ { }, { } ]
}
                
              

GET /knn-results/{res}/query-png-or-placeholder

Get molecule image for a query in PNG format or a placeholder image for absent molecules. When the given molecule is absent then a placeholder image is generated. This call delegates to the query molecule sets GET MoleculesResource with translation to the actual query master index.

Request Parameters
name type description default constraints
res path Knn results name    
aromatize query Aromatize options, use source, aromatize or dearomatize source  
h query Image height in pixels 100 int
hydrogenize query Hydrogenize options. use source, hydrogenize or dehydrogenize source  
query query Qurery index in the knn resuls   int
w query Image width in pixels 100 int
Response Body
media type data type description
image/png (custom) Molecule in SDF format with ID set to SDF property "id".

Example

Request
GET /knn-results/{res}/query-png-or-placeholder
Content-Type: */*
Accept: image/png

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: image/png

                
...
                
              

GET /knn-results/{res}/queryindices

Indices of the queries.

Request Parameters
name type description default
res path Knn results name  
missing query Missing value marker; not used. ????
Response Body
media type data type description
application/json MoleculePropRange (JSON) Indices of the specified neighbor for each query

Example

Request
GET /knn-results/{res}/queryindices
Content-Type: */*
Accept: application/json

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "start" : 12345,
  "count" : 12345,
  "presentcount" : 12345,
  "missingcount" : 12345,
  "missingvalue" : { },
  "values" : [ { }, { } ]
}
                
              

POST /knn-results/{res}/table-labels

Get labels to be displayed in a k-NN view table. A typical visualization use case is to display some of the neighbors of some of the queries along with IDs.

Request Parameters
name type description default constraints multivalued
neighbors[] form Neighbors to retrieve   int yes
queries[] form Query indices in the kNN table   int yes
res path Knn results name     no
missing query Value to use for missing values. ????   no
Response Body
media type data type description
application/json KnnTableLabels (JSON) Collected labels

Example

Request
POST /knn-results/{res}/table-labels
Content-Type: application/x-www-form-urlencoded
Accept: application/json

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
{
  "missingvalue" : "...",
  "q" : {
    "property1" : {
      "queryid" : "...",
      "queryindex" : 12345,
      "querymolindex" : 12345,
      "dissimilarities" : {
        "property1" : 12345.0,
        "property2" : 12345.0
      },
      "targetids" : {
        "property1" : "...",
        "property2" : "..."
      },
      "targetmolindices" : {
        "property1" : 12345,
        "property2" : 12345
      }
    },
    "property2" : {
      "queryid" : "...",
      "queryindex" : 12345,
      "querymolindex" : 12345,
      "dissimilarities" : {
        "property1" : 12345.0,
        "property2" : 12345.0
      },
      "targetids" : {
        "property1" : "...",
        "property2" : "..."
      },
      "targetmolindices" : {
        "property1" : 12345,
        "property2" : 12345
      }
    }
  }
}
                
              

GET /knn-results/{res}/neighbors/{k}/dissimilarities

Dissimilarities of the k-th most similar neighbors.

Request Parameters
name type description default constraints
k path Neighbor index (0-based)   int
res path Knn results name    
missing query Value to use for missing k-th neighbors. ????  
Response Body
media type data type description
application/json MoleculePropRange (JSON) Dissimilarities of the specified neighbor for each query

Example

Request
GET /knn-results/{res}/neighbors/{k}/dissimilarities
Content-Type: */*
Accept: application/json

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "start" : 12345,
  "count" : 12345,
  "presentcount" : 12345,
  "missingcount" : 12345,
  "missingvalue" : { },
  "values" : [ { }, { } ]
}
                
              

GET /knn-results/{res}/neighbors/{k}/indices

Indices of the k-th most similar neighbors.

Request Parameters
name type description default constraints
k path Neighbor index (0-based)   int
res path Knn results name    
missing query Value to use for missing k-th neighbors. ????  
Response Body
media type data type description
application/json MoleculePropRange (JSON) Indices of the specified neighbor for each query

Example

Request
GET /knn-results/{res}/neighbors/{k}/indices
Content-Type: */*
Accept: application/json

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "start" : 12345,
  "count" : 12345,
  "presentcount" : 12345,
  "missingcount" : 12345,
  "missingvalue" : { },
  "values" : [ { }, { } ]
}
                
              

GET /knn-results/{res}/neighbors/{k}/props/{propname}

Additional stored property of the k-th most similar neighbors for all queries.

Request Parameters
name type description default constraints
k path Neighbor index (0-based)   int
propname path Property name    
res path Knn results name    
missing query Value to use for missing values. Note that a property value is considered missing when the specified neighbor is not stored or when the specified neighbor is stored but its specified property value is not available. ????  
Response Body
media type data type description
application/json MoleculePropRange (JSON) Property for k-th nearest neighbor of all queries

Example

Request
GET /knn-results/{res}/neighbors/{k}/props/{propname}
Content-Type: */*
Accept: application/json

                
...
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "start" : 12345,
  "count" : 12345,
  "presentcount" : 12345,
  "missingcount" : 12345,
  "missingvalue" : { },
  "values" : [ { }, { } ]
}