|
@@ -23,7 +23,24 @@ function tripal_feature_analysis_get_property($analysis_id = NULL, $feature_id =
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- return FALSE;
|
|
|
+ // check that the incoming arguments are correct
|
|
|
+ if (($analysis_id and !$feature_id) or
|
|
|
+ (!$analysis_id and $feature_id)) {
|
|
|
+ tripal_report_error('tripal_feature', TRIPAL_WARNING,
|
|
|
+ 'tripal_feature_analysis_get_property: Both an analysis ID and feature ID should be specified',
|
|
|
+ array());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 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 = chado_select_record('analysisfeature', $columns, $values);
|
|
|
+ $analysisfeature_id = $result[0]->analysisfeature_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ // get the property.
|
|
|
+ return chado_get_property('analysisfeature', $analysisfeature_id, $property, $cv_name);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -45,7 +62,26 @@ function tripal_feature_analysis_insert_property($analysis_id = NULL, $feature_i
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- return FALSE;
|
|
|
+ // check that the incoming arguments are correct
|
|
|
+ if (($analysis_id and !$feature_id) or
|
|
|
+ (!$analysis_id and $feature_id)) {
|
|
|
+ tripal_report_error('tripal_feature', TRIPAL_WARNING,
|
|
|
+ 'tripal_feature_analysis_insert_property: Both an analysis ID and feature ID should be specified',
|
|
|
+ array());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 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 = chado_select_record('analysisfeature', $columns, $values);
|
|
|
+ $analysisfeature_id = $result[0]->analysisfeature_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ // insert the property.
|
|
|
+ return chado_insert_property('analysisfeature', $analysisfeature_id,
|
|
|
+ $property, $cv_name, $value, $update_if_present);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -67,7 +103,24 @@ function tripal_feature_analysis_update_property($analysis_id = NULL, $feature_i
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- return FALSE;
|
|
|
+ // check that the incoming arguments are correct
|
|
|
+ if (($analysis_id and !$feature_id) or
|
|
|
+ (!$analysis_id and $feature_id)) {
|
|
|
+ tripal_report_error('tripal_feature', TRIPAL_WARNING,
|
|
|
+ 'tripal_feature_analysis_update_property: Both an analysis ID and feature ID should be specified',
|
|
|
+ array());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 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 = chado_select_record('analysisfeature', $columns, $values);
|
|
|
+ $analysisfeature_id = $result[0]->analysisfeature_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ // update the property.
|
|
|
+ return chado_update_property('analysisfeature', $analysisfeature_id, $property, $cv_name, $value, $insert_if_missing);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -89,7 +142,8 @@ function tripal_feature_analysis_update_property_by_id($analysisfeatureprop_id,
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- return FALSE;
|
|
|
+ // update the property.
|
|
|
+ return chado_update_property('analysisfeature', NULL, $property, $cv_name, $value, FALSE, $analysisfeatureprop_id);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -111,15 +165,33 @@ function tripal_feature_analysis_delete_property($analysis_id = NULL, $feature_i
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- return FALSE;
|
|
|
+ // check that the incoming arguments are correct
|
|
|
+ if (($analysis_id and !$feature_id) or
|
|
|
+ (!$analysis_id and $feature_id)) {
|
|
|
+ tripal_report_error('tripal_feature', TRIPAL_WARNING,
|
|
|
+ 'tripal_feature_analysis_delete_property: Both an analysis ID and feature ID should be specified',
|
|
|
+ array());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 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 = chado_select_record('analysisfeature', $columns, $values);
|
|
|
+ $analysisfeature_id = $result[0]->analysisfeature_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ // get the property.
|
|
|
+ return chado_delete_property('analysisfeature', $analysisfeature_id, $property, $cv_name);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @deprecated Restructured API to make naming more readable and consistent.
|
|
|
* Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
|
|
|
- * This function has been replaced by chado_delete_property().
|
|
|
+ * This function has been replaced by chado_delete_record().
|
|
|
*
|
|
|
- * @see chado_delete_property().
|
|
|
+ * @see chado_delete_record().
|
|
|
*/
|
|
|
function tripal_feature_analysis_delete_property_by_id($analysisfeatureprop_id) {
|
|
|
|
|
@@ -133,7 +205,12 @@ function tripal_feature_analysis_delete_property_by_id($analysisfeatureprop_id)
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- return FALSE;
|
|
|
+ // construct the array that will match the exact record to update
|
|
|
+ $match = array(
|
|
|
+ 'analysisfeatureprop_id' => $analysisfeatureprop_id,
|
|
|
+ );
|
|
|
+
|
|
|
+ return chado_delete_record('analysisfeatureprop', $match);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -155,7 +232,7 @@ function tripal_feature_get_property($feature_id, $property, $cv_name='tripal')
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- return FALSE;
|
|
|
+ return chado_get_property('feature', $feature_id, $property, $cv_name);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -177,7 +254,8 @@ function tripal_feature_insert_property($feature_id, $property, $value, $update_
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- return FALSE;
|
|
|
+ return chado_insert_property('feature', $feature_id, $property,
|
|
|
+ $cv_name, $value, $update_if_present);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -199,7 +277,7 @@ function tripal_feature_update_property($feature_id, $property, $value, $insert_
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- return FALSE;
|
|
|
+ return chado_update_property('feature', $feature_id, $property, $cv_name, $value, $insert_if_missing);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -221,7 +299,7 @@ function tripal_feature_update_property_by_id($featureprop_id, $property, $value
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- return FALSE;
|
|
|
+ return chado_update_property('feature', NULL, $property, $cv_name, $value, FALSE, $featureprop_id);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -243,15 +321,15 @@ function tripal_feature_delete_property($feature_id, $property, $cv_name='tripal
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- return FALSE;
|
|
|
+ return chado_delete_property('feature', $feature_id, $property, $cv_name);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @deprecated Restructured API to make naming more readable and consistent.
|
|
|
* Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
|
|
|
- * This function has been replaced by chado_delete_property().
|
|
|
+ * This function has been replaced by chado_delete_record().
|
|
|
*
|
|
|
- * @see chado_delete_property().
|
|
|
+ * @see chado_delete_record().
|
|
|
*/
|
|
|
function tripal_feature_delete_property_by_id($featureprop_id) {
|
|
|
|
|
@@ -265,7 +343,12 @@ function tripal_feature_delete_property_by_id($featureprop_id) {
|
|
|
)
|
|
|
);
|
|
|
|
|
|
- return FALSE;
|
|
|
+ // construct the array that will match the exact record to update
|
|
|
+ $match = array(
|
|
|
+ 'featureprop_id' => $featureprop_id,
|
|
|
+ );
|
|
|
+
|
|
|
+ return chado_delete_record('featureprop', $match);
|
|
|
}
|
|
|
|
|
|
/**
|