Tripal
Functions
Tripal_chado_module_DEPRECATED_api
Collaboration diagram for Tripal_chado_module_DEPRECATED_api:

Functions

 tripal_get_analysis ($identifier, $options)
 
 tripal_get_analysis_select_options ($syncd_only=TRUE)
 
 tripal_insert_contact ($values)
 
 tripal_autocomplete_contact ($text)
 
 tripal_get_cv ($identifiers, $options=[])
 
 tripal_get_cv_select_options ()
 
 tripal_get_cvterm ($identifiers, $options=[])
 
 tripal_get_cvterm_select_options ($cv_id, $rel_type=FALSE)
 
 tripal_update_cvtermpath ($cv_id, $job_id=NULL)
 
 tripal_insert_cv ($name, $definition)
 
 tripal_insert_cvterm ($term, $options=[])
 
 tripal_submit_obo_job ($obo)
 
 tripal_insert_obo ($name, $path)
 
 tripal_get_obo ($values)
 
 tripal_autocomplete_cv ($string='')
 
 tripal_autocomplete_cvterm ($cv_id, $string='')
 
 tripal_associate_cvterm ($basetable, $record_id, $cvterm, $options=[])
 
 tripal_get_db ($identifiers, $options=[])
 
 tripal_get_db_select_options ()
 
 tripal_get_dbxref ($identifiers, $options=[])
 
 tripal_get_dbxref_url ($dbxref)
 
 tripal_insert_db ($values, $options=[])
 
 tripal_insert_dbxref ($values)
 
 tripal_associate_dbxref ($basetable, $record_id, $dbxref, $options=[])
 
 tripal_autocomplete_dbxref ($db_id, $string='')
 
 tripal_autocomplete_feature ($string='')
 
 tripal_reverse_compliment_sequence ($sequence)
 
 tripal_get_feature_sequences ($feature, $options)
 
 tripal_get_bulk_feature_sequences ($options)
 
 tripal_get_fasta_defline ($feature, $notes='', $featureloc=NULL, $type='', $length=0)
 
 tripal_get_location_string ($featureloc)
 
 tripal_get_organism ($identifiers, $options=[])
 
 tripal_get_organism_scientific_name ($organism)
 
 tripal_get_organism_select_options ($syncd_only=TRUE)
 
 tripal_get_organism_image_url ($organism)
 
 tripal_autocomplete_organism ($text)
 
 tripal_abbreviate_infraspecific_rank ($rank)
 
 tripal_validate_phylotree ($val_type, &$options, &$errors, &$warnings)
 
 tripal_insert_phylotree (&$options, &$errors, &$warnings)
 
 tripal_update_phylotree ($phylotree_id, &$options)
 
 tripal_delete_phylotree ($phylotree_id)
 
 tripal_assign_phylogeny_tree_indices (&$tree, &$index=1)
 
 tripal_phylogeny_import_tree (&$tree, $phylotree, $options, $vocab=[], $parent=NULL)
 
 tripal_phylogeny_get_node_types_vocab ()
 
 tripal_phylogeny_import_tree_file ($file_name, $format, $options=[], $job_id=NULL)
 
 tripal_get_publication ($identifiers, $options=[])
 
 tripal_publication_exists ($pub_details)
 
 tripal_autocomplete_pub ($string='')
 
 tripal_import_pub_by_dbxref ($pub_dbxref, $do_contact=FALSE, $do_update=TRUE)
 
 tripal_execute_active_pub_importers ($report_email=FALSE, $do_update=FALSE)
 
 tripal_reimport_publications ($do_contact=FALSE, $dbxref=NULL, $db=NULL)
 
 tripal_pub_create_citations ($options)
 
 tripal_pub_create_citation ($pub)
 
 tripal_get_minimal_pub_info ($pub)
 
 tripal_get_stock ($identifiers, $options=[])
 
 tripal_get_multiple_stocks ($identifiers, $options=[])
 

Detailed Description

Deprecated legacy api code.

Function Documentation

◆ tripal_abbreviate_infraspecific_rank()

tripal_abbreviate_infraspecific_rank (   $rank)

A handy function to abbreviate the infraspecific rank.

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

◆ tripal_assign_phylogeny_tree_indices()

tripal_assign_phylogeny_tree_indices ( $tree,
$index = 1 
)

Iterates through the tree and sets the left and right indicies.

Parameters
$treeThe tree array.
$indexThis parameters is not used when the function is first called. It is used for recursive calls.

◆ tripal_associate_cvterm()

tripal_associate_cvterm (   $basetable,
  $record_id,
  $cvterm,
  $options = [] 
)

Add a record to a cvterm linking table (ie: feature_cvterm).

Parameters
$basetableThe base table to which the cvterm should be linked/associated. Thus to associate a cvterm to a feature the basetable=feature and cvterm_id is added to the feature_cvterm table.
$record_idThe primary key of the basetable to associate the cvterm with. This should be in integer.
$cvtermAn associative array describing the cvterm. Valid keys include:
  • name: the name for the cvterm,
  • cv_name: the name of the cv the cvterm belongs to.
  • cv_id: the primary key of the cv the cvterm belongs to.
$optionsAn associative array of options. Valid keys include:
  • insert_cvterm: Insert the cvterm if it doesn't already exist. FALSE is the default.

◆ tripal_associate_dbxref()

tripal_associate_dbxref (   $basetable,
  $record_id,
  $dbxref,
  $options = [] 
)

Add a record to a database reference linking table (ie: feature_dbxref).

Parameters
$basetableThe base table for which the dbxref should be associated. Thus to associate a dbxref with a feature the basetable=feature and dbxref_id is added to the feature_dbxref table.
$record_idThe primary key of the basetable to associate the dbxref with. This should be in integer.
$dbxrefAn associative array describing the dbxref. Valid keys include: 'accession' => the accession for the dbxref, 'db_name' => the name of the database the dbxref belongs to. 'db_id' => the primary key of the database the dbxref belongs to.
$optionsAn associative array of options. Valid keys include:
  • insert_dbxref: Insert the dbxref if it doesn't already exist. TRUE is the default.

◆ tripal_autocomplete_contact()

tripal_autocomplete_contact (   $text)

This function is intended to be used in autocomplete forms for contacts.

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

◆ tripal_autocomplete_cv()

tripal_autocomplete_cv (   $string = '')

This function is intended to be used in autocomplete forms.

This function searches for a matching controlled vobulary name.

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

◆ tripal_autocomplete_cvterm()

tripal_autocomplete_cvterm (   $cv_id,
  $string = '' 
)

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

Parameters
$cv_idThe CV ID in which to search for the term.
$stringThe string to search for.
Returns
A json array of terms that begin with the provided string.

◆ tripal_autocomplete_dbxref()

tripal_autocomplete_dbxref (   $db_id,
  $string = '' 
)

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

Parameters
$db_idThe DB ID in which to search for the term.
$stringThe string to search for.
Returns
A json array of terms that begin with the provided string.

◆ tripal_autocomplete_feature()

tripal_autocomplete_feature (   $string = '')

tripal_feature_api 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.

◆ tripal_autocomplete_organism()

tripal_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.

◆ tripal_autocomplete_pub()

tripal_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.

◆ tripal_delete_phylotree()

tripal_delete_phylotree (   $phylotree_id)

Deletes a phylotree record from Chado.

Parameters
$phylotree_id
Returns
TRUE on success, FALSE on failure.

◆ tripal_execute_active_pub_importers()

tripal_execute_active_pub_importers (   $report_email = FALSE,
  $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.
$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.

◆ tripal_get_analysis()

tripal_get_analysis (   $identifier,
  $options 
)

tripal_analysis_api Retrieves a chado analysis variable.

Parameters
$identifieran array with the key stating what the identifier is. Supported keys (only on of the following unique keys is required):
  • analysis_id: the chado analysis.analysis_id primary key.
  • nid: the drupal node.nid primary key. 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 stock record to be returned.

Returns
the analysis node matching the passed in identifier

◆ tripal_get_analysis_select_options()

tripal_get_analysis_select_options (   $syncd_only = TRUE)

Returns a list of analyses that are currently synced with Drupal to use in select lists.

Parameters
$syncd_onlyWhether or not to return all chado analyses or just those sync'd with drupal. Defaults to TRUE (only sync'd analyses).
Returns
An array of analyses sync'd with Drupal where each value is the analysis scientific name and the keys are analysis_id's.

◆ tripal_get_bulk_feature_sequences()

tripal_get_bulk_feature_sequences (   $options)

Retrieves the bulk sequences for a given feature.

Parameters
$optionsAn associative array of options for selecting a feature. Valid keys include:
  • org_commonname: The common name of the organism for which sequences should be retrieved
  • genus: The genus of the organism for which sequences should be retrieved
  • species: The species of the organism for which sequences should be retrieved
  • analysis_name: The name of an analysis to which sequences belong. Only those that are associated with the analysis will be retrieved.
  • type: The type of feature (a sequence ontology term).
  • feature_name: the name of the feature. Can be an array of feature names.
  • feature_uname: the uniquename of the feature. Can be an array of feature unique names.
  • upstream: An integer specifing the number of upstream bases to include in the output
  • downstream: An integer specifying the number of downstream bases to include in the output.
  • derive_from_parent: Set to '1' if the sequence should be obtained from the parent to which this feature is aligned.
  • aggregate: Set to '1' if the sequence should only contain sub features, excluding intro sub feature sequence. For example, set this option to obtain just the coding sequence of an mRNA.
  • sub_feature_types: Only include sub features (or child features) of the types provided in the array
  • relationship_type: If a relationship name is provided (e.g. sequence_of) then any sequences that are in relationships of this type with matched sequences are also included
  • relationship_part: If a relationship is provided in the preceding argument then the rel_part must be either 'object' or 'subject' to indicate which side of the relationship the matched features belong
  • width: Indicate the number of bases to use per line. A new line will be added after the specified number of bases on each line.
  • is_html: Set to '1' if the sequence is meant to be displayed on a web page. This will cause a
    tag to separate lines of the FASTA sequence.
Returns
Returns an array of sequences. The sequences will be in an array with the following keys for each sequence: 'types' => an array of feature types that were used to derive the sequence (e.g. from an aggregated sequence) 'upstream' => the number of upstream bases in the sequence 'downstream' => the number of downstream bases in the sequence 'defline' => the definition line used to create a FASTA sequence 'residues' => the residues 'featureloc_id' => the featureloc_id if from an alignment

◆ tripal_get_cv()

tripal_get_cv (   $identifiers,
  $options = [] 
)

tripal_chado_cv_api Retrieves a chado controlled vocabulary variable

Parameters
$identifierAn array with the key stating what the identifier is. Supported keys (only on of the following unique keys is required):
  • cv_id: the chado cv.cv_id primary key.
  • name: the chado cv.name field (assume unique).
$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 cv record to be returned.

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

◆ tripal_get_cv_select_options()

tripal_get_cv_select_options ( )

Create an options array to be used in a form element which provides a list of all chado cvs.

Returns
An array(cv_id => name) for each cv in the chado cv table.

◆ tripal_get_cvterm()

tripal_get_cvterm (   $identifiers,
  $options = [] 
)

Retrieves a chado controlled vocabulary term variable.

Parameters
$identifierAn array apropriate for use with the chado_generate_var for uniquely identifying a cvterm record. Alternativley, there are also some specially handled keys. They are:
  • id: an ID for the term of the for [dbname]:[accession], where [dbname] is the short name of the vocabulary and accession is the unique ID.
  • cv_id: an integer indicating the cv_id or an array with 'name' => the name of the cv.
  • synonym: an array with 'name' => the name of the synonym of the cvterm you want returned; 'cv_id' => the cv_id of the synonym; 'cv_name' => the name of the cv of the synonym.
  • 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 cvterm record to be returned.

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

◆ tripal_get_cvterm_select_options()

tripal_get_cvterm_select_options (   $cv_id,
  $rel_type = FALSE 
)

Create an options array to be used in a form element which provides a list of all chado cvterms.

Parameters
$cv_idThe chado cv_id; only cvterms with the supplied cv_id will be returnedl.
$rel_typeSet to TRUE if the terms returned should only be relationship types in the vocabulary. This is useful for creating drop-downs of terms used for relationship linker tables.
Returns
An associative array with the cvterm_id's as keys. The first element in the array has a key of '0' and a value of 'Select a Type'.

◆ tripal_get_db()

tripal_get_db (   $identifiers,
  $options = [] 
)

tripal_chado_database_api Retrieves a chado db variable.

Example Usage:

$select_values = array(
'name' => 'SOFP'
);
$db_object = tripal_get_db($select_values);
tripal_get_db($identifiers, $options=[])
Definition: tripal_chado.module.DEPRECATED.api.inc:469

The above code selects the SOFP db and returns the following object:

$db_object = stdClass Object (
[db_id] => 49
[name] => SOFP
[description] =>
[urlprefix] =>
[url] =>
);
Parameters
$identifierAn array with the key stating what the identifier is. Supported keys (only on of the following unique keys is required):
  • db_id: the chado db.db_id primary key.
  • name: the chado db.name field (assume unique).
$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 db record to be returned.

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

◆ tripal_get_db_select_options()

tripal_get_db_select_options ( )

Create an options array to be used in a form element which provides a list of all chado dbs.

Returns
An array(db_id => name) for each db in the chado db table.

◆ tripal_get_dbxref()

tripal_get_dbxref (   $identifiers,
  $options = [] 
)

Retrieves a chado database reference variable.

Example Usage:

$identifiers = array(
'accession' => 'synonym',
'db_id' => array(
'name' => 'SOFP'
)
);
$dbxref_object = tripal_get_dbxref($identifiers);
tripal_get_dbxref($identifiers, $options=[])
Definition: tripal_chado.module.DEPRECATED.api.inc:540

The above code selects the synonym database reference and returns the following object:

$dbxref_object = stdClass Object (
[dbxref_id] => 2581
[accession] => synonym
[description] =>
[version] =>
[db_db_id] => 49
[db_name] => SOFP
[db_description] =>
[db_urlprefix] =>
[db_url] =>
);
Parameters
$identifierAn array apropriate for use with the chado_generate_var for uniquely identifying a dbxref record. Alternatively, 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 dbxref record to be returned.

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

◆ tripal_get_dbxref_url()

tripal_get_dbxref_url (   $dbxref)

Generates a URL for the controlled vocabulary term.

If the URL and URL prefix are provided for the database record of a cvterm then a URL can be created for the term. By default, the db.name and dbxref.accession are concatenated and appended to the end of the db.urlprefix. But Tripal supports the use of {db} and {accession} tokens when if present in the db.urlprefix string will be replaced with the db.name and dbxref.accession respectively.

Parameters
$dbxrefA dbxref object as created by the chado_generate_var() function.
Returns
A string containing the URL.

◆ tripal_get_fasta_defline()

tripal_get_fasta_defline (   $feature,
  $notes = '',
  $featureloc = NULL,
  $type = '',
  $length = 0 
)

Returns a definition line that can be used in a FASTA file.

Parameters
$featureA single feature object containing all the fields from the chado.feature table. Best case is to provide an object generated by the chado_generate_var() function.
$notesOptional: additional notes to be added to the definition line.
$featurelocOptional: a single featureloc object generated using chado_generate_var that contains a record from the chado.featureloc table. Provide this if the sequence was obtained by using the alignment rather than from the feature.residues column.
$typeOptional: the type of sequence. By default the feature type is used.
$lengthOptional: the length of the sequence.
Returns
A string of the format: uniquename|name|type|feature_id or if an alignment: srcfeature_name:fmin..fmax[+-]; alignment of uniquename|name|type|feature_id.

◆ tripal_get_feature_sequences()

tripal_get_feature_sequences (   $feature,
  $options 
)

Retrieves the sequences for a given feature.

If a feature has multiple alignments or multiple relationships then multiple sequences will be returned.

Parameters
$featureAn associative array describing the feature. Valid keys include:
  • feature_id: The feature_id of the feature for which the sequence will be retrieved.
  • name: The feature name. This will appear on the FASTA definition line.
  • parent_id: (optional) only retrieve a sequence if 'derive_from_parent' is true and the parent matches this ID.
  • featureloc_id: (optional) only retrieve a sequence if 'derive_from_parent' is true and the alignment is defined with this featureloc_id.
$optionsAn associative array of options. Valid keys include:
  • width: Indicate the number of bases to use per line. A new line will be added after the specified number of bases on each line.
  • is_html: Set to '1' if the sequence is meant to be displayed on a web page. This will cause a
    tag to separate lines of the FASTA sequence.
  • derive_from_parent: Set to '1' if the sequence should be obtained from the parent to which this feature is aligned.
  • aggregate: Set to '1' if the sequence should only contain sub features, excluding intro sub feature sequence. For example, set this option to obtain just the coding sequence of an mRNA.
  • upstream: An integer specifing the number of upstream bases to include in the output.
  • downstream: An integer specifying the number of downstream bases to include in the output.
  • sub_feature_types: Only include sub features (or child features) of the types provided in the array.
  • relationship_type: If a relationship name is provided (e.g. sequence_of) then any sequences that are in relationships of this type with matched sequences are also included.
  • relationship_part: If a relationship is provided in the preceding argument then the rel_part must be either 'object' or 'subject' to indicate which side of the relationship the matched features belong.
Returns
an array of matching sequence in the following keys for each sequence:
  • types: an array of feature types that were used to derive the sequence (e.g. from an aggregated sequence)
  • upstream: the number of upstream bases included in the sequence
  • downstream: the number of downstream bases included in the sequence
  • defline: the definition line used to create a FASTA sequence
  • residues: the residues
  • featureloc_id: the featureloc_id if the sequences is from an alignment

◆ tripal_get_location_string()

tripal_get_location_string (   $featureloc)

Returns a string representing a feature location in an alignment.

Parameters
$featurelocA single featureloc object generated using chado_generate_var that contains a record from the chado.featureloc table.
Returns
A string of the format: uniquename:featurelocmin..featurelocmax.strand

◆ tripal_get_minimal_pub_info()

tripal_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.

◆ tripal_get_multiple_stocks()

tripal_get_multiple_stocks (   $identifiers,
  $options = [] 
)

Retrieves a chado stock variable.

Parameters
$identifierAn array with the key stating what the identifier is. Supported keys include any field in the stock table. See the chado_select_record() $values parameter for additional details including an example.
$optionsAn array of options. Supported keys include:
Returns
An array of stock objects matching the criteria.

◆ tripal_get_obo()

tripal_get_obo (   $values)

Retrieves an OBO record.

Parameters
$valuesAn associate array with the following allowed keys: obo_id, name.
Returns
An instance of an OBO record object.

◆ tripal_get_organism()

tripal_get_organism (   $identifiers,
  $options = [] 
)

Retrieves a chado organism variable.

Parameters
$identifierAn array with the key stating what the identifier is. Supported keys (only on 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. 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, FALSE will be returned.

◆ tripal_get_organism_image_url()

tripal_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.

◆ tripal_get_organism_scientific_name()

tripal_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.

◆ tripal_get_organism_select_options()

tripal_get_organism_select_options (   $syncd_only = TRUE)

Returns a list of organisms that are currently synced with Drupal 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).
Returns
An array of organisms sync'd with Drupal where each value is the organism scientific name and the keys are organism_id's.

◆ tripal_get_publication()

tripal_get_publication (   $identifiers,
  $options = [] 
)

tripal_pub_api 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.

◆ tripal_get_stock()

tripal_get_stock (   $identifiers,
  $options = [] 
)

tripal_stock_api Retrieves a chado stock variable

Parameters
$identifierAn array with the key stating what the identifier is. Supported keys (only one of the following unique keys is required):
  • stock_id: the chado stock.stock_id primary key
  • nid: the drupal nid of the stock 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 stock record to be returned.

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

◆ tripal_import_pub_by_dbxref()

tripal_import_pub_by_dbxref (   $pub_dbxref,
  $do_contact = FALSE,
  $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.
$do_updateIf set to TRUE then the publication will be updated if it already exists in the database.

◆ tripal_insert_contact()

tripal_insert_contact (   $values)

tripal_contact_api Adds a contact to the Chado contact table.

Parameters
$valuesAn array of values to be inserted. Valid keys include:
  • name: The name of the contact.
  • description: Text describing the contact.
  • type_name: The type of contact. Must be a term in the tripal_contact vocabulary.
  • properties: An associative array containing a list of key value pairs for the properites. The key's must be valid terms in the tripal_contact vocabulary (e.g. Affiliation, Address, etc).
Returns
On success, an array is returned containing the fields of the contact record including the newly added contact_id. On failure, FALSE is returned.

◆ tripal_insert_cv()

tripal_insert_cv (   $name,
  $definition 
)

Adds a controlled vocabulary to the CV table of Chado.

Parameters
$nameThe name of the controlled vocabulary. These are typically all lower case with no special characters other than an undrescore (for spaces).
$commentA description or definition of the vocabulary.
Returns
An object populated with fields from the newly added database.

◆ tripal_insert_cvterm()

tripal_insert_cvterm (   $term,
  $options = [] 
)

Add's a controlled vocabulary term to Chado.

This function will add a cvterm record (and a dbxref record if appropriate values are provided). If the parent vocabulary does not exist then that also is added to the cv table. If the cvterm is a relationship term then the 'is_relationship' value should be set. All terms must also have a corresponding database. This is specified in the term's ID just before the colon (e.g. GO:003824). If the database does not exist in the DB table then it will be added automatically. The accession (the value just after the colon in the term's ID) will be added to the dbxref table. If the CVterm already exists and $update is set (default) then the cvterm is updated. If the CVTerm already exists and $update is not set, then no changes are made and the CVTerm object is returned.

Parameters
$termAn associative array with the following keys:
  • id: the term accession. must be of the form <DB>:<ACCESSION>, where <DB> is the name of the database to which the cvterm belongs and the <ACCESSION> is the term's accession number in the database.
  • name: the name of the term. usually meant to be human-readable.
  • is_obsolete: is present and set to 1 if the term is defunct.
  • definition: the definition of the term.
  • cv_name: The CV name to which the term belongs. If this arugment is null or not provided then the function tries to find a record in the CV table with the same name provided in the $term[namespace]. If this field is provided then it overrides what the value in $term[namespace].
  • is_relationship: If this term is a relationship term then this value should be 1.
  • db_name: In some cases the database name will not be part of the $term['id'] and it needs to be explicitly set. Use this argument only if the database name cannot be specififed in the term ID (e.g. <DB>:<ACCESSION>).
$optionsAn associative array with the following keys:
  • update_existing: By default this is TRUE. If the term exists it is automatically updated.
Returns
A cvterm object

◆ tripal_insert_db()

tripal_insert_db (   $values,
  $options = [] 
)

Adds a new database to the Chado DB table and returns the DB object.

Parameters
$valuesAn associative array of the values of the db (those to be inserted):
  • name: The name of the database. This name is usually used as the prefix for CV term accessions.
  • description: (Optional) A description of the database. By default no description is required.
  • url: (Optional) The URL for the database.
  • urlprefix: (Optional) The URL that is to be used as a prefix when constructing a link to a database term.
$optionsOptional. An associative array of options that can include:
  • update_existing: Set this to '1' to force an update of the database if it already exists. The default is to not update. If the database exists then nothing is added.
Returns
An object populated with fields from the newly added database. If the database already exists it returns the values in the current entry.

◆ tripal_insert_dbxref()

tripal_insert_dbxref (   $values)

Add a database reference.

Parameters
$valuesAn associative array of the values to be inserted including:
  • db_id: the database_id of the database the reference is from.
  • accession: the accession.
  • version: (Optional) The version of the database reference.
  • description: (Optional) A description of the database reference.
Returns
The newly inserted dbxref as an object, similar to that returned by the chado_select_record() function.

◆ tripal_insert_obo()

tripal_insert_obo (   $name,
  $path 
)

Add the OBO to the tripal_cv_obo table in the Drupal database.

If the OBO name already exists in the table then the path is updated.

Parameters
$nameThe human readable name of this ontology.
$pathThe file path or URL of the ontology.
Returns
Returns the ontology ID.

◆ tripal_insert_phylotree()

tripal_insert_phylotree ( $options,
$errors,
$warnings 
)

Inserts a phylotree record into Chado.

This function validates the options passed prior to insertion of the record, and if validation passes then any values in the options array that needed validation lookups (such as the dbxref, analysis, leaf_type, etc) will have their approriate primary key values added to the options array.

Parameters
$optionsAn array of key value pairs with the following keys required: 'name': The name of the tree. This will be displayed to users. 'description: A description about the tree 'anlaysis_id: The ID of the analysis to which this phylotree should be associated. 'analysis': If the analysis_id key is not used then the analysis name may be provided to identify the analysis to which the tree should be associated. 'leaf_type': A sequence ontology term or the word 'organism'. If the type is 'organism' then this tree represents a taxonomic tree. The default, if not specified, is the term 'polypeptide'. 'tree_file': The path of the file containing the phylogenetic tree to import or a Drupal managed_file numeric ID. 'format': The file format. Currently only 'newick is supported'.

Optional keys: 'dbxref': A database cross-reference of the form DB:ACCESSION. Where DB is the database name, which is already present in Chado, and ACCESSION is the unique identifier for this tree in the remote database. 'name_re': If the leaf type is NOT 'taxonomy', then the value of this field can be a regular expression to pull out the name of the feature from the node label in the intput tree. If no value is provided the entire label is used. 'match': Set to 'uniquename' if the leaf nodes should be matched with the feature uniquename. 'load_later': If set, the tree will be loaded via a separate Tripal jobs call. Otherwise, the tree will be loaded immediately. 'no_load': If set the tree file will not be loaded.

Parameters
$errorsAn empty array where validation error messages will be set. The keys of the array will be name of the field from the options array and the value is the error message.
$warningsAn empty array where validation warning messagges will be set. The warnings should not stop an insert or an update but should be provided to the user as information by a drupal_set_message() if appropriate. The keys of the array will be name of the field from the options array and the value is the error message.
Returns
TRUE for success and FALSE for failure.

◆ tripal_phylogeny_get_node_types_vocab()

tripal_phylogeny_get_node_types_vocab ( )

Get the vocabulary terms used to describe nodes in the tree.

Returns
Array of vocab info or FALSE on failure.

◆ tripal_phylogeny_import_tree()

tripal_phylogeny_import_tree ( $tree,
  $phylotree,
  $options,
  $vocab = [],
  $parent = NULL 
)

Iterates through the tree array and creates phylonodes in Chado.

The function iterates through the tree in a top-down approach adding parent internal nodes prior to leaf nodes. Each node of the tree should have the following fields:

-name: The name (or label) for this node. -depth: The depth of the node in the tree. -is_root: Set to 1 if this node is a root node. -is_leaf: Set to 1 if this node is a leaf node. -is_internal: Set to 1 if this node is an internal node. -left_index: The index of the node to the left in the tree. -right_index: The index of the node to the right in the tree. -branch_set: An array containing a list of nodes of that are children of the node. -parent: The name of the parent node. -organism_id: The organism_id for associtating the node with an organism. -properties: An array of key/value pairs where the key is the cvterm_id and the value is the property value. These properties will be associated with the phylonode.

Prior to importing the tree the indicies can be set by using the chado_assign_phylogeny_tree_indices() function.

Parameters
$treeThe tree array.
$phylotree. The phylotree object (from Chado).
$optionsThe options provide some direction for how the tree is imported. The following keys can be used: -taxonomy: Set to 1 if this tree is a taxonomic tree. Set to 0 otherwise. -leaf_type: Set to the leaf type name. If this is a non-taxonomic tree that is associated with features, then this should be the Sequence Ontology term for the feature (e.g. polypeptide). If this is a taxonomic tree then this option is not needed. -match: Set to either 'name' or 'uniquename'. This is used for matching the feature name or uniquename with the node name. This is not needed for taxonomic trees. -match_re: Set to a regular that can be used for matching the node name with the feature name if the node name is not identical to the feature name.
$vocabOptional. An array containing a set of key/value pairs that maps node types to CV terms. The keys must be 'root', 'internal' or 'leaf'. If no vocab is provded then the terms provided by the tripal_phylogeny CV will be used.
$parentThis argument is not needed when the funtion is first called. This function is recursive and this argument is used on recursive calls.

◆ tripal_phylogeny_import_tree_file()

tripal_phylogeny_import_tree_file (   $file_name,
  $format,
  $options = [],
  $job_id = NULL 
)

Imports a tree file.

This function is used as a wrapper for loading a phylogenetic tree using any number of file loaders.

Parameters
$file_nameThe name of the file containing the phylogenetic tree to import.
$formatThe format of the file. Currently only the 'newick' file format is supported.
$optionsOptions if the phylotree record already exists: 'phylotree_id': The imported nodes will be associated with this tree. 'leaf_type': A sequence ontology term or the word 'organism'. If the type is 'organism' then this tree represents a taxonomic tree. The default, if not specified, is the term 'polypeptide'. 'name_re': If the leaf type is NOT 'taxonomy', then the value of this field can be a regular expression to pull out the name of the feature from the node label in the intput tree. If no value is provided the entire label is used. 'match': Set to 'uniquename' if the leaf nodes should be matched with the feature uniquename.

◆ tripal_pub_create_citation()

tripal_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.

◆ tripal_pub_create_citations()

tripal_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.

◆ tripal_publication_exists()

tripal_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.

◆ tripal_reimport_publications()

tripal_reimport_publications (   $do_contact = FALSE,
  $dbxref = NULL,
  $db = NULL 
)

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.

◆ tripal_reverse_compliment_sequence()

tripal_reverse_compliment_sequence (   $sequence)

Performs a reverse compliment of a nucleotide sequence.

Parameters
$sequenceThe nucelotide sequence.
Returns
an upper-case reverse complemented sequence.

◆ tripal_submit_obo_job()

tripal_submit_obo_job (   $obo)

TODO: deprecate this function

Avoid using this function as it will be deprecated in future releases.

This function allows other modules to programatically submit an ontology for loading into Chado.

This function will add a job to the Jobs subsystem for parsing the ontology. You can either pass a known OBO ID to the function or the URL or full path the the ontology file. If a URL or file name is passed then the $obo_name argument must also be provided. If this is the first time the ontology has been provided to Tripal then it will be added to the database and will be assigned a unique OBO ID.

Parameters
$obo_idIf the ontology is already loaded into the Tripal tables then use this argument to specify the unique ID for the ontology that will be loaded.
$obo_nameIf the OBO has not been added before then use this argument to specify the human readable name of the ontology.
$obo_urlIf the OBO to be loaded is located on a remote server then use this argument to provide the URL.
$obo_fileIf the OBO is housed on the local file system of the server then use this argument to specify the full path.
Returns
returns the job_id of the submitted job or FALSE if the job was not added

◆ tripal_update_cvtermpath()

tripal_update_cvtermpath (   $cv_id,
  $job_id = NULL 
)

Duplicate of fill_cvtermpath() stored procedure in Chado.

Identifies all of the root terms of the controlled vocabulary.

Parameters
$cvidThe controlled vocabulary ID from the cv table of Chado (i.e. cv.cv_id).
$job_id

◆ tripal_update_phylotree()

tripal_update_phylotree (   $phylotree_id,
$options 
)

Updates a phylotree record into Chado.

This function validates the options passed prior to update of the record and if validation passes then any values in the options array that needed validation lookups (such as the dbxref, analysis, leaf_type, etc) will have their approriate primary key values added to the options array. A Drupal File object will be added to the options array for the tree file if one is provided.

Parameters
$phylotree_idThe ID of the phylotree to update.
$optionsAn array of key value pairs with the following optional keys: 'name': The name of the tree. This will be displayed to users. 'description: A description about the tree 'anlaysis_id: The ID of the analysis to which this phylotree should be associated. 'analysis': If the analysis_id key is not used then the analysis name may be provided to identify the analysis to which the tree should be associated. 'leaf_type': A sequence ontology term or the word 'organism'. If the type is 'organism' then this tree represents a taxonomic tree. The default, if not specified, is the term 'polypeptide'. 'tree_file': The path of the file containing the phylogenetic tree to import or a Drupal managed_file numeric ID. 'format': The file format. Currently only 'newick is supported' 'dbxref': A database cross-reference of the form DB:ACCESSION. Where DB is the database name, which is already present in Chado, and ACCESSION is the unique identifier for this tree in the remote database. 'name_re': If the leaf type is NOT 'taxonomy', then the value of this field can be a regular expression to pull out the name of the feature from the node label in the intput tree. If no value is provided the entire label is used. 'match': Set to 'uniquename' if the leaf nodes should be matched with the feature uniquename. 'load_later': If set, the tree will be loaded via a separate Tripal jobs call. Otherwise, the tree will be loaded immediately.

◆ tripal_validate_phylotree()

tripal_validate_phylotree (   $val_type,
$options,
$errors,
$warnings 
)

tripal_phylotree_api Validates an $options array for insert or update of a phylotree record.

If validation passes then any values that needed validation lookups (such as the dbxref, analysis, leaf_type, etc) will have their approriate primary_keys added to the $options array, and missing default values will also be added.

Parameters
$val_typeThe type of validation. Can be either 'insert' or 'update'.
$optionsAn array of key/value pairs containing any of the valid keys for either the tripal_insert_phylotree() or tripal_update_phylotree() functions.
$errorsAn empty array where validation error messages will be set. The keys of the array will be name of the field from the options array and the value is the error message.
$warningsAn empty array where validation warning messagges will be set. The warnings should not stop an insert or an update but should be provided to the user as information by a drupal_set_message() if appropriate. The keys of the array will be name of the field from the options array and the value is the error message.
Returns
If validation fails then FALSE is returned. Any options that do not pass validation checks will be added in the $errors array with the key being the option and the value being the error message. If validation is successful then TRUE is returned.