function tripal_feature_delete_features
2.x tripal_feature.delete.inc | tripal_feature_delete_features($organism_id, $analysis_id, $seq_type,
$is_unique, $feature_names, $job = NULL) |
3.x tripal_feature.delete.inc | tripal_feature_delete_features($organism_id, $analysis_id, $seq_type,
$is_unique, $feature_names, $job = NULL) |
1.x tripal_feature-delete.inc | tripal_feature_delete_features($organism_id, $analysis_id, $seq_type,
$is_unique, $feature_names, $job = NULL) |
2 string references to 'tripal_feature_delete_features'
- tripal_feature_delete_form_submit in tripal_feature/
includes/ tripal_feature-delete.inc - tripal_feature_job_describe_args in tripal_feature/
tripal_feature.module
File
- tripal_feature/
includes/ tripal_feature-delete.inc, line 113 - @todo Add file header description
Code
function tripal_feature_delete_features($organism_id, $analysis_id, $seq_type,
$is_unique, $feature_names, $job = NULL) {
global $user;
$match = array();
// if feature names have been provided then handle that separately
if ($feature_names) {
$names = preg_split('/\s+/', $feature_names);
if (sizeof($names) == 1) {
$names = $names[0];
}
if ($is_unique) {
$match['uniquename'] = $names;
}
else {
$match['name'] = $names;
}
$num_deletes = tripal_core_chado_select('feature', array('count(*) as cnt'), $match);
print "Deleting " . $num_deletes[0]->cnt . " features\n";
tripal_core_chado_delete('feature', $match);
}
// if the user has provided an analysis_id then handle that separately
elseif ($analysis_id) {
tripal_feature_delete_by_analysis();
}
else {
if ($organism_id) {
$match['organism_id'] = $organism_id;
}
if ($seq_type) {
$match['type_id'] = array(
'name' => $seq_type,
'cv_id' => array(
'name' => 'sequence'
),
);
}
$num_deletes = tripal_core_chado_select('feature', array('count(*) as cnt'), $match);
print "Deleting " . $num_deletes[0]->cnt . " features\n";
tripal_core_chado_delete('feature', $match);
}
print "Removing orphaned feature pages\n";
tripal_features_cleanup(array(), $user->uid);
}