Browse Source

Added ability to add properties and DBxref's to featuremaps. Added featuremapprop and featuremap_dbxref tables to the featuremap installer

spficklin 11 years ago
parent
commit
18ea428353

+ 1 - 0
tripal_db/theme/tripal_db_admin.tpl.php

@@ -32,3 +32,4 @@
          </p></li>
 </ol>
 
+

+ 142 - 2
tripal_featuremap/api/tripal_featuremap.api.inc

@@ -1,5 +1,145 @@
 <?php
+
 /**
- * @file
- * @todo Add file header description
+ * Retrieve properties of a given type for a given featuremap
+ *
+ * @param $featuremap_id
+ *    The featuremap_id of the properties you would like to retrieve
+ * @param $property
+ *    The cvterm name of the properties to retrieve
+ *
+ * @return
+ *    An featuremap chado variable with the specified properties expanded
+ *
+ * @ingroup tripal_featuremap_api
  */
+function tripal_featuremap_get_property($featuremap_id, $property) {
+  return tripal_core_get_property('featuremap', $featuremap_id, $property, 'featuremap_property');
+}
+
+/**
+ * Insert a given property
+ *
+ * @param $featuremap_id
+ *   The featuremap_id of the property to insert
+ * @param $property
+ *   The cvterm name of the property to insert
+ * @param $value
+ *   The value of the property to insert
+ * @param $update_if_present
+ *   A boolean indicated whether to update the record if it's already present
+ *
+ * @return
+ *   True of success, False otherwise
+ *
+ * @ingroup tripal_featuremap_api
+ */
+function tripal_featuremap_insert_property($featuremap_id, $property, $value, $update_if_present = 0) {
+  return tripal_core_insert_property('featuremap', $featuremap_id, $property, 'featuremap_property', $value, $update_if_present);
+}
+
+/**
+ * Update a given property
+ *
+ * @param $featuremap_id
+ *   The featuremap_id of the property to update
+ * @param $property
+ *   The cvterm name of the property to update
+ * @param $value
+ *   The value of the property to update
+ * @param $insert_if_missing
+ *   A boolean indicated whether to insert the record if it's absent
+ *
+ * Note: The property will be identified using the unique combination of the $featuremap_id and $property
+ * and then it will be updated with the supplied value
+ *
+ * @return
+ *   True of success, False otherwise
+ *
+ * @ingroup tripal_featuremap_api
+ */
+function tripal_featuremap_update_property($featuremap_id, $property, $value, $insert_if_missing = 0) {
+  return tripal_core_update_property('featuremap', $featuremap_id, $property, 'featuremap_property', $value, $insert_if_missing);
+}
+/**
+ * Delete a given property
+ *
+ * @param $featuremap_id
+ *   The featuremap_id of the property to delete
+ * @param $property
+ *   The cvterm name of the property to delete
+ *
+ * Note: The property will be identified using the unique combination of the $featuremap_id and $property
+ * and then it will be deleted
+ *
+ * @return
+ *   True of success, False otherwise
+ *
+ * @ingroup tripal_featuremap_api
+ */
+function tripal_featuremap_delete_property($featuremap_id, $property) {
+  return tripal_core_delete_property('featuremap', $featuremap_id, $property, 'featuremap_property');
+}
+
+/*
+ *
+ */
+function tripal_featuremap_add_featuremap_dbxref($featuremap_id, $featuremap_dbxref) {
+
+  // break apart the dbxref
+  $dbname = '';
+  $accession = '';
+  if(preg_match('/^(.*?):(.*?)$/', $featuremap_dbxref, $matches)) {
+    $dbname = $matches[1];
+    $accession = $matches[2];
+  }
+  else {
+    return FALSE;
+  }
+
+  // check to see if the featuremap_dbxref record already exist
+  $values = array(
+    'dbxref_id' => array(
+      'accession' => $accession,
+      'db_id' => array(
+        'name' => $dbname,
+      ),
+    ),
+    'featuremap_id' => $featuremap_id,
+  );
+  $options = array('statement_name' => 'sel_featuremapdbxref_dbpu');
+  $results = tripal_core_chado_select('featuremap_dbxref', array('*'), $values, $options);
+
+  // if the featuremap_dbxref record  exist then we don't need to re-add it.
+  if(count($results) > 0) {
+    return $results[0];
+  }
+
+  // make sure our database already exists
+  $db = tripal_db_add_db($dbname);
+   
+  // get the database cross-reference
+  $dbxvalues = array(
+    'accession' => $accession,
+    'db_id' => $db->db_id,
+  );
+  $dbxoptions = array('statement_name' => 'sel_dbxref_acdb');
+  $results = tripal_core_chado_select('dbxref', array('dbxref_id'), $dbxvalues, $dbxoptions);
+  // if the accession doesn't exist then add it
+  if(count($results) == 0){
+    $dbxref = tripal_db_add_dbxref($db->db_id, $accession);
+  }
+  else {
+    $dbxref = $results[0];
+  }
+
+  // now add the record
+  $options = array('statement_name' => 'ins_featuremapdbxref_dbpu');
+  $results = tripal_core_chado_insert('featuremap_dbxref', $values, $options);
+  if (!$results) {
+    watchdog('t_featuremap', "Cannot add map dbxref: %db:%accession.",
+      array('%db' => $dbname, '%accession' => $accession). WATCHDOG_ERROR);
+    return FALSE;
+  }
+  return $results;
+}

+ 154 - 0
tripal_featuremap/tripal_featuremap.install

@@ -17,6 +17,9 @@ function tripal_featuremap_install() {
   // features, maps, etc....
   drupal_install_schema('tripal_featuremap');
   
+  // add the featuremapprop table to Chado
+  tripal_featuremap_add_custom_tables();
+  
   // Add cvterms
   tripal_featuremap_add_cvterms();
 
@@ -126,4 +129,155 @@ function tripal_featuremap_add_cvterms() {
      'tripal_featuremap', 0, 1, 'tripal');
    tripal_cv_add_cvterm(array('name' => 'undefined','def' => 'A catch-all for an undefined unit type'), 
      'tripal_featuremap', 0, 1, 'tripal');
+   
+   // add cvterms for map properties
+   tripal_cv_add_cvterm(array('name' => 'Map Dbxref','def' => 'A unique identifer for the map in a remote database.  The format is a database abbreviation and a unique accession separated by a colon.  (e.g. Gramene:tsh1996a)'), 
+     'featuremap_property', 0, 1, 'tripal');
+   tripal_cv_add_cvterm(array('name' => 'Map Type','def' => 'The type of Map (e.g. QTL, Physical, etc.)'), 
+     'featuremap_property', 0, 1, 'tripal');
+   tripal_cv_add_cvterm(array('name' => 'Genome Group','def' => ''), 
+     'featuremap_property', 0, 1, 'tripal');
+   tripal_cv_add_cvterm(array('name' => 'URL','def' => 'A univeral resource locator (URL) reference where the publication can be found.  For maps found online, this would be the web address for the map.'), 
+     'featuremap_property', 0, 1, 'tripal');
+   tripal_cv_add_cvterm(array('name' => 'Population Type','def' => 'A brief descriptoin of the population type used to generate the map (e.g. RIL, F2, BC1, etc).'), 
+     'featuremap_property', 0, 1, 'tripal');
+   tripal_cv_add_cvterm(array('name' => 'Methods','def' => 'A breif description of the methods used to construct the map.'), 
+     'featuremap_property', 0, 1, 'tripal');
+
+}
+
+/*
+ * 
+ */
+function tripal_featuremap_add_custom_tables(){
+  // add the featuremaprop table to Chado
+  $schema = array (
+    'table' => 'featuremapprop',
+    'fields' => array (
+      'featuremapprop_id' => array (
+        'type' => 'serial',
+        'not null' => true,
+      ),
+      'featuremap_id' => array (
+        'type' => 'int',
+        'not null' => true,
+      ),
+      'type_id' => array (
+        'type' => 'int',
+        'not null' => true,
+      ),
+      'value' => array (
+        'type' => 'text',
+        'not null' => false,
+      ),
+      'rank' => array (
+        'type' => 'int',
+        'not null' => true,
+        'default' => 0,
+      ),
+    ),
+    'primary key' => array (
+      0 => 'featuremapprop_id',
+    ),
+    'unique keys' => array (
+      'featuremapprop_c1' => array (
+        0 => 'featuremap_id',
+        1 => 'type_id',
+        2 => 'rank',
+      ),
+    ),
+    'indexes' => array (
+      'featuremapprop_idx1' => array (
+        0 => 'featuremap_id',
+      ),
+      'featuremapprop_idx2' => array (
+        0 => 'type_id',
+      ),
+    ),
+    'foreign keys' => array (
+      'cvterm' => array (
+        'table' => 'cvterm',
+        'columns' => array (
+          'type_id' => 'cvterm_id',
+        ),
+      ),
+      'featuremap' => array (
+        'table' => 'featuremap',
+        'columns' => array (
+          'featuremap_id' => 'featuremap_id',
+        ),
+      ),
+    ),
+  );  
+  tripal_core_create_custom_table(&$ret, 'featuremapprop', $schema, TRUE);
+  
+  // add the featuremap_dbxref table to Chado
+  $schema = array (
+    'table' => 'featuremap_dbxref',
+    'fields' => array (
+      'featuremap_dbxref_id' => array (
+        'type' => 'serial',
+        'not null' => true,
+      ),
+      'featuremap_id' => array (
+        'type' => 'int',
+        'not null' => true,
+      ),
+      'dbxref_id' => array (
+        'type' => 'int',
+        'not null' => true,
+      ),
+    ),
+    'primary key' => array (
+      0 => 'featuremap_dbxref_id',
+    ),
+    'unique keys' => array (
+      'featuremap_dbxref_c1' => array (
+        0 => 'featuremap_id',
+        1 => 'dbxref_id',
+      ),
+    ),
+    'indexes' => array (
+      'featuremap_dbxref_idx1' => array (
+        0 => 'featuremap_dbxref_id',
+      ),
+      'featuremap_dbxref_idx2' => array (
+        0 => 'dbxref_id',
+      ),
+    ),
+    'foreign keys' => array (
+      'dbxref' => array (
+        'table' => 'dbxref',
+        'columns' => array (
+          'dbxref_id' => 'dbxref_id',
+        ),
+      ),
+      'featuremap' => array (
+        'table' => 'featuremap',
+        'columns' => array (
+          'featuremap_id' => 'featuremap_id',
+        ),
+      ),
+    ),
+    'referring_tables' => NULL,
+  );
+  tripal_core_create_custom_table(&$ret, 'featuremap_dbxref', $schema, TRUE);
+}
+
+/**
+ *  Update for Drupal 6.x, Tripal 1.1, FeatureMap Module 1.1
+ *  This update adds a new featuremapprop and featuremap_dbxref tables and 
+ *  CV terms for the featuremap_property CV
+ *
+ */
+function tripal_featuremap_update_6103() {
+
+  tripal_featuremap_add_custom_tables();  
+  tripal_featuremap_add_cvterms();
+   
+  $ret = array(
+    '#finished' => 1,
+  );
+
+  return $ret;
 }

+ 209 - 100
tripal_featuremap/tripal_featuremap.module

@@ -10,6 +10,7 @@
 
 require('api/tripal_featuremap.api.inc');
 require('includes/tripal_featuremap.admin.inc');
+require('includes/tripal_featuremap.form.inc');
 
 /**
  * Display help and module information
@@ -133,6 +134,24 @@ function tripal_featuremap_menu() {
     'access arguments' => array('administer tripal featuremap'),
     'type' => MENU_CALLBACK
   );
+  
+  // AJAX calls for adding/removing properties to a featuremap
+  $items['tripal_featuremap/properties/add'] = array(
+    'page callback' => 'tripal_featuremap_property_add',
+    'access arguments' => array('edit chado_featuremap content'),
+    'type ' => MENU_CALLBACK,
+  );
+  $items['tripal_featuremap/properties/description'] = array(
+    'page callback' => 'tripal_featuremap_property_get_description',
+    'access arguments' => array('edit chado_featuremap content'),
+    'type ' => MENU_CALLBACK,
+  );
+  $items['tripal_featuremap/properties/minus/%/%'] = array(
+    'page callback' => 'tripal_featuremap_property_delete',
+    'page arguments' => array(3, 4),
+    'access arguments' => array('edit chado_featuremap content'),
+    'type ' => MENU_CALLBACK,
+  );
 
   return $items;
 }
@@ -207,11 +226,20 @@ function tripal_featuremap_theme() {
       'arguments' => array('node' => NULL),
       'template' => 'tripal_featuremap_publication',
     ),
+    'tripal_featuremap_references' => array(
+      'arguments' => array('node' => NULL),
+      'template' => 'tripal_featuremap_references',
+    ),
     'tripal_featuremap_admin' => array(
       'template' => 'tripal_featuremap_admin',
       'arguments' =>  array(NULL),
       'path' => drupal_get_path('module', 'tripal_featuremap') . '/theme'
     ),
+    
+    // Themed Forms
+    'chado_featuremap_node_form' => array(
+     'arguments' => array('form'),
+    ),      
   );
 }
 
@@ -269,96 +297,7 @@ function tripal_featuremap_map_access($op, $node, $account) {
   return NULL;
 }
 
-/**
- *  When editing or creating a new node of type 'chado_featuremap' we need
- *  a form.  This function creates the form that will be used for this.
- *
- * @ingroup tripal_featuremap
- */
-function chado_featuremap_form($node) {
-  $type = node_get_types('type', $node);
-  $form = array();
-
-  $featuremap = $node->featuremap;
-
-  // keep track of the map id if we have.  If we do have one then
-  // this is an update as opposed to an insert.
-  $form['featuremap_id'] = array(
-    '#type' => 'value',
-    '#value' => $featuremap->featuremap_id,
-  );
-
-  $form['title']= array(
-    '#type'          => 'textfield',
-    '#title'         => t('Map Name'),
-    '#description'   => t('Please enter a name for this map'),
-    '#required'      => TRUE,
-    '#default_value' => $featuremap->name,
-  );
-
-  $form['description']= array(
-    '#type'          => 'textarea',
-    '#title'         => t('Map Description'),
-    '#description'   => t('A description of the map.'),
-    '#required'      => TRUE,
-    '#default_value' => $featuremap->description,
-  );
-
-  // get the list of unit types
-  $values = array(
-    'cv_id' => array(
-      'name' => 'tripal_featuremap',
-    )
-  );
-  $columns = array('cvterm_id','name');
-  $options = array('order_by' => array('name' => 'ASC'));
-  $featuremap_units = tripal_core_chado_select('cvterm', $columns, $values, $options);
-  $units = array();
-  $units[''] = '';
-  foreach($featuremap_units as $unit) {
-    $units[$unit->cvterm_id] = $unit->name;
-  }
-
-  $form['unittype_id'] = array(
-    '#title'       => t('Map Units'),
-    '#type'        => t('select'),
-    '#description' => t("Chose the units for this map"),
-    '#required'    => TRUE,
-    '#default_value' => $featuremap->unittype_id->cvterm_id,
-    '#options'     => $units,
-  );
 
-  return $form;
-}
-/**
- *  validates submission of form when adding or updating a map node
- *
- * @ingroup tripal_featuremap
- */
-function chado_featuremap_validate($node) {
-  $map = 0;
-  // check to make sure the unique name on the map is unique
-  // before we try to insert into chado. If this is an update then we will
-  // have a featuremap_id, therefore we want to look for another map with this
-  // name but with a different featuremap_id. If this is an insert, just look
-  // for a case where the name already exists.
-  if ($node->featuremap_id) {
-    $sql = "SELECT * FROM ".
-           "{featuremap} WHERE ".
-           "name = '%s' ".
-           "AND NOT featuremap_id = %d";
-    $map = db_fetch_object(chado_query($sql, $node->title, $node->featuremap_id));
-  }
-  else {
-    $sql = "SELECT * FROM ".
-           "{featuremap} ".
-           "WHERE name = '%s'";
-    $map = db_fetch_object(chado_query($sql, $node->title));
-  }
-  if ($map) {
-    form_set_error('name', t('The unique map name already exists. Please choose another'));
-  }
-}
 
 /**
  *  When a new chado_featuremap node is created we also need to add information
@@ -369,6 +308,8 @@ function chado_featuremap_validate($node) {
  */
 function chado_featuremap_insert($node) {
 
+  // if the featuremap_id already exists then we got to the insert via 
+  // a syncing operation.  We do not need to add the feature map
   if ($node->featuremap_id) {
     $featuremap['featuremap_id'] = $node->featuremap_id;
   }
@@ -379,27 +320,103 @@ function chado_featuremap_insert($node) {
       'unittype_id' => $node->unittype_id
     );
     $featuremap = tripal_core_chado_insert('featuremap', $values);
+    if(!$featuremap) {
+      drupal_set_message(t('Unable to add featuremap.', 'warning'));
+      watchdog('tripal_featuremap', 'Unable to create feature map where values: %values',
+        array('%values' => print_r($values, TRUE)), WATCHDOG_WARNING);
+      return;  
+    }
+    
+    // now add the properties
+    $properties = array(); // stores all of the properties we need to add
+    $cross_refs = array(); // stores any cross references for this featuremap
+  
+    // get the list of properties for easy lookup (without doing lots of database queries
+    $properties_list = array();
+    $sql = "
+      SELECT DISTINCT CVT.cvterm_id, CVT.name, CVT.definition
+      FROM  {cvterm} CVT
+        INNER JOIN {cv} ON CVT.cv_id = CV.cv_id
+      WHERE 
+        CV.name = 'featuremap_property' AND 
+        NOT CVT.is_obsolete = 1
+      ORDER BY CVT.name ASC 
+    ";
+    $prop_types = chado_query($sql);
+    while ($prop = db_fetch_object($prop_types)) {
+      $properties_list[$prop->cvterm_id] = $prop->name;
+    }   
+  
+    // get the properties that should be added. Properties are in one of two forms:
+    //  1) prop_value-[type id]-[index]
+    //  2) new_value-[type id]-[index]
+    //  3) new_id, new_value
+    foreach ($node as $name => $value) {
+      if (preg_match('/^new_value-(\d+)-(\d+)/', $name, $matches)) {
+        $type_id = $matches[1];
+        $index = $matches[2];
+        $name = $properties_list[$type_id];
+        $properties[$name][$index] = trim($value);
+      }
+    }
+    if ($node->new_id and $node->new_value) {
+      $type_id = $node->new_id;
+      $index = count($properties[$name]);
+      $name = $properties_list[$type_id];
+      $properties[$name][$index] = trim($node->new_value);
+    }
+    
+    // iterate through all of the properties to see if the Map dbxref is set, 
+    // if so, add it to the $cross_refs array
+    foreach ($properties as $name => $element) {
+      foreach ($element as $index => $value) {
+        if ($name == "Map Dbxref") {
+          // we will add the cross-references to the featuremap_dbxref table
+          // but we also want to keep the property in the featuremapprop table so don't unset it
+          $cross_refs[] = $value;
+        }
+      }
+    }
+    
+    // now add in the properties
+    foreach ($properties as $property => $elements) {
+      foreach ($elements as $rank => $value) {
+         
+        $status = tripal_featuremap_insert_property($featuremap['featuremap_id'], $property, $value, FALSE);
+        if (!$status) {
+          drupal_set_message("Error cannot add property: $property", "error");
+          watchdog('t_featuremap', "Error cannot add property: %prop",
+          array('%property' => $property), WATCHDOG_ERROR);
+        }
+      }
+    }
+  
+    // add in any database cross-references
+    foreach ($cross_refs as $index => $ref) {
+      $featuremap_dbxref = tripal_featuremap_add_featuremap_dbxref($featuremap['featuremap_id'], trim($ref));
+      if (!$featuremap_dbxref) {
+        drupal_set_message("Error cannot add map cross reference: $ref", "error");
+        watchdog('t_featuremap', "Error cannot add map cross reference: %ref",
+        array('%ref' => $ref), WATCHDOG_ERROR);
+      }
+    }
   }
 
+  // add the record to the chado_featuremap table in Drupal
   if ($featuremap) {
     // make sure the entry for this feature doesn't already exist in the chado_featuremap table
     // if it doesn't exist then we want to add it.
     $featuremap_id = chado_get_id_for_node('featuremap', $node) ;
     if (!$featuremap_id) {
        // next add the item to the drupal table
-      $sql = "INSERT INTO {chado_featuremap} (nid, vid, featuremap_id) ".
-            "VALUES (%d, %d, %d)";
+      $sql = "INSERT INTO {chado_featuremap} (nid, vid, featuremap_id) VALUES (%d, %d, %d)";
       db_query($sql, $node->nid, $node->vid, $featuremap['featuremap_id']);
-    }
-  }
-  else {
-    drupal_set_message(t('Unable to add featuremap.', 'warning'));
-    watchdog('tripal_featuremap',
-    'Insert feature: Unable to create featuremap where values: %values',
-    array('%values' => print_r($values, TRUE)),
-    WATCHDOG_WARNING
-    );
+    }       
   }
+
+  
+  
+  
 }
 /**
  * Update nodes
@@ -423,6 +440,94 @@ function chado_featuremap_update($node) {
     'unittype_id' => $node->unittype_id
   );
   $status = tripal_core_chado_update('featuremap', $match, $values);
+  if (!$status) {
+    drupal_set_message("Error updating map", "error");
+    watchdog('t_featuremap', "Error updating map", array(), WATCHDOG_ERROR);
+    return;
+  }
+
+  // now update the properties
+  $properties = array(); // stores all of the properties we need to add
+  $cross_refs = array(); // stores any cross references for this map
+   
+  // get the list of properties for easy lookup (without doing lots of database queries
+  $properties_list = array();
+  $sql = "
+    SELECT DISTINCT CVT.cvterm_id, CVT.name, CVT.definition
+    FROM  {cvterm} CVT
+      INNER JOIN {cv} ON CVT.cv_id = CV.cv_id
+    WHERE 
+      CV.name = 'featuremap_property' AND 
+      NOT CVT.is_obsolete = 1
+    ORDER BY CVT.name ASC 
+  ";
+  $prop_types = chado_query($sql);
+  while ($prop = db_fetch_object($prop_types)) {
+    $properties_list[$prop->cvterm_id] = $prop->name;
+  }
+  
+  // get the properties that should be added. Properties are in one of three forms:
+  //  1) prop_value-[type id]-[index]
+  //  2) new_value-[type id]-[index]
+  //  3) new_id, new_value
+  //  dpm($node);
+  foreach ($node as $key => $value) {
+    if (preg_match('/^prop_value-(\d+)-(\d+)/', $key, $matches)) {
+      $type_id = $matches[1];
+      $index = $matches[2];
+      $name = $properties_list[$type_id];
+      $properties[$name][$index] = trim($value);
+    }
+    if (preg_match('/^new_value-(\d+)-(\d+)/', $key, $matches)) {
+      $type_id = $matches[1];
+      $index = $matches[2];
+      $name = $properties_list[$type_id];
+      $properties[$name][$index] = trim($value);
+    }
+  }
+  if ($node->new_id and $node->new_value) {
+    $type_id = $node->new_id;
+    $name = $properties_list[$type_id];
+    $index = count($properties[$name]);
+    $properties[$name][$index] = trim($node->new_value);
+  }
+  
+  // iterate through all of the properties to see if the Map dbxref is set, 
+  // if so, add it to the $cross_refs array
+  foreach ($properties as $name => $element) {
+    foreach ($element as $index => $value) {
+      if ($name == "Map Dbxref") {
+        // we will add the cross-references to the featuremap_dbxref table
+        // but we also want to keep the property in the featuremapprop table so don't unset it
+        $cross_refs[] = $value;
+      }
+    }
+  }
+
+  // now add in the properties by first removing any the featuremap
+  // already has and adding the ones we have
+  tripal_core_chado_delete('featuremapprop', array('featuremap_id' => $featuremap_id));
+  foreach ($properties as $property => $elements) {
+    foreach ($elements as $rank => $value) {
+      $status = tripal_featuremap_insert_property($featuremap_id, $property, $value, FALSE);
+      if (!$status) {
+        drupal_set_message("Error cannot add property: '$property'", "error");
+        watchdog('t_featuremap', "Error cannot add property: '%prop'",
+        array('%prop' => $property), WATCHDOG_ERROR);
+      }
+    }
+  }
+
+  // add in any database cross-references after first removing
+  tripal_core_chado_delete('featuremap_dbxref', array('featuremap_id' => $featuremap_id));
+  foreach ($cross_refs as $index => $ref) {
+    $featuremap_dbxref = tripal_featuremap_add_featuremap_dbxref($featuremap_id, trim($ref));
+    if (!$featuremap_dbxref) {
+      drupal_set_message("Error cannot add map cross reference: $ref", "error");
+      watchdog('t_featuremap', "Error cannot add map cross reference: %ref",
+      array('%ref' => $ref), WATCHDOG_ERROR);
+    }
+  }
 }
 /**
  *  When a node is requested by the user this function is called to allow us
@@ -501,3 +606,7 @@ function theme_tripal_featuremap_search_result($node) {
 
 }
 
+function tripal_featuremap_form_alter(&$form, &$form_state, $form_id) {
+  if ($form_id == "chado_featuremap_node_form") {
+  }
+}

+ 2 - 2
tripal_pub/api/tripal_pub.api.inc

@@ -886,7 +886,7 @@ function tripal_pub_add_authors($pub_id, $authors, $do_contact) {
  * @ingroup tripal_pub_api
  */
 function tripal_pub_get_property($pub_id, $property) {
-  return tripal_core_get_property('pub', $pub_id, $property, 'tripal');
+  return tripal_core_get_property('pub', $pub_id, $property, 'tripal_pub');
 }
 
 /**
@@ -950,7 +950,7 @@ function tripal_pub_update_property($pub_id, $property, $value, $insert_if_missi
  * @ingroup tripal_pub_api
  */
 function tripal_pub_delete_property($pub_id, $property) {
-  return tripal_core_delete_property('pub', $pub_id, $property, 'tripal');
+  return tripal_core_delete_property('pub', $pub_id, $property, 'tripal_pub');
 }
 
 /*

+ 3 - 3
tripal_pub/includes/pub_form.inc

@@ -263,9 +263,9 @@ function chado_pub_validate($node, &$form) {
     // if the title, type,  year or series_name have changed then check the pub
     // to see if it is a duplicate of another
     if((strcmp(strtolower($pub[0]->title), strtolower($title)) == 0) and
-    (strcmp(strtolower($pub[0]->series_name), strtolower($series_name)) == 0) and
-    ($pub[0]->type_id == $type_id) and
-    ($pub[0]->year == $pyear)) {
+       (strcmp(strtolower($pub[0]->series_name), strtolower($series_name)) == 0) and
+       ($pub[0]->type_id == $type_id) and
+       ($pub[0]->year == $pyear)) {
       $skip_duplicate_check = 1;
     }
   }