function tripal_pub_get_pubs_by_dbxref

2.x tripal_pub.DEPRECATED.inc tripal_pub_get_pubs_by_dbxref($pub_dbxref)
3.x tripal_pub.DEPRECATED.inc tripal_pub_get_pubs_by_dbxref($pub_dbxref)
1.x tripal_pub.api.inc tripal_pub_get_pubs_by_dbxref($pub_dbxref)

Returns the list of publications that are assigned the database cross-reference provided

Parameters

$pub_dbxref: The database cross reference accession. It should be in the form DB:ACCESSION, where DB is the database name and ACCESSION is the unique publication identifier (e.g. PMID:4382934)

Return value

Returns an array of all the publications that have the provided cross reference. If no publications match, then an empty array is returned.

Related topics

1 call to tripal_pub_get_pubs_by_dbxref()
tripal_pub_add_publication in tripal_pub/api/tripal_pub.api.inc
Adds a new publication to the Chado, along with all properties and database cross-references. If the publication does not already exist in Chado then it is added. If it does exist nothing is done. If the $update parameter is TRUE then theā€¦

File

tripal_pub/api/tripal_pub.api.inc, line 491
The Tripal Pub API

Code

function tripal_pub_get_pubs_by_dbxref($pub_dbxref) {

  $return = array();

  if (preg_match('/^(.*?):(.*?)$/', $pub_dbxref, $matches)) {
    $dbname = $matches[1];
    $accession = $matches[2];

    $values = array(
      'dbxref_id' => array(
        'accession' => $accession,
        'db_id' => array(
          'name' => $dbname
        ),
      ),
    );
    $options = array('statement_name' => 'sel_pubdbxref_db');
    $results = tripal_core_chado_select('pub_dbxref', array('pub_id'), $values, $options);
    foreach ($results as $index => $pub) {
      $return[] = $pub->pub_id;
    }
  }
  return $return;
}