Tripal
Functions
Chado Publication
Collaboration diagram for Chado Publication:

Functions

 chado_get_publication ($identifiers, $options=[])
 
 chado_publication_exists ($pub_details)
 
 chado_autocomplete_pub ($string='')
 
 chado_import_pub_by_dbxref ($pub_dbxref, $do_contact=FALSE, $publish=TRUE, $do_update=TRUE)
 
 chado_execute_active_pub_importers ($report_email=FALSE, $publish=TRUE, $do_update=FALSE)
 
 chado_reimport_publications ($do_contact=FALSE, $dbxref=NULL, $db=NULL, $publish=TRUE)
 
 chado_pub_create_citations ($options)
 
 chado_pub_create_citation ($pub)
 
 chado_get_pub_dbxrefs ($pub_id)
 
 chado_get_minimal_pub_info ($pub)
 

Detailed Description

Provides API functions specifically for managing publication records in Chado.

Function Documentation

◆ chado_autocomplete_pub()

chado_autocomplete_pub (   $string = '')

Used for autocomplete in forms for identifying for publications.

Parameters
$fieldThe field in the publication to search on.
$stringThe string to search for.
Returns
A json array of terms that begin with the provided string.

◆ chado_execute_active_pub_importers()

chado_execute_active_pub_importers (   $report_email = FALSE,
  $publish = TRUE,
  $do_update = FALSE 
)

Imports all publications for all active import setups.

Parameters
$report_emailA list of email address, separated by commas, that should be notified once importing has completed.
$publishSet to TRUE if publications should be published after import. For Tripal v3 this value can be set to the string 'sync' or 'both' in the event that the site is in "legacy" mode. Setting this value to 'sync' will create nodes, setting to 'both' will create nodes and entities. If set to TRUE only entities are created.
$do_updateIf set to TRUE then publications that already exist in the Chado database will be updated, whereas if FALSE only new publications will be added.

◆ chado_get_minimal_pub_info()

chado_get_minimal_pub_info (   $pub)

Retrieves the minimal information to uniquely describe any publication.

The returned array is an associative array where the keys are the controlled vocabulary terms in the form [vocab]:[accession].

Parameters
$pubA publication object as created by chado_generate_var().
Returns
An array with the following keys: 'Citation', 'Abstract', 'Authors', 'URL'. All keys are term names in the Tripal Publication Ontology :TPUB.

◆ chado_get_pub_dbxrefs()

chado_get_pub_dbxrefs (   $pub_id)

Retrieves an array with all database cross references

Implemented as SQL for performance reasons because chado_expand_var can take too long as it loads more information than needed

Parameters
$pub_idA pub_id from the 'chado.pub' table
Returns
An array of records with the following keys: 'accession', 'version', 'description', 'name', 'url', 'urlprefix'. These are the column names from the 'dbxref' and 'db' tables

◆ chado_get_publication()

chado_get_publication (   $identifiers,
  $options = [] 
)

Retrieves a chado publication array.

Parameters
$identifierAn array used to uniquely identify a publication. This array has the same format as that used by the chado_generate_var(). The following keys can be useful for uniquely identifying a publication as they should be unique:
  • pub_id: the chado pub.pub_id primary key.
  • nid: the drupal nid of the publication.
  • uniquename: A value to matach with the pub.uniquename field. There are also some specially handled keys. They are:
  • property: An array describing the property to select records for. It should at least have either a 'type_name' key (if unique across cvs) or 'type_id' key. Other supported keys include: 'cv_id', 'cv_name' (of the type), 'value' and 'rank'
  • 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)
  • dbxref_id: The dbxref.dbxref_id of the publication.
$optionsAn array of options. Supported keys include:

NOTE: the $identifier parameter can really be any array similar to $values passed into chado_select_record(). It should fully specify the pub record to be returned.

Returns
If a single publication is retrieved using the identifiers, then a publication array will be returned. The array is of the same format returned by the chado_generate_var() function. Otherwise, FALSE will be returned.

◆ chado_import_pub_by_dbxref()

chado_import_pub_by_dbxref (   $pub_dbxref,
  $do_contact = FALSE,
  $publish = TRUE,
  $do_update = TRUE 
)

Imports a single publication specified by a remote database cross reference.

Parameters
$pub_dbxrefThe unique database ID for the record to update. This value must be of the format DB_NAME:ACCESSION where DB_NAME is the name of the database (e.g. PMID or AGL) and the ACCESSION is the unique identifier for the record in the database.
$do_contactSet to TRUE if authors should automatically have a contact record added to Chado.
$publishSet to TRUE if publications should be published after import. For Tripal v3 this value can be set to the string 'sync' or 'both' in the event that the site is in "legacy" mode. Setting this value to 'sync' will create nodes, setting to 'both' will create nodes and entities. If set to TRUE only entities are created.
$do_updateIf set to TRUE then the publication will be updated if it already exists in the database.

◆ chado_pub_create_citation()

chado_pub_create_citation (   $pub)

This function generates citations for publications. It requires an array structure with keys being the terms in the Tripal publication ontology. This function is intended to be used for any function that needs to generate a citation.

Parameters
$pubAn array structure containing publication details where the keys are the publication ontology term names and values are the corresponding details. The pub array can contain the following keys with corresponding values:
  • Publication Type: an array of publication types. a publication can have more than one type.
  • Authors: a string containing all of the authors of a publication.
  • Journal Name: a string containing the journal name.
  • Journal Abbreviation: a string containing the journal name abbreviation.
  • Series Name: a string containing the series (e.g. conference proceedings) name.
  • Series Abbreviation: a string containing the series name abbreviation
  • Volume: the serives volume number.
  • Issue: the series issue number.
  • Pages: the page numbers for the publication.
  • Publication Date: A date in the format "Year Month Day".
Returns
A text string containing the citation.

◆ chado_pub_create_citations()

chado_pub_create_citations (   $options)

Launch the Tripal job to generate citations.

This function will recreate citations for all publications currently loaded into Tripal. This is useful to create a consistent format for all citations.

Parameters
$optionsOptions pertaining to what publications to generate citations for. One of the following must be present:
  • all: Create and replace citation for all pubs.
  • new: Create citation for pubs that don't already have one.

◆ chado_publication_exists()

chado_publication_exists (   $pub_details)

The publication table of Chado only has a unique constraint for the uniquename of the publication, but in reality a publication can be considered unique by a combination of the title, publication type, published year and series name (e.g. journal name or conference name). The site administrator can configure how publications are determined to be unique. This function uses the configuration specified by the administrator to look for publications that match the details specified by the $pub_details argument and indicates if one ore more publications match the criteria.

Parameters
$pub_detailsAn associative array with details about the publications. The expected keys are: 'Title': The title of the publication. 'Year': The published year of the publication. 'Publication Type': An array of publication types. A publication can have more than one type. 'Series Name': The series name of the publication. 'Journal Name': An alternative to 'Series Name'. 'Conference Name': An alternative to 'Series Name'. 'Citation': The publication citation (this is the value saved in the pub.uniquename field and must be unique).

If this key is present it will also be checked 'Publication Dbxref': A database cross reference of the form DB:ACCESSION where DB is the name of the database and ACCESSION is the unique identifier (e.g PMID:3483139).

Returns
An array containing the pub_id's of matching publications. Returns an empty array if no pubs match.

◆ chado_reimport_publications()

chado_reimport_publications (   $do_contact = FALSE,
  $dbxref = NULL,
  $db = NULL,
  $publish = TRUE 
)

Updates publication records.

Updates publication records that currently exist in the Chado pub table with the most recent data in the remote database.

Parameters
$do_contactSet to TRUE if authors should automatically have a contact record added to Chado. Contacts are added using the name provided by the remote database.
$dbxrefThe unique database ID for the record to update. This value must be of the format DB_NAME:ACCESSION where DB_NAME is the name of the database (e.g. PMID or AGL) and the ACCESSION is the unique identifier for the record in the database.
$dbThe name of the remote database to update. If this value is provided and no dbxref then all of the publications currently in the Chado database for this remote database will be updated.
$publishSet to TRUE if publications should be published after import. For Tripal v3 this value can be set to the string 'sync' or 'both' in the event that the site is in "legacy" mode. Setting this value to 'sync' will create nodes, setting to 'both' will create nodes and entities. If set to TRUE only entities are created.