function tripal_feature_analysis_insert_property

2.x tripal_feature.DEPRECATED.inc tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_id = NUll, $analysisfeature_id = NULL, $property, $value, $update_if_present = 0, $cv_name = 'tripal')
3.x tripal_feature.DEPRECATED.inc tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_id = NUll, $analysisfeature_id = NULL, $property, $value, $update_if_present = 0, $cv_name = 'tripal')
1.x tripal_feature.api.inc tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_id = NUll, $analysisfeature_id = NULL, $property, $value, $update_if_present = 0, $cv_name = 'tripal')

Insert a property for an analysis feature

Parameters

$analysis_id: The analysis ID for the analysis feature. This argument is optional but if specified it must also be accompanied with a feature ID.

$feature_id: The feature ID for the analysis feature. This argument is optional but if specified it must also be accompanied with an analysis ID.

$analysisfeature_id: The analysis feature ID for the analysis feature. This argument is optional and can be used rather than specifying the $analysis_id and $feature_id arguments. If all three arguments are specified (e.g. an $analysis_id, $feature_id and $analysisfeature_id, then the $analysisfeature_id is used and the other two arguments are ignored.

$property: The cvterm name of the property to insert

$value: The value of the property to insert

$update_if_present: A boolean indicated whether to update the record if it's already present

$cv_name: Optional. The name of the cv to which the property belongs. By default this is the 'tripal' cv.

Return value

True of success, False otherwise

Related topics

File

tripal_feature/api/tripal_feature.api.inc, line 89
Provides an application programming interface (API) for working with features

Code

function tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_id = NUll, 
$analysisfeature_id = NULL, $property, $value, $update_if_present = 0, $cv_name = 'tripal') {

  // check that the incoming arguments are correct
  if (($analysis_id and !$feature_id) or 
    (!$analysis_id and $feature_id)) {
    watchdog('tripal_feature', 
    'tripal_feature_analysis_insert_property: Both an analysis ID and feature ID should be specified', 
    array(), WATCHDOG_WARNING);
  }

  // get the analysisfeature_id if one is not provided
  if (!$analysisfeature_id) {
    $columns = array('analysisfeature_id');
    $values = array('analysis_id' => $analysis_id, 'feature_id' => $feature_id);
    $result = tripal_core_chado_select('analysisfeature', $columns, $values);
    $analysisfeature_id = $result[0]->analysisfeature_id;
  }

  // insert the property.
  $success = tripal_core_insert_property('analysisfeature', $analysisfeature_id, 
  $property, $cv_name, $value, $update_if_present);
  if (!$success) {
    watchdog('tripal_feature', 
    'tripal_feature_analysis_insert_property: Failed to insert analysis feature property', 
    array(), WATCHDOG_WARNING);
    return FALSE;
  }
  return $success;
}