function tripal_cv_load_obo_v1_2_id

2.x tripal_cv_load_obo_v1_2_id($obo_id, $jobid = NULL)
1.x tripal_cv_load_obo_v1_2_id($obo_id, $jobid = NULL)

A wrapper function for importing the user specified OBO file into Chado by specifying the obo_id of the OBO. It requires that the file be in OBO v1.2 compatible format. This function is typically executed via the Tripal jobs management after a user submits a job via the Load Onotloies form.


$obo_id: An obo_id from the tripal_cv_obo file that specifies which OBO file to import

$job_id: The job_id of the job from the Tripal jobs management system.

Related topics


tripal_cv/includes/, line 347
Functions to aid in loading ontologies into the chado cv module


function tripal_cv_load_obo_v1_2_id($obo_id, $jobid = NULL) {

  // Get the OBO reference.
  $sql = "SELECT * FROM {tripal_cv_obo} WHERE obo_id = :obo_id";
  $obo = db_query($sql, array(':obo_id' => $obo_id))->fetchObject();

  // Convert the module name to the real path if present
  if (preg_match("/\{(.*?)\}/", $obo->path, $matches)) {
    $module = $matches[1];
    $path = drupal_realpath(drupal_get_path('module', $module));
    $obo->path = preg_replace("/\{.*?\}/", $path, $obo->path);

  // if the reference is for a remote URL then run the URL processing function
  if (preg_match("/^http:\/\//", $obo->path) or 
    preg_match("/^https:\/\//", $obo->path) or 
    preg_match("/^ftp:\/\//", $obo->path)) {
    tripal_cv_load_obo_v1_2_url($obo->name, $obo->path, $jobid, 0);
  // if the reference is for a local file then run the file processing function
  else {
    // check to see if the file is located local to Drupal
    $dfile = $_SERVER['DOCUMENT_ROOT'] . base_path() . $obo->path;
    if (file_exists($dfile)) {
      tripal_cv_load_obo_v1_2_file($obo->name, $dfile, $jobid, 0);
    // if not local to Drupal, the file must be someplace else, just use
    // the full path provided
    else {
      if (file_exists($obo->path)) {
        tripal_cv_load_obo_v1_2_file($obo->name, $obo->path, $jobid, 0);
      else {
        print "ERROR: could not find OBO file: '$obo->path'\n";