and tags in the blast xml '. 'output file. This cvterm represents all hits in the iteration'); // Add cveterm 'analysis_blast_settings' for inserting into analysisprop table tripal_add_cvterms('analysis_blast_settings', 'Settings of a blast analysis, '. 'including db_id, output file, and run parameters separated by a bar |'); // Create a tripal_analysis_blast table to store parsers drupal_install_schema('tripal_analysis_blast'); // Create default parser for swissprot, DB:genbank, and go-seqdb $sql_db = "SELECT db_id, name FROM {db} WHERE name like '%s'"; $sql_parser = "INSERT INTO {tripal_analysis_blast} ". " (db_id, displayname, regex_hit_id, regex_hit_def, regex_hit_accession, genbank_style) ". "VALUES (%d, '%s', '%s', '%s', '%s', %d)"; // Add swissprot parser $previous_db = tripal_db_set_active ('chado'); $results = db_query($sql_db, "%swissprot%"); tripal_db_set_active($previous_db); while ($db = db_fetch_object($results)) { db_query($sql_parser, $db->db_id, 'ExPASy Swissprot', '^sp\|.*?\|(.*?)\s.*?$', '^sp\|.*?\|.*?\s(.*)$', 'sp\|(.*?)\|.*?\s.*?$', 0); } // Add trembl parser $previous_db = tripal_db_set_active ('chado'); $results = db_query($sql_db, "%trembl%"); tripal_db_set_active($previous_db); while ($db = db_fetch_object($results)) { db_query($sql_parser, $db->db_id, 'ExPASy TrEMBL', '^.*?\|(.*?)\s.*?$', '^.*?\|.*?\s(.*)$', '^(.*?)\|.*?\s.*?$', 0); } // Add genbank parser $previous_db = tripal_db_set_active ('chado'); $results = db_query($sql_db, "%genbank%"); tripal_db_set_active($previous_db); while ($db = db_fetch_object($results)) { db_query($sql_parser, $db->db_id, 'Genbank', '', '', '', 1); } } /******************************************************************************* * Implementation of hook_uninstall(). */ function tripal_analysis_blast_uninstall() { // Delete all information associate with the module // Drupal complains when the user tries to uninstall tripal_analysis // and tripal_analysis_blast at the same time. This is because Drupal drops // the {tripal_analysis} table before we can delete anything from it. Thus, // we perform a db_table_exists() check before the deletion //Delete the settings from {tripal_analysis} table tripal_analysis_unregister_child('tripal_analysis_blast'); // Delete module's variables from variables table. db_query("DELETE FROM {variable} WHERE name='%s'", 'tripal_analysis_blast_setting'); // Delete a tripal_analysis_blast table drupal_uninstall_schema('tripal_analysis_blast'); } /******************************************************************************* * Implementation of hook_schema(). This table stores the parsers for blast xml * xml results. */ function tripal_analysis_blast_schema() { $schema = array(); $schema['tripal_analysis_blast'] = array( 'fields' => array( 'db_id' => array( 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0 ), 'displayname' => array( 'type' => 'varchar', 'length' => 100, 'not null' => TRUE, ), 'regex_hit_id' => array( 'type' => 'varchar', 'length' => 30, ), 'regex_hit_def' => array( 'type' => 'varchar', 'length' => 30, ), 'regex_hit_accession' => array( 'type' => 'varchar', 'length' => 30, ), 'genbank_style' => array( 'type' => 'int', 'unsigned' => TRUE, 'default' => 0 ), ), 'indexes' => array( 'db_id' => array('db_id') ), 'primary key' => array('db_id'), ); return $schema; } /******************************************************************************* * Implementation of hook_requirements(). Make sure 'Tripal Core' and 'Tripal * Analysis' are enabled before installation */ function tripal_analysis_blast_requirements($phase) { $requirements = array(); if ($phase == 'install') { if (!function_exists('tripal_create_moddir') || !function_exists('tripal_analysis_register_child')) { $requirements ['tripal_analysis_blast'] = array( 'title' => "tripal_analysis_blast", 'value' => "error. Some required modules are just being installed. Please try again.", 'severity' => REQUIREMENT_ERROR, ); } } return $requirements; }