function tripal_feature_analysis_update_property

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

Update an analysis feature property using the property name. Use this when a property only exists once for a given analysis feature. When more than one value can exist for the same property use the tripal_feature_analysis_update_property_by_id() function.

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 update

$value: The value of the property to update

$insert_if_missing: A boolean indicated whether to insert the record if it's absent

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

Note: The property will be identified using the unique combination of the $analysis_id and $property and then it will be updated with the supplied value

Return value

True of success, False otherwise

Related topics

File

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

Code

function tripal_feature_analysis_update_property($analysis_id = NULL, $feature_id = NUll, 
$analysisfeature_id = NULL, $property, $value, $insert_if_missing = 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_update_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;
  }

  // update the property.
  return tripal_core_update_property('analysisfeature', $analysisfeature_id, $property, $cv_name, $value, $insert_if_missing);
}