tripal_analysis_interpro.install 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 the CVterms needed for this module
  17. tripal_analysis_interpro_add_cvterms();
  18. }
  19. /*******************************************************************************
  20. * Implementation of hook_uninstall().
  21. */
  22. function tripal_analysis_interpro_uninstall() {
  23. // Delete all information associate with the module
  24. // Drupal complains when the user tries to uninstall tripal_analysis
  25. // and tripal_analysis_interpro at the same time. This is because Drupal drops
  26. // the {tripal_analysis} table before we can delete anything from it. Thus,
  27. // we perform a db_table_exists() check before the deletion
  28. //Delete the settings from {tripal_analysis} table
  29. tripal_analysis_unregister_child('tripal_analysis_interpro');
  30. // Delete module's variables from variables table.
  31. db_query("DELETE FROM {variable} WHERE name='%s'",
  32. 'tripal_analysis_interpro_setting');
  33. }
  34. /**
  35. *
  36. */
  37. function tripal_analysis_interpro_add_cvterms(){
  38. // Add cvterm 'analysis_interpro_output_iteration_hits' for inserting into featureprop table
  39. tripal_add_cvterms('analysis_interpro_output_hit', 'Hit in the interpro html output. Each hit belongs to a chado feature. This cvterm represents a hit in the output');
  40. tripal_add_cvterms('analysis_interpro_settings', 'Settings of an interpro analysis, including output file and run parameters separated by a bar |');
  41. tripal_add_cvterms('analysis_interpro_interproparameters','The parameters used when executing an InterProScan job');
  42. tripal_add_cvterms('analysis_interpro_interprofile','Used to hold the name of the XML file containing the InterProScan results');
  43. tripal_add_cvterms('analysis_interpro_parsego','Indicates whether or not the GO terms should be extracted when parsing the InterProScan XML file');
  44. tripal_add_cvterms('analysis_interpro_parseHTML','Indicates that the input file is in HTML format. This functionality is deprecated and may not work, but is provided for backwards compatability.');
  45. tripal_add_cvterms('analysis_interpro_query_re','The regular expression for finding the feature name in the query definition line of the InterPro results');
  46. tripal_add_cvterms('analysis_interpro_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');
  47. tripal_add_cvterms('analysis_interpro_query_uniquename','Indicates if the matched name in the query definition line of the blast results is feature uniquename');
  48. tripal_add_cvterms('analysis_interpro_output_keywords', 'Selected keywords for interpro html output which are indexed for search.');
  49. }
  50. /**
  51. *
  52. */
  53. function tripal_analysis_interpro_update_6000(){
  54. // we have some new cvterms to add
  55. tripal_analysis_interpro_add_cvterms();
  56. $ret = array(
  57. '#finished' => 1,
  58. );
  59. return $ret;
  60. }
  61. /*******************************************************************************
  62. * Implementation of hook_requirements(). Make sure 'Tripal Core' and 'Tripal
  63. * Analysis' are enabled before installation
  64. */
  65. function tripal_analysis_interpro_requirements($phase) {
  66. $requirements = array();
  67. if ($phase == 'install') {
  68. if (!function_exists('tripal_create_moddir') || !function_exists('tripal_analysis_register_child')) {
  69. $requirements ['tripal_analysis_interpro'] = array(
  70. 'title' => "tripal_analysis_interpro",
  71. 'value' => "error. Some required modules are just being installed. Please try again.",
  72. 'severity' => REQUIREMENT_ERROR,
  73. );
  74. }
  75. }
  76. return $requirements;
  77. }