function chado_submit_obo_job

3.x tripal_chado.cv.api.inc chado_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_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

1 call to chado_submit_obo_job()
tripal_submit_obo_job in tripal_chado/api/modules/tripal_chado.module.DEPRECATED.api.inc
TODO: deprecate this function

File

tripal_chado/api/modules/tripal_chado.cv.api.inc, line 1310
Provides API functions specificially for managing controlled vocabulary records in Chado.

Code

function chado_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;

  $includes = array(
    drupal_get_path('module', 'tripal_chado') . '/includes/tripal_chado.cv.inc',
  );

  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_chado', 
    "tripal_cv_load_obo", $args, $user->uid, 10, $includes);
  }
  else {
    if ($obo['url']) {
      $sql = "SELECT * FROM {tripal_cv_obo} WHERE path = :url";
      $result = db_query($sql, array(':url' => $obo['url']))->fetchObject();

      $args = array($result->obo_id);
      return tripal_add_job("Load OBO " . $result->name, 'tripal_chado', 
      "tripal_cv_load_obo", $args, $user->uid, 10, $includes);
    }
    elseif ($obo['file']) {
      $sql = "SELECT * FROM {tripal_cv_obo} WHERE path = :file";
      $result = db_query($sql, array(':url' => $obo['file']))->fetchObject();

      $args = array($result->obo_id);
      return tripal_add_job("Load OBO " . $result->name, 'tripal_chado', 
      "tripal_cv_load_obo", $args, $user->uid, 10, $includes);
    }
  }
  return FALSE;
}