tripal_blast.install 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /**
  3. * @file
  4. * .install file of Tripal BLAST.
  5. *
  6. * Contains hooks to handle installation of this module.
  7. *
  8. * Specifically, a database table (blastdb) is created to store additional information
  9. * related to blast database nodes such as the name/path to the NCBI BLAST database files
  10. * and the type (protein or nucleotide) of the database.
  11. */
  12. use Drupal\node\Entity\Node;
  13. /**
  14. * Implements hook_install().
  15. *
  16. * @see tripal.info
  17. */
  18. function tripal_blast_install() {
  19. // Retreives the Drupal relative directory for a Tripal module.
  20. tripal_create_files_dir('tripal_blast');
  21. }
  22. /**
  23. * Implements hook_uninstall().
  24. */
  25. function tripal_blast_uninstall() {
  26. // @TODO: Removes nodes.
  27. }
  28. /**
  29. * Implements hook_schema().
  30. * Create the blast job database table for storing blast job requests.
  31. */
  32. function tripal_blast_schema() {
  33. // BLAST JOBS
  34. // ------------------------
  35. // Keeps track of additional information related to tripal blast jobs.
  36. $schema['blastjob'] = array(
  37. 'description' => t('Keeps track of additional information related to tripal blast jobs.'),
  38. 'fields' => array(
  39. 'job_id' => array(
  40. 'description' => t('The Tripal job_id for the blast job.'),
  41. 'type' => 'int',
  42. 'unsigned' => true,
  43. 'not null' => true,
  44. ),
  45. 'blast_program' => array(
  46. 'description' => t('The program to use to run the blast (ie: blastn, blastp, etc.).'),
  47. 'type' => 'varchar',
  48. 'length' => 20,
  49. 'not null' => true,
  50. ),
  51. 'target_blastdb' => array(
  52. 'description' => t('The nid of the blastdb used to search against; NULL if target was uploaded.'),
  53. 'type' => 'int',
  54. 'unsigned' => true,
  55. ),
  56. 'target_file' => array(
  57. 'description' => t('The absolute path to the uploaded blast database after it was run through makeblastdb; NULL if target was NOT uploaded.'),
  58. 'type' => 'text',
  59. ),
  60. 'query_file' => array(
  61. 'description' => t('The absolute path to the query file.'),
  62. 'type' => 'text',
  63. ),
  64. 'result_filestub' => array(
  65. 'description' => t('The absolute path and filename (without extension) of the blast results.'),
  66. 'type' => 'text',
  67. ),
  68. 'options' => array(
  69. 'description' => t('A serialized array of options selected for the blast job where the key is the machine name of the option used when calling blast (ie: gapextend) and the value is the value of the option.'),
  70. 'type' => 'text',
  71. ),
  72. ),
  73. 'primary key' => array('job_id'),
  74. 'foreign keys' => array(
  75. 'job_id' => array(
  76. 'table' => 'tripal_jobs',
  77. 'columns' => array(
  78. 'job_id' => 'job_id',
  79. ),
  80. ),
  81. ),
  82. );
  83. return $schema;
  84. }