Tripal 0.3b
Stock Module

Classes

class  views_handler_argument_stockprop_id
class  views_handler_field_computed_stock_nid
class  views_handler_field_stock_dbxref_all
class  views_handler_field_stock_dbxref_by_type
class  views_handler_field_stockprop_all
class  views_handler_field_stockprop_by_type
class  views_handler_field_stockrel_all
class  views_handler_field_stockrel_by_type
class  views_handler_filter_stock_dbxref_id
class  views_handler_filter_stockprop_id

Modules

 Stock Module API
 Stock Views Integration

Functions

 tripal_stock_module_description_page ()
 tripal_stock_admin ()
 tripal_stock_admin_validate ($form, &$form_state)
 tripal_stock_sync_stock_set ($organism_id, $job_id)
 tripal_stock_add_ALL_dbreferences_page ($node)
 tripal_stock_add_ONE_dbreference_form ($form_state, $node)
 tripal_stock_add_ONE_dbreference_form_validate ($form, &$form_state)
 tripal_stock_add_ONE_dbreference_form_submit ($form, &$form_state)
 tripal_stock_edit_ALL_dbreferences_page ($node)
 tripal_stock_edit_ALL_db_references_form ($form_state, &$node)
 tripal_stock_edit_ALL_db_references_form_submit ($form, &$form_state)
 tripal_stock_update_db_reference ($dbxref_id, $database_id, $accession)
 tripal_stock_delete_db_reference ($dbxref_id)
 theme_tripal_stock_edit_ALL_db_references_form ($form)
 tripal_stock_list_dbreferences_for_node ($db_references)
 tripal_stock_add_ALL_property_page ($node)
 tripal_stock_add_ONE_property_form ($form_state, $node)
 tripal_stock_add_ONE_property_form_validate ($form, &$form_state)
 tripal_stock_add_ONE_property_form_submit ($form, &$form_state)
 tripal_stock_edit_ALL_properties_page ($node)
 tripal_stock_edit_ALL_properties_form ($form_state, &$node)
 tripal_stock_edit_ALL_properties_form_submit ($form, &$form_state)
 tripal_stock_update_property ($stockprop_id, $cvterm_id, $value, $preferred, $nid)
 tripal_stock_delete_property ($stockprop_id)
 theme_tripal_stock_edit_ALL_properties_form ($form)
 tripal_stock_list_properties_for_node ($properties, $synonyms)
 tripal_stock_add_ALL_relationships_page ($node)
 tripal_stock_add_ONE_relationship_form ($form_state, $node)
 tripal_stock_add_ONE_relationship_form_validate ($form, &$form_state)
 tripal_stock_add_ONE_relationship_form_submit ($form, &$form_state)
 tripal_stock_edit_ALL_relationships_page ($node)
 tripal_stock_edit_ALL_relationships_form ($form_state, $node)
 tripal_stock_edit_ALL_relationships_form_validate ($form, &$form_state)
 tripal_stock_edit_ALL_relationships_form_submit ($form, &$form_state)
 tripal_stock_update_relationship ($stock_relationship_id, $subject_id, $cvterm_id, $object_id)
 tripal_stock_delete_relationship ($stock_relationship_id)
 theme_tripal_stock_edit_ALL_relationships_form ($form)
 tripal_stock_list_relationships_for_node ($stock_name, $subject_relationships, $object_relationships)
 tripal_stock_back_to_stock_button ($form_state, $nid)
 tripal_stock_back_to_stock_button_submit ($form, $form_state)
 tripal_stock_add_chado_properties_progress ($current)
 tripal_stock_add_chado_properties_navigate ($form_state, $step, $nid)
 tripal_stock_add_chado_properties_navigate_submit ($form, $form_state)
 tripal_stock_is_obsolete_form ($node, $stock_id)
 tripal_stock_is_obsolete_form_submit ($form, &$form_state)
 tripal_stock_menu ()
 cs_node_load ($nid)
 tripal_stock_perm ()
 chado_stock_access ($op, $node, $account)
 tripal_stock_views_api ()
 tripal_stock_theme ()
 tripal_stock_show_stocks ()
 theme_tripal_stock_stock_table (&$stocks)
 tripal_stock_node_info ()
 chado_stock_load ($node)
 chado_stock_form ($node, $form_state)
 chado_stock_validate ($node, &$form)
 chado_stock_insert ($node)
 chado_stock_update ($node)
 chado_stock_delete ($node)
 tripal_stock_block ($op= 'list', $delta=0, $edit=array())

Detailed Description

Provides functions for managing chado stocks including creating details pages for each stock

The Tripal Stock Module provides functionality for adding, editing, deleting and accessing chado stocks. The stock module was designed to store information about stock collections in a laboratory. What is called a stock could also be called a strain or an accession. There is a lot in common between a Drosophila stock and a Saccharomyces strain and an Arabidopsis line. They all come from some taxon, have genotypes, physical locations in the lab, some conceivable relationship with a publication, some conceivable relationship with a sequence feature (such as a transgene), and could be described by some ontology term. For more information about the chado Stock Module see the GMOD Wiki Page (http://gmod.org/wiki/Chado_Stock_Module)


Function Documentation

chado_stock_access ( op,
node,
account 
)

Implements hook_access(): Maps permission catagories to actions

Parameters:
$opThe operation current operation: one of create, update, delete
$nodeThe node object the current operation is being performed on
$accountA user object representing the user for whom the operation is to be performed
Returns:
TRUE grants access; FALSE denies it

Definition at line 195 of file tripal_stock.module.

chado_stock_delete ( node)

Implements hook_delete(): Handles deleting of chado_stocks

NOTE: Currently deletes data -no undo or record-keeping functionality

Parameters:
$nodeThe current node including fields with the form element names and submitted values
Returns:
TRUE if the node was successfully deleted from drupal/chado; FALSE otherwise

Definition at line 862 of file tripal_stock.module.

References tripal_db_set_active().

chado_stock_form ( node,
form_state 
)

Implements hook_form(): Creates the main Add/Edit/Delete Form for chado stocks

Parts to be added by this form name, uniquename, description, type => select from cvterm with key cvterm_id, organism => select from available with key organism_id main_db_reference => accession, version, description, db_name(select from dropdown)

Parameters:
$nodeAn empty node object on insert OR the current stock node object on update
$form_stateThe current state of the form
Returns:
A description of the form to be rendered by drupal_get_form()

Definition at line 430 of file tripal_stock.module.

References tripal_core_expand_chado_vars(), tripal_cv_get_cvterm_options(), tripal_db_get_db_options(), tripal_organism_get_organism_options(), and tripal_stock_add_chado_properties_progress().

chado_stock_insert ( node)

Implements hook_insert(): Inserts data from chado_stock_form() into drupal and chado

Parameters:
$nodeThe current node including fields with the form element names and submitted values
Returns:
TRUE if the node was successfully inserted into drupal/chado; FALSE otherwise

Definition at line 644 of file tripal_stock.module.

References tripal_core_chado_insert(), and tripal_core_chado_select().

Referenced by chado_stock_update().

chado_stock_load ( node)

Implements hook_load(): Prepares the chado_stock node

Parameters:
$nodeThe basic node containing all variables common to all nodes
Returns:
A stock node containing all the variables from the basic node and all stock specific variables

Definition at line 385 of file tripal_stock.module.

References tripal_core_generate_chado_var().

chado_stock_update ( node)

Implements hook_update(): Handles Editing/Updating of main stock info

NOTE: Currently just writes over all old data

Parameters:
$nodeThe current node including fields with the form element names and submitted values
Returns:
TRUE if the node was successfully updated in drupal/chado; FALSE otherwise

Definition at line 750 of file tripal_stock.module.

References chado_stock_insert(), tripal_core_chado_insert(), tripal_core_chado_select(), and tripal_core_chado_update().

chado_stock_validate ( node,
&$  form 
)

Implements hook_validate(): Validate the input from the chado_stock node form

Parameters:
$nodeThe current node including fields with the form element names and submitted values
$formA description of the form to be rendered by drupal_get_form()

Definition at line 565 of file tripal_stock.module.

References tripal_db_set_active().

cs_node_load ( nid)

Implements Menu wildcard_load hook

Purpose: Allows the node ID of a chado stock to be dynamically pulled from the path. The node is loaded from this node ID and supplied to the page as an arguement. This is an example of dynamic argument replacement using wildcards in the path.

Parameters:
$nidThe node ID passed in from the path
Returns:
The node object with the passed in nid

Definition at line 150 of file tripal_stock.module.

theme_tripal_stock_edit_ALL_db_references_form ( form)

Themes the Edit All Database References for a stock form

Parameters:
$formAn array describing the form to be themed
Returns:
An HTML rendering of the form

Definition at line 399 of file tripal_stock-db_references.inc.

theme_tripal_stock_edit_ALL_properties_form ( form)

Definition at line 354 of file tripal_stock-properties.inc.

theme_tripal_stock_edit_ALL_relationships_form ( form)

Definition at line 447 of file tripal_stock-relationships.inc.

theme_tripal_stock_stock_table ( &$  stocks)

A themeing funtion for the default tripal stock table

Parameters:
$stocksAn array of all stock nodes
Returns:
HTML representation of a table of stocks

Definition at line 328 of file tripal_stock.module.

tripal_stock_add_ALL_dbreferences_page ( node)

Display the ADD Database References to Stock Page

This page is displayed after the stock is created as part of a simulated multi-part form

Parameters:
$nodeThe stock node to add the database references to
Returns:
HTML formatted output

Definition at line 17 of file tripal_stock-db_references.inc.

References tripal_stock_add_chado_properties_progress().

tripal_stock_add_ALL_property_page ( node)
tripal_stock_add_ALL_relationships_page ( node)
tripal_stock_add_chado_properties_navigate ( form_state,
step,
nid 
)

Definition at line 72 of file tripal_stock-secondary_tables.inc.

tripal_stock_add_chado_properties_navigate_submit ( form,
form_state 
)

Definition at line 138 of file tripal_stock-secondary_tables.inc.

tripal_stock_add_chado_properties_progress ( current)
tripal_stock_add_ONE_dbreference_form ( form_state,
node 
)

Implements Hook_form(): Handles adding of Database References to Stocks

Parameters:
$form_stateAn array describing the current state of the form
$nodeThe stock node to add the database reference to
Returns:
An array describing the form to be rendered

Definition at line 45 of file tripal_stock-db_references.inc.

References tripal_db_get_db_options().

tripal_stock_add_ONE_dbreference_form_submit ( form,
&$  form_state 
)

Implements hoook_form_submit(): Actually adds the db reference to the stock

Parameters:
$formAn array describing the form that was rendered
$form_stateAn array describing the current state of the form including user input

Definition at line 149 of file tripal_stock-db_references.inc.

References tripal_db_get_dbxref_by_accession(), and tripal_db_set_active().

tripal_stock_add_ONE_dbreference_form_validate ( form,
&$  form_state 
)

Implements hook_form_validate(): Validates the input from tripal_stock_add_ONE_dbreference_form()

Parameters:
$formAn array describing the form that was rendered
$form_stateAn array describing the current state of the form including user input

Definition at line 104 of file tripal_stock-db_references.inc.

References tripal_db_set_active().

tripal_stock_add_ONE_property_form ( form_state,
node 
)
tripal_stock_add_ONE_property_form_submit ( form,
&$  form_state 
)

Definition at line 122 of file tripal_stock-properties.inc.

References get_max_chado_rank(), and tripal_db_set_active().

tripal_stock_add_ONE_property_form_validate ( form,
&$  form_state 
)
tripal_stock_add_ONE_relationship_form ( form_state,
node 
)

Implements Hook_form(): Handles adding of Relationships to Stocks

Definition at line 29 of file tripal_stock-relationships.inc.

References tripal_cv_get_cvterm_options().

tripal_stock_add_ONE_relationship_form_submit ( form,
&$  form_state 
)

Definition at line 168 of file tripal_stock-relationships.inc.

References tripal_db_set_active().

tripal_stock_add_ONE_relationship_form_validate ( form,
&$  form_state 
)
tripal_stock_admin ( )

Purpose: Provide administration options for chado_stocks

Returns:
Form array (as described by the drupal form api)

Definition at line 145 of file tripal_stock-administration.inc.

References tripal_cv_get_cv_options(), tripal_get_module_active_jobs(), and tripal_organism_get_organism_options().

tripal_stock_admin_validate ( form,
&$  form_state 
)

Implements hook_form_validate(): Validates user input

Parameters:
$formAn array describing the form that was rendered
$form_stateAn array describing the current state of the form including user input

Definition at line 260 of file tripal_stock-administration.inc.

References $user, and tripal_add_job().

tripal_stock_back_to_stock_button ( form_state,
nid 
)

Definition at line 9 of file tripal_stock-secondary_tables.inc.

tripal_stock_back_to_stock_button_submit ( form,
form_state 
)

Definition at line 30 of file tripal_stock-secondary_tables.inc.

tripal_stock_block ( op = 'list',
delta = 0,
edit = array() 
)

Purpose: Implement Blocks relating to stock content

Parameters:
$opWhat kind of information to retrieve about the block or blocks. Possible values include list, configure, save, view.
$deltaWhich block to return (not applicable if $op is 'list').
$editIf $op is 'save', the submitted form data from the configuration form.
Returns:
One of the following depending on $op: An array of block descriptions (list), the configuration form (configure), nothing (save), an array defining subject and content for the block indexed by $delta (view)

Definition at line 897 of file tripal_stock.module.

tripal_stock_delete_db_reference ( dbxref_id)

Deletes a given database reference

Parameters:
$dbxref_idThe chado unique idenfier for the database reference to be deleted
Returns:
TRUE on success; FALSE otherwise

Definition at line 372 of file tripal_stock-db_references.inc.

References tripal_db_set_active().

Referenced by tripal_stock_edit_ALL_db_references_form_submit().

tripal_stock_delete_property ( stockprop_id)
tripal_stock_delete_relationship ( stock_relationship_id)
tripal_stock_edit_ALL_db_references_form ( form_state,
&$  node 
)

Implements Hook_form(): Handles adding of Database References to Stocks

Specifically this adds dbxrefs to a current stock using the stock_dbxref table

Parameters:
$form_stateAn array describing the current state of the form
$nodeThe stock node whose database references should be edited
Returns:
An array describing the form to be rendered

Definition at line 228 of file tripal_stock-db_references.inc.

References tripal_core_expand_chado_vars(), and tripal_db_get_db_options().

tripal_stock_edit_ALL_db_references_form_submit ( form,
&$  form_state 
)

Implements hook_form_submit(): Actually edits the database references

Parameters:
$formAn array representing the form
$form_stateAn array representing the current state of the form including user input

Definition at line 307 of file tripal_stock-db_references.inc.

References tripal_stock_delete_db_reference(), and tripal_stock_update_db_reference().

tripal_stock_edit_ALL_dbreferences_page ( node)

Display the EDIT Database References to Stock Page

This page is displayed as a tab on each stock details page (by default)

Parameters:
$nodeThe stock node to add the database references to
Returns:
HTML formatted output

Definition at line 201 of file tripal_stock-db_references.inc.

tripal_stock_edit_ALL_properties_form ( form_state,
&$  node 
)

Implements Hook_form(): Handles adding of Properties & Synonyms to Stocks

Definition at line 187 of file tripal_stock-properties.inc.

References tripal_core_expand_chado_vars(), and tripal_cv_get_cvterm_options().

tripal_stock_edit_ALL_properties_form_submit ( form,
&$  form_state 
)
tripal_stock_edit_ALL_properties_page ( node)

Definition at line 170 of file tripal_stock-properties.inc.

tripal_stock_edit_ALL_relationships_form ( form_state,
node 
)

Implements Hook_form()

Definition at line 208 of file tripal_stock-relationships.inc.

References tripal_core_expand_chado_vars(), and tripal_cv_get_cvterm_options().

tripal_stock_edit_ALL_relationships_form_submit ( form,
&$  form_state 
)
tripal_stock_edit_ALL_relationships_form_validate ( form,
&$  form_state 
)
tripal_stock_edit_ALL_relationships_page ( node)

Definition at line 191 of file tripal_stock-relationships.inc.

tripal_stock_is_obsolete_form ( node,
stock_id 
)

Definition at line 190 of file tripal_stock-secondary_tables.inc.

tripal_stock_is_obsolete_form_submit ( form,
&$  form_state 
)

Definition at line 211 of file tripal_stock-secondary_tables.inc.

References tripal_db_set_active().

tripal_stock_list_dbreferences_for_node ( db_references)

List all database references for a given node

Todo:
Make this function a theme function
Parameters:
$db_referencesAn array of database references to be listed
Returns:
HTML representation of the list

Definition at line 437 of file tripal_stock-db_references.inc.

tripal_stock_list_properties_for_node ( properties,
synonyms 
)

Definition at line 382 of file tripal_stock-properties.inc.

tripal_stock_list_relationships_for_node ( stock_name,
subject_relationships,
object_relationships 
)

Definition at line 479 of file tripal_stock-relationships.inc.

tripal_stock_menu ( )

Implements hook_menu(): Adds menu items for the tripal_stock

Returns:
Menu definitions for the tripal_stock

Definition at line 43 of file tripal_stock.module.

tripal_stock_module_description_page ( )

Purpose: Provide Guidance to new Tripal Admin

Returns:
HTML Formatted text

Definition at line 12 of file tripal_stock-administration.inc.

tripal_stock_node_info ( )

Implements hook_node_info(): registers a stock node type

Returns:
An array describing various details of the node

Definition at line 362 of file tripal_stock.module.

tripal_stock_perm ( )

Implementation of hook_perm()

Purpose: Set the permission types that the chado stock module uses

Returns:
Listing of the possible permission catagories

Definition at line 171 of file tripal_stock.module.

tripal_stock_show_stocks ( )

Purpose: show stocks stored in drupals chado_stock table

This function provides the default html representation of the stock table. This representation can be overridden using Drupal Views2 to create more flexible tables listing stocks.

Returns:
HTML representation of a table of stocks

Definition at line 302 of file tripal_stock.module.

References tripal_stock_get_all_stocks().

tripal_stock_sync_stock_set ( organism_id,
job_id 
)

Syncs all Stocks associated with an organism

Note: Handling of multiple organisms is done in tripal_stock_admin_validate()

Parameters:
$organism_idThe chado primary key of the organism for which stocks should be sync'd
$job_idThe tripal job ID
Returns:
TRUE if successful; FALSE otherwise

Definition at line 303 of file tripal_stock-administration.inc.

References $user, and tripal_db_set_active().

tripal_stock_theme ( )

Implements hook_theme(): Register themeing functions for this module

Returns:
An array of themeing functions to register

Definition at line 244 of file tripal_stock.module.

tripal_stock_update_db_reference ( dbxref_id,
database_id,
accession 
)

Updates a Database Reference

Todo:
Make this function more generic ie: update all parts of the dbxref and db
Parameters:
$dbxref_idThe unique chado identifier of the database reference to be updated
$database_idThe new database ID
$accessionThe new accession

Definition at line 348 of file tripal_stock-db_references.inc.

References tripal_db_set_active().

Referenced by tripal_stock_edit_ALL_db_references_form_submit().

tripal_stock_update_property ( stockprop_id,
cvterm_id,
value,
preferred,
nid 
)
tripal_stock_update_relationship ( stock_relationship_id,
subject_id,
cvterm_id,
object_id 
)
tripal_stock_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_stock.views.inc where all the views integration code is

Returns:
An array with fields important for views integration

Definition at line 230 of file tripal_stock.module.

 All Classes Files Functions Variables