Browse Source

Documention: Small tweaks to the documentation to get the defn groups to display properly in the api site

Lacey Sanderson 11 years ago
parent
commit
3d39ea2833
38 changed files with 571 additions and 578 deletions
  1. 23 22
      tripal_analysis/api/tripal_analysis.api.inc
  2. 2 8
      tripal_analysis/tripal_analysis.module
  3. 3 3
      tripal_bulk_loader/api/tripal_bulk_loader.api.templates.inc
  4. 3 3
      tripal_bulk_loader/tripal_bulk_loader.module
  5. 21 21
      tripal_contact/api/tripal_contact.api.inc
  6. 11 21
      tripal_contact/tripal_contact.module
  7. 0 3
      tripal_core/api/tripal_core.chado_general.api.inc
  8. 16 1
      tripal_core/api/tripal_core.chado_nodes.api.inc
  9. 0 1
      tripal_core/api/tripal_core.chado_query.api.inc
  10. 0 1
      tripal_core/api/tripal_core.chado_schema.api.inc
  11. 0 1
      tripal_core/api/tripal_core.chado_variables.api.inc
  12. 27 30
      tripal_core/api/tripal_core.custom_tables.api.inc
  13. 8 15
      tripal_core/api/tripal_core.files.api.inc
  14. 6 9
      tripal_core/api/tripal_core.jobs.api.inc
  15. 28 31
      tripal_core/api/tripal_core.mviews.api.inc
  16. 7 13
      tripal_core/api/tripal_core.schema_v1.11.api.inc
  17. 10 16
      tripal_core/api/tripal_core.schema_v1.2.api.inc
  18. 7 0
      tripal_core/tripal_core.module
  19. 82 85
      tripal_cv/api/tripal_cv.api.inc
  20. 10 6
      tripal_cv/tripal_cv.module
  21. 5 4
      tripal_db/api/tripal_db.api.inc
  22. 8 1
      tripal_db/tripal_db.module
  23. 130 130
      tripal_feature/api/tripal_feature.api.inc
  24. 0 5
      tripal_feature/tripal_feature.module
  25. 9 1
      tripal_featuremap/api/tripal_featuremap.api.inc
  26. 5 9
      tripal_genetic/tripal_genetic.module
  27. 4 4
      tripal_library/api/tripal_library.api.inc
  28. 5 9
      tripal_natural_diversity/tripal_natural_diversity.module
  29. 14 14
      tripal_organism/api/tripal_organism.api.inc
  30. 7 4
      tripal_organism/tripal_organism.module
  31. 3 7
      tripal_phenotype/tripal_phenotype.module
  32. 3 0
      tripal_project/api/tripal_project.api.inc
  33. 4 8
      tripal_project/tripal_project.module
  34. 79 79
      tripal_pub/api/tripal_pub.api.inc
  35. 14 12
      tripal_pub/tripal_pub.module
  36. 3 0
      tripal_stock/api/tripal_stock.api.inc
  37. 6 1
      tripal_views/api/tripal_views.api.inc
  38. 8 0
      tripal_views/tripal_views.module

+ 23 - 22
tripal_analysis/api/tripal_analysis.api.inc

@@ -1,24 +1,25 @@
 <?php
 
 /**
- * @file
- * API functions relating to Analysis'
- *
  * @defgroup tripal_analysis_api Analysis Module API
  * @ingroup tripal_api
+ * @{
+ * API functions relating to Analysis'
+ * @}
  */
+
 /**
- * Register tripal_analysis sub-modules
+ * Register tripal_analysis_api sub-modules
  *
  * @param $modulename
  *  The name of the module to be registered as a tripal analysis submodule
  *
- * @ingroup tripal_analysis
+ * @ingroup tripal_analysis_api
  */
-function tripal_analysis_register_child($modulename) {
-  $sql = "SELECT * FROM {tripal_analysis} WHERE modulename = :modname";
+function tripal_analysis_api_register_child($modulename) {
+  $sql = "SELECT * FROM {tripal_analysis_api} WHERE modulename = :modname";
   if (!db_query($sql, array(':modname' => $modulename))->fetchField()) {
-    $sql = "INSERT INTO {tripal_analysis} (modulename) VALUES (:modname)";
+    $sql = "INSERT INTO {tripal_analysis_api} (modulename) VALUES (:modname)";
     db_query($sql, array(':modname' => $modulename));
   }
 }
@@ -29,11 +30,11 @@ function tripal_analysis_register_child($modulename) {
  * @param $modulename
  *  The name of the module to un-register
  *
- * @ingroup tripal_analysis
+ * @ingroup tripal_analysis_api
  */
-function tripal_analysis_unregister_child($modulename) {
-  if (db_table_exists('tripal_analysis')) {
-      $sql = "DELETE FROM {tripal_analysis} WHERE modulename = :modname";
+function tripal_analysis_api_unregister_child($modulename) {
+  if (db_table_exists('tripal_analysis_api')) {
+      $sql = "DELETE FROM {tripal_analysis_api} WHERE modulename = :modname";
       db_query($sql, array(':modname' => $modulename));
   }
 }
@@ -50,9 +51,9 @@ function tripal_analysis_unregister_child($modulename) {
  * @return
  *    An analysis chado variable with the specified properties expanded
  *
- * @ingroup tripal_analysis_api
+ * @ingroup tripal_analysis_api_api
  */
-function tripal_analysis_get_property($analysis_id, $property, $cvname = 'tripal') {
+function tripal_analysis_api_get_property($analysis_id, $property, $cvname = 'tripal') {
   return tripal_core_get_property('analysis', $analysis_id, $property, $cvname);
 }
 
@@ -73,9 +74,9 @@ function tripal_analysis_get_property($analysis_id, $property, $cvname = 'tripal
  * @return
  *   True of success, False otherwise
  *
- * @ingroup tripal_analysis_api
+ * @ingroup tripal_analysis_api_api
  */
-function tripal_analysis_insert_property($analysis_id, $property, $value, $update_if_present = 0, $cvname = 'tripal') {
+function tripal_analysis_api_insert_property($analysis_id, $property, $value, $update_if_present = 0, $cvname = 'tripal') {
     return tripal_core_insert_property('analysis', $analysis_id, $property, $cvname, $value, $update_if_present);
 }
 
@@ -99,9 +100,9 @@ function tripal_analysis_insert_property($analysis_id, $property, $value, $updat
  * @return
  *   True of success, False otherwise
  *
- * @ingroup tripal_analysis_api
+ * @ingroup tripal_analysis_api_api
  */
-function tripal_analysis_update_property($analysis_id, $property, $value, $insert_if_missing = 0, $cvname = 'tripal') {
+function tripal_analysis_api_update_property($analysis_id, $property, $value, $insert_if_missing = 0, $cvname = 'tripal') {
   return tripal_core_update_property('analysis', $analysis_id, $property, $cvname, $value, $insert_if_missing);
 }
 
@@ -121,9 +122,9 @@ function tripal_analysis_update_property($analysis_id, $property, $value, $inser
  * @return
  *   True of success, False otherwise
  *
- * @ingroup tripal_analysis_api
+ * @ingroup tripal_analysis_api_api
  */
-function tripal_analysis_delete_property($analysis_id, $property, $cvname = 'tripal') {
+function tripal_analysis_api_delete_property($analysis_id, $property, $cvname = 'tripal') {
   return tripal_core_delete_property('analysis', $analysis_id, $property, $cvname);
 }
 
@@ -136,9 +137,9 @@ function tripal_analysis_delete_property($analysis_id, $property, $cvname = 'tri
  * @return
  *   node of analysis on success, null otherwise
  *
- * @ingroup tripal_analysis_api
+ * @ingroup tripal_analysis_api_api
  */
-function tripal_analysis_get_node($analysis_id) {
+function tripal_analysis_api_get_node($analysis_id) {
   $sql = "SELECT *
            FROM {chado_analysis} CA
               INNER JOIN {node} N on CA.nid = N.nid

+ 2 - 8
tripal_analysis/tripal_analysis.module

@@ -1,17 +1,11 @@
 <?php
 
 /**
- * @file
- * Contains all the main hook implementations for the tripal_analysis module
- *
  * @defgroup tripal_analysis Analysis Module
  * @ingroup tripal_modules
  * @{
  * Provides functions for managing chado analysis' including creating details pages for each one
- *
  * @}
- *
- *
  */
 
 require_once 'api/tripal_analysis.api.inc';
@@ -161,7 +155,7 @@ function tripal_analysis_theme($existing, $type, $theme, $path) {
       'variables' =>  array(NULL),
       'path' => "$path/theme",
     ),
-    
+
     // tripal_feature theme
     'tripal_feature_analyses' => array(
       'template' => 'tripal_feature_analyses',
@@ -233,7 +227,7 @@ function tripal_analysis_views_api() {
 
 /**
  * Implementation of hook_form_alter()
- * 
+ *
  * @param $form
  * @param $form_state
  * @param $form_id

+ 3 - 3
tripal_bulk_loader/api/tripal_bulk_loader.api.templates.inc

@@ -1,10 +1,10 @@
 <?php
 /**
- * @file
- * All functions in this file provide an API to administrative management of bulk loader templates
- *
  * @defgroup tripal_bulk_loader_api Tripal Bulk Loader Module API
  * @ingroup tripal_api
+ * @{
+ * All functions in this file provide an API to administrative management of bulk loader templates
+ * @}
  */
 
 /**

+ 3 - 3
tripal_bulk_loader/tripal_bulk_loader.module

@@ -1,11 +1,11 @@
 <?php
 
 /**
- * @file
- * The functions for the Tripal bulk loader.
- *
  * @defgroup tripal_bulk_loader Tripal Bulk Loader Module
  * @ingroup tripal_modules
+ * @{
+ * Functions implementing the Tripal Generic tab-delimited chado data loader
+ * @}
  */
 
 // Loader

+ 21 - 21
tripal_contact/api/tripal_contact.api.inc

@@ -1,10 +1,10 @@
 <?php
 /**
- * @file
- * Provides an application programming interface (API) to manage libraries
- *
- * @defgroup tripal_contact_api contact Module API
+ * @defgroup tripal_contact_api Contact Module API
  * @ingroup tripal_api
+ * @{
+ * Provides an application programming interface (API) to manage chado contacts
+ * @}
  */
 
 /**
@@ -90,7 +90,7 @@ function tripal_contact_delete_property($contact_id, $property) {
 
 /**
  * Adds a contact to the Chado contact table
- * 
+ *
  * @param $name
  *   The name of the contact
  * @param $description
@@ -101,28 +101,28 @@ function tripal_contact_delete_property($contact_id, $property) {
  *   An associative array containing a list of key value pairs for the properites.
  *   The key's must be valid terms in the tripal_contact vocabulary (e.g. Affiliation,
  *   Address, etc).
- *   
+ *
  * @return
- *   On success, an array is returned containing the fields of the contact 
- *   record including the newly added contact_id. On failure, FALSE is 
+ *   On success, an array is returned containing the fields of the contact
+ *   record including the newly added contact_id. On failure, FALSE is
  *   returned
- *   
+ *
  * @ingroup tripal_contact_api
- * 
+ *
  */
 function tripal_contact_add_contact($name, $description, $type, $properties) {
 
-  // check to see if this contact name already exists.    
+  // check to see if this contact name already exists.
   $values =  array('name' => $name);
   $options = array('statement_name' => 'sel_contact_na');
   $contact = tripal_core_chado_select('contact', array('contact_id'), $values, $options);
-  
-  if (count($contact) == 0) {    
+
+  if (count($contact) == 0) {
     $cvterm = tripal_cv_get_cvterm_by_name($type, NULL, 'tripal_contact');
     if (!$cvterm) {
       watchdog('tripal_contact',"Cannot find contact type '%type'",
         array('%type' => $type), WATCHDOG_ERROR);
-      return FALSE;  
+      return FALSE;
     }
     $values =  array(
       'name' => $name,
@@ -133,26 +133,26 @@ function tripal_contact_add_contact($name, $description, $type, $properties) {
     $contact = tripal_core_chado_insert('contact', $values, $options);
     if (!$contact) {
       watchdog('tripal_contact','Could not add the contact', array(), WATCHDOG_ERROR);
-      return FALSE; 
+      return FALSE;
     }
   }
   else {
     $contact = (array) $contact[0];
   }
- 
+
   // add the description property. We don't store this in the contact.description
-  // field because it is only 255 characters long and may not be enough  
+  // field because it is only 255 characters long and may not be enough
   if ($description) {
     tripal_contact_insert_property($contact['contact_id'], 'contact_description', $description, TRUE);
   }
-    
+
   // add in the other properties provided
   foreach ($properties as $key => $value) {
     $success = tripal_contact_insert_property($contact['contact_id'], $key,$value, TRUE);
     if (!$success) {
       watchdog('tripal_contact',"Could not add the contact property '%prop'", array('%prop' => $key), WATCHDOG_ERROR);
-      return FALSE;  
-    }  
+      return FALSE;
+    }
   }
-  return $contact; 
+  return $contact;
 }

+ 11 - 21
tripal_contact/tripal_contact.module

@@ -1,19 +1,5 @@
 <?php
 
-/**
- *  @file
- * This file contains the basic functions needed for this drupal module.
- * The drupal tripal_contact module maps directly to the chado X module.
- *
- * For documentation regarding the Chado X module:
- * @see http://gmod.org/wiki/Chado_General_Module
- */
-
-require('api/tripal_contact.api.inc');
-require('theme/tripal_contact.theme.inc');
-require('includes/tripal_contact.admin.inc');
-require('includes/tripal_contact.chado_node.inc');
-
 /**
  * @defgroup tripal_contact Contact Module
  * @ingroup tripal_modules
@@ -27,8 +13,12 @@ require('includes/tripal_contact.chado_node.inc');
  * @}
  */
 
+require('api/tripal_contact.api.inc');
+require('theme/tripal_contact.theme.inc');
+require('includes/tripal_contact.admin.inc');
+require('includes/tripal_contact.chado_node.inc');
 
-/*************************************************************************
+/**
  * Implements hook_views_api()
  * Purpose: Essentially this hook tells drupal that there is views support for
  *  for this module which then includes tripal_contact.views.inc where all the
@@ -105,7 +95,7 @@ function tripal_contact_menu() {
     'type' => MENU_LOCAL_TASK,
     'weight' => 0
   );
-  
+
   $items['admin/tripal/chado/tripal_contact/sync'] = array(
     'title' => ' Sync',
     'description' => 'Create pages on this site for libraries stored in Chado',
@@ -147,7 +137,7 @@ function tripal_contact_menu() {
  */
 function tripal_contact_theme($existing, $type, $theme, $path) {
   $core_path = drupal_get_path('module', 'tripal_core');
-  
+
   $items = array(
     'node__chado_contact' => array(
       'template' => 'node--chado-generic',
@@ -221,7 +211,7 @@ function tripal_contact_block_view($delta = '') {
       case 'contbase':
         $block['subject'] = t('Details');
         $block['content'] = array(
-          '#theme' => 'tripal_contact_base', 
+          '#theme' => 'tripal_contact_base',
           '#nodes' => $node,
           '#title' => '',
         );
@@ -229,7 +219,7 @@ function tripal_contact_block_view($delta = '') {
       case 'contprops':
         $block['subject'] = t('Properties');
         $block['content'] = array(
-          '#theme' => 'tripal_contact_properties', 
+          '#theme' => 'tripal_contact_properties',
           '#nodes' => $node,
           '#title' => '',
         );
@@ -237,7 +227,7 @@ function tripal_contact_block_view($delta = '') {
       case 'contrels':
         $block['subject'] = t('Relationships');
         $block['content'] = array(
-          '#theme' => 'tripal_contact_relationships', 
+          '#theme' => 'tripal_contact_relationships',
           '#nodes' => $node,
           '#title' => '',
         );
@@ -245,7 +235,7 @@ function tripal_contact_block_view($delta = '') {
       case 'contpubs':
         $block['subject'] = t('Publications');
         $block['content'] = array(
-          '#theme' => 'tripal_contact_publications', 
+          '#theme' => 'tripal_contact_publications',
           '#nodes' => $node,
           '#title' => '',
         );

+ 0 - 3
tripal_core/api/tripal_core.chado_general.api.inc

@@ -4,9 +4,6 @@ require_once "tripal_core.schema_v1.2.api.inc";
 require_once "tripal_core.schema_v1.11.api.inc";
 
 /**
- * @file
- * Chado API
- *
  * @defgroup tripal_chado_api Chado API
  * @ingroup tripal_core_api
  * @{

+ 16 - 1
tripal_core/api/tripal_core.chado_nodes.api.inc

@@ -1,7 +1,6 @@
 <?php
 
 /**
- * @file
  * @defgroup tripal_chado_node_api Chado Node API
  * @ingroup tripal_chado_api
  * @{
@@ -11,6 +10,22 @@
  * similar. This API aims to abstract much of the common functionality in order to make
  * it easier for new Tripal modules to implement drupal node types and to centralize the
  * maintenance effort as much as possible.
+ *
+ * A generic sync form has been created. See tripal_core_chado_node_sync_form() for
+ * instructions on how to implement this form in your module.
+ *
+ * Many of the base chado tables also have associated prop, _dbxref and _relationship
+ * tables. Generic mini-forms have been created to help you handle these forms. To
+ * implement this functionality you call the mini-form from your module node form and
+ * then call the associated update functions from both your hook_insert and hook_update.
+ * The functions of interest are as follows:
+ *   - chado_node_properties_form() and chado_node_properties_form_update_properties()
+ *     to provide an interface for adding/removing properties
+ *   - tripal_core_additional_dbxrefs_form() and tripal_core_additional_dbxrefs_form_update_dbxrefs()
+ *     to provide an interface for adding/removing additional database references
+ *   - tripal_core_relationships_form() and tripal_core_relationships_form_update_relationships()
+ *     to provide an interface for adding/removing relationships between chado records
+ *     from your base table
  * @}
  */
 

+ 0 - 1
tripal_core/api/tripal_core.chado_query.api.inc

@@ -1,7 +1,6 @@
 <?php
 
 /**
- * @file
  * @defgroup tripal_chado_query_api Chado Query API
  * @ingroup tripal_chado_api
  * @{

+ 0 - 1
tripal_core/api/tripal_core.chado_schema.api.inc

@@ -1,7 +1,6 @@
 <?php
 
 /**
- * @file
  * @defgroup tripal_chado_schema_api Chado Query API
  * @ingroup tripal_chado_api
  * @{

+ 0 - 1
tripal_core/api/tripal_core.chado_variables.api.inc

@@ -1,7 +1,6 @@
 <?php
 
 /**
- * @file
  * @defgroup tripal_chado_variables_api Chado Variables API
  * @ingroup tripal_chado_api
  * @{

+ 27 - 30
tripal_core/api/tripal_core.custom_tables.api.inc

@@ -1,8 +1,5 @@
 <?php
 /**
- * @file
- * Contains functions for the Custom Tables API
-
  * @defgroup tripal_custom_tables_api Custom Tables API
  * @ingroup tripal_core_api
  * @{
@@ -11,7 +8,7 @@
  */
 
 /**
- * Edits a custom table in the chado database. It supports 
+ * Edits a custom table in the chado database. It supports
  * using the Drupal Schema API array.
  *
  * @param $table_id
@@ -39,11 +36,11 @@ function tripal_core_edit_custom_table($table_id, $table_name, $schema, $skip_cr
   $sql = "SELECT * FROM {tripal_custom_tables} WHERE table_id = :table_id";
   $results = db_query($sql, array(':table_id' => $table_id));
   $custom_table = $results->fetchObject();
-  
+
   // if the user changed the table name, we want to drop the old one and force
   // creation of the new one.
   if ($custom_table->table_name != $table_name) {
-    chado_query("DROP TABLE %s", $custom_table->table_name);  
+    chado_query("DROP TABLE %s", $custom_table->table_name);
     $skip_creation = 0; // we want to create the table
   }
 
@@ -93,7 +90,7 @@ function tripal_core_edit_custom_table($table_id, $table_name, $schema, $skip_cr
  *   A Drupal-style Schema API definition of the table
  * @param $skip_creation
  *   Set as TRUE to skip dropping and re-creation of the table if it already
- *   exists.  This is useful if the table was already created through another 
+ *   exists.  This is useful if the table was already created through another
  *   means and you simply want to make Tripal aware of the table schema.  If the
  *   table does not exist it will be created.
  *
@@ -106,17 +103,17 @@ function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
   global $databases;
   $created = 0;
   $recreated = 0;
-  
+
   // see if the table entry already exists in the tripal_custom_tables table.
   $sql = "SELECT * FROM {tripal_custom_tables} WHERE table_name = :table_name";
   $results = db_query($sql, array(':table_name' => $table));
   $centry = $results->fetchObject();
-  
+
   // check to see if the table already exists in the chado schema
-  $exists = chado_table_exists($table); 
-  
+  $exists = chado_table_exists($table);
+
   // if the table does not exist then create it
-  if (!$exists) { 
+  if (!$exists) {
     try {
       $ret = db_create_table('chado.' . $table, $schema);
       $created = 1;
@@ -126,15 +123,15 @@ function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
       watchdog('tripal_core', "Error adding custom table: @message", array('@message' => $error), WATCHDOG_ERROR);
       drupal_set_message("Could not add custom table. $error.", "error");
       return FALSE;
-    }    
-  }  
+    }
+  }
 
   // if the table exists in Chado and in our custom table and
-  // skip creation is turned off then drop and re-create the table 
-  if ($exists and is_object($centry) and !$skip_creation) {    
-    
-    // drop the table we'll recreate it with the new schema    
-    try {      
+  // skip creation is turned off then drop and re-create the table
+  if ($exists and is_object($centry) and !$skip_creation) {
+
+    // drop the table we'll recreate it with the new schema
+    try {
       chado_query('DROP TABLE {' . $table . '}');
       db_create_table('chado.' . $table, $schema);
       $recreated = 1;
@@ -162,24 +159,24 @@ function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
   if (!$success) {
     watchdog('tripal_core', "Error adding custom table %table_name.",
       array('%table_name' => $table), WATCHDOG_ERROR);
-    drupal_set_message(t("Could not add custom table %table_name. 
-      Please check the schema array.", array('%table_name' => $table)), 'error');      
+    drupal_set_message(t("Could not add custom table %table_name.
+      Please check the schema array.", array('%table_name' => $table)), 'error');
     return FALSE;
   }
-  
-  
+
+
   // now add any foreign key constraints
   if (!$skip_creation and array_key_exists('foreign keys', $schema)) {
-    
+
     // iterate through the foreign keys and add each one
     $fkeys = $schema['foreign keys'];
     foreach ($fkeys as $fktable => $fkdetails) {
       $relations = $fkdetails['columns'];
       foreach ($relations as $left => $right) {
         $sql = '
-          ALTER TABLE {' . $table . '} 
-            ADD CONSTRAINT ' . $table . '_' . $left . '_fkey FOREIGN KEY (' . $left . ') 
-            REFERENCES  {' . $fktable . '} (' . $right . ') 
+          ALTER TABLE {' . $table . '}
+            ADD CONSTRAINT ' . $table . '_' . $left . '_fkey FOREIGN KEY (' . $left . ')
+            REFERENCES  {' . $fktable . '} (' . $right . ')
             ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
         ';
         try {
@@ -189,13 +186,13 @@ function tripal_core_create_custom_table($table, $schema, $skip_creation = 1) {
           $error = $e->getMessage();
           watchdog('tripal_core', "Error, could not add foreign key contraint to custom table: %error",
             array('%error' => $error), WATCHDOG_ERROR);
-          drupal_set_message("Could not add foreign key contraint to table: $error", 'error');      
-          return FALSE;          
+          drupal_set_message("Could not add foreign key contraint to table: $error", 'error');
+          return FALSE;
         }
       }
     }
   }
-  
+
   if ($created) {
     drupal_set_message("Custom table created successfully.", 'status');
   }

+ 8 - 15
tripal_core/api/tripal_core.files.api.inc

@@ -1,27 +1,20 @@
-<?php 
+<?php
 /**
- * @file
- * The Tripal Files API
- *
- * This file provides the API to help Tripal modules to storing files
- * in a consistent directory strcuture.
- *
- * @defgroup tripal_files_api  Files API
+ * @defgroup tripal_files_api Files API
  * @ingroup tripal_core_api
  * @{
  * Provides an application programming interface (API) for managing files within
  * the Tripal data directory structure.
- *
  * @}
  *
  */
- 
+
 /**
  * This function is a substitute for Drupal 6's file_directory_path()
  * function which no longer exists in Drupal 7.  However, the function
  * call is useful because it's more intitutive. So this wrapper was created
- * to mimic the behavior of the old function.  
- * 
+ * to mimic the behavior of the old function.
+ *
  * @return
  *   the public directory where tripal files are housed: sites/default/files/tripal
  */
@@ -59,7 +52,7 @@ function tripal_create_moddir($module_name) {
 /**
  * This function creates directories inside of the module's
  * Data directory.
- * 
+ *
  * @param $module_name
  * @param $path
  */
@@ -67,7 +60,7 @@ function tripal_create_mod_subdir($module_name, $path) {
 
   // make sure the module data directory exists
   tripal_create_moddir($module_name);
-  
+
   // now make sure the sub dir exists
   $sub_dir = tripal_file_directory_path() . $module_name . $path;
   if (!file_prepare_directory($sub_dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
@@ -87,7 +80,7 @@ function tripal_create_mod_subdir($module_name, $path) {
  *
  * @returns
  *   The path within the Drupal installation where the data directory resides
- *   
+ *
  * @ingroup tripal_files_api
  */
 function tripal_get_moddir($module_name) {

+ 6 - 9
tripal_core/api/tripal_core.jobs.api.inc

@@ -1,8 +1,5 @@
 <?php
 /**
- * @file
- * Contains functions related to the Tripal Jobs API
- *
  * @defgroup tripal_jobs_api Jobs API
  * @ingroup tripal_core_api
  * @{
@@ -21,7 +18,7 @@
  * waiting jobs is determined first by priority and second by the order the jobs were entered.
  *
  * The API functions described below provide a programmatic interface for adding, checking and viewing jobs.
- * @} 
+ * @}
  */
 
 /**
@@ -68,7 +65,7 @@ function tripal_add_job($job_name, $modulename, $callback, $arguments, $uid, $pr
   if (is_array($arguments)) {
     $args = serialize($arguments);
   }
-  
+
   $record = new stdClass();
   $record->job_name = $job_name;
   $record->modulename = $modulename;
@@ -190,14 +187,14 @@ function tripal_jobs_get_end_time($job) {
  */
 function tripal_jobs_rerun($job_id, $goto_jobs_page = TRUE) {
   global $user;
-  
+
   $user_id = $user->uid;
 
   $sql = "SELECT * FROM {tripal_jobs} WHERE job_id = :job_id";
   $results = db_query($sql, array(':job_id' => $job_id));
-  $job = $results->fetchObject(); 
+  $job = $results->fetchObject();
   // arguments for jobs used to be stored as plain string with a double colon
-  // separating them.  But as of Tripal v2.0 the arguments are stored as 
+  // separating them.  But as of Tripal v2.0 the arguments are stored as
   // a serialized array.  To be backwards compatible, we should check for serialization
   // and if not then we will use the old style
   $args = unserialize($job->arguments);
@@ -295,7 +292,7 @@ function tripal_jobs_launch($do_parallel = 0, $job_id = NULL) {
     // Add the job_id as the last item in the list of arguments. All
     // callback functions should support this argument.
     $callback = $job->callback;
-    
+
     // arguments for jobs used to be stored as plain string with a double colon
     // separating them.  But as of Tripal v2.0 the arguments are stored as
     // a serialized array.  To be backwards compatible, we should check for serialization

+ 28 - 31
tripal_core/api/tripal_core.mviews.api.inc

@@ -1,8 +1,5 @@
 <?php
 /**
- * @file
- * Contains functions for the Materialized Views API
-
  * @defgroup tripal_mviews_api Materalized Views API
  * @ingroup tripal_core_api
  * @{
@@ -72,7 +69,7 @@ function tripal_add_legacy_mview($name, $modulename, $mv_table, $mv_specs, $inde
         $field = trim($field);
         $index .= "CREATE INDEX idx_${mv_table}_${field} ON $mv_table ($field);";
       }
-    } 
+    }
   }
 
   // add the table to the database
@@ -100,19 +97,19 @@ function tripal_add_legacy_mview($name, $modulename, $mv_table, $mv_specs, $inde
  *   The name of the module submitting the materialized view (e.g. 'tripal_library')
  * @param $mv_schema
  *   If using the newer Schema API array to define the materialized view then
- *   this variable should contain the array or a string representation of the 
+ *   this variable should contain the array or a string representation of the
  *   array.
  * @param $query
  *   The SQL query that loads the materialized view with data
  * @param $comment
- *   A string containing a description of the materialized view 
- *   
+ *   A string containing a description of the materialized view
+ *
  * @ingroup tripal_mviews_api
  */
 function tripal_add_mview($name, $modulename, $schema_arr, $query, $comment = NULL) {
-  
+
   $mv_table = $schema_arr['table'];
-  
+
   if (!$mv_table) {
      watchdog('tripal_core', 'Must have a table name when creating an mview.', array(), WATCHDOG_ERROR);
      return NULL;
@@ -135,7 +132,7 @@ function tripal_add_mview($name, $modulename, $schema_arr, $query, $comment = NU
     if (chado_table_exists($mv_table)) {
       $sql = 'DROP TABLE {' . $mv_table . '}';
       chado_query($sql);
-    }   
+    }
     // create the table
     if (!tripal_core_create_custom_table ($mv_table, $schema_arr, 0)) {
       drupal_set_message(t("Could not create the materialized view. Check Drupal error report logs."), 'error');
@@ -200,14 +197,14 @@ function tripal_edit_mview($mview_id, $name, $modulename, $mv_table, $mv_specs,
   // get the view before we update and check to see if the table structure has
   // changed. IF so, then we want to drop and recreate the table. If not, then
   // just save the updated SQL.
-  $create_table = 1;  
+  $create_table = 1;
   $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = :mview_id";
   $results = db_query($sql, array(':mview_id' => $mview_id));
-  $mview = $results->fetchObject();  
-  if ($mview->mv_schema == $mv_schema and $mview->mv_table == $mv_table and 
-     $mview->mv_specs == $mv_specs and $mview->indexed == $indexed and 
+  $mview = $results->fetchObject();
+  if ($mview->mv_schema == $mv_schema and $mview->mv_table == $mv_table and
+     $mview->mv_specs == $mv_specs and $mview->indexed == $indexed and
      $mview->special_index == $special_index) {
-    // nothing has changed so simpy update the SQL and other fields 
+    // nothing has changed so simpy update the SQL and other fields
     $create_table = 0;
   }
   else {
@@ -219,7 +216,7 @@ function tripal_edit_mview($mview_id, $name, $modulename, $mv_table, $mv_specs,
     $record->query = $query;
     $record->special_index = $special_index;
   }
-  
+
   // if we are going to create the table then we must first drop it if it exists
   if ($create_table) {
     $previous_db = tripal_db_set_active('chado');  // use chado database
@@ -248,7 +245,7 @@ function tripal_edit_mview($mview_id, $name, $modulename, $mv_table, $mv_specs,
 
     // re-create the table differently depending on if it the traditional method
     // or the Drupal Schema API method
-    if ($create_table and $mv_schema) {     
+    if ($create_table and $mv_schema) {
       if (!tripal_core_create_custom_table($mv_table, $schema_arr, 0)) {
         drupal_set_message(t("Could not create the materialized view. Check Drupal error report logs."));
       }
@@ -260,11 +257,11 @@ function tripal_edit_mview($mview_id, $name, $modulename, $mv_table, $mv_specs,
       $sql = "CREATE TABLE {$mv_table} ($mv_specs); $index";
       $results = chado_query($sql);
       if ($results) {
-        drupal_set_message(t("View '%name' created.  All records cleared. Please re-populate the view.", 
+        drupal_set_message(t("View '%name' created.  All records cleared. Please re-populate the view.",
           array('%name' => $name)));
       }
       else {
-        drupal_set_message(t("Failed to create the materialized view table: '%mv_table'", 
+        drupal_set_message(t("Failed to create the materialized view table: '%mv_table'",
           array('%mv_table' => $mv_table)), 'error');
       }
     }
@@ -273,12 +270,12 @@ function tripal_edit_mview($mview_id, $name, $modulename, $mv_table, $mv_specs,
       if ($query != $mview->query) {
         $message .= "Please repopulate the view to use updated query.";
       }
-      drupal_set_message(t($message, array('%name' => $name)));  
+      drupal_set_message(t($message, array('%name' => $name)));
     }
   }
   else {
-    drupal_set_message(t("Failed to update the materialized view: '%mv_table'", 
-      array('%mv_table' => $mv_table)), 'error');  
+    drupal_set_message(t("Failed to update the materialized view: '%mv_table'",
+      array('%mv_table' => $mv_table)), 'error');
   }
 }
 
@@ -320,7 +317,7 @@ function tripal_mviews_get_mview_id($view_name) {
  */
 function tripal_mviews_action($op, $mview_id, $redirect = FALSE) {
   global $user;
-  
+
   if (!$mview_id) {
     return '';
   }
@@ -336,17 +333,17 @@ function tripal_mviews_action($op, $mview_id, $redirect = FALSE) {
     tripal_add_job("Populate materialized view '$mview->name'", 'tripal_core',
        'tripal_update_mview', $args, $user->uid);
   }
-  
+
   // if op is to delete then do so
   if ($op == 'delete') {
-    
+
     // remove the mview from the tripal_mviews table
     $sql = "DELETE FROM {tripal_mviews} WHERE mview_id = $mview_id";
     db_query($sql);
-    
+
     // does the table already exist?
     $mview_exists = db_table_exists('chado.' . $mview->mv_table);
-    
+
     // drop the table from chado if it exists
     if ($mview_exists) {
       $sql = "DROP TABLE {" . $mview->mv_table . "}";
@@ -375,17 +372,17 @@ function tripal_update_mview($mview_id) {
   $sql = "SELECT * FROM {tripal_mviews} WHERE mview_id = :mview_id ";
   $results = db_query($sql, array(':mview_id' => $mview_id));
   $mview = $results->fetchObject();
-  if ($mview) {    
+  if ($mview) {
     // execute the query inside a transaction so that it doesn't destroy existing data
     // that may leave parts of the site unfunctional
     $transaction = db_transaction();
     try {
       $previous_db = tripal_db_set_active('chado');  // use chado database
       $success = db_query("DELETE FROM {" . $mview->mv_table . "}");
-      $success = db_query("INSERT INTO {" . $mview->mv_table . "} ($mview->query)");    
+      $success = db_query("INSERT INTO {" . $mview->mv_table . "} ($mview->query)");
       tripal_db_set_active($previous_db);  // now use drupal database
       // if success get the number of results and update the table record
-      if ($success) { 
+      if ($success) {
         $sql = "SELECT count(*) as cnt FROM {" . $mview->mv_table . "}";
         $results = chado_query($sql);
         $count = $results->fetchObject();
@@ -395,7 +392,7 @@ function tripal_update_mview($mview_id) {
         $record->status = "Populated with " . number_format($count->cnt) . " rows";
         drupal_write_record('tripal_mviews', $record, 'mview_id');
       }
-      // if not success then throw an error 
+      // if not success then throw an error
       else {
         throw new Exception("ERROR populating the materialized view ". $mview->mv_table . ". See Drupal's recent log entries for details.");
       }

+ 7 - 13
tripal_core/api/tripal_core.schema_v1.11.api.inc

@@ -1,23 +1,14 @@
 <?php
-/* @file: This file contains default schema definitions for all chado v1.11 tables
- *        to be used by other function. Specifically these functions are used
- *        by the tripal_core select/insert/update API functions and by
- *        the Tripal Views module.
- *
- *        These schema definitions can be augmented by anohter modules
- *        (specifically to add missing definitions) by implementing
- *        hook_chado_schema_v1_11_<table name>().
- *
+/**
  * @defgroup tripal_schema_v1_11_api Chado v1.11 Schema API
- * @ingroup tripal_core_api
+ * @ingroup tripal_chado_schema_api
  * @{
  * Provides an application programming interface (API) for describing Chado tables.
  * This API consists of a set of functions, one for each table in Chado.  Each
  * function simply returns a Drupal style array that defines the table.
  *
- * Because Drupal 6 does not handle foreign key (FK) relationships, however FK
- * relationships are needed to for Tripal Views.  Therefore, FK relationships
- * have been added to the schema defintitions below.
+ * Because Drupal 6 does not handle foreign key (FK) relationships, which are needed to
+ * for Tripal Views, they have been added to the schema defintitions below.
  *
  * The functions provided in this documentation should not be called as is, but if you need
  * the Drupal-style array definition for any table, use the following function
@@ -30,6 +21,9 @@
  * Chado and uses the Drupal hook infrastructure to call the appropriate
  * hook function to retrieve the table schema.
  *
+ * If you need to augment these schema definitions within your own module, you need to
+ * implement the hook_chado_schema_v1_11_[table name]() hook where [table name] is the
+ * name of the chado table whose schema definition you want to augment.
  * @}
  */
 

+ 10 - 16
tripal_core/api/tripal_core.schema_v1.2.api.inc

@@ -1,23 +1,14 @@
 <?php
-/* @file: This file contains default schema definitions for all chado v1.2 tables
- *        to be used by other function. Specifically these functions are used
- *        by the tripal_core select/insert/update API functions and by
- *        the Tripal Views module.
- *
- *        These schema definitions can be augmented by another modules
- *        (specifically to add missing definitions) by implementing
- *        hook_chado_schema_v1_2_<table name>().
- *
+/**
  * @defgroup tripal_schema_v1_2_api Chado v1.2 Schema API
- * @ingroup tripal_core_api
+ * @ingroup tripal_chado_schema_api
  * @{
  * Provides an application programming interface (API) for describing Chado tables.
  * This API consists of a set of functions, one for each table in Chado.  Each
  * function simply returns a Drupal style array that defines the table.
  *
- * Because Drupal 6 does not handle foreign key (FK) relationships, however FK 
- * relationships are needed to for Tripal Views.  Therefore, FK relationships
- * have been added to the schema defintitions below.
+ * Because Drupal 6 does not handle foreign key (FK) relationships, which are needed to
+ * for Tripal Views, they have been added to the schema defintitions below.
  *
  * The functions provided in this documentation should not be called as is, but if you need
  * the Drupal-style array definition for any table, use the following function
@@ -26,10 +17,13 @@
  *   $table_desc = tripal_core_get_chado_table_schema($table)
  *
  * where the variable $table contains the name of the table you want to
- * retireve.  The tripal_core_get_chado_table_schema function determines the appropriate version of 
- * Chado and uses the Drupal hook infrastructure to call the appropriate 
+ * retireve.  The tripal_core_get_chado_table_schema function determines the appropriate version of
+ * Chado and uses the Drupal hook infrastructure to call the appropriate
  * hook function to retrieve the table schema.
  *
+ * If you need to augment these schema definitions within your own module, you need to
+ * implement the hook_chado_schema_v1_2_[table name]() hook where [table name] is the
+ * name of the chado table whose schema definition you want to augment.
  * @}
  */
 
@@ -14178,6 +14172,6 @@ function tripal_core_chado_get_v1_2_tables() {
     'synonym',
     'tableinfo',
     'treatment'
-   );  
+   );
    return $tables;
 }

+ 7 - 0
tripal_core/tripal_core.module

@@ -29,11 +29,18 @@
  /**
  * @defgroup tripal_core_api Core Module API
  * @ingroup tripal_api
+ * @{
+ * Functions providing support for all Tripal modules.
+ * @}
  */
 
 /**
  * @defgroup tripal_core Tripal Core Module
  * @ingroup tripal_modules
+ * @{
+ * Functionality useful for all other Tripal modules including the Tripal jobs, files,
+ * materialized views and custom table functions.
+ * @}
  */
 
 // APPLICATION PROGRAMMER INTERFACE -------------

+ 82 - 85
tripal_cv/api/tripal_cv.api.inc

@@ -1,10 +1,7 @@
 <?php
 
 /**
- * @file
- * Controlled Vocabulary API
- *
- * @defgroup tripal_cv_api CV Module API
+ * @defgroup tripal_cv_api Ccontrolled Vocabulary API
  * @ingroup tripal_api
  * This module provides a set of functions to simplify working with
  * controlled vocabularies.  Most of the API functions deal with retrieving
@@ -158,11 +155,11 @@ function tripal_cv_get_cv_id($cv_name) {
 }
 
 /**
- * Create an options array to be used in a form element which provides a 
+ * Create an options array to be used in a form element which provides a
  * list of all chado cvs
  *
  * NOTE: This function is deprecated as of Tripal v1.0
- * 
+ *
  * @return
  *   An array(cv_id => name) for each cv in the chado cv table
  *
@@ -197,7 +194,7 @@ function tripal_cv_get_cvterm_by_id($cvterm_id) {
   }
   $values = array('cvterm_id' => $cvterm_id);
   $options = array('statement_name' => 'sel_cvterm_id');
-  $r = tripal_core_chado_select('cvterm', array('*'), $values, $options);  
+  $r = tripal_core_chado_select('cvterm', array('*'), $values, $options);
   if (!$r) {
     return FALSE;
   }
@@ -284,7 +281,7 @@ function tripal_cv_get_cvterm_by_synonym($synonym, $cv_id = NULL, $cv_name = 'tr
   $statement = "sel_cvtermsynonym_sy";
   if ($cv_id) {
     $values['cvterm_id'] = array('cv_id' => $cv_id);
-    $statement = "sel_cvtermsynonym_sycv";    
+    $statement = "sel_cvtermsynonym_sycv";
   }
   if ($cv_name) {
     $values['cvterm_id'] = array('cv_id' => array('name' => $cv_name));
@@ -295,7 +292,7 @@ function tripal_cv_get_cvterm_by_synonym($synonym, $cv_id = NULL, $cv_name = 'tr
     'case_insensitive_columns' => array('name')
   );
   $synonym = tripal_core_chado_select('cvtermsynonym', array('cvterm_id'), $values, $options);
-  
+
   // if the synonym doens't exist or more than one record is returned then return false
   if (count($synonym) == 0) {
     return FALSE;
@@ -303,12 +300,12 @@ function tripal_cv_get_cvterm_by_synonym($synonym, $cv_id = NULL, $cv_name = 'tr
   if (count($synonym) > 1) {
     return FALSE;
   }
-  
+
   // get the cvterm
   $values = array('cvterm_id' => $synonym[0]->cvterm_id);
   $options = array('statement_name' => 'sel_cvterm_id');
   $cvterm = tripal_core_chado_select('cvterm', array('*'), $values, $options);
-  return $cvterm[0]; 
+  return $cvterm[0];
 }
 /**
  * Create an options array to be used in a form element
@@ -361,17 +358,17 @@ function tripal_cv_update_cvtermpath($cvid, $job_id = NULL) {
   // first get the controlled vocabulary name:
   $sql = "SELECT * FROM {cv} WHERE cv_id = :cv_id";
   $cv = chado_query($sql, array(':cv_id' => $cvid))->fetchObject();
-  
+
   print "\nUpdating cvtermpath for $cv->name...\n";
-  
+
   $previous = tripal_db_set_active('chado');
   try {
     $sql = "SELECT * FROM fill_cvtermpath(:name)";
     db_query($sql, array(':name' => $cv->name));
-    tripal_db_set_active($previous); 
+    tripal_db_set_active($previous);
   }
   catch (Exception $e) {
-    tripal_db_set_active($previous);  
+    tripal_db_set_active($previous);
     $error = $e->getMessage();
     watchdog('tripal_cv', "Could not fill cvtermpath table: @error", array('@error' => $error), WATCHDOG_ERROR);
     return FALSE;
@@ -395,20 +392,20 @@ function tripal_cv_update_cvtermpath($cvid, $job_id = NULL) {
  * @ingroup tripal_cv_api
  */
 function tripal_cv_add_cv($name, $definition) {
-  
+
   // insert/update values
   $ins_values = array(
     'name'       => $name,
     'definition' => $definition
   );
-  
+
   // see if the CV (default-namespace) exists already in the database
   $sel_values = array('name' => $name);
   $sel_options = array('statement_name' => 'sel_cv_na');
   $results = tripal_core_chado_select('cv', array('*'), $sel_values, $sel_options);
 
   // if it does not exists then add it
-  if (count($results) == 0) {    
+  if (count($results) == 0) {
     $ins_options = array('statement_name' => 'ins_cv_nade');
     $success = tripal_core_chado_insert('cv', $ins_values, $ins_options);
     if (!$success) {
@@ -474,9 +471,9 @@ function tripal_cv_add_cv($name, $definition) {
  *
  * @ingroup tripal_cv_api
  */
-function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship = 0, 
+function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship = 0,
   $update = 1, $dbname = 'internal') {
-      
+
   // get the term properties
   $id = $term['id'];
   $name = '';
@@ -484,17 +481,17 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
   $definition = '';
   $is_obsolete = 0;
   $accession = '';
-  
+
   if (array_key_exists('name', $term)) {
-    $name = $term['name'];  
+    $name = $term['name'];
   }
   else {
-    $name = $id;  
+    $name = $id;
   }
 
   if (array_key_exists('namespace', $term)) {
     $cvname = $term['namespace'];
-  } 
+  }
   else {
     $cvname = $defaultcv;
   }
@@ -509,7 +506,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
     if (strcmp($is_obsolete, 'true') == 0) {
       $is_obsolete = 1;
     }
-  }  
+  }
   if (!$name and !$id) {
     watchdog('tripal_cv', "Cannot find cvterm without 'id' or 'name'", NULL, WATCHDOG_WARNING);
     return 0;
@@ -517,27 +514,27 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
   if (!$id) {
     $id = $name;
   }
-  
+
   // get the accession and the database from the cvterm id
   if ($dbname) {
     $accession = $id;
   }
-  
+
   if (preg_match('/^.+?:.*$/', $id)) {
     $accession = preg_replace('/^.+?:(.*)$/', '\1', $id);
     $dbname = preg_replace('/^(.+?):.*$/', '\1', $id);
   }
-  
+
   // check that we have a database name, give a different message if it's a relationship
   if ($is_relationship and !$dbname) {
     watchdog('tripal_cv', "A database name is not provided for this relationship term: $id", NULL, WATCHDOG_WARNING);
-    return 0; 
+    return 0;
   }
   if (!$is_relationship and !$dbname) {
     watchdog('tripal_cv', "A database identifier is missing from the term: $id", NULL, WATCHDOG_WARNING);
     return 0;
   }
-  
+
   // make sure the CV name exists
   $cv = tripal_cv_get_cv_by_name($cvname);
   if (!$cv) {
@@ -552,16 +549,16 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
   // here for easy reference below.  Because CV terms can change their names
   // but accessions don't change, the following SQL finds cvterms based on
   // their accession rather than the name
-  $cvtermsql = "     
-    SELECT CVT.name, CVT.cvterm_id, CV.cv_id, CV.name as cvname, 
-      DB.name as dbname, DB.db_id, DBX.accession 
+  $cvtermsql = "
+    SELECT CVT.name, CVT.cvterm_id, CV.cv_id, CV.name as cvname,
+      DB.name as dbname, DB.db_id, DBX.accession
     FROM {cvterm} CVT
       INNER JOIN {dbxref} DBX on CVT.dbxref_id = DBX.dbxref_id
       INNER JOIN {db} DB on DBX.db_id = DB.db_id
       INNER JOIN {cv} CV on CV.cv_id = CVT.cv_id
     WHERE DBX.accession = :accession and DB.name = :name
-  ";    
-  
+  ";
+
   // add the database. The function will just return the DB object if the
   // database already exists.
   $db = tripal_db_get_db_by_name($dbname);
@@ -584,25 +581,25 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
   );
   $options = array('statement_name' => 'sel_cvterm_c1');
   $result = tripal_core_chado_select('cvterm', array('*'), $values, $options);
-  
+
   // if the constraint is met then let's check it to see if
   // the database name matches the one we have been provided
   if (count($result) == 1) {
     $cvterm = $result[0];
-    
+
     // get the dbxref record
     $values = array('dbxref_id' => $cvterm->dbxref_id);
     $options = array('statement_name' => 'sel_dbxref_id');
     $result = tripal_core_chado_select('dbxref', array('*'), $values, $options);
     $dbxref = $result[0];
-    
+
     // get the db
     $values = array('db_id' => $dbxref->db_id);
     $options = array('statement_name' => 'sel_db_id');
     $result = tripal_core_chado_select('db', array('*'), $values, $options);
     $db_check = $result[0];
-    
-    // the database name for this existing term does not match that of the 
+
+    // the database name for this existing term does not match that of the
     // one provided to this function.  The CV name matches otherwise we
     // wouldn't have made it this far. So, let's swap the database for
     // this term
@@ -611,19 +608,19 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
       // look to see if the correct dbxref record already exists for this database
       $values = array(
         'db_id' => $db->db_id,
-        'accession' => $accession,       
+        'accession' => $accession,
       );
       $options = array('statement_name' => 'sel_dbxref_idac');
       $result = tripal_core_chado_select('dbxref', array('*'), $values, $options);
 
-      // if we already have a good dbxref then we want to update our cvterm 
+      // if we already have a good dbxref then we want to update our cvterm
       // to use this dbxref
       if (count($result) > 0) {
         $dbxref = $result[0];
         $match = array('cvterm_id' => $cvterm->cvterm_id);
         $values = array('dbxref_id' => $dbxref->dbxref_id);
         $options = array('statement_name' => 'upd_cvterm_db');
-        $success = tripal_core_chado_update('cvterm', $match, $values, $options); 
+        $success = tripal_core_chado_update('cvterm', $match, $values, $options);
         if (!$success) {
           watchdog('tripal_cv', "Failed to correct the dbxref id for the cvterm " .
             "'$name' (id: $accession), for database $dbname", NULL, WATCHDOG_WARNING);
@@ -631,20 +628,20 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
         }
       }
       // if we don't have the record then we want to delete our cvterm and let the code
-      // below recreate it with the correct info 
-      else {          
+      // below recreate it with the correct info
+      else {
         $match = array('cvterm_id' => $cvterm->cvterm_id);
         $options = array('statement_name' => 'del_cvterm_cv');
         tripal_core_chado_delete('cvterm', $match, $options);
-      }      
+      }
     }
-    
-    // check that the accession matches.  Sometimes an OBO can define the same term 
+
+    // check that the accession matches.  Sometimes an OBO can define the same term
     // multiple times but with different accessions.  If this is the case we
     // can't do an insert or it will violate the constraint in the cvterm table.
     // so we'll need to add the record to the cvterm_dbxref table instead
     if ($dbxref->accession != $accession) {
-      
+
       // get/add the dbxref fort his term
       $dbxref_new =  tripal_db_add_dbxref($db->db_id, $accession);
       if (!$dbxref_new) {
@@ -652,17 +649,17 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
           "$name (id: $accession), for database $dbname", NULL, WATCHDOG_WARNING);
         return 0;
       }
-      
+
       // check to see if the cvterm_dbxref record already exists
       $values = array(
         'cvterm_id' => $cvterm->cvterm_id,
         'dbxref_id' => $dbxref_new->dbxref_id,
         'is_for_definition' => 1,
       );
-      $options = array('statement_name' => 'sel_cvtermdbxref_cvdbis');      
+      $options = array('statement_name' => 'sel_cvtermdbxref_cvdbis');
       $result = tripal_core_chado_select('cvterm_dbxref', array('*'), $values, $options);
-      
-      // if the cvterm_dbxref record does not exists then add it 
+
+      // if the cvterm_dbxref record does not exists then add it
       if (count($result)==0) {
         $options = array(
           'statement_name' => 'ins_cvtermdbxref_cvdbis',
@@ -670,21 +667,21 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
         );
         $success = tripal_core_chado_insert('cvterm_dbxref', $values, $options);
         if (!$success) {
-          watchdog('tripal_cv', "Failed to find or insert the cvterm_dbxref record for a " . 
+          watchdog('tripal_cv', "Failed to find or insert the cvterm_dbxref record for a " .
             "duplicated cvterm:  $name (id: $accession), for database $dbname", NULL, WATCHDOG_WARNING);
           return 0;
         }
-      }        
+      }
       // get the original cvterm with the same name and return that.
       $result = chado_query($cvtermsql, array(':accession' => $dbxref->accession, ':name' => $dbname));
       $cvterm = $result->fetchObject();
       return $cvterm;
     }
-    
-    // continue on, we've fixed the record if the db_id did not match, 
+
+    // continue on, we've fixed the record if the db_id did not match,
     // we can now perform and updated if we need to.
   }
-  
+
   // get the CVterm record
   $result = chado_query($cvtermsql, array(':accession' => $accession, ':name' => $dbname));
   $cvterm = $result->fetchObject();
@@ -697,13 +694,13 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
         "$name (id: $accession), for database $dbname", NULL, WATCHDOG_WARNING);
       return 0;
     }
-    
+
     // check to see if the dbxref already has an entry in the cvterm table
     // this is the second constraint in the cvterm table
     $values = array('dbxref_id' => $dbxref->dbxref_id);
     $options = array('statement_name' => 'sel_cvterm_db');
     $check = tripal_core_chado_select('cvterm', array('cvterm_id'), $values, $options);
-    if (count($check) == 0) {      
+    if (count($check) == 0) {
       // now add the cvterm
       $ins_values = array(
         'cv_id'                => $cv->cv_id,
@@ -711,7 +708,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
         'definition'           => $definition,
         'dbxref_id'            => $dbxref->dbxref_id,
         'is_obsolete'          => $is_obsolete,
-        'is_relationshiptype'  => $is_relationship, 
+        'is_relationshiptype'  => $is_relationship,
       );
       $ins_options = array('statement_name' => 'ins_cvterm_all');
       $success = tripal_core_chado_insert('cvterm', $ins_values, $ins_options);
@@ -726,32 +723,32 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
         }
       }
     }
-    // this dbxref already exists in the cvterm table 
+    // this dbxref already exists in the cvterm table
     else {
       watchdog('tripal_cv', "The dbxref already exists for another cvterm record: $name (cv: " . $cvname . " db: $dbname)", NULL, WATCHDOG_WARNING);
       return 0;
-    } 
+    }
     $result = chado_query($cvtermsql, array(':accession' => $accession, ':name' => $dbname));
     $cvterm = $result->fetchObject();
   }
   // upate the cvterm
-  elseif ($update) { 
+  elseif ($update) {
     $match = array('cvterm_id' => $cvterm->cvterm_id);
     $upd_values = array(
       'name'                => $name,
       'definition'          => $definition,
       'is_obsolete'         => $is_obsolete,
-      'is_relationshiptype' => $is_relationship, 
+      'is_relationshiptype' => $is_relationship,
     );
     $upd_options = array('statement_name' => 'upd_cvterm_nadeisis');
-    $success = tripal_core_chado_update('cvterm', $match, $upd_values, $upd_options);    
+    $success = tripal_core_chado_update('cvterm', $match, $upd_values, $upd_options);
     if (!$success) {
       watchdog('tripal_cv', "Failed to update the term: $name", NULL, WATCHDOG_WARNING);
       return 0;
     }
     $result = chado_query($cvtermsql, array(':accession' => $accession, ':name' => $dbname));
     $cvterm = $result->fetchObject();
-  } 
+  }
   else {
      // do nothing, we have the cvterm but we don't want to update
   }
@@ -769,7 +766,7 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
  * this is the first time the ontology has been provided to Tripal
  * then it will be added to the database and will be assigned a
  * unique OBO ID.
- * 
+ *
  * @param $obo_id
  *   If the ontology is already loaded into the Tripal tables then
  *   use this argument to specify the unique ID for the ontology
@@ -782,11 +779,11 @@ function tripal_cv_add_cvterm($term, $defaultcv = '_global', $is_relationship =
  *   use this argument to provide the URL.
  * @param $obo_file
  *   If the OBO is housed on the local file system of the server then
- *   use this argument to specify the full path.  
- *   
+ *   use this argument to specify the full path.
+ *
  * @return
  *   returns the job_id of the submitted job or FALSE if the job was not added
- *   
+ *
  * @ingroup tripal_cv_api
  */
 
@@ -796,7 +793,7 @@ function tripal_cv_submit_obo_job($obo_id = NULL, $obo_name = NULL, $obo_url = N
   if ($obo_id) {
     $sql = "SELECT * FROM {tripal_cv_obo} WHERE obo_id = :obo_id";
     $obo = db_query($sql, array(':obo_id' => $obo_id))->fetchObject();
-        
+
     $args = array($obo_id);
     return tripal_add_job("Load OBO $obo->name", 'tripal_cv',
        "tripal_cv_load_obo_v1_2_id", $args, $user->uid);
@@ -818,15 +815,15 @@ function tripal_cv_submit_obo_job($obo_id = NULL, $obo_name = NULL, $obo_url = N
 
 /**
  * Add the obo to the tripal_cv_obo table in the Drupal database
- * 
+ *
  * @param $name
  * The human readable name of this ontology
  * @param $path
  * The file path or URL of the ontology
- * 
+ *
  * @return
  * Returns the ontology ID
- * 
+ *
  * @ingroup tripal_cv_api
  */
 function tripal_cv_add_obo_ref($name, $path) {
@@ -834,35 +831,35 @@ function tripal_cv_add_obo_ref($name, $path) {
   $record->name = $name;
   $record->path = $path;
   drupal_write_record('tripal_cv_obo', $record);
-  return $record->obo_id;  
+  return $record->obo_id;
 }
 
 /**
  * This function is intended to be used in autocomplete forms
  * for searching for CV terms that begin with the provided string
- * 
+ *
  * @param $cv_id
  * The CV ID in which to search for the term
  * @param $string
  * The string to search for
- * 
+ *
  * @return
  * A json array of terms that begin with the provided string
- *  
+ *
  * @ingroup tripal_cv_api
  */
 function tripal_cv_cvterm_name_autocomplete($cv_id, $string = '') {
   $sql = "
-    SELECT cvterm_id, name 
-    FROM {cvterm} 
-    WHERE cv_id = :cv_id and name like :name 
-    ORDER by name 
+    SELECT cvterm_id, name
+    FROM {cvterm}
+    WHERE cv_id = :cv_id and name like :name
+    ORDER by name
     LIMIT 25 OFFSET 0
   ";
   $results = chado_query($sql, array(':cv_id' => $cv_id, ':name' => $string . '%'));
   $items = array();
   foreach ($results as $term) {
      $items[$term->name] = $term->name;
-  }  
-  drupal_json_output($items);   
+  }
+  drupal_json_output($items);
 }

+ 10 - 6
tripal_cv/tripal_cv.module

@@ -1,5 +1,14 @@
 <?php
 
+/**
+ * @defgroup tripal_cv Controlled Vocabulary Module
+ * @ingroup tripal_modules
+ * @{
+ * Provides functions for managing chado controlled vocabularies which are used ubiquitously
+ * throughout chado.
+ * @}
+ */
+
 require_once "includes/charts.inc";
 require_once "includes/trees.inc";
 require_once "includes/obo_loader.inc";
@@ -13,11 +22,6 @@ require_once "includes/tripal_cv_admin.inc";
 
 require_once "api/tripal_cv.schema.api.inc";
 
-/**
- * @defgroup tripal_cv CV Module
- * @ingroup tripal_modules
- */
-
 /**
  * Implements hook_init().
  * Adds CSS and JS needed for this modules rendered content
@@ -75,7 +79,7 @@ function tripal_cv_menu() {
     'access arguments' => array('administer controlled vocabularies'),
     'type' => MENU_CALLBACK,
   );
-  
+
   $items['admin/tripal/loaders/obo_loader'] = array(
     'title' => 'Load Ontology',
     'description' => 'Load an Ontology into chado as a controlled vocabulary.',

+ 5 - 4
tripal_db/api/tripal_db.api.inc

@@ -1,11 +1,12 @@
 <?php
 
 /**
- * @file
- * Provides an application programming interface (API) to manage references to external databases
- *
- * @defgroup tripal_db_api DB Module API
+
+ * @defgroup tripal_db_api Database Reference API
  * @ingroup tripal_api
+ * @{
+ * Provides an application programming interface (API) to manage references to external databases
+ * @}
  */
 
 /**

+ 8 - 1
tripal_db/tripal_db.module

@@ -4,8 +4,15 @@ require_once "api/tripal_db.api.inc";
 require_once "includes/tripal_db.admin.inc";
 
 /**
- * @defgroup tripal_db DB Module
+ * @defgroup tripal_db Database Reference Module
  * @ingroup tripal_modules
+ * @{
+ * Provides functions for managing chado database references which link chado content, such
+ * as features and stocks, to records/pages in external databases/websites. For example,
+ * you might have a feature record in your site which is also in the NCBI website and by
+ * adding a database refrence to your feature, an automatic link to the content at NCBI
+ * is created.
+ * @}
  */
 
 /**

+ 130 - 130
tripal_feature/api/tripal_feature.api.inc

@@ -1,10 +1,10 @@
 <?php
 /**
- * @file
- * Provides an application programming interface (API) for working with features
- *
- * @defgroup tripal_feature_api Feature Module API
+ * @defgroup tripal_feature_api Feature API
  * @ingroup tripal_api
+ * @{
+ * Provides an application programming interface (API) for working with features
+ * @}
  */
 
 /**
@@ -111,7 +111,7 @@ function tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_i
   if (!$success) {
      watchdog('tripal_feature',
       'tripal_feature_analysis_insert_property: Failed to insert analysis feature property',
-       array(), WATCHDOG_WARNING);  
+       array(), WATCHDOG_WARNING);
      return FALSE;
   }
   return $success;
@@ -437,7 +437,7 @@ function tripal_feature_reverse_complement($sequence) {
   return strtoupper($seq);
 }
 /**
- * Retrieves the sequence for a feature.  
+ * Retrieves the sequence for a feature.
  *
  * @param $feature_id
  *   The feature_id of the feature for which the sequence will be retrieved
@@ -450,11 +450,11 @@ function tripal_feature_reverse_complement($sequence) {
  *   Set to '1' if the sequence should be obtained from the parent to which
  *   this feature is aligned.
  * @param $aggregate
- *   Set to '1' if the sequence should only contain sub features, excluding 
+ *   Set to '1' if the sequence should only contain sub features, excluding
  *   intra sub feature sequence.  For example, set this option to obtain just
  *   the coding sequence of an mRNA.
  * @param $output_format
- *   The type of format.  Valid formats include 'fasta_html', 'fasta_txt' and 
+ *   The type of format.  Valid formats include 'fasta_html', 'fasta_txt' and
  *   'raw'.  The format 'fasta_txt' outputs line
  *   breaks as <br> tags and the entire return value is in a <span> tag
  *   with a fixed-width font definition.  'fasta_txt' outputs line breaks with
@@ -464,38 +464,38 @@ function tripal_feature_reverse_complement($sequence) {
  * @param $upstream
  *   An integer specifing the number of upstream bases to include in the output
  * @param $downstream
- *   An integer specifying the number of downstream bases to include in the 
+ *   An integer specifying the number of downstream bases to include in the
  *   output.
  * @param $sub_features
- *   Only include sub features (or child features) of the types provided in the array 
+ *   Only include sub features (or child features) of the types provided in the array
  * @param $relationship
  *   If a relationship name is provided (e.g. sequence_of) then any sequences that
  *   are in relationships of this type with matched sequences are also included
  * @param $rel_part
  *   If a relationship is provided in the preceeding argument then the rel_part
- *   must be either 'object' or 'subject' to indicate which side of the 
+ *   must be either 'object' or 'subject' to indicate which side of the
  *   relationship the matched features belong
- *      
+ *
  * @return
  *   The DNA/protein sequence formated as requested.
  *
  * @ingroup tripal_feature_api
  */
-function tripal_feature_get_formatted_sequence($feature_id, $feature_name, 
+function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
   $num_bases_per_line, $derive_from_parent, $aggregate, $output_format,
   $upstream, $downstream, $sub_features = array(), $relationship = '', $rel_part = '') {
-  
+
   // to speed things up we need to make sure we have a persistent connection
-  $connection = tripal_db_persistent_chado(); 
-  
+  $connection = tripal_db_persistent_chado();
+
   if (!$upstream) {
      $upstream = 0;
   }
   if (!$downstream) {
      $downstream = 0;
   }
-  
-  if ($rel_part == "object" or $rel_part == "subject") { 
+
+  if ($rel_part == "object" or $rel_part == "subject") {
     if ($rel_part == "subject") {
       $psql = '
         PREPARE feature_rel_get_object (int, text) AS
@@ -506,17 +506,17 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
           INNER JOIN feature FO              ON FO.feature_id   = FR.object_id
           INNER JOIN cvterm CVTO             ON CVTO.cvterm_id  = FO.type_id
           INNER JOIN organism O              ON O.organism_id   = FO.organism_id
-        WHERE 
+        WHERE
           FS.feature_id = $1 AND
           CVTFR.name    = $2
-      ';  
+      ';
       $status = tripal_core_chado_prepare('feature_rel_get_object', $psql, array('int', 'text'));
       if (!$status) {
-        watchdog('tripal_feature', "init: not able to prepare SQL statement '%name'", 
+        watchdog('tripal_feature', "init: not able to prepare SQL statement '%name'",
           array('%name' => 'feature_by_subject'), 'WATCHDOG ERROR');
-      }    
+      }
       $sql = "EXECUTE feature_rel_get_object(:feature_id, :relationship)";
-      $features = chado_query($sql, array(':feature_id' => $feature_id, ':relationship' => $relationship)); 
+      $features = chado_query($sql, array(':feature_id' => $feature_id, ':relationship' => $relationship));
     }
     if ($rel_part == "object") {
       $psql = '
@@ -528,20 +528,20 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
           INNER JOIN feature FS              ON FS.feature_id   = FR.subject_id
           INNER JOIN cvterm CVTO             ON CVTO.cvterm_id  = FS.type_id
           INNER JOIN organism O              ON O.organism_id   = FS.organism_id
-        WHERE 
+        WHERE
           FO.feature_id = $1 AND
           CVTFR.name    = $2
       ';
       $status = tripal_core_chado_prepare('feature_rel_get_subject', $psql, array('int', 'text'));
       if (!$status) {
-        watchdog('tripal_feature', "init: not able to prepare SQL statement '%name'", 
+        watchdog('tripal_feature', "init: not able to prepare SQL statement '%name'",
           array('%name' => 'feature_by_object'), 'WATCHDOG ERROR');
       }
       $sql = "EXECUTE feature_rel_get_subject(:feature_id, :relationship)";
-      $features = chado_query($sql, array(':feature_id' => $feature_id, ':relationship' => $relationship));     
+      $features = chado_query($sql, array(':feature_id' => $feature_id, ':relationship' => $relationship));
     }
     $sequences = '';
-    while ($feature = $features->fetchObject()) {  
+    while ($feature = $features->fetchObject()) {
 
       // recurse and get the sequences for these in the relationship
       if ($rel_part == "subject") {
@@ -550,99 +550,99 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
       if ($rel_part == "object") {
         $defline = "$feature->uniquename $feature->feature_type ($feature->genus $feature->species), $relationship, $feature_name";
       }
-      $sequences .= tripal_feature_get_formatted_sequence($feature->feature_id, $defline, 
+      $sequences .= tripal_feature_get_formatted_sequence($feature->feature_id, $defline,
         $num_bases_per_line, $derive_from_parent, $aggregate, $output_format,
-        $upstream, $downstream, $sub_features, '', '');  
-    }  
-    return $sequences;  
+        $upstream, $downstream, $sub_features, '', '');
+    }
+    return $sequences;
   }
-  
+
   // prepare statements we'll need to use later
   if (!tripal_core_is_sql_prepared('sequence_by_parent')) {
     // prepare the queries we're going to use later during the render phase
     // This SQL statement uses conditionals in the select clause to handle
     // cases cases where the alignment is in the reverse direction and when
-    // the upstream and downstream extensions go beyond the lenght of the 
+    // the upstream and downstream extensions go beyond the lenght of the
     // parent sequence.
     $psql ='
-      PREPARE sequence_by_parent (int, int, int) AS 
+      PREPARE sequence_by_parent (int, int, int) AS
       SELECT srcname, srcfeature_id, strand, srctypename, typename,
-        fmin, fmax, upstream, downstream, adjfmin, adjfmax, 
+        fmin, fmax, upstream, downstream, adjfmin, adjfmax,
         substring(residues from (adjfmin + 1) for (upstream + (fmax - fmin) + downstream))  as residues,
         genus, species
       FROM (
         SELECT
-          OF.name srcname, FL.srcfeature_id, FL.strand, 
+          OF.name srcname, FL.srcfeature_id, FL.strand,
           OCVT.name as srctypename, SCVT.name as typename,
           FL.fmin, FL.fmax, OO.genus, OO.species,
-          CASE 
-            WHEN FL.strand >= 0 THEN 
-              CASE 
+          CASE
+            WHEN FL.strand >= 0 THEN
+              CASE
                  WHEN FL.fmin - $1 <= 0 THEN 0
                  ELSE FL.fmin - $1
               END
             WHEN FL.strand < 0 THEN
-              CASE 
+              CASE
                  WHEN FL.fmin - $2 <= 0 THEN 0
                  ELSE FL.fmin - $2
-              END                   
-          END as adjfmin,                                                                
-          CASE 
+              END
+          END as adjfmin,
+          CASE
             WHEN FL.strand >= 0 THEN
-              CASE 
-                WHEN FL.fmax + $2 > OF.seqlen THEN OF.seqlen 
+              CASE
+                WHEN FL.fmax + $2 > OF.seqlen THEN OF.seqlen
                 ELSE FL.fmax + $2
               END
             WHEN FL.strand < 0 THEN
               CASE
                 WHEN FL.fmax + $1 > OF.seqlen THEN OF.seqlen
-                ELSE FL.fmax + $1   
-              END               
-          END as adjfmax,                     
-          CASE 
-            WHEN FL.strand >= 0 THEN 
-              CASE 
+                ELSE FL.fmax + $1
+              END
+          END as adjfmax,
+          CASE
+            WHEN FL.strand >= 0 THEN
+              CASE
                  WHEN FL.fmin - $1 <= 0 THEN FL.fmin
                  ELSE $1
               END
             ELSE
-              CASE 
+              CASE
                  WHEN FL.fmax + $1 > OF.seqlen THEN OF.seqlen - FL.fmax
                  ELSE $1
-              END                   
-          END as upstream,                
-          CASE 
-            WHEN FL.strand >= 0 THEN 
-              CASE 
+              END
+          END as upstream,
+          CASE
+            WHEN FL.strand >= 0 THEN
+              CASE
                  WHEN FL.fmax + $2 > OF.seqlen THEN OF.seqlen - FL.fmax
                  ELSE $2
               END
             ELSE
-              CASE 
+              CASE
                  WHEN FL.fmin - $2 <= 0 THEN FL.fmin
                  ELSE $2
-              END                   
-          END as downstream,  
-          OF.residues                                                     
-        FROM {featureloc} FL 
+              END
+          END as downstream,
+          OF.residues
+        FROM {featureloc} FL
           INNER JOIN {feature} SF   on FL.feature_id    = SF.feature_id
           INNER JOIN {cvterm}  SCVT on SF.type_id       = SCVT.cvterm_id
-          INNER JOIN {feature} OF   on FL.srcfeature_id = OF.feature_id                
+          INNER JOIN {feature} OF   on FL.srcfeature_id = OF.feature_id
           INNER JOIN {cvterm}  OCVT on OF.type_id       = OCVT.cvterm_id
           INNER JOIN {organism} OO  on OF.organism_id   = OO.organism_id
         WHERE SF.feature_id = $3 and NOT (OF.residues = \'\' or OF.residues IS NULL)) as tbl1
-    ';              
+    ';
     $status = tripal_core_chado_prepare('sequence_by_parent', $psql, array('int', 'int', 'int'));
     if (!$status) {
-      watchdog('tripal_feature', 
-        "init: not able to prepare SQL statement '%name'", 
+      watchdog('tripal_feature',
+        "init: not able to prepare SQL statement '%name'",
         array('%name' => 'sequence_by_parent'), 'WATCHDOG ERROR');
     }
-    
+
     // this query is meant to get all of the sub features of any given
     // feature (arg #1) and order them as they appear on the reference
     // feature (arg #2).
-    $psql ='PREPARE sub_features (int, int) AS 
+    $psql ='PREPARE sub_features (int, int) AS
             SELECT SF.feature_id, CVT.name as type_name, SF.type_id
             FROM {feature_relationship} FR
               INNER JOIN {feature} SF on SF.feature_id = FR.subject_id
@@ -650,50 +650,50 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
               INNER JOIN {featureloc} FL on FL.feature_id = FR.subject_id
               INNER JOIN {feature} PF on PF.feature_id = FL.srcfeature_id
             WHERE FR.object_id = $1 and PF.feature_id = $2
-            ORDER BY FL.fmin ASC';            
+            ORDER BY FL.fmin ASC';
     $status = tripal_core_chado_prepare('sub_features', $psql, array('int', 'int'));
     if (!$status) {
-      watchdog('tripal_views_handler_field_sequence', 
-        "init: not able to prepare SQL statement '%name'", 
+      watchdog('tripal_views_handler_field_sequence',
+        "init: not able to prepare SQL statement '%name'",
         array('%name' => 'ssub_features'), 'WATCHDOG ERROR');
     }
-    $psql ='PREPARE count_sub_features (int, int) AS 
+    $psql ='PREPARE count_sub_features (int, int) AS
             SELECT count(*) as num_children
             FROM {feature_relationship} FR
               INNER JOIN {feature} SF on SF.feature_id = FR.subject_id
               INNER JOIN {cvterm} CVT on CVT.cvterm_id = SF.type_id
               INNER JOIN {featureloc} FL on FL.feature_id = FR.subject_id
               INNER JOIN {feature} PF on PF.feature_id = FL.srcfeature_id
-            WHERE FR.object_id = $1 and PF.feature_id = $2';            
+            WHERE FR.object_id = $1 and PF.feature_id = $2';
     $status = tripal_core_chado_prepare('count_sub_features', $psql, array('int', 'int'));
     if (!$status) {
-      watchdog('tripal_views_handler_field_sequence', 
-        "init: not able to prepare SQL statement '%name'", 
+      watchdog('tripal_views_handler_field_sequence',
+        "init: not able to prepare SQL statement '%name'",
         array('%name' => 'count_sub_features'), 'WATCHDOG ERROR');
     }
   }
-    
+
   // if we need to get the sequence from the parent then do so now.
-  if ($derive_from_parent) {                  
-    
+  if ($derive_from_parent) {
+
     // execute the query to get the sequence from the parent
     $sql = "EXECUTE sequence_by_parent (:upstream, :downstream, :feature_id)";
     $parents = chado_query($sql, array(':uptream' => $upstream, ':downstream' => $downstream, ':feature_id' => $feature_id));
 
-    while ($parent = $parents->fetchObject()) {  
+    while ($parent = $parents->fetchObject()) {
       $seq = '';  // initialize the sequence for each parent
 
       // if we are to aggregate then we will ignore the feature returned
       // by the query above and rebuild it using the sub features
       if ($aggregate) {
-        
+
         // now get the sub features that are located on the parent.
         $sql = "EXECUTE sub_features (:feature_id, :srcfeature_id)";
         $children = chado_query($sql, array(':feature_id' => $feature_id, ':srcfeature_id' => $parent->srcfeature_id));
         $sql = "EXECUTE count_sub_features (:feature_id, :srcfeature_id)";
         $sub_features = chado_query($sql, array(':feature_id' => $feature_id, ':srcfeature_id' => $parent->srcfeature_id));
         $num_children = $sub_features->fetchObject();
-               
+
         // iterate through the sub features and concat their sequences. They
         // should already be in order.
         $types = array();
@@ -705,20 +705,20 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
           if (count($sub_features) > 0 and !in_array($child->type_name, $sub_features)) {
              continue;
           }
-        
+
           // keep up with the types
           if (!in_array($child->type_name, $types)) {
             $types[] = $child->type_name;
           }
-          
+
           $sql = "EXECUTE sequence_by_parent (:upstream, %d, :feature_id)";
 
-          // if the first sub feature we need to include the upstream bases. first check if 
+          // if the first sub feature we need to include the upstream bases. first check if
           // the feature is in the foward direction or the reverse.
           if ($i == 0 and $parent->strand >= 0) {  // forward direction
             // -------------------------- ref
-            //    ....---->  ---->        
-            //     up    1       2         
+            //    ....---->  ---->
+            //     up    1       2
             $q = chado_query($sql, array(':upstream' => $upstream, ':downstream' => 0, ':feature_id' => $child->feature_id));
           }
           elseif ($i == 0 and $parent->strand < 0) { // reverse direction
@@ -727,7 +727,7 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
             //    down  1       2
             $q = chado_query($sql, array(':upstream' => 0, ':downstream' => $downstream, ':feature_id' => $child->feature_id));
           }
-                    
+
           // Next, if the last sub feature we need to include the downstream bases. first check if
           // the feature is in teh forward direction or the reverse
           if ($i == $num_children->num_children - 1 and $parent->strand >= 0) {  // forward direction
@@ -742,38 +742,38 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
             //          1       2  up
             $q = chado_query($sql, array(':upstream' => $upstream, ':downstream' => 0, ':feature_id' => $child->feature_id));
           }
-          
+
           // for internal sub features we don't want upstream or downstream bases
-          else {         
+          else {
             $sql = "EXECUTE sequence_by_parent (%d, %d, %d)";
             $q = chado_query($sql, array(':upstream' => 0, ':downstream' => 0, ':feature_id' => $child->feature_id));
           }
-          
+
           while ($subseq = $q->fetchObject()) {
-            // concatenate the sequences of all the sub features            
+            // concatenate the sequences of all the sub features
             if ($subseq->srcfeature_id == $parent->srcfeature_id) {
-              $seq .= $subseq->residues;   
+              $seq .= $subseq->residues;
             }
-          }                 
+          }
           $i++;
-        } 
-      } 
+        }
+      }
       // if this isn't an aggregate then use the parent residues
       else {
          $seq = $parent->residues;
       }
-                            
+
       // get the reverse compliment if feature is on the reverse strand
       $dir = 'forward';
       if ($parent->strand < 0) {
         $seq = tripal_feature_reverse_complement($seq);
         $dir = 'reverse';
       }
-      
+
       // now format for display
       if ($output_format == 'fasta_html') {
          $seq = wordwrap($seq, $num_bases_per_line, "<br>", TRUE);
-      } 
+      }
       elseif ($output_format == 'fasta_txt') {
          $seq = wordwrap($seq, $num_bases_per_line, "\r\n", TRUE);
       }
@@ -788,19 +788,19 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
          $residues .= "Includes " . $parent->downstream . " bases downstream.  ";
       }
       if (!$seq) {
-        
+
         if ($output_format == 'fasta_html') {
-          $residues .= "No sequence available.</br>"; 
-        } 
+          $residues .= "No sequence available.</br>";
+        }
         else {
-          $residues .= "No sequence available.\r\n"; 
-        }         
+          $residues .= "No sequence available.\r\n";
+        }
       }
       else {
         if ($output_format == 'fasta_html') {
           $residues .= "<br>";
         }
-        $residues .= "\r\n" . $seq . "\r\n";          
+        $residues .= "\r\n" . $seq . "\r\n";
         if ($output_format == 'fasta_html') {
           $residues .= "<br>";
         }
@@ -810,18 +810,18 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
   // if we are not getting the sequence from the parent sequence then
   // use what comes through from the feature record
   else {
-    $sql = "SELECT * FROM {feature} F WHERE feature_id = :feature_id"; 
+    $sql = "SELECT * FROM {feature} F WHERE feature_id = :feature_id";
     $values = chado_query($sql, array(':feature_id' => $feature_id))->fetchObject();
     $residues = $values->residues;
     if ($output_format == 'fasta_html') {
-       $residues = wordwrap($residues, $num_bases_per_line, "<br>", TRUE);  
-    } 
+       $residues = wordwrap($residues, $num_bases_per_line, "<br>", TRUE);
+    }
     elseif ($output_format == 'fasta_txt') {
-       $residues = wordwrap($residues, $num_bases_per_line, "\r\n", TRUE);  
+       $residues = wordwrap($residues, $num_bases_per_line, "\r\n", TRUE);
     }
     $residues = ">$feature_name\r\n$residues\r\n";
   }
-  
+
   // format the residues for display
   if ($residues and $num_bases_per_line) {
     if ($output_format == 'fasta_html') {
@@ -837,34 +837,34 @@ function tripal_feature_get_formatted_sequence($feature_id, $feature_name,
  * This function adds an entry to the feature_dbxref table.
   *
  * @param $feature_id
- *   The numeric feature_if of the feature 
+ *   The numeric feature_if of the feature
  * @param $dbname
  *   The name of the database to which the term belongs
  * @param accession
- *   The accession of the term   
- *    
+ *   The accession of the term
+ *
  * @return
  *   TRUE on success. FALSE on failure.
  *
  * @ingroup tripal_feature_api
  */
 function tripal_feature_add_dbxref($feature_id, $dbname, $accession) {
-   
+
   // make sure the db exists. If it doesn't, then add it
   $values = array('name' => $dbname);
   $options = array('statement_name' => 'sel_db_na');
   $db = tripal_core_chado_select('db', array('db_id'), $values, $options);
-  if (!$db or count($db) == 0) {    
+  if (!$db or count($db) == 0) {
     $options = array('statement_name' => 'ins_db_na');
     $success = tripal_core_chado_insert('db', $values, $options);
       if (!$success) {
-      watchdog('tripal_feature', 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, " . 
-        "could not be added because the database, %dbname, does not exist and cannot be added.', 
+      watchdog('tripal_feature', 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, " .
+        "could not be added because the database, %dbname, does not exist and cannot be added.',
         array('%feature_id' => $feature_id, '%dbname' => $dbname), WATCHDOG_WARNING);
       return FALSE;
     }
   }
-  
+
   // first make sure that the record doesn't already exist
   $values = array(
     'dbxref_id' => array(
@@ -877,13 +877,13 @@ function tripal_feature_add_dbxref($feature_id, $dbname, $accession) {
   );
   $options = array('statement_name' => 'sel_featuredbxref_dbfe');
   $xref = tripal_core_chado_select('feature_dbxref', array('feature_dbxref_id'), $values, $options);
-  if (count($xref) == 0) {    
+  if (count($xref) == 0) {
     // if the record doesn't exist then add it.
     $options = array('statement_name' => 'ins_featuredbxref_dbfe');
     $success = tripal_core_chado_insert('feature_dbxref', $values, $options);
     if (!$success) {
-      watchdog('tripal_feature', 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, ' . 
-        'could not be added: %db:%accession.', array('%feature_id' => $feature_id, '%db' => $dbname, 
+      watchdog('tripal_feature', 'tripal_feature_add_dbxref: The feature dbxref entry for feature, %feature_id, ' .
+        'could not be added: %db:%accession.', array('%feature_id' => $feature_id, '%db' => $dbname,
         '%accession' => $accession), WATCHDOG_WARNING);
       return FALSE;
     }
@@ -895,34 +895,34 @@ function tripal_feature_add_dbxref($feature_id, $dbname, $accession) {
  * This function adds an entry to the feature_cvterm table.
   *
  * @param $feature_id
- *   The numeric feature_if of the feature 
+ *   The numeric feature_if of the feature
  * @param $cvname
  *   The name of the controlled vocabulary to which the term belongs
  * @param cvterm
- *   The name of the cvterm  
- *    
+ *   The name of the cvterm
+ *
  * @return
  *   TRUE on success. FALSE on failure.
  *
  * @ingroup tripal_feature_api
  */
 function tripal_feature_add_cvterm($feature_id, $cvname, $cvterm) {
-   
+
   // make sure the cv exists. If it doesn't, then add it
   $values = array('name' => $cvname);
   $options = array('statement_name' => 'sel_cv_na');
   $cv = tripal_core_chado_select('cv', array('cv_id'), $values, $options);
-  if (!$cv or count($cv) == 0) {    
+  if (!$cv or count($cv) == 0) {
     $options = array('statement_name' => 'ins_cv_na');
     $success = tripal_core_chado_insert('cv', $values, $options);
       if (!$success) {
-      watchdog('tripal_feature', 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, " . 
-        "could not be added because the CV, %cvname, does not exist and cannot be added.', 
+      watchdog('tripal_feature', 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, " .
+        "could not be added because the CV, %cvname, does not exist and cannot be added.',
         array('%feature_id' => $feature_id, '%cvname' => $cvname), WATCHDOG_WARNING);
       return FALSE;
     }
   }
-  
+
   // first make sure that the record doesn't already exist
   $values = array(
     'cvterm_id' => array(
@@ -936,12 +936,12 @@ function tripal_feature_add_cvterm($feature_id, $cvname, $cvterm) {
   );
   $options = array('statement_name' => 'sel_featuredcvterm_cvfepu');
   $xref = tripal_core_chado_select('feature_cvterm', array('feature_cvterm_id'), $values, $options);
-  if (count($xref) == 0) {    
+  if (count($xref) == 0) {
     // if the record doesn't exist then add it.
     $options = array('statement_name' => 'ins_featurecvterm_cvfepu');
     $success = tripal_core_chado_insert('feature_cvterm', $values, $options);
     if (!$success) {
-      watchdog('tripal_feature', 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, ' . 
+      watchdog('tripal_feature', 'tripal_feature_add_cvterm: The feature cvterm entry for feature, %feature_id, ' .
         'could not be added: %cvterm.', array('%feature_id' => $feature_id, '%cvterm' => $cvterm), WATCHDOG_WARNING);
       return FALSE;
     }

+ 0 - 5
tripal_feature/tripal_feature.module

@@ -1,10 +1,5 @@
 <?php
 
-/**
- * @file
- * @todo Add file header description
- */
-
 /**
  * @defgroup tripal_feature Feature Module
  * @ingroup tripal_modules

+ 9 - 1
tripal_featuremap/api/tripal_featuremap.api.inc

@@ -1,5 +1,13 @@
 <?php
 
+/**
+ * @defgroup tripal_featuremap_api Feature Map API
+ * @ingroup tripal_api
+ * @{
+ * Provides an application programming interface (API) to manage chado feature maps
+ * @}
+ */
+
 /**
  * Retrieve properties of a given type for a given featuremap
  *
@@ -117,7 +125,7 @@ function tripal_featuremap_add_featuremap_dbxref($featuremap_id, $featuremap_dbx
 
   // make sure our database already exists
   $db = tripal_db_add_db($dbname);
-   
+
   // get the database cross-reference
   $dbxvalues = array(
     'accession' => $accession,

+ 5 - 9
tripal_genetic/tripal_genetic.module

@@ -1,15 +1,11 @@
 <?php
 
 /**
- *  @file
- * This file contains the basic functions needed for this drupal module.
- * The drupal tripal_genetic module maps directly to the chado X module.
- *
- * For documentation regarding the Chado X module:
- * @see http://gmod.org/wiki/Chado_General_Module
- *
  * @defgroup tripal_genetic Genetic Module
  * @ingroup tripal_modules
+ * @{
+ * Provides functions for managing chado genetic data
+ * @}
  */
 
 require('api/tripal_genetic.api.inc');
@@ -77,7 +73,7 @@ function tripal_genetic_views_api() {
  */
 function tripal_genetic_theme($existing, $type, $theme, $path) {
   $core_path = drupal_get_path('module', 'tripal_core');
-    
+
   $items = array(
     'tripal_feature_genotypes' => array(
       'variables' => array('node' => NULL),
@@ -104,7 +100,7 @@ function tripal_genetic_theme($existing, $type, $theme, $path) {
  * @ingroup tripal_genetic
  */
 function tripal_genetic_node_view($node, $view_mode, $langcode) {
-  
+
   if ($node->type == 'chado_feature') {
     if ($view_mode == 'full') {
       // the tripal_natural_diversity module provides a tripal_feature_nd_genotype

+ 4 - 4
tripal_library/api/tripal_library.api.inc

@@ -1,10 +1,10 @@
 <?php
 /**
- * @file
- * Provides an application programming interface (API) to manage libraries
- *
- * @defgroup tripal_library_api Library Module API
+ * @defgroup tripal_library_api Library API
  * @ingroup tripal_api
+ * @{
+ * Provides an application programming interface (API) to manage libraries
+ * @}
  */
 
 /**

+ 5 - 9
tripal_natural_diversity/tripal_natural_diversity.module

@@ -5,15 +5,11 @@ require_once('theme/tripal_natural_diversity.theme.inc');
 require_once('includes/tripal_natural_diversity.schema.inc');
 require_once('includes/tripal_natural_diversity.admin.inc');
 /**
- *  @file
- * This file contains the basic functions needed for this drupal module.
- * The drupal tripal_natural_diversity module maps directly to the chado X module.
- *
- * For documentation regarding the Chado X module:
- * @see http://gmod.org/wiki/Chado_General_Module
- *
  * @defgroup tripal_natural_diversity Natural Diversity Module
  * @ingroup tripal_modules
+ * @{
+ * Provides functions for managing chado natural diversity data
+ * @}
  */
 
 /**
@@ -77,7 +73,7 @@ function tripal_natural_diversity_views_api() {
  */
 function tripal_natural_diversity_theme($existing, $type, $theme, $path) {
   $core_path = drupal_get_path('module', 'tripal_core');
-  
+
   $items = array(
     // tripal_feature templates
     'tripal_feature_nd_genotypes' => array(
@@ -159,7 +155,7 @@ function tripal_natural_diversity_node_view($node, $view_mode, $langcode) {
       if ($view_mode == 'full') {
         // the tripal_genetic module provides a tripal_feature_genotype
         // template. if the tripal_genetic content is present get rid of it as this
-        // module superceeds it.      
+        // module superceeds it.
         if (array_key_exists('tripal_feature_genotypes', $node->content)) {
           unset($node->content['tripal_feature_genotypes']);
         }

+ 14 - 14
tripal_organism/api/tripal_organism.api.inc

@@ -1,11 +1,11 @@
 <?php
 
 /**
- * @file
- * Provides an application programming interface (API) to manage organisms
- *
- * @defgroup tripal_library_api Organism Module API
+ * @defgroup tripal_library_api Organism API
  * @ingroup tripal_api
+ * @{
+ * Provides an application programming interface (API) to manage organisms
+ * @}
  */
 
 /**
@@ -69,29 +69,29 @@ function tripal_organism_get_synced() {
 }
 
 /**
- * 
+ *
  * @param $organism
  * @param $nid
  */
 function tripal_organism_get_image_url($organism, $nid = NULL) {
   $url = '';
-  
+
   // first look for an image with the genus/species name.  This is old-style tripal
   // and we keep it for backwards compatibility.  If we don't find that file
   // then look for the image with the node ID in the name. If we don't find that then
-  // no image tag is generated  
+  // no image tag is generated
   $base_path = realpath('.');
   $image_dir = tripal_get_moddir('tripal_organism') . "/images";
   $image_name =  $organism->genus . "_" . $organism->species . ".jpg";
 
-  if (file_exists("$base_path/$image_dir/$image_name")) { 
-    $url = file_create_url("$image_dir/$image_name"); 
-  } 
+  if (file_exists("$base_path/$image_dir/$image_name")) {
+    $url = file_create_url("$image_dir/$image_name");
+  }
   else {
      $image_name = $nid . ".jpg";
-     if (file_exists("$base_path/$image_dir/$image_name")) { 
-       $url = file_create_url("$image_dir/$image_name"); 
-     }  
-  } 
+     if (file_exists("$base_path/$image_dir/$image_name")) {
+       $url = file_create_url("$image_dir/$image_name");
+     }
+  }
   return $url;
 }

+ 7 - 4
tripal_organism/tripal_organism.module

@@ -8,6 +8,9 @@ require_once "includes/tripal_organism.chado_node.inc";
  * @file
  * @defgroup tripal_organism Organism Module
  * @ingroup tripal_modules
+ * @{
+ * Provides functions for managing chado organisms including creating details pages for each one
+ * @}
  */
 
 /**
@@ -88,7 +91,7 @@ function tripal_organism_menu() {
     'access arguments' => array('adminster tripal organism'),
     'type' => MENU_NORMAL_ITEM,
   );
-  
+
   $items['admin/tripal/chado/tripal_organism/help'] = array(
     'title' => 'Help',
     'description' => "A description of the Tripal Organism module including a short description of it's usage.",
@@ -98,7 +101,7 @@ function tripal_organism_menu() {
     'type' => MENU_LOCAL_TASK,
     'weight' => 10
   );
-  
+
   $items['admin/tripal/chado/tripal_organism/configuration'] = array(
     'title' => 'Settings',
     'description' => 'Manage integration of Chado organisms including associated features',
@@ -118,7 +121,7 @@ function tripal_organism_menu() {
     'type' => MENU_LOCAL_TASK,
     'weight' => 2
   );
-  
+
   $items['admin/tripal/chado/tripal_organism/views/organisms/enable'] = array(
     'title' => 'Enable Organism Administrative View',
     'page callback' => 'tripal_views_admin_enable_view',
@@ -126,7 +129,7 @@ function tripal_organism_menu() {
     'access arguments' => array('administer tripal organism'),
     'type' => MENU_CALLBACK,
   );
-  
+
 
   return $items;
 }

+ 3 - 7
tripal_phenotype/tripal_phenotype.module

@@ -1,15 +1,11 @@
 <?php
 
 /**
- *  @file
- * This file contains the basic functions needed for this drupal module.
- * The drupal tripal_phenotype module maps directly to the chado X module.
- *
- * For documentation regarding the Chado X module:
- * @see http://gmod.org/wiki/Chado_General_Module
- *
  * @defgroup tripal_phenotype Phenotype Module
  * @ingroup tripal_modules
+ * @{
+ * Provides functions for managing chado phenotype data
+ * @}
  */
 
 /**

+ 3 - 0
tripal_project/api/tripal_project.api.inc

@@ -7,6 +7,9 @@
 /**
  * @defgroup tripal_project_api Project Module API
  * @ingroup tripal_api
+ * @{
+ * Provides an application programming interface (API) to manage projects
+ * @}
  */
 
 /**

+ 4 - 8
tripal_project/tripal_project.module

@@ -5,15 +5,11 @@ require('includes/tripal_project.admin.inc');
 require('includes/tripal_project.chado_node.inc');
 
 /**
- *  @file
- * This file contains the basic functions needed for this drupal module.
- * The drupal tripal_project module maps directly to the chado general module.
- *
- * For documentation regarding the Chado General module:
- * @see http://gmod.org/wiki/Chado_General_Module
- *
  * @defgroup tripal_project Project Module
  * @ingroup tripal_modules
+ * @{
+ * Provides functions for managing chado projects including creating details pages for each one
+ * @}
  */
 
 /**
@@ -74,7 +70,7 @@ function tripal_project_menu() {
     'type' => MENU_LOCAL_TASK,
     'weight' => 0
   );
-  
+
   $items['admin/tripal/chado/tripal_project/views/projects/enable'] = array(
     'title' => 'Enable Project Administrative View',
     'page callback' => 'tripal_views_admin_enable_view',

+ 79 - 79
tripal_pub/api/tripal_pub.api.inc

@@ -1,10 +1,10 @@
 <?php
 /**
- * @file
- * The Tripal Pub API
- *
  * @defgroup tripal_pub_api Publication Module API
  * @ingroup tripal_api
+ * @{
+ * Provides an application programming interface (API) to manage chado publications
+ * @}
  */
 
 /*
@@ -112,7 +112,7 @@ function tripal_pub_update_publications($do_contact = FALSE, $dbxref = NULL, $db
         INNER JOIN pub_dbxref PDBX ON P.pub_id = PDBX.pub_id
         INNER JOIN dbxref DBX      ON DBX.dbxref_id = PDBX.dbxref_id
         INNER JOIN db DB           ON DB.db_id = DBX.db_id
-    "; 
+    ";
     $args = array();
     if ($dbxref and preg_match('/^(.*?):(.*?)$/', $dbxref, $matches)) {
       $dbname = $matches[1];
@@ -127,18 +127,18 @@ function tripal_pub_update_publications($do_contact = FALSE, $dbxref = NULL, $db
     }
     $sql .= "ORDER BY DB.name, P.pub_id";
     $results = chado_query($sql, $args);
-  
+
     $num_to_retrieve = 100;
     $i = 0;                 // count the number of IDs. When we hit $num_to_retrieve we'll do the query
     $curr_db = '';          // keeps track of the current current database
     $ids = array();         // the list of IDs for the database
     $search = array();      // the search array passed to the search function
-  
+
     // iterate through the pub IDs
     while ($pub = $results->fetchObject()) {
       $accession = $pub->accession;
       $remote_db = $pub->db_name;
-  
+
       // here we need to only update publications for databases we support
       $supported_dbs = variable_get('tripal_pub_supported_dbs', array());
       if(!in_array($remote_db, $supported_dbs)) {
@@ -158,14 +158,14 @@ function tripal_pub_update_publications($do_contact = FALSE, $dbxref = NULL, $db
       );
       $pubs = tripal_pub_get_remote_search_results($remote_db, $search, 1, 0);
       tripal_pub_add_publications($pubs, $do_contact, TRUE);
-  
+
       $i++;
     }
-  
+
     // sync the newly added publications with Drupal
     print "Syncing publications with Drupal...\n";
     tripal_pub_sync_pubs();
-  
+
     // if the caller wants to create contacts then we should sync them
     if ($do_contact) {
       print "Syncing contacts with Drupal...\n";
@@ -249,14 +249,14 @@ function tripal_pub_import_publications_by_import_id($import_id, $job_id = NULL)
 function tripal_pub_import_publications($report_email = FALSE, $do_update = FALSE) {
   $num_to_retrieve = 100;
   $page = 0;
-  
+
   print "\nNOTE: Loading of publications is performed using a database transaction. \n" .
       "If the load fails or is terminated prematurely then the entire set of \n" .
       "insertions/updates is rolled back and will not be found in the database\n\n";
-  
+
   // start the transaction
   $transaction = db_transaction();
-  
+
   try {
     // get all of the loaders
     $args = array();
@@ -284,13 +284,13 @@ function tripal_pub_import_publications($report_email = FALSE, $do_update = FALS
       // our requested numer of records.  This means we've hit the end
       while (count($pubs) == $num_to_retrieve);
     }
-    
+
     // sync the newly added publications with Drupal. If the user
     // requested a report then we don't want to print any syncing information
     // so pass 'FALSE' to the sync call
     print "Syncing publications with Drupal...\n";
     tripal_pub_sync_pubs();
-  
+
     // iterate through each of the reports and generate a final report with HTML links
     $HTML_report = '';
     if ($report_email) {
@@ -315,7 +315,7 @@ function tripal_pub_import_publications($report_email = FALSE, $do_update = FALS
       );
       drupal_mail('tripal_pub', 'import_report', $report_email, language_default(), $params, $site_email, TRUE);
     }
-  
+
     // if any of the importers wanted to create contacts from the authors then sync them
     if($do_contact) {
       print "Syncing contacts with Drupal...\n";
@@ -343,13 +343,13 @@ function tripal_pub_import_by_dbxref($pub_dbxref, $do_contact = FALSE, $do_updat
   print "\nNOTE: Loading of publications is performed using a database transaction. \n" .
       "If the load fails or is terminated prematurely then the entire set of \n" .
       "insertions/updates is rolled back and will not be found in the database\n\n";
-  
+
   $transaction = db_transaction();
   try {
     if(preg_match('/^(.*?):(.*?)$/', $pub_dbxref, $matches)) {
       $dbname = $matches[1];
       $accession = $matches[2];
-  
+
       $criteria = array(
         'num_criteria' => 1,
         'remote_db' => $dbname,
@@ -373,7 +373,7 @@ function tripal_pub_import_by_dbxref($pub_dbxref, $do_contact = FALSE, $do_updat
     // sync the newly added publications with Drupal
     print "Syncing publications with Drupal...\n";
     tripal_pub_sync_pubs();
-  
+
     // if any of the importers wanted to create contacts from the authors then sync them
     if($do_contact) {
       print "Syncing contacts with Drupal...\n";
@@ -387,11 +387,11 @@ function tripal_pub_import_by_dbxref($pub_dbxref, $do_contact = FALSE, $do_updat
         print "FAILED: Rolling back database changes...\n";
       return;
   }
-   
+
   print "Done.\n";
 }
 /**
- * 
+ *
  * @param $pubs
  * @param $do_contact
  * @param $update
@@ -402,13 +402,13 @@ function tripal_pub_add_publications($pubs, $do_contact, $update = FALSE) {
   $report['inserted'] = array();
   $report['skipped'] = array();
   $total_pubs = count($pubs);
-  
+
   // iterate through the publications and add each one
   $i = 1;
   foreach ($pubs as $pub) {
     $memory = number_format(memory_get_usage()) . " bytes";
     print "Processing $i of $total_pubs. Memory usage: $memory.\r";
-     
+
     // add the publication to Chado
     $action = '';
     $pub_id = tripal_pub_add_publication($pub, $action, $do_contact, $update);
@@ -475,7 +475,7 @@ function tripal_pub_add_pub_dbxref($pub_id, $pub_dbxref) {
 
   // make sure our database already exists
   $db = tripal_db_add_db($dbname);
-   
+
   // get the database cross-reference
   $dbxvalues = array(
     'accession' => $accession,
@@ -673,7 +673,7 @@ function tripal_pub_get_pub_by_uniquename($name) {
  */
 function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE, $update_if_exists = FALSE) {
   $pub_id = 0;
-  
+
   if (!is_array($pub_details)) {
     return FALSE;
   }
@@ -717,7 +717,7 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
     }
     elseif (count($results) > 1) {
       watchdog('tripal_pub', "The publication with the same title, type and year is present multiple times. Cannot ".
-        "determine which to use.  Title: '%title'. Type: '%type'. Year: '%year'", 
+        "determine which to use.  Title: '%title'. Type: '%type'. Year: '%year'",
       array('%title' => $pub_details['Title'], '%type' => $pub_details['Publication Type'], '%year' => $pub_details['Year']), WATCHDOG_ERROR);
       $action = 'error';
       return FALSE;
@@ -788,13 +788,13 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
   // is an update.  The only thing we don't want to remove are the 'Publication Dbxref'
   if ($update_if_exists) {
     $sql = "
-      DELETE FROM {pubprop} 
-      WHERE 
-        pub_id = :pub_id AND 
+      DELETE FROM {pubprop}
+      WHERE
+        pub_id = :pub_id AND
         NOT type_id in (
           SELECT cvterm_id
-          FROM {cvterm} 
-          WHERE name = 'Publication Dbxref' 
+          FROM {cvterm}
+          WHERE name = 'Publication Dbxref'
         )
     ";
     chado_query($sql, array(':pub_id' => $pub_id));
@@ -825,7 +825,7 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
     $key == 'Year' or $key == 'Pages') {
       continue;
     }
-     
+
     $success = 0;
     if (is_array($value)) {
       foreach ($value as $subkey => $subvalue) {
@@ -889,7 +889,7 @@ function tripal_pub_add_authors($pub_id, $authors, $do_contact) {
       $type = 'Collective';
     }
     $name = trim($name);
-     
+
     // add an entry to the pubauthors table
     $values = array(
       'pub_id' => $pub_id,
@@ -1010,17 +1010,17 @@ function tripal_pub_delete_property($pub_id, $property) {
 
 
 /**
- * This function generates an array suitable for use with the 
+ * This function generates an array suitable for use with the
  * tripal_pub_create_citation function for any publication
  * already stored in the Chado tables.
- *  
+ *
  * @param $pub_id
  *   The publication ID
  * @param $skip_existing
  *   Set to TRUE to skip publications that already have a citation
- *   in the pubprop table.  Set to FALSE to generate a citation 
+ *   in the pubprop table.  Set to FALSE to generate a citation
  *   regardless if the citation already exists.
- *   
+ *
  * @return
  *   An array suitable for the trpial_pub_create_citation function. On
  *   failure returns FALSE.
@@ -1074,7 +1074,7 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
   // get the citation
   // ---------------------------------
   $values = array(
-    'pub_id' => $pub->pub_id, 
+    'pub_id' => $pub->pub_id,
     'type_id' => array(
       'name' => 'Citation',
     ),
@@ -1091,13 +1091,13 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
       // skip this publication, it already has a citation
       return FALSE;
     }
-  }  
+  }
 
   // ---------------------------------
   // get the publication types
   // ---------------------------------
   $values = array(
-    'pub_id' => $pub->pub_id, 
+    'pub_id' => $pub->pub_id,
     'type_id' => array(
       'name' => 'Publication Type',
     ),
@@ -1114,7 +1114,7 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
   // get the authors list
   // ---------------------------------
   $values = array(
-    'pub_id' => $pub->pub_id, 
+    'pub_id' => $pub->pub_id,
     'type_id' => array(
       'name' => 'Authors',
     ),
@@ -1132,8 +1132,8 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
   // if there is no 'Author's property then try to retreive authors from the pubauthor table
   else {
     $sql = "
-      SELECT string_agg(surname || ' ' || givennames, ', ') 
-      FROM {pubauthor} 
+      SELECT string_agg(surname || ' ' || givennames, ', ')
+      FROM {pubauthor}
       WHERE pub_id = :pub_id
       GROUP BY pub_id
     ";
@@ -1176,25 +1176,25 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
     'Media Alias',
     'Original Title');
   foreach ($props AS $prop) {
-    $sql = 
-      "SELECT value FROM {pubprop} 
-       WHERE type_id = 
-         (SELECT cvterm_id 
-          FROM {cvterm} 
-          WHERE name = :cvtname AND cv_id = 
-            (SELECT cv_id 
-             FROM {cv} 
+    $sql =
+      "SELECT value FROM {pubprop}
+       WHERE type_id =
+         (SELECT cvterm_id
+          FROM {cvterm}
+          WHERE name = :cvtname AND cv_id =
+            (SELECT cv_id
+             FROM {cv}
              WHERE name = 'tripal_pub'
             )
-         ) 
+         )
        AND pub_id = :pub_id
     ";
     $val = trim(chado_query($sql, array(':cvtname' => $prop, ':pub_id' => $pub->pub_id))->fetchField());
     if ($val) {
       $pub_array[$prop] =$val;
-    } 
+    }
   }
-  return $pub_array;  
+  return $pub_array;
 }
 
 
@@ -1202,34 +1202,34 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
  * This function generates citations for publications.  It requires
  * an array structure with keys being the terms in the Tripal
  * publication ontology.  This function is intended to be used
- * for any function that needs to generate a citation. 
- * 
+ * for any function that needs to generate a citation.
+ *
  * @param $pub
  *   An array structure containing publication details where the keys
- *   are the publication ontology term names and values are the 
+ *   are the publication ontology term names and values are the
  *   corresponding details.  The pub array can contain the following
- *   keys with corresponding values:   
+ *   keys with corresponding values:
  *     - Publication Type:  an array of publication types. a publication can have more than one type
  *     - Authors: a  string containing all of the authors of a publication
  *     - Journal Name:  a string containing the journal name
  *     - Journal Abbreviation: a string containing the journal name abbreviation
  *     - Series Name: a string containing the series (e.g. conference proceedings) name
- *     - Series Abbreviation: a string containing the series name abbreviation     
+ *     - Series Abbreviation: a string containing the series name abbreviation
  *     - Volume: the serives volume number
  *     - Issue: the series issue number
  *     - Pages: the page numbers for the publication
  *     - Publication Date:  A date in the format "Year Month Day"
- *      
+ *
  * @return
  *   A text string containing the citation
  */
 function tripal_pub_create_citation($pub) {
   $citation = '';
   $pub_type = '';
-  
+
   // An article may have more than one publication type. For example,
   // a publication type can be 'Journal Article' but also a 'Clinical Trial'.
-  // Therefore, we need to select the type that makes most sense for 
+  // Therefore, we need to select the type that makes most sense for
   // construction of the citation. Here we'll iterate through them all
   // and select the one that matches best.
   if(is_array($pub['Publication Type'])) {
@@ -1237,19 +1237,19 @@ function tripal_pub_create_citation($pub) {
       if ($ptype == 'Journal Article' ) {
         $pub_type = $ptype;
         break;
-      } 
-      else if ($ptype == 'Conference Proceedings'){ 
+      }
+      else if ($ptype == 'Conference Proceedings'){
         $pub_type = $ptype;
         break;
-      } 
+      }
       else if ($ptype == 'Book') {
         $pub_type = $ptype;
         break;
-      } 
+      }
       else if ($ptype == 'Letter') {
         $pub_type = $ptype;
         break;
-      } 
+      }
       else if ($ptype == 'Book Chapter') {
         $pub_type = $ptype;
         break;
@@ -1257,24 +1257,24 @@ function tripal_pub_create_citation($pub) {
       else if ($ptype == "Research Support, Non-U.S. Gov't") {
         $pub_type = $ptype;
         // we don't break because if the article is also a Journal Article
-        // we prefer that type 
+        // we prefer that type
       }
     }
     if (!$pub_type) {
-      watchdog('tripal_pub', "Cannot generate citation for publication type: %types", 
+      watchdog('tripal_pub', "Cannot generate citation for publication type: %types",
         array('%types' => print_r($pub['Publication Type'], TRUE)), WATCHDOG_ERROR);
       return FALSE;
     }
   }
   else {
     $pub_type = $pub['Publication Type'];
-  }    
+  }
   //----------------------
   // Journal Article
   //----------------------
   if ($pub_type == 'Journal Article') {
     $citation = $pub['Authors'] . '. ' . $pub['Title'] .  '. ';
-  
+
     if (array_key_exists('Journal Name', $pub)) {
       $citation .= $pub['Journal Name'] . '. ';
     }
@@ -1282,7 +1282,7 @@ function tripal_pub_create_citation($pub) {
       $citation .= $pub['Journal Abbreviation'] . '. ';
     }
     elseif (array_key_exists('Series Name', $pub)) {
-      $citation .= $pub['Series Name'] . '. ';  
+      $citation .= $pub['Series Name'] . '. ';
     }
     elseif (array_key_exists('Series Abbreviation', $pub)) {
       $citation .= $pub['Series Abbreviation'] . '. ';
@@ -1315,7 +1315,7 @@ function tripal_pub_create_citation($pub) {
   //----------------------
   elseif ($pub_type == "Research Support, Non-U.S. Gov't") {
     $citation = $pub['Authors'] . '. ' . $pub['Title'] .  '. ';
-  
+
     if (array_key_exists('Journal Name', $pub)) {
       $citation .= $pub['Journal Name'] . '. ';
     }
@@ -1332,7 +1332,7 @@ function tripal_pub_create_citation($pub) {
   //----------------------
   elseif ($pub_type == 'Letter') {
     $citation = $pub['Authors'] . '. ' . $pub['Title'] .  '. ';
-  
+
     if (array_key_exists('Journal Name', $pub)) {
       $citation .= $pub['Journal Name'] . '. ';
     }
@@ -1340,7 +1340,7 @@ function tripal_pub_create_citation($pub) {
       $citation .= $pub['Journal Abbreviation'] . '. ';
     }
     elseif (array_key_exists('Series Name', $pub)) {
-      $citation .= $pub['Series Name'] . '. ';  
+      $citation .= $pub['Series Name'] . '. ';
     }
     elseif (array_key_exists('Series Abbreviation', $pub)) {
       $citation .= $pub['Series Abbreviation'] . '. ';
@@ -1372,25 +1372,25 @@ function tripal_pub_create_citation($pub) {
   // Book
   //----------------------
   elseif ($pub_type == 'Book') {
-  
+
   }
   //----------------------
   // Book Chapter
   //----------------------
   elseif ($pub_type == 'Book Chapter') {
-    
+
   }
   //----------------------
   // Conference Proceedings
   //----------------------
   elseif ($pub_type == 'Conference Proceedings') {
     $citation = $pub['Authors'] . '. ' . $pub['Title'] .  '. ';
-  
+
     if (array_key_exists('Conference Name', $pub)) {
       $citation .= $pub['Conference Name'] . '. ';
     }
     elseif (array_key_exists('Series Name', $pub)) {
-      $citation .= $pub['Series Name'] . '. ';  
+      $citation .= $pub['Series Name'] . '. ';
     }
     elseif (array_key_exists('Series Abbreviation', $pub)) {
       $citation .= $pub['Series Abbreviation'] . '. ';

+ 14 - 12
tripal_pub/tripal_pub.module

@@ -11,12 +11,14 @@ require_once "includes/importers/tripal_pub.PMID.inc";
 require_once "includes/importers/tripal_pub.AGL.inc";
 
 /**
- * @file
- *
+ * @defgroup tripal_pub Publication Module
+ * @ingroup tripal_modules
+ * @{
  * The Tripal Publication module allows you to search the PubMed databse for academic articles,
- * that relate to user specified tpoic\s. As well, it allows management of publications so that
+ * that relate to user specified topic\s. As well, it allows management of publications so that
  * a user can enter specified details regarding a desired publication. This allows all of the important
  * information that is unique to a Academic Publication to be stored for access.
+ * @}
  */
 
 
@@ -96,7 +98,7 @@ function tripal_pub_menu() {
     'weight' => 2
   );
   return $items;
-  
+
   $items['admin/tripal/chado/tripal_pub/citation'] = array(
     'title' => 'Citations',
     'description' => 'Update publication citations',
@@ -106,7 +108,7 @@ function tripal_pub_menu() {
     'type' => MENU_LOCAL_TASK,
     'weight' => 1
   );
-  
+
   $items['admin/tripal/chado/tripal_pub/import_list'] = array(
     'title' => t('Importers'),
     'description' => t('List all publication importers'),
@@ -115,7 +117,7 @@ function tripal_pub_menu() {
     'type' => MENU_LOCAL_TASK,
     'weight' => 0
   );
-  
+
   // add a second link for the importer on the data loaders page
   $items['admin/tripal/loaders/pub_import'] = array(
     'title' => 'Publications Importers',
@@ -124,7 +126,7 @@ function tripal_pub_menu() {
     'access arguments' => array('administer tripal pubs'),
     'type' => MENU_NORMAL_ITEM,
   );
-  
+
   $items['admin/tripal/chado/tripal_pub/import/new'] = array(
     'title' => t('Add an Importer'),
     'description' => t('Add a new publication importer.'),
@@ -146,7 +148,7 @@ function tripal_pub_menu() {
     'access arguments' => array('administer tripal pubs'),
     'type ' => MENU_CALLBACK,
   );
-  
+
   $items['admin/tripal/chado/tripal_pub/import/submit/%'] = array(
     'page callback' => 'tripal_pub_importer_submit_job',
     'page arguments' => array(6),
@@ -205,7 +207,7 @@ function tripal_pub_menu() {
  */
 function tripal_pub_theme($existing, $type, $theme, $path) {
   $core_path = drupal_get_path('module', 'tripal_core');
-  
+
   $items = array(
     'node__chado_pub' => array(
       'template' => 'node--chado-generic',
@@ -279,7 +281,7 @@ function tripal_pub_theme($existing, $type, $theme, $path) {
     'tripal_pub_search_setup_form_elements' => array(
       'render element' => 'form',
     ),
-    
+
     // teaser
     'tripal_pub_teaser' => array(
       'variables' => array('node' => NULL),
@@ -402,7 +404,7 @@ function tripal_pub_form_alter(&$form, &$form_state, $form_id) {
 }
 
 /**
- * 
+ *
  * @param $callback
  * @param $args
  */
@@ -414,7 +416,7 @@ function tripal_pub_job_describe_args($callback, $args) {
     $qargs = array(':import_id' => $args[0]);
     $sql = "SELECT * FROM {tripal_pub_import} WHERE pub_import_id = :import_id ";
     $import = db_query($sql, $qargs)->fetchObject();
-    
+
     $new_args['Importer'] = $import->name;
   }
   return $new_args;

+ 3 - 0
tripal_stock/api/tripal_stock.api.inc

@@ -7,6 +7,9 @@
 /**
  * @defgroup tripal_stock_api Stock Module API
  * @ingroup tripal_api
+ * @{
+ * Provides an application programming interface (API) to manage stocks
+ * @}
  */
 
 /**

+ 6 - 1
tripal_views/api/tripal_views.api.inc

@@ -3,9 +3,14 @@
 /**
  * @file
  * API functions for Tripal Views Integration
- *
+ */
+
+ /**
  * @defgroup tripal_views_api Tripal Views Module API
  * @ingroup tripal_api
+ * @{
+ * Provides functions for Tripal Views Integrations
+ * @}
  */
 
 /**

+ 8 - 0
tripal_views/tripal_views.module

@@ -1,5 +1,13 @@
 <?php
 
+/**
+ * @defgroup tripal_views Tripal Views Module
+ * @ingroup tripal_modules
+ * @{
+ * Provides functions for integrating chado with Drupal Views.
+ * @}
+ */
+
 require_once "tripal_views.views.inc";
 
 require_once "includes/tripal_views_integration.inc";