123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?php
- /*******************************************************************************
- * Implementation of hook_install();
- */
- function tripal_analysis_kegg_install(){
- // create the module's data directory
- tripal_create_moddir('tripal_analysis_kegg');
-
- // We need to register to tripal_analysis module so it can provide a control
- // for our kegg result. Basically the registration is done by inserting
- // modulename into the drupal {tripal_analysis} table AND inserting required
- // information to the chado Analysis table. Also in tripal_analysis_interpro.module,
- // we need to define HOOK_get_settings() for the module to work properly.
-
- // Inert into drupal's {tripal_analysis}
- tripal_analysis_register_child('tripal_analysis_kegg');
-
- // add the cvterms needed for this module
- tripal_analysis_kegg_add_cvterms ();
- // add the db and the cv for the KEGG terms
- tripal_add_db('KEGG','KEGG: Kyoto Encyclopedia of Genes and Genomes.',
- 'http://www.genome.jp',
- 'http://www.genome.jp/kegg/');
- tripal_add_mview(
- // view name
- 'kegg_by_organism',
- // tripal module name
- 'kegg_by_organism',
- // table name
- 'kegg_by_organism',
- // table schema definition
- 'analysis_name character varying(255),
- analysis_id integer,
- organism_id integer',
- // columns for indexing
- 'analysis_id,organism_id',
- // SQL statement to populate the view
- "SELECT DISTINCT A.name,A.analysis_id,F.organism_id
- FROM {analysisprop} AP
- INNER JOIN analysis A on A.analysis_id = AP.analysis_id
- INNER JOIN cvterm CVT on CVT.cvterm_id = AP.type_id
- INNER JOIN analysisfeature AF on AF.analysis_id = A.analysis_id
- INNER JOIN feature F on F.feature_id = AF.feature_id
- WHERE CVT.name = 'analysis_kegg_settings'",
- // special index
- ''
- );
- }
- /*******************************************************************************
- * Provide update script for adding new cvterms
- */
- function tripal_analysis_kegg_update_6000(){
- // we have some new cvterms to add
- tripal_analysis_kegg_add_cvterms();
- $ret = array(
- '#finished' => 1,
- );
-
- return $ret;
- }
- /**
- *
- */
- function tripal_analysis_kegg_add_cvterms () {
- tripal_add_cvterms('analysis_kegg_settings', 'Settings of a KEGG analysis, Currently include only the heir.tar.gz file name & path.');
- tripal_add_cvterms('kegg_brite_data', 'This term is intended for use in the analysisfeatureprop table to store the KAAS results data.');
- tripal_add_cvterms('analysis_kegg_query_re','The regular expression for finding the feature name in the query definition line of the blast results');
- tripal_add_cvterms('analysis_kegg_query_type','The feature type (e.g. mRNA, polypeptide) of the query input file. This type is used to identify the query feature when multiple features have the same name');
- tripal_add_cvterms('analysis_kegg_query_uniquename','Indicates if the matched name in the query definition line of the blast results is feature uniquename');
- tripal_add_cvterms('analysis_kegg_output_keywords', 'Selected keywords for kegg html output which are indexed for search.');
- }
- /*******************************************************************************
- * Implementation of hook_uninstall()
- */
- function tripal_analysis_kegg_uninstall(){
- // tripal_delete_db('KEGG');
- tripal_analysis_unregister_child('tripal_analysis_kegg');
- $mview = tripal_mviews_get_mview_id('kegg_by_organism');
- if($mview){
- tripal_mviews_action('delete',$mview);
- }
- }
- /*******************************************************************************
- * Implementation of hook_requirements(). Make sure 'Tripal Core' and 'Tripal
- * Analysis' are enabled before installation
- */
- function tripal_analysis_kegg_requirements($phase) {
- $requirements = array();
- if ($phase == 'install') {
- if (!function_exists('tripal_create_moddir') || !function_exists('tripal_analysis_register_child')) {
- $requirements ['tripal_analysis_kegg'] = array(
- 'title' => "tripal_analysis_kegg",
- 'value' => "error. Some required modules are just being installed. Please try again.",
- 'severity' => REQUIREMENT_ERROR,
- );
- }
- }
- return $requirements;
- }
|