| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 | <?php/** * @file * Contains hooks to handle installation of this module. * * Specifically, a database table (blastdb) is created to store additional information * related to blast database nodes such as the name/path to the NCBI BLAST database files * and the type (protein or nucleotide) of the database. *//** * Implements hook_install(). */function blast_ui_install() {   tripal_create_files_dir('tripal_blast');}/** * Implements hook_schema(). * Create the blastdb database table for storing addditional info related to blastdb nodes. * * NOTE: This hook is called via Drupal magic during the installation process and no longer * needs to be called explicitly in hook_install(). */function blast_ui_schema(){  // A table ot keep extra information related to blastdb nodes.  $schema['blastdb'] = array(    'description' => t('The base table for blastdb node'),    'fields' => array(      'nid' => array(        'description' => t('The primary identifier for a node.'),        'type' => 'serial',        'unsigned' => true,        'not null' => true,      ),      'name' => array(        'description' => t('The human-readable name of the blast database.'),        'type' => 'varchar',        'length' => 255,        'not null' => true,      ),      'path' => array(        'description' => t('The full path and filename prefix of the blast database.'),        'type' => 'varchar',        'length' => 1023,        'not null' => true,      ),      'dbtype' => array(        'description' => t('Type of the blast database. Should be either n for nucleotide or p for protein.'),        'type' => 'varchar',        'length' => 15,        'not null' => true,      ),      'dbxref_id_regex' => array(        'description' => t('The Regular Expression to use to extract the id from the FASTA header of the BLAST database hit.'),        'type' => 'text',      ),      'dbxref_db_id' => array(        'description' => t('The Database records from this BLAST Database reference.'),        'type' => 'int',      ),      'dbxref_linkout_type' => array(        'description' => t('Type of linkout to be used for this database reference.'),        'type' => 'varchar',        'length' => 50,        'not null' => true,        'default' => 'link'      ),    ),        'indexes' => array(      'name' => array('name'),    ),        'primary key' => array('nid'),    'unique keys' => array(       'nid' => array('nid'),    ),  );    // BLAST JOBS  // ------------------------  // Keeps track of additional information related to tripal blast jobs.  $schema['blastjob'] = array(    'description' => t('Keeps track of additional information related to tripal blast jobs.'),    'fields' => array(      'job_id' => array(        'description' => t('The Tripal job_id for the blast job.'),        'type' => 'int',        'unsigned' => true,        'not null' => true,      ),      'blast_program' => array(        'description' => t('The program to use to run the blast (ie: blastn, blastp, etc.).'),        'type' => 'varchar',        'length' => 20,        'not null' => true,      ),      'target_blastdb' => array(        'description' => t('The nid of the blastdb used to search against; NULL if target was uploaded.'),        'type' => 'int',        'unsigned' => true,      ),      'target_file' => array(        'description' => t('The absolute path to the uploaded blast database after it was run through makeblastdb; NULL if target was NOT uploaded.'),        'type' => 'text',      ),      'query_file' => array(        'description' => t('The absolute path to the query file.'),        'type' => 'text',      ),      'result_filestub' => array(        'description' => t('The absolute path and filename (without extension) of the blast results.'),        'type' => 'text',      ),      'options' => array(        '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.'),        'type' => 'text',      ),    ),    'primary key' => array('job_id'),    'foreign keys' => array(      'job_id' => array(        'table' => 'tripal_jobs',        'columns' => array(          'job_id' => 'job_id',        ),      ),    ),  );    return $schema;}/** * Make BlastDB type more readable & support Link-outs for BLAST Hits. */function blast_ui_update_7101() {  // Changing the length of the type field to allow it to be more readable.  db_change_field('blastdb', 'dbtype', 'dbtype',    array(        'description' => t('Type of the blast database. Should be either n for nucleotide or p for protein.'),        'type' => 'varchar',        'length' => 15,        'not null' => true,    )  );  // Add fields related to Link-outs  db_add_field(    'blastdb',    'dbxref_id_regex',    array(      'description' => t('The Regular Expression to use to extract the id from the FASTA header of the BLAST database hit.'),      'type' => 'text',    )  );  db_add_field(    'blastdb',    'dbxref_db_id',    array(      'description' => t('The Database records from this BLAST Database reference.'),      'type' => 'int',    )  );}/** * Support complex types of link-outs such as GBrowse & JBrowse coordinate links. */function blast_ui_update_7102() {  db_add_field(    'blastdb',    'dbxref_linkout_type',    array(      'description' => t('Type of linkout to be used for this database reference.'),      'type' => 'varchar',      'length' => 50,      'not null' => true,      'default' => 'link'    )  );}/** * Add saving of blast job information for recent job list & resubmit functionality. */function blast_ui_update_7103() {  $schema = array();  // Keeps track of additional information related to tripal blast jobs.  $schema['blastjob'] = array(    'description' => t('Keeps track of additional information related to tripal blast jobs.'),    'fields' => array(      'job_id' => array(        'description' => t('The Tripal job_id for the blast job.'),        'type' => 'int',        'unsigned' => true,        'not null' => true,      ),      'blast_program' => array(        'description' => t('The program to use to run the blast (ie: blastn, blastp, etc.).'),        'type' => 'varchar',        'length' => 20,        'not null' => true,      ),      'target_blastdb' => array(        'description' => t('The nid of the blastdb used to search against; NULL if target was uploaded.'),        'type' => 'int',        'unsigned' => true,      ),      'target_file' => array(        'description' => t('The absolute path to the uploaded blast database after it was run through makeblastdb; NULL if target was NOT uploaded.'),        'type' => 'text',      ),      'query_file' => array(        'description' => t('The absolute path to the query file.'),        'type' => 'text',      ),      'result_filestub' => array(        'description' => t('The absolute path and filename (without extension) of the blast results.'),        'type' => 'text',      ),      'options' => array(        '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.'),        'type' => 'text',      ),    ),    'primary key' => array('job_id'),    'foreign keys' => array(      'job_id' => array(        'table' => 'tripal_jobs',        'columns' => array(          'job_id' => 'job_id',        ),      ),    ),  );    // First create the tables.  db_create_table('blastjob', $schema['blastjob']);  }
 |