'analysis_type', 'def' => 'The type of analysis was performed. This value is automatically set by '. 'each Tripal Analysis module and should be equal to the module name '. '(e.g. tripal_analysis_blast, tripal_analysis_go).' ); tripal_cv_add_cvterm($term, 'tripal', 0, 1, 'tripal'); // add analysis_date $term = array( 'name' => 'analysis_date', 'def' => 'The date that an analysis was performed.' ); tripal_cv_add_cvterm($term, 'tripal', 0, 1, 'tripal'); // add analysis_short_name $term = array( 'name' => 'analysis_short_name', 'def' => 'A computer legible (no spaces or special characters) abbreviation for the analysis.' ); tripal_cv_add_cvterm($term, 'tripal', 0, 1 , 'tripal'); } /** * Implementation of hook_uninstall(). */ function tripal_analysis_uninstall() { // Use schema API to delete database table. drupal_uninstall_schema('tripal_analysis'); // Remove analysis nodes from drupal. $sql_ana_id = "SELECT nid, vid ". "FROM {node} ". "WHERE type like 'chado_analysi%'"; $result = db_query($sql_ana_id); while ($ana = db_fetch_object($result)) { node_delete($ana->nid); } } /** * Implementation of hook_schema() creates two tables. * * - chado_analysis table * stores nodes that are also saved in the analysis table of chado database. * - tripal_analysis table * stores the sub-module names, such as tripal_analysis_blast, that are registered * with this module. */ function tripal_analysis_schema() { // chado_analysis table $schema['chado_analysis'] = array( 'fields' => array( 'vid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 ), 'nid' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 ), 'analysis_id' => array( 'type' => 'int', 'not null' => TRUE, 'default' => 0 ) ), 'indexes' => array( 'analysis_id' => array('analysis_id') ), 'unique keys' => array( 'nid_vid' => array('nid', 'vid'), 'vid' => array('vid') ), 'primary key' => array('nid'), ); // tripal_analysis table $schema['tripal_analysis'] = array( 'description' => t('Table to store analysis sub-modules'), 'fields' => array( 'modulename' => array( 'type' => 'text', 'size' => 'small', 'not null' => TRUE, 'description' => t('The module name. Tripal Analysis will use the '. 'module name to call module_setting_form()') ) ), 'unique keys' => array( 'modulename' => array('modulename') ) ); return $schema; } /** * Provide update script for adding new cvterms */ function tripal_analysis_update_6001() { // we have some new cvterms to add tripal_cv_add_cvterm(array('name' => 'based_on_analysis', 'def' => 'The analysis that this analysis was based on. For example, blast/kegg/interpro analyses are based on a unigene analysis. The unigene analysis_id should be stored in analysisprop as the rank using this cvterm. The name of said unigene analysis can be inserted as the value in analysisprop.'), 'tripal', 0, 1, 'tripal'); tripal_cv_add_cvterm(array('name' => 'additional_files', 'def' => 'Additional files for this analysis. Each file should be separated by a semi-colon and have this format: , ;'), 'tripal', 0, 1, 'tripal'); $ret = array( '#finished' => 1, ); return $ret; } /** * Implementation of hook_requirements(). */ function tripal_analysis_requirements($phase) { $requirements = array(); if ($phase == 'install') { // make sure chado is installed if (!tripal_core_is_chado_installed()) { $requirements ['tripal_analysis'] = array( 'title' => "tripal_analysis", 'value' => "ERROR: Chado most be installed before this module can be enabled", 'severity' => REQUIREMENT_ERROR, ); } } return $requirements; }