Difference between revisions of "Sample Code Cookbook"

From NCBO Wiki
Jump to navigation Jump to search
Line 15: Line 15:
 
** Use the Annotator web service to identify ontology terms in textual data.  
 
** Use the Annotator web service to identify ontology terms in textual data.  
 
*** Annotator Web service documentation: http://www.bioontology.org/wiki/index.php/Annotator_Web_service   
 
*** Annotator Web service documentation: http://www.bioontology.org/wiki/index.php/Annotator_Web_service   
*** Example code:  
+
*** Example code: https://bmir-gforge.stanford.edu/gf/project/client_examples/scmsvn/?action=browse&path=%2Ftrunk%2FJava%2FAnnotator%2F (Java), https://bmir-gforge.stanford.edu/gf/project/client_examples/scmsvn/?action=browse&path=%2Ftrunk%2FPython%2FAnnotator%2F (Python)
  
 
* I have PubMed abstracts and want to link information in the abstracts to my database of interest.  
 
* I have PubMed abstracts and want to link information in the abstracts to my database of interest.  
 
** Process the text with the Annotator web service. If your database of interest is included in the NCBO Resource Index you can search the database(s) for records that contain these terms. See http://www.bioontology.org/wiki/index.php/Resource_Index for more details on the Resource Index web service.
 
** Process the text with the Annotator web service. If your database of interest is included in the NCBO Resource Index you can search the database(s) for records that contain these terms. See http://www.bioontology.org/wiki/index.php/Resource_Index for more details on the Resource Index web service.
  
* I have a web form with fields I would like to users to fill-in with a specific set of terms from the Gene Ontology.
+
* I have a web form with text fields I would like to populate with ontology terms, e.g. to select relevant Gene Ontology terms.
** Generate this subset of terms and then load this ontology as a view of the Gene Ontology (http://bioportal.bioontology.org/ontologies/44532#views). Then choose the ontology-term autocomplete widget from the Widgets page (http://bioportal.bioontology.org/ontologies/44532#widgets) and select the "Get Code" button for Javascript that you can add to your web form.
+
** Use the Autocomplete widget (example for the Gene Ontology, http://bioportal.bioontology.org/ontologies/44532#widgets). Select the "Get Code" button for the code and instructions on how to add this Javascript to your web form.  If you would like to limit the terms to a subset of the Gene Ontology, create this subset and then load this ontology subset as a View of the Gene Ontology (http://bioportal.bioontology.org/ontologies/44532#views).  
  
* I would like to include the graph display of my ontology on my web site.
+
* I would like to add the graph display of my ontology on my web site.  
** Choose the Visualization widget from the widgets page (e.g. http://bioportal.bioontology.org/ontologies/44532#widgets) for your ontology of interest and select the "Get Code" button to add the ontology graph to your web site.
+
** Use the Visualization widget for your ontology of interest from the widgets page (example for Gene Ontology, http://bioportal.bioontology.org/ontologies/44532#widgets). Select the "Get Code" button for the code and instructions on how to add this Javascript to your web form.  
  
 
* I would like to get all terms from an ontology and re-format the data to use in my own system.
 
* I would like to get all terms from an ontology and re-format the data to use in my own system.
** Use the "Get all terms" web service (http://www.bioontology.org/wiki/index.php/NCBO_REST_services#Get_all_terms_using_the_specific_ontology_version_id and http://www.bioontology.org/wiki/index.php/NCBO_REST_services#Get_all_terms_using_the_virtual_ontology_id) to get a list of all of the terms and all details about each term, e.g. synonyms, definition, subclass, etc.
+
** Use the Get All Terms Web service to get all terms and properties for your ontology of interest.
 +
*** Get All Terms Web service documentation: http://www.bioontology.org/wiki/index.php/NCBO_REST_services#Get_all_terms_using_the_specific_ontology_version_id and http://www.bioontology.org/wiki/index.php/NCBO_REST_services#Get_all_terms_using_the_virtual_ontology_id) to get a list of all of the terms and all details about each term, e.g. synonyms, definition, subclass, etc.

Revision as of 23:25, 2 November 2010

This page lists use cases and provides examples of how these questions can be answered using NCBO software (web services and widgets), and includes links to code samples and documentation.

Use Cases

  • I have PubMed abstracts and want to link information in the abstracts to my database of interest.
    • Process the text with the Annotator web service. If your database of interest is included in the NCBO Resource Index you can search the database(s) for records that contain these terms. See http://www.bioontology.org/wiki/index.php/Resource_Index for more details on the Resource Index web service.
  • I have a web form with text fields I would like to populate with ontology terms, e.g. to select relevant Gene Ontology terms.
  • I would like to add the graph display of my ontology on my web site.