Tripal
Functions
Chado Organism
Collaboration diagram for Chado Organism:

Functions

 chado_get_organism ($identifiers, $options=[])
 
 chado_get_organism_scientific_name ($organism)
 
 chado_get_organism_id_from_scientific_name ($name, $options=[])
 
 chado_get_organism_select_options ($syncd_only=TRUE, $show_common_name=FALSE)
 
 chado_get_organism_image_url ($organism)
 
 chado_autocomplete_organism ($text)
 
 chado_abbreviate_infraspecific_rank ($rank)
 
 chado_unabbreviate_infraspecific_rank ($rank)
 

Detailed Description

Provides API functions specifically for managing organism records in Chado.

Function Documentation

◆ chado_abbreviate_infraspecific_rank()

chado_abbreviate_infraspecific_rank (   $rank)

A handy function to abbreviate the infraspecific rank.

Parameters
$rankThe rank below species.
Returns
The proper abbreviation for the rank.

◆ chado_autocomplete_organism()

chado_autocomplete_organism (   $text)

This function is intended to be used in autocomplete forms for searching for organisms that begin with the provided string.

Parameters
$textThe string to search for.
Returns
A json array of terms that begin with the provided string.

◆ chado_get_organism()

chado_get_organism (   $identifiers,
  $options = [] 
)

Retrieves a chado organism variable.

Parameters
$identifierAn array with the key stating what the identifier is. Supported keys (only one of the following unique keys is required):
  • organism_id: the chado organism.organism_id primary key.
  • genus & species: the chado organism.genus field & organism.species field.
  • scientific_name: Full taxonomic name, can include infraspecific nomenclature. There are also some specially handled keys. They are:
  • property: An array/object describing the property to select records for. It should at least have either a type_name (if unique across cvs) or type_id. Other supported keys include: cv_id/cv_name (of the type), value and rank.
$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 organism record to be returned.

Returns
If unique values were passed in as an identifier then an object describing the organism will be returned (will be a chado variable from chado_generate_var()). Otherwise, NULL will be returned.

◆ chado_get_organism_id_from_scientific_name()

chado_get_organism_id_from_scientific_name (   $name,
  $options = [] 
)

Returns organism_id values of organisms matching the specified full scientific name, abbreviation, or common name of an organism.

Parameters
$nameThe organism name to be queried. Infraspecific type can be abbreviated.
$optionsAn array of options. The following keys are available:
  • check_abbreviation: If TRUE and the $name did not match the scientific name, then check the abbreviation.
  • check_common_name: If TRUE and the $name did not match the scientific name, then check the common name.
  • case_sensitive: If TRUE then all searches should be case sensitive. Default is FALSE. If no options are specified, search is for a match of $name to the scientific_name only, case insensitive.
Returns
Array of matching organism_id values.

◆ chado_get_organism_image_url()

chado_get_organism_image_url (   $organism)

Return the path for the organism image.

Parameters
$organismAn organism table record.
Returns
If the type parameter is 'url' (the default) then the fully qualified url to the image is returend. If no image is present then NULL is returned.

◆ chado_get_organism_scientific_name()

chado_get_organism_scientific_name (   $organism)

Returns the full scientific name of an organism.

Parameters
$organismAn organism object.
Returns
The full scientific name of the organism.

◆ chado_get_organism_select_options()

chado_get_organism_select_options (   $syncd_only = TRUE,
  $show_common_name = FALSE 
)

Returns a list of organisms to use in select lists.

Parameters
$syncd_onlyWhether or not to return all chado organisms or just those sync'd with drupal. Defaults to TRUE (only sync'd organisms). For Tripal v3 you want FALSE here.
$show_common_nameWhen true, include the organism common name, if present, in parentheses.
Returns
An array of organisms where each value is the organism scientific name and the keys are organism_id's.

◆ chado_unabbreviate_infraspecific_rank()

chado_unabbreviate_infraspecific_rank (   $rank)

A handy function to expand the infraspecific rank from an abbreviation.

Parameters
$rankThe rank below species or its abbreviation. A period at the end of the abbreviation is optional.
Returns
The proper unabbreviated form for the rank.