tripal_analysis_interpro.install 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. //$Id:
  3. /*******************************************************************************
  4. * Implementation of hook_install().
  5. */
  6. function tripal_analysis_interpro_install() {
  7. // create the module's data directory
  8. tripal_create_moddir('tripal_analysis_interpro');
  9. // We need to register to tripal_analysis module so it can provide a control
  10. // for our interpro result. Basically the registration is done by inserting
  11. // modulename into the drupal {tripal_analysis} table AND inserting required
  12. // information to the chado Analysis table. Also in tripal_analysis_interpro.module,
  13. // we need to define HOOK_get_settings() for the module to work properly.
  14. // Inert into drupal's {tripal_analysis}
  15. tripal_analysis_register_child('tripal_analysis_interpro');
  16. // Add cvterm 'analysis_interpro_output_iteration_hits' for inserting into featureprop table
  17. tripal_add_cvterms('analysis_interpro_output_hit', 'Hit in the interpro html '.
  18. 'output. Each hit belongs to a chado feature. This cvterm represents a hit in the output');
  19. // Add cvterm 'analysis_interpro_settings' for inserting into analysisprop table
  20. tripal_add_cvterms('analysis_interpro_settings', 'Settings of an interpro analysis, '.
  21. 'including output file and run parameters separated by a bar |');
  22. }
  23. /*******************************************************************************
  24. * Implementation of hook_uninstall().
  25. */
  26. function tripal_analysis_interpro_uninstall() {
  27. // Delete all information associate with the module
  28. // Drupal complains when the user tries to uninstall tripal_analysis
  29. // and tripal_analysis_interpro at the same time. This is because Drupal drops
  30. // the {tripal_analysis} table before we can delete anything from it. Thus,
  31. // we perform a db_table_exists() check before the deletion
  32. //Delete the settings from {tripal_analysis} table
  33. tripal_analysis_unregister_child('tripal_analysis_interpro');
  34. // Delete module's variables from variables table.
  35. db_query("DELETE FROM {variable} WHERE name='%s'",
  36. 'tripal_analysis_interpro_setting');
  37. }
  38. /*******************************************************************************
  39. * Implementation of hook_requirements(). Make sure 'Tripal Core' and 'Tripal
  40. * Analysis' are enabled before installation
  41. */
  42. function tripal_analysis_interpro_requirements($phase) {
  43. $requirements = array();
  44. if ($phase == 'install') {
  45. if (!function_exists('tripal_create_moddir') || !function_exists('tripal_analysis_register_child')) {
  46. $requirements ['tripal_analysis_interpro'] = array(
  47. 'title' => "tripal_analysis_interpro",
  48. 'value' => "error. Some required modules are just being installed. Please try again.",
  49. 'severity' => REQUIREMENT_ERROR,
  50. );
  51. }
  52. }
  53. return $requirements;
  54. }