ソースを参照

More Doxygen documenation

spficklin 14 年 前
コミット
50b706d146

+ 1 - 1
tripal_core/cvterms.php

@@ -1,7 +1,7 @@
 <?php
 
 /** 
- * @defgroup tripal_core_cv_api Tripal Basic CV API
+ * @defgroup tripal_core_cv_api Core Module CV API
  * @{
  * For working with controlled vocabularies see the Controlled Vocabulary
  * API.  However, there are cases where a CV does not exist. For example in

+ 1 - 1
tripal_core/jobs.php

@@ -1,7 +1,7 @@
 <?php
 
 /** 
- * @defgroup tripal_jobs_api Tripal Jobs API
+ * @defgroup tripal_jobs_api Core Module Jobs API
  * @{
  * Tripal offers a job management subsystem for managing tasks that may require an extended period of time for 
  * completion.  Drupal uses a UNIX-based cron job to handle tasks such as  checking  the  availability of updates, 

+ 1 - 1
tripal_core/mviews.php

@@ -1,7 +1,7 @@
 <?php
 
 /** 
- * @defgroup tripal_mviews_api Tripal Materalized Views API
+ * @defgroup tripal_mviews_api Core Module Materalized Views API
  * @{
  * Provides an application programming interface (API) to manage materialized views in Chado.
  * The Perl-based chado comes with an interface for managing materialzed views.  This

+ 32 - 5
tripal_core/tripal_core.api.inc

@@ -25,7 +25,7 @@
 require_once "tripal_core.schema.api.inc";
 
 /** 
- * @defgroup tripal_chado_api Tripal Chado API
+ * @defgroup tripal_chado_api Core Module Chado API
  * @{
  * Provides an application programming interface (API) to manage data withing the Chado database.
  * This includes functions for selecting, inserting, updating and deleting records 
@@ -54,6 +54,16 @@ require_once "tripal_core.schema.api.inc";
  * @}
  * @ingroup tripal_api
  */
+
+/** 
+ * @defgroup tripal_files_api Core Module Files API
+ * @{
+ * Provides an application programming interface (API) for managing files within 
+ * the Tripal data directory structure.
+ *
+ * @}
+ * @ingroup tripal_api
+ */
  
 /**
 * Provides a generic routine for inserting into any Chado table
@@ -1495,9 +1505,19 @@ function tripal_core_delete_property($basetable, $record_id,$property,$cv_name){
 }
 
 /**
+ * This function is typically used in the '.install' file for a Tripal module
+ * Each module should call this function during installation to create
+ * the module data directory which is sites/default/files/tripal/[module_name] 
+ * for default Drupal settings.  This directory can then be used by the module 
+ * for storing files.
+ *
+ * @param $module_name
+ *   the name of the module being installed.
  *
+ * @returns
+ *   nothing
  *
- * @ingroup tripal_core
+ * @ingroup tripal_files_api
  */
 function tripal_create_moddir($module_name){
    // make the data directory for this module
@@ -1512,9 +1532,16 @@ function tripal_create_moddir($module_name){
 }
 
 /**
+ * Each Tripal module has a unique data directory which was creatd using the
+ * tripal_create_moddir function during installation.  This function 
+ * retrieves the directory path.
  *
+ * @param $module_name
+ *   The name of the module
  *
- * @ingroup tripal_core
+ * @returns
+ *   The path within the Drupal installation where the data directory resides
+ * @ingroup tripal_files_api
  */
 function tripal_get_moddir($module_name){
    $data_dir = file_directory_path() . "/tripal/$module_name";
@@ -1528,7 +1555,7 @@ function tripal_get_moddir($module_name){
  * schemas.  It is also used for backwards compatibility with older versions
  * of tripal or in cases where chado is located outside of the Drupal database.
  *
- * @ingroup tripal_core
+ * @ingroup tripal_chado_api
  */
 function tripal_db_set_active($dbname){
    global $db_url, $db_type;
@@ -1590,7 +1617,7 @@ function tripal_db_set_active($dbname){
  * @endcode
  * @return the maximum rank
  *
- * @ingroup tripal_core
+ * @ingroup tripal_chado_api
  */
 function tripal_get_max_chado_rank ($tablename, $where_options) {
 

+ 1 - 1
tripal_core/tripal_core.schema.api.inc

@@ -8,7 +8,7 @@
  */
 
 /** 
- * @defgroup tripal_schema_api Tripal Schema API
+ * @defgroup tripal_schema_api Core Module 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 

+ 93 - 3
tripal_cv/trees.php

@@ -15,9 +15,99 @@ function tripal_cv_show_browser() {
 
 
 /**
-*
-* @ingroup tripal_cv
-*/
+ * Generates JSON used for generating an exapandable tree of terms from
+ * a controlled vocabulary that has associated counts. 
+ *
+ * The progammer must first create a materialized view that
+ * will generate count data for a given controlled vocabulary.  For example, the Tripal
+ * Analysis GO creates a materialized view for counting Gene Ontology assignments
+ * to features.  This view is created on install of the module and is named
+ * 'go_count_analysis'.
+ *
+ * Second, the progammer must add an HTML 'div' box to the desired page
+ * with a class name of 'tripal_cv_tree', and an id of the following format:
+ *
+ *  tripal_[module_name]_cv_tree_[unique id]
+ *
+ * where [module_name] is the name of the tripal module (e.g. tripal_analyisis_go)
+ * and [unique id] is some unique identifier that the contolling module 
+ * recognizes. This string is the $tree_id variable passed as the first argument
+ * to the function.  For example, the Tripal GO Analysis module generates 
+ * tree ids of the form:
+ * 
+ *  tripal_analysis_go_cv_tree_10_2_bp
+ * 
+ * In this case the module that will manage this tree is identified as 'tripal_analysis_go' and within
+ * the [unique id] portion contains the
+ * organism_id (e.g. 10), analysis_id (e.g. 2) and tree type (bp = biological process). 
+ *
+ * Second, the programmer must then define a hook in the controlling module for setting
+ * some options used to build the chart.  The hook has the form:  hook_cv_tree($tree_id).
+ * This hook should accept the full $tree_id as the single parameter.  For the Tripal
+ * Analysis GO module the hook is named:  tripal_analysis_go_cv_tree.  
+ *
+ * The array returned by this hook must have the following fields: 
+ *  - cv_id 
+ *      the cv_id for the controlled vocabulary
+ *  - count_mview
+ *      the name of the materialized view that contains the count data
+ *      this materialized view must have at least two columns, one with the cvterm_id
+ *      for each term and a second column containing the counts. The tree will only
+ *      be expanded to include child terms that have counts.
+ *  - cvterm_id_column
+ *      the column name in the materialized view that contains
+ *      the cvterm_ids
+ *  - count_column
+ *      the column name in the materialized view that contains the
+ *      counts
+ *  - filter
+ *      an SQL compatible WHERE clause string (whithout the word 'WHERE')
+ *      that can be used for filtering the records in the materialized view.
+ *  - label
+ *      the title for the tree
+ *
+ * Example from the tripal_analysis_go module:
+ * @code
+ *  function tripal_analysis_go_cv_tree($tree_id){
+ * 
+ *   $organism_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$1",$tree_id);
+ *   $analysis_id = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$2",$tree_id);
+ *   $type        = preg_replace("/^tripal_analysis_go_cv_tree_(\d+)-(\d+)_(bp|cc|mf)$/","$3",$tree_id);
+ * 
+ *   if(strcmp($type,'mf')==0){
+ *      $class = 'molecular_function';
+ *   }
+ *   if(strcmp($type,'cc')==0){
+ *      $class = 'cellular_component';
+ *   }
+ *   if(strcmp($type,'bp')==0){
+ *      $class = 'biological_process';
+ *   }
+ * 
+ *   $options = array(
+ *      cv_id            => tripal_cv_get_cv_id($class),
+ *      count_mview      => 'go_count_analysis',
+ *      cvterm_id_column => 'cvterm_id',
+ *      count_column     => 'feature_count',
+ *      filter           => "CNT.organism_id = $organism_id AND CNT.analysis_id = $analysis_id",
+ *      label            => 'Features',
+ *   );
+ *   return $options;
+ * }
+ *
+ * @endcode
+ *
+ * @param $tree_id
+ *   The unique identifier for the tree
+ *
+ * @return
+ *   JSON array needed for the jsTree package for generating expandable trees.
+ *
+ * With these three components (materialized view, a 'div' box with proper CSS class and ID, and a hook_cv_tree)
+ * a tree will be created on the page.  There is no need to call this function directly.
+ *
+ * @ingroup tripal_cv
+ */
 function tripal_cv_tree($tree_id){
   // parse out the tripal module name from the chart_id to find out 
   // which Tripal "hook" to call:

+ 1 - 1
tripal_db/tripal_db.api.inc

@@ -1,7 +1,7 @@
 <?php
 
 /**
- * @defgroup tripal_db_api Database Module API
+ * @defgroup tripal_db_api DB Module API
  * @ingroup tripal_api
  * @ingroup tripal_db
  * Provides an application programming interface (API) to manage references to external databases

+ 1 - 1
tripal_db/tripal_db.module

@@ -3,7 +3,7 @@
 require_once "tripal_db.api.inc";
 
 /**
- * @defgroup tripal_db External Database Module
+ * @defgroup tripal_db Database Module
  * @ingroup tripal_modules
  */