|
Tripal 0.3b
|
| chado_cv_access | ( | $ | op, |
| $ | node, | ||
| $ | account | ||
| ) |
The following function proves access control for users trying to perform actions on data managed by this module
Definition at line 167 of file tripal_cv.module.
| theme_tripal_cv_cvterm_edit | ( | &$ | cvterm | ) |
Definition at line 1093 of file tripal_cv.module.
| tripal_ajax_cv_edit | ( | ) |
Purpose: The edit controlled vocabulary javascript
Definition at line 388 of file tripal_cv.module.
| tripal_cv_add_cvterm_callback | ( | ) |
Purpose: This function gets called when the selecting of a cv from the select list triggers it. This function simply rebuilds the form with new information. No elements are created here
Definition at line 792 of file tripal_cv.module.
References $args.
| tripal_cv_add_cvterm_form | ( | &$ | form_state | ) |
Purpose: Provides the form that allows adding of terms to an existing controlled vocabulary
Definition at line 600 of file tripal_cv.module.
References tripal_core_chado_select().
| tripal_cv_add_cvterm_form_submit | ( | $ | form, |
| &$ | form_state | ||
| ) |
Purpose: Adds terms to an existing controlled vocabulary
Definition at line 722 of file tripal_cv.module.
References tripal_core_chado_insert(), and tripal_core_chado_select().
| tripal_cv_add_cvterm_form_validate | ( | $ | form, |
| &$ | form_state | ||
| ) |
Purpose: Validates the input for adding a cvterm
Definition at line 710 of file tripal_cv.module.
| tripal_cv_add_form | ( | &$ | form_state = NULL | ) |
Purpose: Provides the Add controlled vocabulary form
Definition at line 521 of file tripal_cv.module.
| tripal_cv_add_form_submit | ( | $ | form, |
| &$ | form_state | ||
| ) |
Purpose: The submit function for the add controlled vocabulary form
Definition at line 566 of file tripal_cv.module.
References tripal_db_set_active().
| tripal_cv_add_obo_defaults | ( | ) |
Add's defaults to the tripal_cv_obo table
Definition at line 139 of file tripal_cv.install.
Referenced by tripal_cv_install(), and tripal_cv_update_6000().
| tripal_cv_admin_page | ( | ) |
Purpose: Provides the form for Updating and Deleteing existing chado controlled vocabularies (See chado cv table)
Definition at line 333 of file tripal_cv.module.
| tripal_cv_chart | ( | $ | chart_id | ) |
Generates JSON used for generating a Google chart of count data associated with a controlled vocabulary. An example would be features assigned to Gene Ontology terms. To generate a chart, 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'.
Next, an HTML 'div' box must be added to the desired page with a class name of 'tripal_cv_chart', and an id of the following format:
tripal_[module_name]_cv_chart_[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 $chart_id variable passed as the first argument to the function. For example, the Tripal GO Analysis module generates chart ids of the form:
tripal_analysis_go_cv_chart_10_2_bp
In this case the module that will manage this chart 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 chart 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_chart($chart_id). This hook should accept the full $chart_id as the single parameter. For the Tripal Analysis GO module the hook is named: tripal_analysis_go_cv_chart.
The array returned by this hook must have the following fields:
Example from the tripal_analysis_go module:
function tripal_analysis_go_cv_chart($chart_id){
// The CV module will create the JSON array necessary for buillding a
// pie chart using jgChart and Google Charts. We have to pass to it
// a table that contains count information, tell it which column
// contains the cvterm_id and provide a filter for getting the
// results we want from the table.
$organism_id = preg_replace("/^tripal_analysis_go_cv_chart_(\d+)-(\d+)_(bp|cc|mf)$/","$1",$chart_id);
$analysis_id = preg_replace("/^tripal_analysis_go_cv_chart_(\d+)-(\d+)_(bp|cc|mf)$/","$2",$chart_id);
$type = preg_replace("/^tripal_analysis_go_cv_chart_(\d+)-(\d+)_(bp|cc|mf)$/","$3",$chart_id);
$sql = "SELECT * FROM {Analysis} WHERE analysis_id = %d";
$previous_db = tripal_db_set_active('chado'); // use chado database
$analysis = db_fetch_object(db_query($sql,$analysis_id));
tripal_db_set_active($previous_db); // now use drupal database
if(strcmp($type,'mf')==0){
$class = 'molecular_function';
$title = "Number of Molecular Function Terms From $analysis->name Analysis";
}
if(strcmp($type,'cc')==0){
$class = 'cellular_component';
$title = "Number of Cellular Component Terms From $analysis->name Analysis";
}
if(strcmp($type,'bp')==0){
$class = 'biological_process';
$title = "Number of Biological Process Terms From $analysis->name Analysis";
}
$options = array(
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 AND
CNT.cvterm_id IN (
SELECT CVTR.subject_id
FROM {CVTerm_relationship} CVTR
INNER JOIN CVTerm CVT on CVTR.object_id = CVT.cvterm_id
INNER JOIN CV on CVT.cv_id = CV.cv_id
WHERE CVT.name = '$class' AND
CV.name = '$class'
)
",
type => 'p',
size => '550x175',
title => $title,
);
return $options;
}
| $chart_id | The unique identifier for the chart |
With these three components (materialized view, a 'div' box with proper CSS class and ID, and a hook_cv_chart) a chart will be created on the page. There is no need to call this function directly.
Definition at line 125 of file charts.php.
References tripal_cv_count_chart().
| tripal_cv_count_chart | ( | $ | cnt_table, |
| $ | fk_column, | ||
| $ | cnt_column, | ||
| $ | filter = null, |
||
| $ | title = '', |
||
| $ | type = 'p3', |
||
| $ | size = '300x75' |
||
| ) |
This function generates an array with fields compatible with Google charts used for generating pie charts of counts associated with terms in a controlled vocabulary. An example would be counts of features assigned to terms in the Sequence Ontology.
| $cnt_table | The name of the table (most likely a materialized view) that contains count data for each term. The table must have at least two columns, one with the cvterm_id for each term, and a second column with the count (i.e. features assigned the term). |
| $fk_column | This is the name of the column in the $cnt_table that holds the cvterm_id for each term. |
| $cnt_column | The name of the column in the $cnt_table containing the counts |
| $filter | An SQL compatible 'where' clause (without the word 'WHERE') used to filter the records in the $cnt_table |
| $title | The title of the chart to be rendered. |
| $type | The type of chart to be rendered. The value used here is the same as the type names for Google charts. Default is p3 (pie chart). |
| $size | The size in pixels of the chart to be rendered. Default is 300x75. The size of the chart is constrained by Google charts. See the Google chart documentation for exact limitations. |
Definition at line 178 of file charts.php.
References tripal_db_set_active().
Referenced by tripal_cv_chart().
| tripal_cv_cvterm_edit | ( | $ | cvterm_id | ) |
Definition at line 1076 of file tripal_cv.module.
References tripal_db_set_active().
| tripal_cv_cvterm_info | ( | $ | cvterm_id | ) |
Definition at line 352 of file trees.php.
References tripal_db_set_active().
| tripal_cv_cvtermpath_form | ( | ) |
Definition at line 977 of file tripal_cv.module.
References tripal_db_set_active().
| tripal_cv_cvtermpath_form_validate | ( | $ | form, |
| &$ | form_state | ||
| ) |
Definition at line 1014 of file tripal_cv.module.
References $user, tripal_add_job(), and tripal_db_set_active().
| tripal_cv_edit_form | ( | &$ | form_state = NULL, |
| $ | cvid = NULL |
||
| ) |
Purpose: Provides a form to allow updating/deleteing of controlled vocabularies
Definition at line 400 of file tripal_cv.module.
References tripal_db_set_active().
| tripal_cv_edit_form_submit | ( | $ | form, |
| &$ | form_state | ||
| ) |
Purpose: The submit function of the update/delete controlled vocabulary form
Definition at line 470 of file tripal_cv.module.
References tripal_db_set_active().
| tripal_cv_get_cv_id | ( | $ | cv_name | ) |
Definition at line 1061 of file tripal_cv.module.
References tripal_db_set_active().
Referenced by tripal_feature_cv_tree().
| tripal_cv_get_schemas | ( | ) |
This function simply defines all tables needed for the module to work correctly. By putting the table definitions in a separate function we can easily provide the entire list for hook_install or individual tables for an update.
Definition at line 118 of file tripal_cv.install.
Referenced by tripal_cv_schema().
| tripal_cv_init | ( | ) |
Definition at line 18 of file tripal_cv.module.
| tripal_cv_init_tree | ( | $ | cv_id, |
| $ | cnt_table = null, |
||
| $ | fk_column = null, |
||
| $ | cnt_column = null, |
||
| $ | filter = null, |
||
| $ | label = null |
||
| ) |
Generates JSON needed for jsTree Root-level Branches
This function returns the JSON array for the jsTree jQuery code that builds a tree for browsing the ontology. This function should be called to generate the root level branches of the tree.
Definition at line 176 of file trees.php.
References tripal_db_set_active().
Referenced by tripal_cv_update_tree().
| tripal_cv_install | ( | ) |
Implementation of hook_install();
Definition at line 8 of file tripal_cv.install.
References tripal_add_mview(), tripal_create_moddir(), tripal_cv_add_obo_defaults(), and tripal_db_set_active().
| tripal_cv_list_form | ( | $ | form_state | ) |
Definition at line 425 of file trees.php.
References tripal_db_set_active().
| tripal_cv_menu | ( | ) |
Definition at line 33 of file tripal_cv.module.
| tripal_cv_module_description_page | ( | ) |
Purpose: Provide Guidance to new Tripal Admin
Definition at line 240 of file tripal_cv.module.
| tripal_cv_perm | ( | ) |
Set the permission types that the chado module uses. Essentially we want permissionis that protect creation, editing and deleting of chado data objects
Definition at line 197 of file tripal_cv.module.
| tripal_cv_requirements | ( | $ | phase | ) |
Implementation of hook_requirements(). Make sure 'Tripal Core' is enabled before installation
Definition at line 88 of file tripal_cv.install.
| tripal_cv_schema | ( | ) |
Implementation of hook_schema().
Definition at line 106 of file tripal_cv.install.
References tripal_cv_get_schemas().
| tripal_cv_select_form | ( | ) |
Purpose: Provides the actual "Select CV" form on the Update/Delete Controlled Vocabulary page. This form also triggers the edit javascript
Definition at line 354 of file tripal_cv.module.
References tripal_db_set_active().
| tripal_cv_theme | ( | ) |
We need to let drupal know about our theme functions and their arguments. We create theme functions to allow users of the module to customize the look and feel of the output generated in this module
Definition at line 225 of file tripal_cv.module.
| tripal_cv_tree | ( | $ | tree_id | ) |
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:
Example from the tripal_analysis_go module:
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;
}
| $tree_id | The unique identifier for the tree |
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.
| tripal_cv_uninstall | ( | ) |
Implementation of hook_uninstall()
Definition at line 71 of file tripal_cv.install.
References tripal_mviews_action(), and tripal_mviews_get_mview_id().
| tripal_cv_update_6000 | ( | ) |
This update adds the new tripal_obo table. This is an upgrade from Tripal version 0.2
Definition at line 57 of file tripal_cv.install.
References $ret, and tripal_cv_add_obo_defaults().
| tripal_cv_update_cvtermpath | ( | $ | cvid = NULL, |
| $ | job_id = NULL |
||
| ) |
Update the cvtermpath table
Definition at line 1037 of file tripal_cv.module.
References tripal_db_set_active().
Referenced by tripal_cv_load_update_cvtermpath().
| tripal_cv_update_tree | ( | ) |
Definition at line 135 of file trees.php.
References tripal_cv_get_term_children(), and tripal_cv_init_tree().
| tripal_cv_views_api | ( | ) |
Implements hook_views_api() Purpose: Essentially this hook tells drupal that there is views support for for this module which then includes tripal_cv.views.inc where all the views integration code is
Definition at line 214 of file tripal_cv.module.