function chado_get_table_property_types
3.x tripal_chado.property.api.inc | chado_get_table_property_types($prop_table) |
Retrieves all of the property types currently availalbe in a prop table.
Parameters
$prop_table: The name of the property table.
Return value
An array of cvterm objects as created by chado_generate_var().
Throws
Exception
Related topics
File
- tripal_chado/
api/ tripal_chado.property.api.inc, line 656 - Provides an application programming interface (API) to manage data withing the Chado database.
Code
function chado_get_table_property_types($prop_table) {
// Make sure this is a prop table.
if (!preg_match('/prop$/', $prop_table)) {
throw new Exception('Please provide a valid Chado property table');
}
$sql = 'SELECT DISTINCT type_id FROM {' . $prop_table . '}';
$results = chado_query($sql);
$types = array();
foreach ($results as $result) {
$types[] = chado_generate_var('cvterm', array('cvterm_id' => $result->type_id));
}
return $types;
}