tripal_analysis_interpro.install 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. }
  49. /**
  50. *
  51. */
  52. function tripal_analysis_interpro_update_6000(){
  53. // we have some new cvterms to add
  54. tripal_analysis_interpro_add_cvterms();
  55. $ret = array(
  56. '#finished' => 1,
  57. );
  58. return $ret;
  59. }
  60. /*******************************************************************************
  61. * Implementation of hook_requirements(). Make sure 'Tripal Core' and 'Tripal
  62. * Analysis' are enabled before installation
  63. */
  64. function tripal_analysis_interpro_requirements($phase) {
  65. $requirements = array();
  66. if ($phase == 'install') {
  67. if (!function_exists('tripal_create_moddir') || !function_exists('tripal_analysis_register_child')) {
  68. $requirements ['tripal_analysis_interpro'] = array(
  69. 'title' => "tripal_analysis_interpro",
  70. 'value' => "error. Some required modules are just being installed. Please try again.",
  71. 'severity' => REQUIREMENT_ERROR,
  72. );
  73. }
  74. }
  75. return $requirements;
  76. }