Class: DiseaseSearch

DiseaseSearch

new DiseaseSearch(baseURL, appID, appKey)

Parameters:
Name Type Description
baseURL string URL for the Open PHACTS API
appID string Application ID for the application being used. Created by https://dev.openphacts.org
appKey string Application Key for the application ID.
Author:
License:
Source:

Methods

associationsByDisease(URI, pageopt, pageSizeopt, orderByopt, lensopt, callback)

Fetch the disease-target associations for a particular disease represented by the URI provided.
Parameters:
Name Type Attributes Default Description
URI string The URI for the disease of interest.
page string <optional>
1 Which page of records to return.
pageSize string <optional>
10 How many records to return. Set to 'all' to return all records in a single page
orderBy string <optional>
Order the records by this field eg ?assay_type or DESC(?assay_type)
lens string <optional>
An optional lens to apply to the result.
callback requestCallback Function that will be called with the result.
Source:
Example
var searcher = new DiseaseSearch("https://beta.openphacts.org/2.1", "appID", "appKey");
var callback=function(success, status, response){
   var associations = searcher.parseAssociationsByDiseaseResponse(response);
};
searcher.associationsByDisease('http://linkedlifedata.com/resource/umls/id/C0004238', null, null, null, null, callback);

associationsByDiseaseCount(URI, lensopt, callback)

Count the number of targets associated with a disease represented by the URI provided.
Parameters:
Name Type Attributes Description
URI string The URI for the disease of interest.
lens string <optional>
An optional lens to apply to the result.
callback requestCallback Function that will be called with the result.
Source:
Example
var searcher = new DiseaseSearch("https://beta.openphacts.org/2.1", "appID", "appKey");
var callback=function(success, status, response){
   var associationsCount = searcher.parseAssociationsByDiseaseCountResponse(response);
};
searcher.associationsByDiseaseCount('http://linkedlifedata.com/resource/umls/id/C0004238', null, callback);

associationsByTarget(URI, pageopt, pageSizeopt, orderByopt, lensopt, callback)

Fetch the disease-target associations for a particular target represented by the URI provided.
Parameters:
Name Type Attributes Default Description
URI string The URI for the target of interest.
page string <optional>
1 Which page of records to return.
pageSize string <optional>
10 How many records to return. Set to 'all' to return all records in a single page
orderBy string <optional>
Order the records by this field eg ?assay_type or DESC(?assay_type)
lens string <optional>
An optional lens to apply to the result.
callback requestCallback Function that will be called with the result.
Source:
Example
var searcher = new DiseaseSearch("https://beta.openphacts.org/2.1", "appID", "appKey");
var callback=function(success, status, response){
   var associations = searcher.parseAssociationsByTargetResponse(response);
};
searcher.associationsByTarget('http://purl.uniprot.org/uniprot/Q9Y5Y9', null, null, null, null, callback);

associationsByTargetCount(URI, lensopt, callback)

Count the number of diseases associated with a target represented by the URI provided.
Parameters:
Name Type Attributes Description
URI string The URI for the target of interest.
lens string <optional>
An optional lens to apply to the result.
callback requestCallback Function that will be called with the result.
Source:
Example
var searcher = new DiseaseSearch("https://beta.openphacts.org/2.1", "appID", "appKey");
var callback=function(success, status, response){
   var associationsCount = searcher.parseAssociationsByTargetCountResponse(response);
};
searcher.associationsByTargetCount('http://purl.uniprot.org/uniprot/Q9Y5Y9', null, callback);

diseasesByTarget(URI, pageopt, pageSizeopt, orderByopt, lensopt, callback)

Fetch the diseases for a target represented by the URI provided.
Parameters:
Name Type Attributes Default Description
URI string The URI for the target of interest.
page string <optional>
1 Which page of records to return.
pageSize string <optional>
10 How many records to return. Set to 'all' to return all records in a single page
orderBy string <optional>
Order the records by this field eg ?assay_type or DESC(?assay_type)
lens string <optional>
An optional lens to apply to the result.
callback requestCallback Function that will be called with the result.
Source:
Example
var searcher = new DiseaseSearch("https://beta.openphacts.org/2.1", "appID", "appKey");
var callback=function(success, status, response){
   var diseases = searcher.parseDiseasesByTargetResponse(response);
};
searcher.diseasesByTarget('http://purl.uniprot.org/uniprot/Q9Y5Y9', null, null, null, null, callback);

diseasesByTargetCount(URI, lensopt, callback)

Count the number of diseases for a target represented by the URI provided.
Parameters:
Name Type Attributes Description
URI string The URI for the target of interest.
lens string <optional>
An optional lens to apply to the result.
callback requestCallback Function that will be called with the result.
Source:
Example
var searcher = new DiseaseSearch("https://beta.openphacts.org/2.1", "appID", "appKey");
var callback=function(success, status, response){
   var diseaseResult = searcher.parseDiseasesByTargetCountResponse(response);
};
searcher.diseasesByTargetCount('http://purl.uniprot.org/uniprot/Q9Y5Y9', null, callback);

fetchDisease(URI, lensopt, callback)

Fetch the disease represented by the URI provided.
Parameters:
Name Type Attributes Description
URI string The URI for the disease of interest.
lens string <optional>
An optional lens to apply to the result.
callback requestCallback Function that will be called with the result.
Source:
Example
var searcher = new DiseaseSearch("https://beta.openphacts.org/2.1", "appID", "appKey");
var callback=function(success, status, response){
   var diseaseResult = searcher.parseDiseaseResponse(response);
};
searcher.fetchDisease('http://linkedlifedata.com/resource/umls/id/C0004238', null, callback);

fetchDiseaseBatch(URIList, lensopt, callback)

Fetch multiple diseases represented by the URIs provided.
Parameters:
Name Type Attributes Description
URIList Array A list of URIs for multiple diseases.
lens string <optional>
An optional lens to apply to the result.
callback requestCallback Function that will be called with the result.
Source:
Example
var searcher = new DiseaseSearch("https://beta.openphacts.org/2.1", "appID", "appKey");
var callback=function(success, status, response){
   var diseaseResult = searcher.parseDiseaseBatchResponse(response);
};
searcher.fetchDiseaseBatch('http://linkedlifedata.com/resource/umls/id/C0004238|http://linkedlifedata.com/resource/umls/id/C0004238', null, callback);

parseAssociationsByDiseaseCountResponse(response) → {Number}

Parameters:
Name Type Description
response Object the JSON response from DiseaseSearch#associationsByDiseaseCount
Source:
Returns:
Total count of disease-target associations which correspond to a disease
Type
Number

parseAssociationsByDiseaseResponse(response) → {AssociationsResponse}

Parse the results from DiseaseSearch#associationsByDisease
Parameters:
Name Type Description
response Object the JSON response from DiseaseSearch#associationsByDisease
Source:
Returns:
List of disease-target associations
Type
AssociationsResponse

parseAssociationsByTargetCountResponse(response) → {Number}

Parameters:
Name Type Description
response Object the JSON response from DiseaseSearch#associationsByTargetCount
Source:
Returns:
Total count of disease-target associations which correspond to a target
Type
Number

parseAssociationsByTargetResponse(response) → {AssociationsResponse}

Parse the results from DiseaseSearch#associationsByTarget
Parameters:
Name Type Description
response Object the JSON response from DiseaseSearch#associationsByTarget
Source:
Returns:
List of disease-target associations
Type
AssociationsResponse

parseDiseaseBatchResponse(response) → {Array.FetchDiseaseResponse}

Parse the results from DiseaseSearch#fetchDiseaseBatch
Parameters:
Name Type Description
response Object the JSON response from DiseaseSearch#fetchDiseaseBatch
Source:
Returns:
Containing the flattened response
Type
Array.FetchDiseaseResponse

parseDiseaseResponse(response) → {FetchDiseaseResponse}

Parse the results from DiseaseSearch#fetchDisease
Parameters:
Name Type Description
response Object the JSON response from DiseaseSearch#fetchDisease
Source:
Returns:
Containing the flattened response
Type
FetchDiseaseResponse

parseDiseasesByTargetCountResponse(response) → {Number}

Parse the results from DiseaseSearch#diseasesByTargetCount
Parameters:
Name Type Description
response Object the JSON response from DiseaseSearch#diseasesByTargetCount
Source:
Returns:
Count of the number of diseases for the target
Type
Number

parseDiseasesByTargetResponse(response) → {DiseasesByTargetResponse}

Parse the results from DiseaseSearch#diseasesByTarget
Parameters:
Name Type Description
response Object the JSON response from DiseaseSearch#diseasesByTarget
Source:
Returns:
List of disease items
Type
DiseasesByTargetResponse

parseTargetsByDiseaseCountResponse(response) → {Number}

Parse the results from DiseaseSearch#targetsByDiseaseCount
Parameters:
Name Type Description
response Object the JSON response from DiseaseSearch#targetsByDiseaseCount
Source:
Returns:
Count of the number of diseases for the target
Type
Number

parseTargetsByDiseaseResponse(response) → {TargetsByDiseaseResponse}

Parse the results from DiseaseSearch#targetsByDisease
Parameters:
Name Type Description
response Object the JSON response from DiseaseSearch#targetsByDisease
Source:
Returns:
List of disease items
Type
TargetsByDiseaseResponse

targetsByDisease(URI, pageopt, pageSizeopt, orderByopt, lensopt, callback)

Fetch the targets for a disease represented by the URI provided.
Parameters:
Name Type Attributes Default Description
URI string The URI for the disease of interest.
page string <optional>
1 Which page of records to return.
pageSize string <optional>
10 How many records to return. Set to 'all' to return all records in a single page
orderBy string <optional>
Order the records by this field eg ?assay_type or DESC(?assay_type)
lens string <optional>
An optional lens to apply to the result.
callback requestCallback Function that will be called with the result.
Source:
Example
var searcher = new DiseaseSearch("https://beta.openphacts.org/2.1", "appID", "appKey");
var callback=function(success, status, response){
   var targets = searcher.parseTargetsByDiseaseResponse(response);
};
searcher.targetsByDisease('http://linkedlifedata.com/resource/umls/id/C0004238', null, null, null, null, callback);

targetsByDiseaseCount(URI, lensopt, callback)

Count the number of targets for a disease represented by the URI provided.
Parameters:
Name Type Attributes Description
URI string The URI for the disease of interest.
lens string <optional>
An optional lens to apply to the result.
callback requestCallback Function that will be called with the result.
Source:
Example
var searcher = new DiseaseSearch("https://beta.openphacts.org/2.1", "appID", "appKey");
var callback=function(success, status, response){
   var targetResult = searcher.parseTargetsByDiseaseCountResponse(response);
};
searcher.targetsByDiseaseCount('http://linkedlifedata.com/resource/umls/id/C0004238', null, callback);