Browse Source

Clean repository to fix repository issues

Lacey Sanderson 11 years ago
parent
commit
14601e7da4

+ 0 - 0
blast_ui/blast_ui.info → blast_ui.info


+ 6 - 0
blast_ui/blast_ui.install → blast_ui.install

@@ -5,6 +5,12 @@
  * Contains hooks to handle installation of this module
  */
 
+
+/**
+*
+* Implement hook_install()
+*
+*/
 function blast_ui_install() {
    tripal_create_files_dir('tripal_blast');
 }

+ 92 - 0
blast_ui.module

@@ -0,0 +1,92 @@
+<?php
+
+/**
+ * @file
+ * Contains all functions for the blast module
+ */
+
+require_once 'includes/blast_ui.blastn.inc';
+require_once 'includes/blast_ui.blastp.inc';
+require_once 'includes/blast_ui.node.inc';
+
+
+/**
+ *
+ * Implements hook_menu()
+ * 
+ */
+function blast_ui_menu() {
+
+  $items['blast'] = array(
+    'title' => 'BLAST',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('blast_nucleotide_form'),
+    'access arguments' => array('access content'),
+    'type' => MENU_NORMAL_ITEM,
+    'expanded' => TRUE,
+);
+
+  $items['blast/report/%'] = array(
+    'title' => 'Nucleotide BLAST result:',
+    'page callback' => 'show_blast_output',
+    'page arguments' => array(2),
+    'access arguments' => array('access content'),
+    'type' => MENU_CALLBACK,
+);
+
+  $items['blast/blastn'] = array(
+    'title' => 'Nucleotide BLAST',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('blast_nucleotide_form'),
+    'access arguments' => array('access content'),
+    'type' => MENU_NORMAL_ITEM
+  );
+
+//  $items['blast/blastp'] = array(
+//    'title' => 'Protein BLAST',
+//    'page callback' => 'drupal_get_form',
+//    'page arguments' => array('blast_protein_form'), 
+//    'access arguments' => array('access content'),
+//    'type' => MENU_NORMAL_ITEM
+//  );
+
+  return $items;
+}
+
+/**
+ * Facilitate presenting the result of the blast search
+ *
+ * @param $args
+ *  A string containing name of the blast output file. 
+ *
+ * @return $result
+ *  Return a string containing the blast search output. A link is also provided to let users download the output file.    
+ *
+ */
+function show_blast_output($args = 'all') { 
+
+  if (preg_match('/^[^\/]*/',$args)) {
+    $full_path_filename = '/var/www/kp-amir/sites/default/files/' . $args;
+
+    if (file_exists($full_path_filename)) {
+      $result = t('<a href="@url" target="_blank">Download your BLAST result</a>', array('@url' => url('sites/default/files/' . $args)));
+      $result .= check_markup(file_get_contents($full_path_filename), 'full_html');
+
+      $result = str_replace('<script src="blastResult.js"></script>','',$result);
+    }
+    else {
+      tripal_report_error(
+        'blast_ui',
+        TRIPAL_ERROR,
+        'Unable to open blast results file (%file)',
+        array('%file' => $full_path_filename)
+      );
+      $result = '<p>An error was encountered while trying to process your blast results</p>';
+    }
+  }
+  else {
+    $result = '<p>An error was encountered while trying to process your blast results</p>';
+  } 
+
+  return $result;
+}

+ 0 - 40
blast_ui/blast_ui.module

@@ -1,40 +0,0 @@
-<?php
-
-require_once 'includes/blast_ui.blastn.inc';
-require_once 'includes/blast_ui.blastp.inc';
-require_once 'includes/blast_ui.node.inc';
-
-function blast_ui_menu() {
-
-  $items['blast'] = array(
-    'title' => 'BLAST',
-    'page callback' => 'drupal_get_form',
-    // Add in a page callback/aguements for a drupal form letting you choose nucl. or protein and then redirecting you
-    'page arguments' => array('blast_nucleotide_form'),
-    'access arguments' => array('access content'),
-    'type' => MENU_NORMAL_ITEM,
-    'expanded' => TRUE
-  );
-
-  $items['blast/blastn'] = array(
-    'title' => 'Nucleotide BLAST',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('blast_nucleotide_form'), //Need to change these to use the blast_ui prefix instead of just blast
-
-    // Added the following
-    'access arguments' => array('access content'),
-    'type' => MENU_NORMAL_ITEM
-  );
-
-  $items['blast/blastp'] = array(
-    'title' => 'Protein BLAST',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('blast_protein_form'), //Need to change these to use the blast_ui prefix instead of just blast
-
-    // Added the following
-    'access arguments' => array('access content'),
-    'type' => MENU_NORMAL_ITEM
-  );
-
-  return $items;
-}

+ 0 - 9
blast_ui/includes/newEmptyPHP.php

@@ -1,9 +0,0 @@
-<?php
-
-$query = "/tmp/AB000263_0.fna";
-$blastdb = "HSV6";
-$cmd = "blastn -task blastn -query $query -db /home/amir/$blastdb -out /tmp/php.blastn.html -html";
-system($cmd,$output);
-print_r($cmd);
-
-?>

+ 73 - 18
blast_ui/includes/blast_ui.blastn.inc → includes/blast_ui.blastn.inc

@@ -1,12 +1,26 @@
 <?php
 
+/**
+ * @file
+ * Contains all functions for the nucleotide blast module 
+ */
+
+
+/**
+ * Form constructor for the nucleotide blast form.
+ *
+ * @see blast_nucleotide_form_validate()
+ * @see blast_nucleotide_form_submit()
+ *
+ */
 function blast_nucleotide_form($form, &$form_state) {
   
 //Nucleotide BLAST
 
 $form['nBLAST'] = array(
     '#type' => 'fieldset',
-    '#title' => t('Standard Nucleotide BLAST'),
+    '#title' => t('Enter Query Sequence'),
+    '#description' => t('Enter one or more queries in the top text box or use the browse button to upload a file from your local disk. The file may contain a single sequence or a list of sequences. In both cases, the data must be in FASTA format. <a href="http://www.ncbi.nlm.nih.gov/BLAST/blastcgihelp.shtml" target="_blank">More information..</a> '),
     '#collapsible' => TRUE, 
     '#collapsed' => FALSE,  
   );
@@ -21,7 +35,7 @@ $form['#attributes']['enctype'] = 'multipart/form-data';
 $form['nBLAST']['UPLOAD'] = array(
   	'#prefix' => 'Or upload your query files:	',
   	'#type' => 'file',
-  	'#description' => t('Please give a text a FASTA file, not a MS-Word or other document, you can upload up to 10 Mb.'),
+  	'#description' => t('The file should be a plain-text FASTA file and not a .doc, .docx, etc. It cannot be greater than 10 Mb in size.'),
   );
 
 
@@ -29,7 +43,8 @@ $form['nBLAST']['UPLOAD'] = array(
 
 $form['DB'] = array(
   '#type' => 'fieldset',
-  '#title' => t('BLAST Assembled KnowPulse Genomes'),
+  '#title' => t('Choose Search Set'),
+  '#description' => t('Choose from one of the nucleotide BLAST databases listed below. You can also use the browse button to upload a file from your local disk. The file may contain a single sequence or a list of sequences. '),
   '#collapsible' => TRUE, 
   '#collapsed' => FALSE,  
 );
@@ -37,7 +52,7 @@ $form['DB'] = array(
 $options = _DB_options();
 $form['DB']['SELECT_DB'] = array(
  '#type' => 'select',
- '#title' => t('KnowPulse Databases:'),
+ '#title' => t('Nucleotide BLAST Databases:'),
  '#options' => $options,
  '#default_value' => t('Select a database'),
 );
@@ -47,7 +62,7 @@ $form['#attributes']['enctype'] = 'multipart/form-data';
 $form['DB']['DBUPLOAD'] = array(
    '#prefix' => 'Or upload your own dataset:	',
   	'#type' => 'file',
-  	'#description' => t('Please give a text or a FASTA file, not a MS-Word or other document, you can upload up to 10 Mb.'),
+  	'#description' => t('The file should be a plain-text FASTA file and not a .doc, .docx, etc. It cannot be greater than 10 Mb in size.'),
   );
   
 //Algorithm parameters
@@ -93,11 +108,11 @@ $form['ALG']['GParam']['shortQueries'] = array(
 	
 $form['ALG']['GParam']['eVal'] = array(
   '#type' => 'textfield', 
-  '#title' => t('Expect threshold'), 
+  '#title' => t('e-Value (Expected Threshold)'), 
   '#default_value' => 10, 
   '#size' => 12, 
   '#maxlength' => 20, 
-  '#description' => t('Expected number of chance matches in a random model.'),
+  '#description' => t('Expected number of chance matches in a random model. This number should be give in a decimal format. <a href="http://www.ncbi.nlm.nih.gov/BLAST/blastcgihelp.shtml#expect" target="_blank">More Information</a> | <a href="https://www.youtube.com/watch?v=nO0wJgZRZJs" target="_blank">Expect value vedio tutorial</a>'),
 );
 	
 $form['ALG']['GParam']['wordSize'] = array(
@@ -176,13 +191,20 @@ $form['ALG']['SParam']['M&MScores'] = array(
   return $form;
 }
 
+/**
+ * Form validation handler for blast_nucleotide_form().
+ *
+ * @see blast_nucleotide_form_validate()
+ */
 function blast_nucleotide_form_validate($form, &$form_state) {
    $fastaSeq = $form_state['input']['FASTA'];
    if (isset($fastaSeq)) {
       if(_validateFasta($fastaSeq)){
           form_set_error('nBLAST', t('Error: Failed to read the Blast query: Wrong format provided for FASTA nucleotide sequence'));
       } else {
-         $form_state['flag'] = 'seqQuery';
+	//$seq_filename = "/tmp/user__query_file.fasta";
+	//file_put_contents ( $seq_filename , $fastaSeq);
+        $form_state['qFlag'] = 'seqQuery';
       }  
    }
    $upQuery = file_save_upload('UPLOAD', array('file_validate_extensions' => array('txt fasta fa fna')), FILE_EXISTS_RENAME);
@@ -213,8 +235,13 @@ function blast_nucleotide_form_validate($form, &$form_state) {
       
 }
 
+/**
+ * Form submition handler for blast_nucleotide_form().
+ *
+ * @see blast_nucleotide_form_submit()
+ */
 function blast_nucleotide_form_submit($form, &$form_state) {  
-  exec("export BLASTDB=<>"); 
+  exec("export BLASTDB=/home/Sequences/blast_dbs/"); 
   $eVal = $form_state['values']['eVal'];
   
   $trgtKey = $form_state['values']['maxTarget'];
@@ -285,7 +312,9 @@ function blast_nucleotide_form_submit($form, &$form_state) {
   
   if ( isset($form_state['qFlag']) ) {
      if ( $form_state['qFlag'] == 'seqQuery' ) {
-        $query = $form_state['values']['FASTA'];
+        $seq_content = $form_state['values']['FASTA'];
+	$query = "/tmp/user__query_file.fasta";
+        file_put_contents ( $query , $seq_content);
      } elseif ( $form_state['qFlag'] == 'upQuery' ) {
         $query = $form_state['upQuery_path'];
      }
@@ -294,17 +323,37 @@ function blast_nucleotide_form_submit($form, &$form_state) {
   if ( $form_state['dbFlag'] == 'upQuery') {
      $subjectSeq = $form_state['upDB_path'];
      $subSeqOut = drupal_basename($form_state['upDB_path']) . rand(0, 10000);
-     $blast_query_cmd = "blastn -query $query -subject $subjectSeq -out /tmp/$subSeqOut.blastn.html -evalue $eVal -word_size $wordSize -gapopen $gapOpen -gapextend $gapExtend -penalty $penalty -reward $reward -num_alignments 100 -html";
-     system($blast_query_cmd);
+     $blast_subj_cmd = "blastn -query $query -subject $subjectSeq -out sites/default/files/$subSeqOut.blastn.html -evalue $eVal -word_size $wordSize -gapopen $gapOpen -gapextend $gapExtend -penalty $penalty -reward $reward -num_alignments 100 -html";
+     system($blast_subj_cmd);
   } elseif ($form_state['dbFlag'] == 'blastdb') {
      $selected_db = $form_state['values']['SELECT_DB'];
-     $blastdb = $form['DB']['SELECT_DB']['#options'][$selected_db];
-     $subSeqOut = drupal_basename($form_state['upQuery_path']). rand(0, 10000);
-     $blast_db_cmd = "blastn -task blastn -query $query -db /$blastdb -out /tmp/$subSeqOut.blastn.html -evalue $eVal -word_size $wordSize -gapopen $gapOpen -gapextend $gapExtend -penalty $penalty -reward $reward -num_alignments 100 -html";
-     system($blast_cmd); 
+     $blastdb_node = node_load($selected_db);
+     $blastdb_path = $blastdb_node->db_path;     
+     $blastdb_human_name = $form['DB']['SELECT_DB']['#options'][$selected_db];
+     $subSeqOut = $blastdb_human_name . rand(0, 10000);
+     $blast_db_cmd = "blastn -task blastn -query $query -db sites/default/files/$blastdb_path -out sites/default/files/$subSeqOut.blastn.html -evalue $eVal -word_size $wordSize -gapopen $gapOpen -gapextend $gapExtend -penalty $penalty -reward $reward -num_alignments 100 -html";
+     system($blast_db_cmd,$input);
   }
+
+  $path = "$subSeqOut.blastn.html";
+  drupal_goto("blast/report/$path");
 }
 
+
+/**
+ * FASTA validating parser
+ *
+ * @param $sequence 
+ *  A string of characters to be validated. A sequence in FASTA format begins with a single-line description, followed by lines of sequence data. 
+ *  The description line is distinguished from the sequence data by a greater-than (">") symbol in the first column. 
+ *  The word following the ">" symbol is the identifier of the sequence, and the rest of the line is the description (both are optional). 
+ *  There should be no space between the ">" and the first letter of the identifier. The sequence ends if another line starting with a ">" appears; 
+ *  this indicates the start of another sequence.
+ *
+ * @return
+ *  Return a boolean. 1 if the sequence does not pass the format valifation stage and 0 otherwise.   
+ *
+ */
 function _validateFasta($sequence) {
 	$fastaIdRegEx = '/^>.*(\\n|\\r)/';
 	$fastaSeqRegEx = '/[^acgntuACGNTU\n\r]/';
@@ -317,8 +366,15 @@ function _validateFasta($sequence) {
   return $flag;
 }
 
-function _DB_options() {
 
+/**
+ * Load the preexisting blast databases 
+ *
+ * @return
+ *  Return human readble names of the preexisting blast databases   
+ *
+ */
+function _DB_options() {
    $type = 'blastdb';
    $nodes  = node_load_multiple(array(), array('type'=> $type));
 
@@ -327,6 +383,5 @@ function _DB_options() {
          $options[$node->nid] = $node->db_name;
       }     
    }
-   
    return $options;
 }

+ 91 - 61
blast_ui/includes/blast_ui.blastp.inc → includes/blast_ui.blastp.inc

@@ -26,14 +26,6 @@ $form['pBLAST']['FASTA'] = array(
   	'#description' => t('Please give a text file, not a MS-Word or other document, you can upload up to 10 Mb.'),
   );
 
-//// Job title 
-//  $form ['pBLAST']['JOB_ID'] = array(
-//    '#type' => 'textfield',
-//    '#title' => t('Job title'),
-//    '#suffix' => t('Enter a descriptive title for your pairwise alignment'),
-//  );
-
-
 //DATABASE//
 
 	$form['DB'] = array(
@@ -57,7 +49,7 @@ $form['pBLAST']['FASTA'] = array(
   
 // Upload a file as an alternative to enter a query sequence 
   $form['#attributes']['enctype'] = 'multipart/form-data';
-  $form['DB']['UPLOAD'] = array(
+  $form['DB']['DBUPLOAD'] = array(
   	'#prefix' => 'Or upload your own dataset:	',
   	'#type' => 'file',
   	'#description' => t('Please give a text file, not a MS-Word or other document, you can upload up to 10 Mb.'),
@@ -104,16 +96,16 @@ $form['pBLAST']['FASTA'] = array(
    '#default_value' => TRUE,
 );
 	
-	$form['ALG']['GParam']['eVal'] = array(
-  '#type' => 'textfield', 
-  '#title' => t('Expect threshold'), 
-  '#default_value' => 10, 
-  '#size' => 12, 
-  '#maxlength' => 20, 
-  '#description' => t('Expected number of chance matches in a random model.'),
+   $form['ALG']['GParam']['eVal'] = array(
+  	'#type' => 'textfield', 
+  	'#title' => t('Expect threshold'), 
+  	'#default_value' => 10, 
+  	'#size' => 12, 
+  	'#maxlength' => 20, 
+  	'#description' => t('Expected number of chance matches in a random model.'),
 );
 	
-	 $form['ALG']['GParam']['wordSize'] = array(
+   $form['ALG']['GParam']['wordSize'] = array(
        '#type' => 'select',
        '#title' => t('Word size:'),
        '#options' => array(
@@ -204,63 +196,98 @@ function _ajax_example_get_first_dropdown_options() {
 function _ajax_example_get_second_dropdown_options($key = '') {
   $options = array(
     t('PAM30') => drupal_map_assoc(array(
-      t('Extension: 15 Extension: 3'),
-      t('Extension: 14 Extension: 3'),
-      t('Extension: 13 Extension: 3'),
-      t('Extension: 12 Extension: 3'),
-      t('Extension: 11 Extension: 3'),
-      t('Extension: 17 Extension: 2'),
-      t('Extension: 16 Extension: 2'), 
-      t('Extension: 15 Extension: 2'),
-      t('Extension: 14 Extension: 2'),
-      t('Extension: 13 Extension: 2'),
-      t('Extension: 21 Extension: 1'),
-      t('Extension: 20 Extension: 1'),
-      t('Extension: 19 Extension: 1'),
-      t('Extension: 18 Extension: 1'),
-      t('Extension: 17 Extension: 1'),
-    )),
+      t('Existence: 7 Extension: 2'),
+      t('Existence: 6 Extension: 2'),
+      t('Existence: 5 Extension: 2'),
+      t('Existence: 10 Extension: 1'),
+      t('Existence: 9 Extension: 1'),
+      t('Existence: 8 Extension: 1'),
+     )),
     t('PAM70') => drupal_map_assoc(array(
-      t('Flute'),
-      t('Clarinet'),
-      t('Oboe'),
-      t('Bassoon'),
+      t('Existence: 8 Extension: 2'),
+      t('Existence: 7 Extension: 2'),
+      t('Existence: 6 Extension: 2'),
+      t('Existence: 11 Extension: 1'),
+      t('Existence: 10 Extension: 1'),
+      t('Existence: 9 Extension: 1'),
     )),
     t('PAM250') => drupal_map_assoc(array(
-      t('Trumpet'),
-      t('Trombone'),
-      t('French Horn'),
-      t('Euphonium'),
+      t('Existence: 15 Extension: 3'),
+      t('Existence: 14 Extension: 3'),
+      t('Existence: 13 Extension: 3'),
+      t('Existence: 12 Extension: 3'),
+      t('Existence: 11 Extension: 3'),
+      t('Existence: 17 Extension: 2'),
+      t('Existence: 16 Extension: 2'),
+      t('Existence: 15 Extension: 2'),
+      t('Existence: 14 Extension: 2'),
+      t('Existence: 13 Extension: 2'),
+      t('Existence: 21 Extension: 1'),
+      t('Existence: 20 Extension: 1'),
+      t('Existence: 19 Extension: 1'),
+      t('Existence: 18 Extension: 1'),
+      t('Existence: 17 Extension: 1'),
     )),
     t('BLOSUM80') => drupal_map_assoc(array(
-      t('Bass Drum'),
-      t('Timpani'),
-      t('Snare Drum'),
-      t('Tambourine'),
+      t('Existence: 8 Extension: 2'),
+      t('Existence: 7 Extension: 2'),
+      t('Existence: 6 Extension: 2'),
+      t('Existence: 11 Extension: 1'),
+      t('Existence: 10 Extension: 1'),
+      t('Existence: 9 Extension: 1'),
     )),
     t('BLOSUM62') => drupal_map_assoc(array(
-      t('Bass Drum'),
-      t('Timpani'),
-      t('Snare Drum'),
-      t('Tambourine'),
+      t('Existence: 11 Extension: 2'),
+      t('Existence: 10 Extension: 2'),
+      t('Existence: 9 Extension: 2'),
+      t('Existence: 8 Extension: 2'),
+      t('Existence: 7 Extension: 2'),
+      t('Existence: 6 Extension: 2'),
+      t('Existence: 13 Extension: 1'),
+      t('Existence: 12 Extension: 1'),
+      t('Existence: 11 Extension: 1'),
+      t('Existence: 10 Extension: 1'),
+      t('Existence: 9 Extension: 1'),
     )),
     t('BLOSUM45') => drupal_map_assoc(array(
-      t('Bass Drum'),
-      t('Timpani'),
-      t('Snare Drum'),
-      t('Tambourine'),
+      t('Existence: 13 Extension: 3'),
+      t('Existence: 12 Extension: 3'),
+      t('Existence: 11 Extension: 3'),
+      t('Existence: 10 Extension: 3'),
+      t('Existence: 15 Extension: 2'),
+      t('Existence: 14 Extension: 2'),
+      t('Existence: 13 Extension: 2'),
+      t('Existence: 12 Extension: 2'),
+      t('Existence: 19 Extension: 1'),
+      t('Existence: 18 Extension: 1'),
+      t('Existence: 17 Extension: 1'),
+      t('Existence: 16 Extension: 1'),
     )),
     t('BLOSUM50') => drupal_map_assoc(array(
-      t('Bass Drum'),
-      t('Timpani'),
-      t('Snare Drum'),
-      t('Tambourine'),
+      t('Existence: 13 Extension: 3'),
+      t('Existence: 12 Extension: 3'),
+      t('Existence: 11 Extension: 3'),
+      t('Existence: 10 Extension: 3'),
+      t('Existence: 9 Extension: 3'),
+      t('Existence: 16 Extension: 2'),
+      t('Existence: 15 Extension: 2'),
+      t('Existence: 14 Extension: 2'),
+      t('Existence: 13 Extension: 2'),
+      t('Existence: 12 Extension: 2'),
+      t('Existence: 19 Extension: 1'),
+      t('Existence: 18 Extension: 1'),
+      t('Existence: 17 Extension: 1'),
+      t('Existence: 16 Extension: 1'),
+      t('Existence: 15 Extension: 1'),
     )),
     t('BLOSUM90') => drupal_map_assoc(array(
-      t('Bass Drum'),
-      t('Timpani'),
-      t('Snare Drum'),
-      t('Tambourine'),
+      t('Existence: 9 Extension: 2'),
+      t('Existence: 8 Extension: 2'),
+      t('Existence: 7 Extension: 2'),
+      t('Existence: 6 Extension: 2'),
+      t('Existence: 11 Extension: 1'),
+      t('Existence: 10 Extension: 1'),
+      t('Existence: 9 Extension: 1'),
     )),
     );
     if (isset($options[$key])) {
@@ -273,3 +300,6 @@ function _ajax_example_get_second_dropdown_options($key = '') {
 function ajax_example_dependent_dropdown_callback($form, $form_state) {
   return $form['ALG']['SParam']['gapCost'];
 }
+
+
+

+ 61 - 15
blast_ui/includes/blast_ui.node.inc → includes/blast_ui.node.inc

@@ -1,10 +1,16 @@
-<?php
+x<?php
 
 /**
  * @file
  * Contains all functions for creating the blastdb node type
  */
 
+
+/**
+ *
+ * Implements hook_node_info()
+ * 
+ */
 function blast_ui_node_info() {
   return array(
     'blastdb' => array(
@@ -48,33 +54,39 @@ function blastdb_node_access($node, $op, $account) {
   }
 }
 
+/**
+ * Form constructor for the blastdb node
+ *
+ * @see blastdb_insert()
+ * @see blastdb_update()
+ * @see blastdb_delete()
+ * @see blastdb_load()
+ *
+ */
 function blastdb_form($node, &$form_state) {
   $form = array();
   
   $form['db_name']= array(
     '#type' => 'textfield',
-    '#title' => t('File Name'),
+    '#title' => t('Human-readable Name for Blast database'),
     '#required' => TRUE,
     '#default_value' => isset($node->db_name) ? $node->db_name : '',
   );
   $form['db_path']= array(
     '#type' => 'textfield',
-    '#title' => t('File Address'),
+    '#title' => t('File Name'),
     '#required' => TRUE,
     '#default_value' => isset($node->db_path) ? $node->db_path : '',
   );
-//  $form['#attributes']['enctype'] = 'multipart/form-data';
-//  $form['db_path'] = array(
-//  	'#prefix' => 'Upload the file you wish to convert to a Blast db file',
-//  	'#type' => 'file',
-//  	'#description' => t('Please give a text or a FASTA file, not a MS-Word or other document, you can upload up to 10 Mb.'),
-//  );
-
-  
 
   return $form;
 }
 
+/**
+*
+* Implements hook_insert()
+*                                                                                                            
+*/
 function blastdb_insert($node) {
  
   db_insert('blastdb')->fields(array(
@@ -82,22 +94,55 @@ function blastdb_insert($node) {
     'name' => $node->db_name,
     'path' => $node->db_path,
   ))->execute();
-  
-//  exec("makeblastdb -in $node->db_path -dbtype nucl -out $node->db_name");
-  
+
+}
+
+/**
+ * Implements hook_node_insert().
+ * This function acts on ALL NODES
+ */
+function blastdb_node_insert($node) {
+  if ($node->type == 'blastdb') {
+  }
 }
 
+/**
+*
+* Implements hook_update()
+*                                                                                                            
+*/
 function blastdb_update($node) {
+dpm($node, 'node in module-specific insert');
     db_update('blastdb')->fields(array(
     'name' => $node->db_name,
     'path' => $node->db_path,
   ))->condition('nid', $node->nid)->execute();
 }
 
+/**
+ * Implements hook_node_update().
+ * This	function acts on ALL NODES
+ */
+function blastdb_node_update($node) {
+  if ($node->type == 'blastdb')	    {
+
+  }
+}
+
+/**
+*
+* Implements hook_delete()
+*                                                                                                            
+*/
 function blastdb_delete($node) {
    db_delete('blastdb')->condition('nid',$node->nid)->execute();
 }
 
+/**
+*
+* Implements hook_load()
+*                                                                                                            
+*/
 function blastdb_load($nodes) {
     
   $result = db_query('SELECT nid, name, path FROM {blastdb} WHERE nid IN (:nids)', array(':nids' => array_keys($nodes)));
@@ -105,7 +150,8 @@ function blastdb_load($nodes) {
   foreach ($result as $record) {
     $nodes[$record->nid]->db_name = $record->name;
     $nodes[$record->nid]->db_path = $record->path;
+    $nodes[$record->nid]->title = $record->name;
   }
-   
+
 }