Browse Source

Working on updating feature module to Drupal 7x.

spficklin 11 years ago
parent
commit
5d898e12aa

+ 0 - 177
tripal_feature/includes/indexFeatures.inc

@@ -1,177 +0,0 @@
-<?php
-/**
- * @file
- * @todo Add file header description
- */
-
-
-// This script can be run as a stand-alone script to sync all the features from chado to drupal
-//
-// To index a single feature
-// -i feature_id
-// -n node_id
-//
-// To index all features
-// -i 0
-
-$arguments = getopt("i:n:");
-
-if (isset($arguments['i'])) {
-  $drupal_base_url = parse_url('http://www.example.com');
-  $_SERVER['HTTP_HOST'] = $drupal_base_url['host'];
-  $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] = $_SERVER['PHP_SELF'];
-  $_SERVER['REMOTE_ADDR'] = NULL;
-  $_SERVER['REQUEST_METHOD'] = NULL;
-
-  require_once 'includes/bootstrap.inc';
-  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
-
-  $feature_id = $arguments['i'];
-  $nid        = $arguments['n'];
-
-  # print "\n";
-  # print "feature id is $feature_id\n";
-  # print "nid is $nid\n";
-  # print "\n";
-
-  if ($feature_id > 0) {
-    # print "indexing feature $feature_id\n";
-   // We register a shutdown function to ensure that the nodes
-   // that are indexed will have proper entries in the search_totals
-   // table.  Without these entries, the searching doesn't work
-   // properly. This function may run for quite a while since
-   // it must calculate the sum of the scores of all entries in
-   // the search_index table.  In the case of common words like
-   // 'contig', this will take quite a while
-    register_shutdown_function('search_update_totals');
-    tripal_feature_index_feature($feature_id, $nid);
-  }
-  else{
-    print "indexing all features...\n";
-    tripal_features_reindex(0);
-  }
-
-}
-
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_features_reindex($max_sync, $job_id = NULL) {
-  $i = 0;
-
-  // We register a shutdown function to ensure that the nodes
-  // that are indexed will have proper entries in the search_totals
-  // table.  Without these entries, the searching doesn't work
-  // properly. This function may run for quite a while since
-  // it must calculate the sum of the scores of all entries in
-  // the search_index table.  In the case of common words like
-  // 'contig', this will take quite a while
-  register_shutdown_function('search_update_totals');
-
-  // use this SQL statement to get the features that we're going to index. This
-  // SQL statement is derived from the hook_search function in the Drupal API.
-  // Essentially, this is the SQL statement that finds all nodes that need
-  // reindexing, but adjusted to include the chado_feature
-  $sql = "SELECT N.nid, N.title, CF.feature_id " .
-         "FROM {node} N " .
-         "  INNER JOIN {chado_feature} CF ON CF.nid = N.nid ";
-  $results = db_query($sql);
-
-  // load into ids array
-  $count = 0;
-  $chado_features = array();
-  while ($chado_feature = db_fetch_object($results)) {
-    $chado_features[$count] = $chado_feature;
-    $count++;
-  }
-
-  // Iterate through features that need to be indexed
-  $interval = intval($count * 0.01);
-  if ($interval >= 0) {
-    $interval = 1;
-  }
-  foreach ($chado_features as $chado_feature) {
-
-    // update the job status every 1% features
-    if ($job_id and $i % $interval == 0) {
-      $prog = intval(($i/$count)*100);
-      tripal_job_set_progress($job_id, $prog);
-      print "$prog%\n";
-    }
-
-    // sync only the max requested
-    if ($max_sync and $i == $max_sync) {
-      return '';
-    }
-    $i++;
-
-  /**
-    * tripal_feature_index_feature ($chado_feature->feature_id,$chado_feature->nid);
-    * parsing all the features can cause memory overruns
-    * we are not sure why PHP does not clean up the memory as it goes
-    * to avoid this problem we will call this script through an
-    * independent system call
-    */
-
-    $cmd = "php " . drupal_get_path('module', 'tripal_feature') . "/indexFeatures.php ";
-    $cmd .= "-i $chado_feature->feature_id -n $chado_feature->nid ";
-
-    # print "\t$cmd\n";
-    # print "\tfeature id is $chado_feature->feature_id\n";
-    # print "\tnid is $chado_feature->nid\n";
-    # print "\n";
-
-    system($cmd);
-    }
-
-  return '';
-}
-
-/**
- *
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_index_feature($feature_id, $nid) {
-  #print "\tfeature $feature_id nid $nid\n";
-  // return if we haven't been provided with a feature_id
-  if (!$feature_id) {
-    return 0;
-  }
-
-  // if we only have a feature_id then let's find a corresponding
-  // node.  If we can't find a node then return.
-  if (!$nid) {
-    $nsql = "SELECT N.nid,N.title FROM {chado_feature} CF " .
-            "  INNER JOIN {node} N ON N.nid = CF.nid " .
-            "WHERE CF.feature_id = %d";
-    $node = db_fetch_object(db_query($nsql, $feature_id));
-    if (!$node) {
-      return 0;
-    }
-    $node = node_load($node->nid);
-  }
-  else {
-    $node = node_load($nid);
-  }
-
-  // node load the noad, the comments and the taxonomy and
-  // index
-  $node->build_mode = NODE_BUILD_SEARCH_INDEX;
-  $node = node_build_content($node, FALSE, FALSE);
-  $node->body = drupal_render($node->content);
-  node_invoke_nodeapi($node, 'view', FALSE, FALSE);
-  //   $node->body .= module_invoke('comment', 'nodeapi', $node, 'update index');
-  //   $node->body .= module_invoke('taxonomy','nodeapi', $node, 'update index');
-  //   print "$node->title: $node->body\n";
-  search_index($node->nid, 'node', $node->body);
-
-  # $mem = memory_get_usage(TRUE);
-  # $mb = $mem/1048576;
-  # print "$mb mb\n";
-
-  return 1;
-}
-

+ 3 - 3
tripal_feature/includes/seq_extract.inc

@@ -20,11 +20,11 @@ function tripal_feature_seq_extract_page() {
     unset($_SESSION['tripal_feature_seq_extract']['download']);
      
     if ($format == 'fasta_html') {
-      drupal_set_header('Content-Type: text/html');
+      drupal_add_http_header('Content-Type: text/html');
     }
     else {
-      drupal_set_header('Content-Type: text');
-      drupal_set_header('Content-Disposition: attachment; filename="sequences.fasta.txt"');
+      drupal_add_http_header('Content-Type: text');
+      drupal_add_http_header('Content-Disposition: attachment; filename="sequences.fasta.txt"');
     }
     
     tripal_feature_seq_extract_get_features(NULL, $genus, $species, $analysis, 

+ 8 - 8
tripal_feature/includes/tripal_feature.admin.inc

@@ -677,8 +677,8 @@ function tripal_feature_set_vocabulary() {
        'required' => 0,
        'weight' => 1,
     );
-    drupal_execute('taxonomy_form_vocabulary', $form_state, $values);
-    drupal_execute('taxonomy_form_vocabulary', $form_state);
+    drupal_form_submit('taxonomy_form_vocabulary', $form_state, $values);
+    drupal_form_submit('taxonomy_form_vocabulary', $form_state);
   }
 
   if (!$op_vid) {
@@ -695,8 +695,8 @@ function tripal_feature_set_vocabulary() {
        'required' => 0,
        'weight' => 2,
     );
-    drupal_execute('taxonomy_form_vocabulary', $form_state, $values);
-    drupal_execute('taxonomy_form_vocabulary', $form_state);
+    drupal_form_submit('taxonomy_form_vocabulary', $form_state, $values);
+    drupal_form_submit('taxonomy_form_vocabulary', $form_state);
   }
 
   if (!$lb_vid) {
@@ -713,8 +713,8 @@ function tripal_feature_set_vocabulary() {
        'required' => 0,
        'weight' => 3,
     );
-    drupal_execute('taxonomy_form_vocabulary', $form_state, $values);
-    drupal_execute('taxonomy_form_vocabulary', $form_state);
+    drupal_form_submit('taxonomy_form_vocabulary', $form_state, $values);
+    drupal_form_submit('taxonomy_form_vocabulary', $form_state);
   }
 
   if (!$an_vid) {
@@ -731,7 +731,7 @@ function tripal_feature_set_vocabulary() {
        'required' => 0,
        'weight' => 4,
     );
-    drupal_execute('taxonomy_form_vocabulary', $form_state, $values);
-    drupal_execute('taxonomy_form_vocabulary', $form_state);
+    drupal_form_submit('taxonomy_form_vocabulary', $form_state, $values);
+    drupal_form_submit('taxonomy_form_vocabulary', $form_state);
   }
 }

+ 0 - 35
tripal_feature/tripal_feature.install

@@ -13,43 +13,10 @@ function tripal_feature_install() {
   // create the module's data directory
   tripal_create_moddir('tripal_feature');
 
-  // create the tables that correlate drupal nodes with chado
-  // features, organisms, etc....
-  drupal_install_schema('tripal_feature');
-
   // add the materialized view
   tripal_feature_add_organism_count_mview();
 
 }
-/**
- *  Update for Drupal 6.x, Tripal 0.2b, Feature Module 0.2
- *  This update adjusts the materialized view by adding a 'cvterm_id' column
- *
- * @ingroup tripal_feature
- */
-function tripal_feature_update_6000() {
-  // recreate the materialized view
-  tripal_feature_add_organism_count_mview();
-  $ret = array(
-    '#finished' => 1,
-  );
-
-  return $ret;
-}
-
-/**
- *
- * @ingroup tripal_feature
- */
-/*
-function tripal_feature_update_6300() {
-  // add the relationship aggregator table to the database
-  $schema = tripal_feature_get_schemas('tripal_feature_relagg');
-  $ret = array();
-  db_create_table($ret, 'tripal_feature_relagg', $schema['tripal_feature_relagg']);
-
-  return $ret;
-} */
 /**
  *
  * @ingroup tripal_feature
@@ -121,8 +88,6 @@ function tripal_feature_uninstall() {
     tripal_mviews_action("delete", $mview_id);
   }
 
-  drupal_uninstall_schema('tripal_feature');
-
   // Get the list of nodes to remove
   $sql_feature_id = "SELECT nid, vid " .
                "FROM {node} " .

+ 203 - 219
tripal_feature/tripal_feature.module

@@ -15,7 +15,6 @@
 
 require_once "includes/tripal_feature.admin.inc";
 require_once "includes/tripal_feature.sync_features.inc";
-require_once "includes/indexFeatures.inc";
 require_once "includes/fasta_loader.inc";
 require_once "includes/gff_loader.inc";
 require_once "includes/seq_extract.inc";
@@ -87,14 +86,14 @@ function tripal_feature_node_info() {
   $nodes = array();
 
   $nodes['chado_feature'] = array(
-    'name' => t('Feature'),
-    'module' => 'chado_feature',
+    'name'        => t('Feature'),
+    'base'        => 'chado_feature',
     'description' => t('A feature from the chado database'),
-    'has_title' => FALSE,
+    'has_title'   => FALSE,
     'title_label' => t('Feature'),
-    'has_body' => FALSE,
-    'body_label' => t('Feature Description'),
-    'locked' => TRUE
+    'has_body'    => FALSE,
+    'body_label'  => t('Feature Description'),
+    'locked'      => TRUE
   );
   return $nodes;
 }
@@ -106,13 +105,28 @@ function tripal_feature_node_info() {
  *
  * @ingroup tripal_feature
  */
-function tripal_feature_perm() {
+function tripal_feature_permissions() {
   return array(
-    'access chado_feature content',
-    'create chado_feature content',
-    'delete chado_feature content',
-    'edit chado_feature content',
-    'administer tripal features',
+    'access chado_feature content' => array(
+      'title' => t('View Features'),
+      'description' => t('Allow users to view feature pages.'),
+    ),
+    'create chado_feature content' => array(
+      'title' => t('Create Features'),
+      'description' => t('Allow users to create new feature pages.'),
+    ),
+    'delete chado_feature content' => array(
+      'title' => t('Delete Features'),
+      'description' => t('Allow users to delete feature pages.'),
+    ),
+    'edit chado_feature content' => array(
+      'title' => t('Edit Features'),
+      'description' => t('Allow users to edit feature pages.'),
+    ),
+    'adminster tripal feature' => array(
+      'title' => t('Administer Features'),
+      'description' => t('Allow users to administer all features.'),
+    ),
   );
 }
 
@@ -121,12 +135,12 @@ function tripal_feature_perm() {
  *
  * This hook allows node modules to limit access to the node types they define.
  *
- *  @param $op
- *  The operation to be performed
- *
  *  @param $node
  *  The node on which the operation is to be performed, or, if it does not yet exist, the
  *  type of node to be created
+ *  
+ *  @param $op
+ *  The operation to be performed
  *
  *  @param $account
  *  A user object representing the user for whom the operation is to be performed
@@ -139,7 +153,7 @@ function tripal_feature_perm() {
  *  
  * @ingroup tripal_feature
  */
-function chado_feature_access($op, $node, $account) {
+function chado_feature_node_access($node, $op, $account) {
   if ($op == 'create') {
     if (!user_access('create chado_feature content', $account)) {
       return FALSE;
@@ -344,108 +358,111 @@ function tripal_feature_theme() {
  *
  * @ingroup tripal_feature
  */
-function tripal_feature_block($op = 'list', $delta = 0, $edit=array()) {
-  switch ($op) {
-    case 'list':
-      $blocks['references']['info'] = t('Tripal Feature References');
-      $blocks['references']['cache'] = BLOCK_NO_CACHE;
-
-      $blocks['base']['info'] = t('Tripal Feature Details');
-      $blocks['base']['cache'] = BLOCK_NO_CACHE;
-
-      $blocks['sequence']['info'] = t('Tripal Feature Sequence');
-      $blocks['sequence']['cache'] = BLOCK_NO_CACHE;
-
-      $blocks['featureloc_sequences']['info'] = t('Tripal Feature Annotated Sequence');
-      $blocks['featureloc_sequences']['cache'] = BLOCK_NO_CACHE;
-
-      $blocks['synonyms']['info'] = t('Tripal Feature Synonyms');
-      $blocks['synonyms']['cache'] = BLOCK_NO_CACHE;
-
-      $blocks['properties']['info'] = t('Tripal Feature Properties');
-      $blocks['properties']['cache'] = BLOCK_NO_CACHE;;
-
-      $blocks['terms']['info'] = t('Tripal Annotated Terms');
-      $blocks['terms']['cache'] = BLOCK_NO_CACHE;;
-
-      $blocks['alignments']['info'] = t('Tripal Feature Alignments');
-      $blocks['alignments']['cache'] = BLOCK_NO_CACHE;
-
-      $blocks['relationships']['info'] = t('Tripal Feature Relationships');
-      $blocks['relationships']['cache'] = BLOCK_NO_CACHE;
-
-      $blocks['org_feature_counts']['info'] = t('Tripal Organism Feature Counts');
-      $blocks['org_feature_counts']['cache'] = BLOCK_NO_CACHE;
-
-      $blocks['org_feature_browser']['info'] = t('Tripal Organism Feature Browser');
-      $blocks['org_feature_browser']['cache'] = BLOCK_NO_CACHE;
-
-      return $blocks;
-
-  case 'view':
-    if (user_access('access chado_feature content') and arg(0) == 'node' and is_numeric(arg(1))) {
-      $nid = arg(1);
-      $node = node_load($nid);
-
-      $block = array();
-      switch ($delta) {
-        case 'references':
-          $block['subject'] = t('References');
-          $block['content'] = theme('tripal_feature_references', $node);
-          break;
-        case 'base':
-          $block['subject'] = t('Feature Details');
-          $block['content'] = theme('tripal_feature_base', $node);
-          break;
-        case 'synonyms':
-          $block['subject'] = t('Synonyms');
-          $block['content'] = theme('tripal_feature_synonyms', $node);
-          break;
-        case 'properties':
-          $block['subject'] = t('Properties');
-          $block['content'] = theme('tripal_feature_properties', $node);
-          break;
-        case 'terms':
-          $block['subject'] = t('Annotated Terms');
-          $block['content'] = theme('tripal_feature_terms', $node);
-          break;
-        case 'sequence':
-          $block['subject'] = t('Sequence');
-          $block['content'] = theme('tripal_feature_sequence', $node);
-          break;
-        case 'featureloc_sequences':
-          $block['subject'] = t('Formatted Sequences');
-          $block['content'] = theme('tripal_feature_featureloc_sequences', $node);
-          break;
-        case 'alignments':
-          $block['subject'] = t('Alignments');
-          $block['content'] = theme('tripal_feature_alignments', $node);
-          break;
-        case 'relationships':
-          $block['subject'] = t('Relationships');
-          $block['content'] = theme('tripal_feature_relationships', $node);
-          break;
-        case 'org_feature_counts':
-          $block['subject'] = t('Feature Type Summary');
-          $block['content'] = theme('tripal_organism_feature_counts', $node);
-          break;
-        case 'org_feature_browser':
-          $block['subject'] = t('Feature Browser');
-          $block['content'] = theme('tripal_organism_feature_browser', $node);
-          break;
-        case 'library_feature_browser':
-          $block['subject'] = t('Library Feature Browser');
-          $block['content'] = theme('tripal_library_feature_browser', $node);
-          break;
-        case 'analysis_feature_browser':
-          $block['subject'] = t('Analysis Feature Browser');
-          $block['content'] = theme('tripal_analysis_feature_browser', $node);
-          break;
-        default :
-      }
-      return $block;
-    }
+function tripal_feature_block_info() {
+
+  $blocks['references']['info'] = t('Tripal Feature References');
+  $blocks['references']['cache'] = BLOCK_NO_CACHE;
+
+  $blocks['base']['info'] = t('Tripal Feature Details');
+  $blocks['base']['cache'] = BLOCK_NO_CACHE;
+
+  $blocks['sequence']['info'] = t('Tripal Feature Sequence');
+  $blocks['sequence']['cache'] = BLOCK_NO_CACHE;
+
+  $blocks['featureloc_sequences']['info'] = t('Tripal Feature Annotated Sequence');
+  $blocks['featureloc_sequences']['cache'] = BLOCK_NO_CACHE;
+
+  $blocks['synonyms']['info'] = t('Tripal Feature Synonyms');
+  $blocks['synonyms']['cache'] = BLOCK_NO_CACHE;
+
+  $blocks['properties']['info'] = t('Tripal Feature Properties');
+  $blocks['properties']['cache'] = BLOCK_NO_CACHE;;
+
+  $blocks['terms']['info'] = t('Tripal Annotated Terms');
+  $blocks['terms']['cache'] = BLOCK_NO_CACHE;;
 
+  $blocks['alignments']['info'] = t('Tripal Feature Alignments');
+  $blocks['alignments']['cache'] = BLOCK_NO_CACHE;
+
+  $blocks['relationships']['info'] = t('Tripal Feature Relationships');
+  $blocks['relationships']['cache'] = BLOCK_NO_CACHE;
+
+  $blocks['org_feature_counts']['info'] = t('Tripal Organism Feature Counts');
+  $blocks['org_feature_counts']['cache'] = BLOCK_NO_CACHE;
+
+  $blocks['org_feature_browser']['info'] = t('Tripal Organism Feature Browser');
+  $blocks['org_feature_browser']['cache'] = BLOCK_NO_CACHE;
+
+  return $blocks;
+}
+/**
+ *
+ *
+ * @ingroup tripal_feature
+ */
+function tripal_feature_block_view($delta = '') {
+  
+  if (user_access('access chado_feature content') and arg(0) == 'node' and is_numeric(arg(1))) {
+    $nid = arg(1);
+    $node = node_load($nid);
+  
+    $block = array();
+    switch ($delta) {
+      case 'references':
+        $block['subject'] = t('References');
+        $block['content'] = theme('tripal_feature_references', $node);
+        break;
+      case 'base':
+        $block['subject'] = t('Feature Details');
+        $block['content'] = theme('tripal_feature_base', $node);
+        break;
+      case 'synonyms':
+        $block['subject'] = t('Synonyms');
+        $block['content'] = theme('tripal_feature_synonyms', $node);
+        break;
+      case 'properties':
+        $block['subject'] = t('Properties');
+        $block['content'] = theme('tripal_feature_properties', $node);
+        break;
+      case 'terms':
+        $block['subject'] = t('Annotated Terms');
+        $block['content'] = theme('tripal_feature_terms', $node);
+        break;
+      case 'sequence':
+        $block['subject'] = t('Sequence');
+        $block['content'] = theme('tripal_feature_sequence', $node);
+        break;
+      case 'featureloc_sequences':
+        $block['subject'] = t('Formatted Sequences');
+        $block['content'] = theme('tripal_feature_featureloc_sequences', $node);
+        break;
+      case 'alignments':
+        $block['subject'] = t('Alignments');
+        $block['content'] = theme('tripal_feature_alignments', $node);
+        break;
+      case 'relationships':
+        $block['subject'] = t('Relationships');
+        $block['content'] = theme('tripal_feature_relationships', $node);
+        break;
+      case 'org_feature_counts':
+        $block['subject'] = t('Feature Type Summary');
+        $block['content'] = theme('tripal_organism_feature_counts', $node);
+        break;
+      case 'org_feature_browser':
+        $block['subject'] = t('Feature Browser');
+        $block['content'] = theme('tripal_organism_feature_browser', $node);
+        break;
+      case 'library_feature_browser':
+        $block['subject'] = t('Library Feature Browser');
+        $block['content'] = theme('tripal_library_feature_browser', $node);
+        break;
+      case 'analysis_feature_browser':
+        $block['subject'] = t('Analysis Feature Browser');
+        $block['content'] = theme('tripal_analysis_feature_browser', $node);
+        break;
+      default :
+    }
+    return $block;
   }
 }
 /**
@@ -513,7 +530,7 @@ function chado_feature_insert($node) {
   if (!$node_check) {
     // next add the item to the drupal table
     $sql = "INSERT INTO {chado_feature} (nid, vid, feature_id, sync_date) " .
-           "VALUES (%d, %d, %d, " . time() . ")";
+           "VALUES (%d, %d, %d, " . REQUEST_TIME . ")";
       db_query($sql, $node->nid, $node->vid, $feature[0]->feature_id);
   }
 }
@@ -601,7 +618,7 @@ function chado_feature_delete($node) {
              "WHERE nid = %d " .
              "AND vid = %d";
   db_query($sql_del, $node->nid, $node->vid);
-  $sql_del = "DELETE FROM {node_revisions} " .
+  $sql_del = "DELETE FROM {node_revision} " .
              "WHERE nid = %d " .
              "AND vid = %d";
   db_query($sql_del, $node->nid, $node->vid);
@@ -746,7 +763,6 @@ function chado_feature_add_gbaccession($accession, $feature_id) {
  */
 function chado_feature_form($node, $param) {
 
-  $type = node_get_types('type', $node);
   $form = array();
 
   $feature = $node->feature;
@@ -1792,117 +1808,85 @@ function tripal_feature_color_sequence($sequence, $parts, $defline) {
 }
 
 /**
- *  This function customizes the view of the chado_feature node.  It allows
- *  us to generate the markup.
  *
  * @ingroup tripal_feature
  */
-function chado_feature_view($node, $teaser = FALSE, $page = FALSE) {
-
-  if (!$teaser) {
-    // use drupal's default node view:
-    $node = node_prepare($node, $teaser);
-
-    // if we're building the node for searching then
-    // we want to handle this within the module and
-    // not allow theme customization.  We don't want to
-    // index all items (such as DNA sequence).
-    if ($node->build_mode == NODE_BUILD_SEARCH_INDEX) {
-      $node->content['index_version'] = array(
-        '#value' => theme('tripal_feature_search_index', $node),
-        '#weight' => 1,
-      );
-    }
-    elseif ($node->build_mode == NODE_BUILD_SEARCH_RESULT) {
-      $node->content['index_version'] = array(
-        '#value' => theme('tripal_feature_search_results', $node),
-        '#weight' => 1,
-      );
-    }
-    else {
-       // do nothing here, let the theme derived template handle display
-    }
+function tripal_feature_node_presave($node) {
+  
+  // set the title to ensure it is always unique
+  switch ($node->type) {
+    case 'chado_feature':
+      
+      $values = array('organism_id' => $node->organism_id);
+      $organism = tripal_core_chado_select('organism', array('genus', 'species'), $values);
+      $node->title = $node->fname . ', ' . $node->uniquename . ' (' . $node->feature_type . ') ' . $organism[0]->genus . ' ' . $organism[0]->species;
+      break;
   }
-
-  return $node;
 }
 
 /**
- * Display feature information for associated organisms. This function also
- * provides contents for indexing
  *
  * @ingroup tripal_feature
  */
-function tripal_feature_nodeapi(&$node, $op, $teaser, $page) {
+function tripal_feature_node_insert($node) {
   
-  switch ($op) {
-    
-     // set the title to ensure it is always unique
-    case 'presave':
-      switch ($node->type) {
-        case 'chado_feature':
-          
-          $values = array('organism_id' => $node->organism_id);
-          $organism = tripal_core_chado_select('organism', array('genus', 'species'), $values);
-          $node->title = $node->fname . ', ' . $node->uniquename . ' (' . $node->feature_type . ') ' . $organism[0]->genus . ' ' . $organism[0]->species;
-          break;
+  // set the URL path after inserting.  We do it here because we do not 
+  // know the feature_id in the presave 
+  switch ($node->type) {
+    case 'chado_feature':
+      if (!$node->feature_id) {
+        $sql = "SELECT * FROM {chado_feature} WHERE nid = %d";
+        $chado_feature = db_fetch_object(db_query($sql, $node->nid));
+        $node->feature_id = $chado_feature->feature_id;
       }
-      break;
       
-    // set the URL path after inserting.  We do it here because we do not 
-    // know the feature_id in the presave  
-    case 'insert':
-      switch ($node->type) {
-        case 'chado_feature':
-          if (!$node->feature_id) {
-            $sql = "SELECT * FROM {chado_feature} WHERE nid = %d";
-            $chado_feature = db_fetch_object(db_query($sql, $node->nid));
-            $node->feature_id = $chado_feature->feature_id;
-          }
-
-          
-          // remove any previous alias
-          db_query("DELETE FROM {url_alias} WHERE src = '%s'", "node/$node->nid");
-          
-          // set the URL for this feature page
-          $url_alias = tripal_feature_get_feature_url($node);
-          path_set_alias("node/$node->nid", $url_alias);
-          break;
-      }
-      break;
+      // remove any previous alias
+      db_query("DELETE FROM {url_alias} WHERE src = '%s'", "node/$node->nid");
       
-    // set the URL path after inserting.  We do it here because we do not 
-    // know the feature_id in the presave  
-    case 'update':
-      switch ($node->type) {
-        case 'chado_feature':
-          
-          // remove any previous alias
-          db_query("DELETE FROM {url_alias} WHERE src = '%s'", "node/$node->nid");
-          
-          // set the URL for this feature page
-          $url_alias = tripal_feature_get_feature_url($node);
-          path_set_alias("node/$node->nid", $url_alias);
-          break;
-      }
+      // set the URL for this feature page
+      $url_alias = tripal_feature_get_feature_url($node);
+      path_set_alias("node/$node->nid", $url_alias);
       break;
+  }
+}
+/**
+ *
+ * @ingroup tripal_feature
+ */
+function tripal_feature_node_update($node) {
+  
+  // set the URL path after inserting.  We do it here because we do not 
+  // know the feature_id in the presave  
+  switch ($node->type) {
+    case 'chado_feature':
       
+      // remove any previous alias
+      db_query("DELETE FROM {url_alias} WHERE src = '%s'", "node/$node->nid");
       
-    // add items to other nodes, build index and search results
-    case 'view':
-      switch ($node->type) {
-        case 'chado_organism':
-        // Show feature browser
-          $types_to_show = array('chado_organism', 'chado_library');
-          if (in_array($node->type, $types_to_show, TRUE)) {
-            $node->content['tripal_organism_feature_counts'] = array(
-              '#value' => theme('tripal_organism_feature_counts', $node),
-            );
-            $node->content['tripal_organism_feature_browser'] = array(
-              '#value' => theme('tripal_organism_feature_browser', $node),
-            );
-          }
-        break;
+      // set the URL for this feature page
+      $url_alias = tripal_feature_get_feature_url($node);
+      path_set_alias("node/$node->nid", $url_alias);
+      break;
+  }
+}
+/**
+ *
+ * @ingroup tripal_feature
+ */
+function tripal_feature_node_update($node) { 
+  
+  // add items to other nodes, build index and search results
+  switch ($node->type) {
+    case 'chado_organism':
+      // Show feature browser
+      $types_to_show = array('chado_organism', 'chado_library');
+      if (in_array($node->type, $types_to_show, TRUE)) {
+        $node->content['tripal_organism_feature_counts'] = array(
+          '#value' => theme('tripal_organism_feature_counts', $node),
+        );
+        $node->content['tripal_organism_feature_browser'] = array(
+          '#value' => theme('tripal_organism_feature_browser', $node),
+        );
       }
     break;
   }
@@ -2159,16 +2143,16 @@ function tripal_feature_del_vocabulary() {
   // need to be installed for the taxonomy to work.
   foreach ($vocabularies as $vocab) {
     if ($vocab->name == 'Feature Type') {
-      taxonomy_del_vocabulary($vocab->vid);
+      taxonomy_vocabulary_delete($vocab->vid);
     }
     if ($vocab->name == 'Organism') {
-      taxonomy_del_vocabulary($vocab->vid);
+      taxonomy_vocabulary_delete($vocab->vid);
     }
     if ($vocab->name == 'Library') {
-      taxonomy_del_vocabulary($vocab->vid);
+      taxonomy_vocabulary_delete($vocab->vid);
     }
     if ($vocab->name == 'Analysis') {
-      taxonomy_del_vocabulary($vocab->vid);
+      taxonomy_vocabulary_delete($vocab->vid);
     }
   }