function chado_get_nid_from_id

2.x chado_get_nid_from_id($table, $id, $linking_table = NULL)

Get node id for a chado feature/organism/analysis. E.g, if you want to get the node id for an analysis, use: $nid = chado_get_nid_from_id ('analysis', $analysis_id) Likewise, $nid = chado_get_nid_from_id ('organism', $organism_id) $nid = chado_get_nid_from_id ('feature', $feature_id)


$table: The chado table the id is from

$id: The value of the primary key from the $table chado table (ie: feature_id)

$linking_table: The Drupal table linking the chado record to it's node. This field is optional and defaults to chado_$table

Return value

The nid of the associated node

Related topics

6 calls to chado_get_nid_from_id()
chado_expand_var in tripal_core/api/
Retrieves fields, or tables that were excluded by default from a variable.
chado_get_node_id in tripal_core/api/
drush_tripal_phylogeny_trp_insert_phylotree in tripal_phylogeny/
Deletes a phylotree record.
drush_tripal_phylogeny_trp_update_phylotree in tripal_phylogeny/
tripal_feature_load_featurelocs in tripal_feature/theme/
Load the locations for a given feature

... See full list

1 string reference to 'chado_get_nid_from_id'


tripal_core/api/, line 87
API to handle much of the common functionality implemented when creating a drupal node type.


function chado_get_nid_from_id($table, $id, $linking_table = NULL) {
  if (empty($linking_table)) {
    $linking_table = 'chado_' . $table;

  $sql = "SELECT nid FROM {" . $linking_table . "} WHERE " . $table . "_id = :" . $table . "_id";
  return db_query($sql, array(":" . $table . "_id" => $id))->fetchField();