|
@@ -15,12 +15,12 @@
|
|
|
/**
|
|
|
* Provides the form to load an already existing controlled
|
|
|
* Vocabulary into chado
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $form
|
|
|
- * The form array
|
|
|
+ * The form array
|
|
|
* @param $form_state
|
|
|
* The form state array
|
|
|
- *
|
|
|
+ *
|
|
|
* @return
|
|
|
* The form array with new additions
|
|
|
*
|
|
@@ -104,13 +104,13 @@ function tripal_cv_obo_form($form, &$form_state) {
|
|
|
/**
|
|
|
* The submit function for the load ontology form. It registers a
|
|
|
* tripal job to import the user specified ontology file
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $form
|
|
|
- * The form array
|
|
|
+ * The form array
|
|
|
* @param $form_state
|
|
|
* The form state array
|
|
|
- *
|
|
|
- *
|
|
|
+ *
|
|
|
+ *
|
|
|
* @ingroup tripal_obo_loader
|
|
|
*/
|
|
|
function tripal_cv_obo_form_submit($form, &$form_state) {
|
|
@@ -119,19 +119,24 @@ function tripal_cv_obo_form_submit($form, &$form_state) {
|
|
|
$obo_url = trim($form_state['values']['obo_url']);
|
|
|
$obo_file = trim($form_state['values']['obo_file']);
|
|
|
|
|
|
- tripal_cv_submit_obo_job($obo_id, $obo_name, $obo_url, $obo_file);
|
|
|
+ tripal_submit_obo_job(array(
|
|
|
+ 'ob_id' => $obo_id,
|
|
|
+ 'name' => $obo_name,
|
|
|
+ 'url' => $obo_url,
|
|
|
+ 'file' => $obo_file
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 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
|
|
|
+ * 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.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $obo_id
|
|
|
* An obo_id from the tripal_cv_obo file that specifies which OBO file to import
|
|
|
* @param $job_id
|
|
|
- * The job_id of the job from the Tripal jobs management system.
|
|
|
+ * The job_id of the job from the Tripal jobs management system.
|
|
|
*
|
|
|
* @ingroup tripal_obo_loader
|
|
|
*/
|
|
@@ -166,19 +171,19 @@ function 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 filename and path of the OBO. It requires that the file be in OBO v1.2
|
|
|
- * compatible format. This function is typically executed via the Tripal jobs
|
|
|
+ * A wrapper function for importing the user specified OBO file into Chado by
|
|
|
+ * specifying the filename and path 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.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $obo_name
|
|
|
* The name of the OBO (typially the ontology or controlled vocabulary name)
|
|
|
* @param $file
|
|
|
* The path on the file system where the ontology can be found
|
|
|
* @param $job_id
|
|
|
- * The job_id of the job from the Tripal jobs management system.
|
|
|
+ * The job_id of the job from the Tripal jobs management system.
|
|
|
* @param $is_new
|
|
|
- * Set to TRUE if this is a new ontology that does not yet exist in the
|
|
|
+ * Set to TRUE if this is a new ontology that does not yet exist in the
|
|
|
* tripal_cv_obo table. If TRUE the OBO will be added to the table.
|
|
|
*
|
|
|
* @ingroup tripal_obo_loader
|
|
@@ -187,7 +192,7 @@ function tripal_cv_load_obo_v1_2_file($obo_name, $file, $jobid = NULL, $is_new =
|
|
|
$newcvs = array();
|
|
|
|
|
|
if ($is_new) {
|
|
|
- tripal_cv_add_obo_ref($obo_name, $file);
|
|
|
+ tripal_insert_obo($obo_name, $file);
|
|
|
}
|
|
|
|
|
|
$success = tripal_cv_load_obo_v1_2($file, $jobid, $newcvs);
|
|
@@ -199,19 +204,19 @@ function tripal_cv_load_obo_v1_2_file($obo_name, $file, $jobid = NULL, $is_new =
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * A wrapper function for importing the user specified OBO file into Chado by
|
|
|
- * specifying the remote URL of the OBO. It requires that the file be in OBO v1.2
|
|
|
- * compatible format. This function is typically executed via the Tripal jobs
|
|
|
+ * A wrapper function for importing the user specified OBO file into Chado by
|
|
|
+ * specifying the remote URL 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.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $obo_name
|
|
|
* The name of the OBO (typially the ontology or controlled vocabulary name)
|
|
|
* @param $url
|
|
|
* The remote URL of the OBO file.
|
|
|
* @param $job_id
|
|
|
- * The job_id of the job from the Tripal jobs management system.
|
|
|
+ * The job_id of the job from the Tripal jobs management system.
|
|
|
* @param $is_new
|
|
|
- * Set to TRUE if this is a new ontology that does not yet exist in the
|
|
|
+ * Set to TRUE if this is a new ontology that does not yet exist in the
|
|
|
* tripal_cv_obo table. If TRUE the OBO will be added to the table.
|
|
|
*
|
|
|
* @ingroup tripal_obo_loader
|
|
@@ -236,15 +241,15 @@ function tripal_cv_load_obo_v1_2_url($obo_name, $url, $jobid = NULL, $is_new = T
|
|
|
}
|
|
|
fclose($url_fh);
|
|
|
fclose($obo_fh);
|
|
|
-
|
|
|
+
|
|
|
if ($is_new) {
|
|
|
- tripal_cv_add_obo_ref($obo_name, $url);
|
|
|
+ tripal_insert_obo($obo_name, $url);
|
|
|
}
|
|
|
|
|
|
// second, parse the OBO
|
|
|
$success = tripal_cv_load_obo_v1_2($temp, $jobid, $newcvs);
|
|
|
if ($success) {
|
|
|
-
|
|
|
+
|
|
|
// update the cvtermpath table
|
|
|
tripal_cv_load_update_cvtermpath($newcvs, $jobid);
|
|
|
print "Done\n";
|
|
@@ -255,42 +260,42 @@ function tripal_cv_load_obo_v1_2_url($obo_name, $url, $jobid = NULL, $is_new = T
|
|
|
|
|
|
/**
|
|
|
* A function for executing the cvtermpath function of Chado. This function
|
|
|
- * populates the cvtermpath table of Chado for quick lookup of term
|
|
|
+ * populates the cvtermpath table of Chado for quick lookup of term
|
|
|
* relationships
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $newcvs
|
|
|
* An associative array of controlled vocabularies to update. The key must be
|
|
|
* the name of the vocabulary and the value the cv_id from the cv table of chado.
|
|
|
* @param $jobid
|
|
|
- * The job_id of the job from the Tripal jobs management system.
|
|
|
- *
|
|
|
+ * The job_id of the job from the Tripal jobs management system.
|
|
|
+ *
|
|
|
* @ingroup tripal_obo_loader
|
|
|
*/
|
|
|
function tripal_cv_load_update_cvtermpath($newcvs, $jobid) {
|
|
|
|
|
|
print "\nUpdating cvtermpath table. This may take a while...\n";
|
|
|
foreach ($newcvs as $namespace => $cvid) {
|
|
|
- tripal_cv_update_cvtermpath($cvid, $jobid);
|
|
|
+ tripal_update_cvtermpath($cvid, $jobid);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Imports a given OBO file into Chado. This function is usually called by
|
|
|
- * one of three wrapper functions: tripal_cv_load_obo_v1_2_id,
|
|
|
+ * one of three wrapper functions: tripal_cv_load_obo_v1_2_id,
|
|
|
* tripal_cv_load_obo_v1_2_file or tirpal_cv_load_obo_v1_2_url. But, it can
|
|
|
- * be called directly if the full path to an OBO file is available on the
|
|
|
+ * be called directly if the full path to an OBO file is available on the
|
|
|
* file system.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $flie
|
|
|
* The full path to the OBO file on the file system
|
|
|
* @param $jobid
|
|
|
* The job_id of the job from the Tripal jobs management system.
|
|
|
* @param $newcvs
|
|
|
- * An empty array passed by reference that upon return will contain the list
|
|
|
+ * An empty array passed by reference that upon return will contain the list
|
|
|
* of newly added vocabularies. The key will contain the CV name and the
|
|
|
* value the new cv_id
|
|
|
- *
|
|
|
- *
|
|
|
+ *
|
|
|
+ *
|
|
|
* @ingroup tripal_obo_loader
|
|
|
*/
|
|
|
function tripal_cv_load_obo_v1_2($file, $jobid = NULL, &$newcvs) {
|
|
@@ -312,10 +317,10 @@ function tripal_cv_load_obo_v1_2($file, $jobid = NULL, &$newcvs) {
|
|
|
print "Step 1: Preloading File $file\n";
|
|
|
|
|
|
// make sure we have an 'internal' and a '_global' database
|
|
|
- if (!tripal_db_add_db('internal')) {
|
|
|
+ if (!tripal_insert_db(array('name' => 'internal'))) {
|
|
|
tripal_cv_obo_quiterror("Cannot add 'internal' database");
|
|
|
}
|
|
|
- if (!tripal_db_add_db('_global')) {
|
|
|
+ if (!tripal_insert_db(array('name' => '_global'))) {
|
|
|
tripal_cv_obo_quiterror("Cannot add '_global' database");
|
|
|
}
|
|
|
|
|
@@ -327,7 +332,7 @@ function tripal_cv_load_obo_v1_2($file, $jobid = NULL, &$newcvs) {
|
|
|
// present for each stanza. Some ontologies have adopted the v1.4 method
|
|
|
// in their v1.2 files and not including it.
|
|
|
if (array_key_exists('default-namespace', $header)) {
|
|
|
- $defaultcv = tripal_cv_add_cv($header['default-namespace'][0], '');
|
|
|
+ $defaultcv = tripal_insert_cv($header['default-namespace'][0], '');
|
|
|
if (!$defaultcv) {
|
|
|
tripal_cv_obo_quiterror('Cannot add namespace ' . $header['default-namespace'][0]);
|
|
|
}
|
|
@@ -335,21 +340,21 @@ function tripal_cv_load_obo_v1_2($file, $jobid = NULL, &$newcvs) {
|
|
|
}
|
|
|
// if the 'default-namespace' is missing
|
|
|
else {
|
|
|
-
|
|
|
- // look to see if an 'ontology' key is present. It is part of the v1.4
|
|
|
+
|
|
|
+ // look to see if an 'ontology' key is present. It is part of the v1.4
|
|
|
// specification so it shouldn't be in the file, but just in case
|
|
|
if (array_key_exists('ontology', $header)) {
|
|
|
- $defaultcv = tripal_cv_add_cv(strtoupper($header['ontology'][0]), '');
|
|
|
+ $defaultcv = tripal_insert_cv(strtoupper($header['ontology'][0]), '');
|
|
|
if (!$defaultcv) {
|
|
|
tripal_cv_obo_quiterror('Cannot add namespace ' . strtoupper($header['ontology'][0]));
|
|
|
}
|
|
|
$newcvs[strtoupper(strtoupper($header['ontology'][0]))] = $defaultcv->cv_id;
|
|
|
}
|
|
|
else {
|
|
|
- $defaultcv = tripal_cv_add_cv('_global', '');
|
|
|
+ $defaultcv = tripal_insert_cv('_global', '');
|
|
|
$newcvs['_global'] = $defaultcv->cv_id;
|
|
|
}
|
|
|
- watchdog('t_obo_loader', "This OBO is missing the 'default-namespace' header. It is not possible to determine which vocabulary terms without a 'namespace' key should go. Instead, those terms will be placed in the '%vocab' vocabulary.",
|
|
|
+ watchdog('t_obo_loader', "This OBO is missing the 'default-namespace' header. It is not possible to determine which vocabulary terms without a 'namespace' key should go. Instead, those terms will be placed in the '%vocab' vocabulary.",
|
|
|
array('%vocab' => $defaultcv->name), WATCHDOG_WARNING);
|
|
|
}
|
|
|
|
|
@@ -376,10 +381,10 @@ function tripal_cv_load_obo_v1_2($file, $jobid = NULL, &$newcvs) {
|
|
|
|
|
|
/**
|
|
|
* Immediately terminates loading of the OBO file.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $message
|
|
|
* The error message to present to the user
|
|
|
- *
|
|
|
+ *
|
|
|
* @ingroup tripal_obo_loader
|
|
|
*/
|
|
|
function tripal_cv_obo_quiterror($message) {
|
|
@@ -390,11 +395,11 @@ function tripal_cv_obo_quiterror($message) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * OBO files are divided into a typedefs terms section and vocabulary terms section.
|
|
|
+ * OBO files are divided into a typedefs terms section and vocabulary terms section.
|
|
|
* This function loads the typedef terms from the OBO.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $defaultcv
|
|
|
- * A database object containing a record from the cv table for the
|
|
|
+ * A database object containing a record from the cv table for the
|
|
|
* default controlled vocabulary
|
|
|
* @param $newcvs
|
|
|
* An associative array of controlled vocabularies for this OBO. The key must be
|
|
@@ -403,7 +408,7 @@ function tripal_cv_obo_quiterror($message) {
|
|
|
* The name of the default database.
|
|
|
* @param $jobid
|
|
|
* The job_id of the job from the Tripal jobs management system.
|
|
|
- *
|
|
|
+ *
|
|
|
* @ingroup tripal_obo_loader
|
|
|
*/
|
|
|
function tripal_cv_obo_load_typedefs($defaultcv, $newcvs, $default_db, $jobid) {
|
|
@@ -453,11 +458,11 @@ function tripal_cv_obo_load_typedefs($defaultcv, $newcvs, $default_db, $jobid) {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * OBO files are divided into a typedefs section and a terms section. This
|
|
|
+ * OBO files are divided into a typedefs section and a terms section. This
|
|
|
* function loads the typedef terms from the OBO.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $defaultcv
|
|
|
- * A database object containing a record from the cv table for the
|
|
|
+ * A database object containing a record from the cv table for the
|
|
|
* default controlled vocabulary
|
|
|
* @param $jobid
|
|
|
* The job_id of the job from the Tripal jobs management system.
|
|
@@ -527,18 +532,18 @@ function tripal_cv_obo_process_terms($defaultcv, $jobid = NULL, &$newcvs, $defau
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Uses the provided term array to add/update information to Chado about the
|
|
|
+ * Uses the provided term array to add/update information to Chado about the
|
|
|
* term including the term, dbxref, synonyms, properties, and relationships.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $term
|
|
|
- * An array representing the cvterm.
|
|
|
+ * An array representing the cvterm.
|
|
|
* @param $defaultcv
|
|
|
* The name of the default controlled vocabulary
|
|
|
* @is_relationship
|
|
|
* Set to 1 if this term is a relationship term
|
|
|
* @default_db
|
|
|
* The name of the default database.
|
|
|
- *
|
|
|
+ *
|
|
|
* @ingroup tripal_obo_loader
|
|
|
*/
|
|
|
function tripal_cv_obo_process_term($term, $defaultcv, $is_relationship = 0, &$newcvs, $default_db) {
|
|
@@ -547,14 +552,14 @@ function tripal_cv_obo_process_term($term, $defaultcv, $is_relationship = 0, &$n
|
|
|
if (!array_key_exists('namespace', $term) and !($defaultcv or $defaultcv == '')) {
|
|
|
tripal_cv_obo_quiterror("Cannot add the term: no namespace defined. " . $term['id'][0]);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// construct the term array for sending to the tripal_cv_add_cvterm function
|
|
|
// for adding a new cvterm
|
|
|
$t = array();
|
|
|
$t['id'] = $term['id'][0];
|
|
|
$t['name'] = $term['name'][0];
|
|
|
if (array_key_exists('def', $term)) {
|
|
|
- $t['def'] = $term['def'][0];
|
|
|
+ $t['definition'] = $term['def'][0];
|
|
|
}
|
|
|
if (array_key_exists('subset', $term)) {
|
|
|
$t['subset'] = $term['subset'][0];
|
|
@@ -566,8 +571,12 @@ function tripal_cv_obo_process_term($term, $defaultcv, $is_relationship = 0, &$n
|
|
|
$t['is_obsolete'] = $term['is_obsolete'][0];
|
|
|
}
|
|
|
|
|
|
+ $t['cv_name'] = $defaultcv;
|
|
|
+ $t['is_relationship'] = $is_relationship;
|
|
|
+ $t['db_name'] = $default_db;
|
|
|
+
|
|
|
// add the cvterm
|
|
|
- $cvterm = tripal_cv_add_cvterm($t, $defaultcv, $is_relationship, 1, $default_db);
|
|
|
+ $cvterm = tripal_insert_cvterm($t, array('update_existing' => TRUE));
|
|
|
if (!$cvterm) {
|
|
|
tripal_cv_obo_quiterror("Cannot add the term " . $term['id'][0]);
|
|
|
}
|
|
@@ -705,15 +714,15 @@ function tripal_cv_obo_process_term($term, $defaultcv, $is_relationship = 0, &$n
|
|
|
|
|
|
/**
|
|
|
* Adds a cvterm relationship
|
|
|
- *
|
|
|
+ *
|
|
|
* @param $cvterm
|
|
|
- * A database object for the cvterm
|
|
|
+ * A database object for the cvterm
|
|
|
* @param $rel
|
|
|
* The relationship name
|
|
|
* @param $objname
|
|
|
* The relationship term name
|
|
|
* @param $defaultcv
|
|
|
- * A database object containing a record from the cv table for the
|
|
|
+ * A database object containing a record from the cv table for the
|
|
|
* default controlled vocabulary
|
|
|
* @object_is_relationship
|
|
|
* Set to 1 if this term is a relationship term
|
|
@@ -731,8 +740,11 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $rel,
|
|
|
'id' => "$default_db:$rel",
|
|
|
'definition' => '',
|
|
|
'is_obsolete' => 0,
|
|
|
+ 'cv_name' => $defaultcv,
|
|
|
+ 'is_relationship' => TRUE,
|
|
|
+ 'db_naame' => $default_db
|
|
|
);
|
|
|
- $relcvterm = tripal_cv_add_cvterm($term, $defaultcv, 1, 0, $default_db);
|
|
|
+ $relcvterm = tripal_insert_cvterm($term, array('update_existing' => FALSE));
|
|
|
|
|
|
if (!$relcvterm) {
|
|
|
// if the relationship term couldn't be found in the default_db provided
|
|
@@ -742,8 +754,11 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $rel,
|
|
|
'id' => "OBO_REL:$rel",
|
|
|
'definition' => '',
|
|
|
'is_obsolete' => 0,
|
|
|
+ 'cv_name' => $defaultcv,
|
|
|
+ 'is_relationship' => TRUE,
|
|
|
+ 'db_name' => 'OBO_REL'
|
|
|
);
|
|
|
- $relcvterm = tripal_cv_add_cvterm($term, $defaultcv, 1, 0, 'OBO_REL');
|
|
|
+ $relcvterm = tripal_insert_cvterm($term, array('update_existing' => FALSE));
|
|
|
if (!$relcvterm) {
|
|
|
tripal_cv_obo_quiterror("Cannot find the relationship term in the current ontology or in the relationship ontology: $rel\n");
|
|
|
}
|
|
@@ -759,7 +774,7 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $rel,
|
|
|
$objterm['id'] = $oterm['id'][0];
|
|
|
$objterm['name'] = $oterm['name'][0];
|
|
|
if (array_key_exists('def', $oterm)) {
|
|
|
- $objterm['def'] = $oterm['def'][0];
|
|
|
+ $objterm['definition'] = $oterm['def'][0];
|
|
|
}
|
|
|
if (array_key_exists('subset', $oterm)) {
|
|
|
$objterm['subset'] = $oterm['subset'][0];
|
|
@@ -770,7 +785,12 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $rel,
|
|
|
if (array_key_exists('is_obsolete', $oterm)) {
|
|
|
$objterm['is_obsolete'] = $oterm['is_obsolete'][0];
|
|
|
}
|
|
|
- $objcvterm = tripal_cv_add_cvterm($objterm, $defaultcv, $object_is_relationship, 1, $default_db);
|
|
|
+
|
|
|
+ $objterm['cv_name' ] = $defaultcv;
|
|
|
+ $objterm['is_relationship'] = $object_is_relationship;
|
|
|
+ $objterm['db_name'] = $default_db;
|
|
|
+
|
|
|
+ $objcvterm = tripal_insert_cvterm($objterm, array('update_existing' => TRUE));
|
|
|
if (!$objcvterm) {
|
|
|
tripal_cv_obo_quiterror("Cannot add cvterm " . $oterm['name'][0]);
|
|
|
}
|
|
@@ -799,10 +819,10 @@ function tripal_cv_obo_add_relationship($cvterm, $defaultcv, $rel,
|
|
|
|
|
|
/**
|
|
|
* Retreives the term array from the temp loading table for a given term id.
|
|
|
- *
|
|
|
+ *
|
|
|
* @param id
|
|
|
* The id of the term to retrieve
|
|
|
- *
|
|
|
+ *
|
|
|
* @ingroup tripal_obo_loader
|
|
|
*/
|
|
|
function tripal_cv_obo_get_term($id) {
|
|
@@ -817,18 +837,18 @@ function tripal_cv_obo_get_term($id) {
|
|
|
|
|
|
/**
|
|
|
* Adds the synonyms to a term
|
|
|
- *
|
|
|
+ *
|
|
|
* @param term
|
|
|
* An array representing the cvterm. It must have a 'synonym' key/value pair.
|
|
|
* @param cvterm
|
|
|
* The database object of the cvterm to which the synonym will be added.
|
|
|
- *
|
|
|
+ *
|
|
|
* @ingroup tripal_obo_loader
|
|
|
*/
|
|
|
function tripal_cv_obo_add_synonyms($term, $cvterm) {
|
|
|
|
|
|
// make sure we have a 'synonym_type' vocabulary
|
|
|
- $syncv = tripal_cv_add_cv('synonym_type', 'A vocabulary added by the Tripal CV module OBO loader for storing synonym types.');
|
|
|
+ $syncv = tripal_insert_cv('synonym_type', 'A vocabulary added by the Tripal CV module OBO loader for storing synonym types.');
|
|
|
|
|
|
// now add the synonyms
|
|
|
if (array_key_exists('synonym', $term)) {
|
|
@@ -860,8 +880,10 @@ function tripal_cv_obo_add_synonyms($term, $cvterm) {
|
|
|
'id' => "internal:$scope",
|
|
|
'definition' => '',
|
|
|
'is_obsolete' => 0,
|
|
|
+ 'cv_name' => $syncv->name,
|
|
|
+ 'is_relationship' => FALSE
|
|
|
);
|
|
|
- $syntype = tripal_cv_add_cvterm($term, $syncv->name, 0, 1);
|
|
|
+ $syntype = tripal_insert_cvterm($term, array('update_existing' => TRUE));
|
|
|
if (!$syntype) {
|
|
|
tripal_cv_obo_quiterror("Cannot add synonym type: internal:$scope");
|
|
|
}
|
|
@@ -917,13 +939,13 @@ function tripal_cv_obo_add_synonyms($term, $cvterm) {
|
|
|
* Parse the OBO file and populate the templ loading table
|
|
|
*
|
|
|
* @param $file
|
|
|
- * The path on the file system where the ontology can be found
|
|
|
+ * The path on the file system where the ontology can be found
|
|
|
* @param $header
|
|
|
* An array passed by reference that will be populated with the header
|
|
|
* information from the OBO file
|
|
|
* @param $jobid
|
|
|
* The job_id of the job from the Tripal jobs management system.
|
|
|
- *
|
|
|
+ *
|
|
|
* @ingroup tripal_obo_loader
|
|
|
*/
|
|
|
function tripal_cv_obo_parse($obo_file, &$header, $jobid) {
|
|
@@ -1048,7 +1070,7 @@ function tripal_cv_obo_parse($obo_file, &$header, $jobid) {
|
|
|
|
|
|
/**
|
|
|
* Adds a database reference to a cvterm
|
|
|
- *
|
|
|
+ *
|
|
|
* @param cvterm
|
|
|
* The database object of the cvterm to which the synonym will be added.
|
|
|
* @param xref
|
|
@@ -1076,7 +1098,7 @@ function tripal_cv_obo_add_cvterm_dbxref($cvterm, $xref) {
|
|
|
}
|
|
|
|
|
|
// add the database
|
|
|
- $db = tripal_db_add_db($dbname);
|
|
|
+ $db = tripal_insert_db(array('name' => $dbname));
|
|
|
if (!$db) {
|
|
|
tripal_cv_obo_quiterror("Cannot find database '$dbname' in Chado.");
|
|
|
}
|
|
@@ -1111,12 +1133,12 @@ function tripal_cv_obo_add_cvterm_dbxref($cvterm, $xref) {
|
|
|
|
|
|
/**
|
|
|
* Adds a property to a cvterm
|
|
|
- *
|
|
|
+ *
|
|
|
* @param cvterm
|
|
|
* A database object for the cvterm to which properties will be added
|
|
|
* @param $property
|
|
|
* The name of the property to add
|
|
|
- * @param $value
|
|
|
+ * @param $value
|
|
|
* The value of the property
|
|
|
* @param rank
|
|
|
* The rank of the property
|
|
@@ -1126,7 +1148,7 @@ function tripal_cv_obo_add_cvterm_dbxref($cvterm, $xref) {
|
|
|
function tripal_cv_obo_add_cvterm_prop($cvterm, $property, $value, $rank) {
|
|
|
|
|
|
// make sure the 'cvterm_property_type' CV exists
|
|
|
- $cv = tripal_cv_add_cv('cvterm_property_type', '');
|
|
|
+ $cv = tripal_insert_cv('cvterm_property_type', '');
|
|
|
if (!$cv) {
|
|
|
tripal_cv_obo_quiterror("Cannot add/find cvterm_property_type cvterm");
|
|
|
}
|
|
@@ -1144,8 +1166,10 @@ function tripal_cv_obo_add_cvterm_prop($cvterm, $property, $value, $rank) {
|
|
|
'id' => "internal:$property",
|
|
|
'definition' => '',
|
|
|
'is_obsolete' => 0,
|
|
|
+ 'cv_name' => $cv->name,
|
|
|
+ 'is_relationship' => FALSE,
|
|
|
);
|
|
|
- $cvproptype = tripal_cv_add_cvterm($term, $cv->name, 0, 0);
|
|
|
+ $cvproptype = tripal_insert_cvterm($term, array('update_existing' => FALSE));
|
|
|
if (!$cvproptype) {
|
|
|
tripal_cv_obo_quiterror("Cannot add cvterm property: internal:$property");
|
|
|
return FALSE;
|
|
@@ -1187,7 +1211,7 @@ function tripal_cv_obo_add_cvterm_prop($cvterm, $property, $value, $rank) {
|
|
|
|
|
|
/**
|
|
|
* Adds a database cross reference to a cvterm
|
|
|
- *
|
|
|
+ *
|
|
|
* @param db_id
|
|
|
* The database ID of the cross reference
|
|
|
* @param accession
|