|
@@ -1859,7 +1859,7 @@ function tripal_chado_update_7336() {
|
|
|
/**
|
|
|
* Update the NCBITaxon DB entry.
|
|
|
*/
|
|
|
-function tripal_chado_update_7337(){
|
|
|
+function tripal_chado_update_7337() {
|
|
|
|
|
|
chado_insert_db(array(
|
|
|
'name' => 'NCBITaxon',
|
|
@@ -1868,3 +1868,54 @@ function tripal_chado_update_7337(){
|
|
|
'urlprefix' => 'https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id={accession}',
|
|
|
));
|
|
|
}
|
|
|
+/**
|
|
|
+ * Correctly flag SOFP terms as "not" relationships, allowing the mview to
|
|
|
+ * populate them.
|
|
|
+ */
|
|
|
+function tripal_chado_update_7338() {
|
|
|
+
|
|
|
+ try {
|
|
|
+ // Get all SOFP terms and set their is_relationshiptype to 0
|
|
|
+
|
|
|
+ $sofp = chado_get_db(['name' => 'SOFP']);
|
|
|
+ $fp = chado_get_cv(['name' => 'feature_property']);
|
|
|
+
|
|
|
+ if (!$sofp || !$fp) {
|
|
|
+ // No need to update unless the SOFP db exists
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $terms = chado_select_record('cvterm', ['cvterm_id', 'name'], [
|
|
|
+ 'dbxref_id' => [
|
|
|
+ 'db_id' => [
|
|
|
+ 'name' => 'SOFP',
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ 'cv_id' => ['name' => 'feature_property'],
|
|
|
+ ]);
|
|
|
+
|
|
|
+ if (empty($terms)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($terms as $term) {
|
|
|
+
|
|
|
+ $id = $term->cvterm_id;
|
|
|
+ $name = $term->name;
|
|
|
+
|
|
|
+ if ($name == 'linked_to') {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ chado_update_record('cvterm', ['cvterm_id' => $id], ['is_relationshiptype' => 0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ //repopulate the mview.
|
|
|
+ print("repopulating the db2cv mview...");
|
|
|
+ $mview_id = chado_get_mview_id('db2cv_mview');
|
|
|
+ chado_populate_mview($mview_id);
|
|
|
+
|
|
|
+ } catch (\PDOException $e) {
|
|
|
+ $error = $e->getMessage();
|
|
|
+ throw new DrupalUpdateException('Could not perform update: ' . $error);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|