function tripal_submit_obo_job

2.x tripal_cv.api.inc tripal_submit_obo_job($obo)

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_id: If 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_name: If the OBO has not been added before then use this argument to specify the human readable name of the ontology.

$obo_url: If the OBO to be loaded is located on a remote server then use this argument to provide the URL.

$obo_file: If the OBO is housed on the local file system of the server then use this argument to specify the full path.

Return value

returns the job_id of the submitted job or FALSE if the job was not added

Related topics

8 calls to tripal_submit_obo_job()
tripal_contact_install in tripal_contact/tripal_contact.install
Implementation of hook_install().
tripal_cv_install in tripal_cv/tripal_cv.install
Implementation of hook_install().
tripal_cv_obo_form_submit in tripal_cv/includes/tripal_cv.obo_loader.inc
The submit function for the load ontology form. It registers a tripal job to import the user specified ontology file
tripal_cv_submit_obo_job in tripal_cv/api/tripal_cv.DEPRECATED.inc
tripal_feature_install in tripal_feature/tripal_feature.install
Implements hook_install().

... See full list

1 string reference to 'tripal_submit_obo_job'

File

tripal_cv/api/tripal_cv.api.inc, line 809
This module provides a set of functions to simplify working with controlled vocabularies.

Code

function tripal_submit_obo_job($obo) {
  global $user;

  // Set Defaults
  $obo['obo_id'] = (isset($obo['obo_id'])) ? $obo['obo_id'] : NULL;
  $obo['name'] = (isset($obo['name'])) ? $obo['name'] : NULL;
  $obo['url'] = (isset($obo['url'])) ? $obo['url'] : NULL;
  $obo['file'] = (isset($obo['file'])) ? $obo['file'] : NULL;

  if ($obo['obo_id']) {
    $sql = "SELECT * FROM {tripal_cv_obo} WHERE obo_id = :obo_id";
    $result = db_query($sql, array(':obo_id' => $obo['obo_id']))->fetchObject();

    $args = array($result->obo_id);
    return tripal_add_job("Load OBO " . $result->name, 'tripal_cv', 
    "tripal_cv_load_obo_v1_2_id", $args, $user->uid);
  }
  else {
    if ($obo['url']) {
      $args = array($obo['name'], $obo['url']);
      return tripal_add_job("Load OBO " . $obo['name'], 'tripal_cv', 
      "tripal_cv_load_obo_v1_2_url", $args, $user->uid);
    }
    elseif ($obo['file']) {
      $args = array($obo['name'], $obo['file']);
      return tripal_add_job("Load OBO " . $obo['name'], 'tripal_cv', 
      "tripal_cv_load_obo_v1_2_file", $args, $user->uid);
    }
  }
  return FALSE;
}