Skip to content

Commit

Permalink
Fixes requested by Lacey and for warnings during building
Browse files Browse the repository at this point in the history
  • Loading branch information
spficklin committed Aug 28, 2018
1 parent f935a70 commit b6ee052
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 47 deletions.
34 changes: 1 addition & 33 deletions docs/dev_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,10 @@ Developer's Guide
:maxdepth: 2
:caption: Table of Contents

dev_guide/introduction
dev_guide/data_structures
dev_guide/best_practices
dev_guide/custom_modules
dev_guide/custom_field
dev_guide/custom_data_loader
dev_guide/custom_web_services



Introduction to the Tripal API
-------------------------------

Tripal provides an Application Programming Interfaces (API) that allows developers to interact with and customize Tripal. Using the API, developers can customize the way data is presented or create custom modules that provide new or different functionality. These custom modules can in turn be shared with the Tripal community. The Tripal API is documented online at http://api.tripal.info/api/tripal/3.x (COMING SOON). This document provides examples and best practices for using the Tripal API.

Requirements
-------------------------------

In order to use the Tripal API the developer should have the following skills:

Common skills:

* Knowledge of PHP.
* Knowledge of relational databases and SQL.

To create custom modules:

* Familiarity with Drupal API
* Familiarity with Drupal module development

To use Chado for data storage:

* Knowledge of Chado and relationships between tables (at least tables where data of interest is stored).
* An idea how data is stored in Chado (or a willingness to ask questions)

Things that will make your Tripal development experience postive, fun and rewarding:

* A desire to write code that can be re-used and shared by other groups
* A desire to share your work with others to support other the Tripal community members.
* A willingness to ask for help on the Tripal Github issue queue if you get stuck, find bugs or desire new features.
3 changes: 2 additions & 1 deletion docs/dev_guide/custom_field.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Creating a Custom Field
========================
=======================

The most common way that new content will be added to an existing site is by creating new fields, or field displays. In Tripal v2 customizations were added by editing PHP templates files. These template files were relatively easy to create and customize, but they provided less flexibility and did not integrate well with other Drupal features such as GUI-based page layout and Drupal Views. Tripal v3 fields now provide this flexibility. They also support data exchange and data collections!

Expand Down Expand Up @@ -32,6 +32,7 @@ The process for creating a custom field are as follows:
* Decide if you need the Chado field classes or the base Tripal field classes. If you intend to work with data housed in Chado then you should use the Chado field classes.
* Decide if you want to build your class manually from the ground up or speed development by using the Staton Lab Fields Generator tool.
* Create new implementations of classes that extend those listed in the table above. If you implement the functions properly your field is plug-and-play! Tripal will find it and be able to use it.

The rest of this section will walk you through these steps.


Expand Down
22 changes: 10 additions & 12 deletions docs/dev_guide/custom_field/select_vocab_terms.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Selecting Vocabulary Terms
============================
==========================

Ontologies: what and why?
--------------------------
-------------------------

Tripal 3 requires all bundles and fields to be associated with a Controlled Vocabulary (CV). CVs are dictionaries of defined terms (CV terms) that make data machine-accessible, ensuring uniform terms are used across experiments, organisms and websites. Without CVterms, our scientific knowledge might be split by "dialects". Plant biologists might study temperature stress, while animal biologists study heat shock. Each group might benefit from the knowledge of the other, but they use a different vocabulary to describe the same thing, creating challenges for data discovery and exchange. CV terms make this easier not just for people, but especially for machines. Ontologies take this a step further. Where CVs are controlled lists of CVterms, ontologies are a controlled language, that include heirarchical relationships of terms.

Expand All @@ -11,17 +11,17 @@ Tripal leverages vocabularies to make use of the `Semantic Web <https://en.wikip
Before you can create a new Bundle or Field the vocabulary term must be present in your local Tripal site. You can check if a term exists by using the Tripal lookup service on your local site using the URL path cv/lookup (e.g. http://your-site/cv/lookup). If the term is not present then you'll need to add it. You can do so manually by using Tripal's controlled vocabulary admin pages. For creating new bundles this is all you need to do. However, when creating Fields you will want to programmatically add the term. This is important because Fields are meant to be shared. If you create an awesome field that you want to share with others then you need to make sure the terms get added programmatically. The following sections describe how terms are stored in Chado and how you can add them using Tripal API calls.

Storage of Terms in Chado
--------------------------
-------------------------

In Chado, CVs are stored by two tables: the **db** and **cv** tables. Chado was designed to store a record for the online database that a vocabulary lives at in the **db** table, and the namespace of a vocabulary in the **cv** table. For example, the sequence ontology uses the namespace, sequence, which is stored in the **cv** table but uses the short name of SO which is stored in the **db** table. As we'll see later, sometimes the distinction between what gets stored in the **cv** vs the **db** tables can get a bit fuzzy with some vocabularies. The terms themselves are stored in the cvterm table. The cvterm table has a foreign key to the **cv** table via the **cv_id** field. Every controlled vocabulary term has an accession. For example the term gene in the Sequence Ontology has an accession number of SO:0000704. Accession numbers consist of two parts: a vocabulary "short name", followed by a unique identifier separated by a colon. Within Chado, the accession for any term is stored in the dbxref table. This table has a foreign key to the **db** table via the **db_id** as well as a foreign key to the cvterm table via the **dbxref_id** field.

Vocabulary Short Names and Namespaces
--------------------------------------
-------------------------------------

How can you tell what the **short name** and **namespace** values will be for a vocabulary term that you want to insert into Chado for your custom Bundle or Field? Hint: use the information is in the EMBL-EBI `Ontology Lookup Service <http://www.ebi.ac.uk/ols/index>`_ (OLS). The following sections provide three examples for different cases.

Case 1: Ontologies without a defined namespace
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Consider the term for `organism <http://www.ebi.ac.uk/ols/ontologies/obi/terms?iri=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FOBI_0100026>`_.

Expand Down Expand Up @@ -74,7 +74,7 @@ Second, we insert the record for the controlled vocabulary.
Case 2: Ontologies with a defined namespace
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Consider the entry for `CDS <https://www.ebi.ac.uk/ols/ontologies/so/terms?iri=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FSO_0000316>`_.

Expand All @@ -97,17 +97,15 @@ Notice that in the Term Info box on the right there is the term **has_obo_namesp
Notice in the code above we can properly set the cv_name to sequence.

Case 3: Ontologies with multiple namespaces
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Some ontologies are b into sub-ontologies. This includes the Gene Ontology (GO). Let's consider the example GO term `cell aggregation <http://www.ebi.ac.uk/ols/ontologies/go/terms?iri=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FGO_0098743>`_. Looking at the EBI entry, the teal box is GO, the orange box is GO:0098743, and the has_obo_namespace is biological_process. However, the GO provides two other namespaces: cellular_component and molecular_function. Be sure to pay attention to these different namespaces if you ever need to manually insert a term.

.. figure:: select_vocab_terms.3.go.png


Case 4: Ontologies with muliptle short names
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The EDAM ontology builds its term accessions using different short names instead of the ontology. Consider the EDAM term for `Sequence <http://www.ebi.ac.uk/ols/ontologies/edam/terms?iri=http%3A%2F%2Fedamontology.org%2Fdata_2044>`_. The teal box is EDAM, the orange box is data:2044, and there is no **namespace**.

Expand Down Expand Up @@ -141,8 +139,8 @@ For this case, the **namespace** is EDAM, the short name is **data**, and the ac
Case 5: You really cant a term!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Case 5: You really cant find a term!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sometimes a good CVterm just doesn't exist for what you want to describe. If you can't find a CV term, you can insert a term into the "local" CV. This is meant to be used as a last resort. In these cases, before you use a local term, consider contributing the term to an existing CV or ontology. Any terms that are invented for a local site may mean that the data exposed by your site cannot be discovered by other sites or tools. In this case, the accession will not be numeric, but is the same as the term name.

Expand Down
1 change: 0 additions & 1 deletion docs/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ User's Guide
user_guide/job_management
user_guide/web_services
user_guide/bulk_loader
user_guide/galaxy_integration
user_guide/customize_site
1 change: 1 addition & 0 deletions docs/user_guide/example_genomics/pub_import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Some things to know about the publication importer:
2. If a publication with an accession (e.g. PubMed ID) already exists in the local database, the record will be updated.
3. If a publication in the local database matches by title, journal and year with one that is to be imported, then the record will be updated. Y
4. Run the newly created Tripal Job to finish:

::

cd /var/www/html
Expand Down
1 change: 1 addition & 0 deletions docs/user_guide/install_tripal/pre_planning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ After selection of one of the options above you can arrange your database/webser

- **Arrangement #1**: The database and web server are housed on a single server. This is the approach taken by this course. It is necessary to gain access to a machine with enough memory (RAM), hard disk speed and space, and processor power to handle both services.
- **Arrangement #2**: The database and web server are housed on different servers. This provides dedicated resources to each service (i.e. web and database).

Selection of an appropriate machine

Databases are typically bottle-necked by RAM and disk speed. Selection of the correct balance of RAM, disk speed, disk size and CPU speed is important and dependent on the size of the data. The best advice is to consult an IT professional who can recommend a server installation tailored for the expected size of your data.
Expand Down

0 comments on commit b6ee052

Please sign in to comment.