ソースを参照

Worked through several warnings/errors

Stephen Ficklin 8 年 前
コミット
0e3a2d81aa

+ 0 - 42
legacy/tripal_pub/tripal_pub.install

@@ -215,48 +215,6 @@ function tripal_pub_add_custom_tables() {
   chado_create_custom_table('pubauthor_contact', $schema, TRUE);
 }
 
-/**
- * Add cvs related to publications
- *
- * @ingroup tripal_pub
- */
-function tripal_pub_add_cvs() {
-
-
-  // Add the cv for pub properties
-  tripal_insert_cv(
-    'tripal_pub',
-    'A heirarchical set of terms for describing a publication. It is intended to be used as the default vocabularies in Tripal for publication types and contact properties.'
-  );
-
-  // Add the cv for pub types
-  tripal_insert_cv(
-    'pub_type',
-    'Contains types of publications. This can be used if the tripal_pub vocabulary (which is default for publications in Tripal) is not desired.'
-  );
-
-  // Add the cv for pub properties
-  tripal_insert_cv(
-    'pub_property',
-    'Contains properties for publications. This can be used if the tripal_pub vocabulary (which is default for publications in Tripal) is not desired.'
-  );
-
-  // Add cv for relationship types
-  tripal_insert_cv(
-    'pub_relationship',
-    'Contains types of relationships between publications.'
-  );
-}
-
-/**
- * Add cvterms related to publications
- *
- * @ingroup tripal_pub
- */
-function tripal_pub_add_cvterms() {
-
-}
-
 /**
  * This is the required update for tripal_pub when upgrading from Drupal core API 6.x.
  *

+ 0 - 36
legacy/tripal_stock/tripal_stock.install

@@ -47,11 +47,6 @@ function tripal_stock_requirements($phase) {
  * @ingroup tripal_stock
  */
 function tripal_stock_install() {
-  // add some controlled vocabularies
-  tripal_stock_add_cvs();
-
-  tripal_stock_add_cvterms();
-
   // set the default vocabularies
   tripal_set_default_cv('stock', 'type_id', 'stock_type');
   tripal_set_default_cv('stockprop', 'type_id', 'stock_property');
@@ -106,34 +101,3 @@ function tripal_stock_schema() {
 
   return $schema;
 }
-
-/**
- * Add cvs related to publications
- *
- * @ingroup tripal_pub
- */
-function tripal_stock_add_cvs() {
-
-  // Add cv for relationship types
-  tripal_insert_cv(
-    'stock_relationship',
-    'Contains types of relationships between stocks.'
-  );
-  tripal_insert_cv(
-    'stock_property',
-    'Contains properties for stocks.'
-  );
-  tripal_insert_cv(
-    'stock_type',
-    'Contains a list of types for stocks.'
-  );
-}
-
-/**
- * Add cvterms related to publications
- *
- * @ingroup tripal_pub
- */
-function tripal_stock_add_cvterms() {
-
-}

+ 1 - 1
tripal/includes/TripalBundleController.inc

@@ -9,7 +9,7 @@ class TripalBundleController extends EntityAPIControllerExportable {
   }
 
   /**
-   * Create a type - we first set up the values that are specific
+   * Create a type we first set up the values that are specific
    * to our type schema but then also go through the EntityAPIController
    * function.
    *

+ 7 - 6
tripal/includes/TripalFields/TripalField.inc

@@ -102,16 +102,17 @@ class TripalField {
       tripal_set_message(t('Missing instance of field "%field"', array('%field' => $field['field_name'])), TRIPAL_ERROR);
     }
     else {
-      if (!array_key_exists('term_vocabulary', $instance['settings'])) {
-        tripal_set_message(t('Missing controlled vocbulary for field "%field"', array('%field' => $field['field_name'])), TRIPAL_ERROR);
-      }
-      else {
+      // If the vocabulary and accession are set then make sure that the
+      // term is a real term. It is possible that the vocabulary and accession
+      // may not be set initially. This occurs when a field is created
+      // dynamically be a priviledge site admin.
+      if (array_key_exists('term_vocabulary', $instance['settings'])) {
         $vocabulary = $instance['settings']['term_vocabulary'];
         $accession = $instance['settings']['term_accession'];
         $term = tripal_get_term_details($vocabulary, $accession);
         if (!$term) {
-          //throw new Error(t('Cannot create TripalField of type "%term" as that
-          //    term does not exist.', array('%term' => $class::$term)));
+          throw new Error(t('Cannot create TripalField of type "%term" as that
+              term does not exist.', array('%term' => "$vocabulary:$accession")));
         }
       }
     }

+ 1 - 1
tripal/includes/tripal.fields.inc

@@ -294,7 +294,7 @@ function tripal_form_field_ui_field_overview_form_submit($form, &$form_state) {
         // Unset the the _add_new_field entry so Drupal doesn't try to
         // Create the field.
         unset($form_state['values']['fields']['_add_new_field']);
-        drupal_set_message('Please set the controlled vocabulary that best describes the data of this field. See the "Controlled Vocabulary Term" section below.');
+        drupal_set_message('Please set the controlled vocabulary that best describes the data of this field. See the "Controlled Vocabulary Term" section below.', 'notice');
       }
     }
     catch (Exception $e) {

+ 51 - 37
tripal_chado/api/modules/tripal_chado.cv.api.inc

@@ -450,6 +450,10 @@ function tripal_insert_cv($name, $definition) {
  *   An associative array with the following keys:
  *    - update_existing: By default this is TRUE.  If the term exists it is
  *      automatically updated.
+ *    - force_db_change:  Sometimes a term may need to switch from one
+ *      database to another.  If the term already exists, but associated
+ *      with another term the insert (or update, rather) will fail.  Set
+ *      this variable to TRUE to force the change to occur.
  *
  * @return
  *   A cvterm object
@@ -541,11 +545,13 @@ function tripal_insert_cvterm($term, $options = array()) {
   // Check that we have a database name, give a different message if it's a
   // relationship.
   if ($is_relationship and !$dbname) {
-    tripal_report_error('tripal_chado', TRIPAL_WARNING, "A database name is not provided for this relationship term: $id", NULL);
+    tripal_report_error('tripal_chado', TRIPAL_WARNING,
+      "A database name is not provided for this relationship term: $id", NULL);
     return 0;
   }
   if (!$is_relationship and !$dbname) {
-    tripal_report_error('tripal_chado', TRIPAL_WARNING, "A database identifier is missing from the term: $id", NULL);
+    tripal_report_error('tripal_chado', TRIPAL_WARNING,
+      "A database identifier is missing from the term: $id", NULL);
     return 0;
   }
 
@@ -555,7 +561,8 @@ function tripal_insert_cvterm($term, $options = array()) {
     $cv = tripal_insert_cv($cvname, '');
   }
   if (!$cv) {
-    tripal_report_error('tripal_chado', TRIPAL_WARNING, "Cannot find namespace '$cvname' when adding/updating $id", NULL);
+    tripal_report_error('tripal_chado', TRIPAL_WARNING,
+      "Cannot find namespace '$cvname' when adding/updating $id", NULL);
     return 0;
   }
 
@@ -614,40 +621,47 @@ function tripal_insert_cvterm($term, $options = array()) {
     $result = chado_select_record('db', array('*'), $values);
     $db_check = $result[0];
 
-//     // The database name for this existing term does not match that of the
-//     // one provided to this function.  The CV name matches otherwise we
-//     // wouldn't have made it this far. So, let's swap the database for
-//     // this term.
-//     if ($db_check->name != $db->name) {
-
-//       // Look to see if the correct dbxref record already exists for this
-//       // database.
-//       $values = array(
-//         'db_id' => $db->db_id,
-//         'accession' => $accession,
-//       );
-//       $result = chado_select_record('dbxref', array('*'), $values);
-
-//       // If we already have a good dbxref then we want to update our cvterm
-//       // to use this dbxref.
-//       if (count($result) > 0) {
-//         $dbxref = $result[0];
-//         $match = array('cvterm_id' => $cvterm->cvterm_id);
-//         $values = array('dbxref_id' => $dbxref->dbxref_id);
-//         $success = chado_update_record('cvterm', $match, $values);
-//         if (!$success) {
-//           tripal_report_error('tripal_chado', TRIPAL_WARNING, "Failed to correct the dbxref id for the cvterm " .
-//             "'$name' (id: $accession), for database $dbname", NULL);
-//           return 0;
-//         }
-//       }
-//       // If we don't have the dbxref then we want to delete our cvterm and let
-//       // the code below recreate it with the correct info.
-//       else {
-//         $match = array('cvterm_id' => $cvterm->cvterm_id);
-//         chado_delete_record('cvterm', $match);
-//       }
-//     }
+    // If the database from the existing record doesn't match the one that
+    // has been provided then we have a problem.  The term already exists
+    // but we don't want to just switch the term, the callee must force it.
+    if ($db_check->name != $db->name) {
+      if (array_key_exists('force_db_change', $options) and
+          $options['force_db_change'] != TRUE) {
+        tripal_report_error('tripal_cv', TRIPAL_ERROR,
+            'The term already exists, but associated with a different database record: \'!db\'. It cannot be added: !record',
+            array(':term' => $name, '!db' => $db_check->name, '!record' => print_r($cvterm, TRUE))
+        );
+        return FALSE;
+      }
+
+      // Look to see if the correct dbxref record already exists for this
+      // database.
+      $values = array(
+        'db_id' => $db->db_id,
+        'accession' => $accession,
+      );
+      $result = chado_select_record('dbxref', array('*'), $values);
+
+      // If we already have a good dbxref then we want to update our cvterm
+      // to use this dbxref.
+      if (count($result) > 0) {
+        $dbxref = $result[0];
+        $match = array('cvterm_id' => $cvterm->cvterm_id);
+        $values = array('dbxref_id' => $dbxref->dbxref_id);
+        $success = chado_update_record('cvterm', $match, $values);
+        if (!$success) {
+          tripal_report_error('tripal_chado', TRIPAL_WARNING, "Failed to correct the dbxref id for the cvterm " .
+            "'$name' (id: $accession), for database $dbname", NULL);
+          return 0;
+        }
+      }
+      // If we don't have the dbxref then we want to delete our cvterm and let
+      // the code below recreate it with the correct info.
+      else {
+        $match = array('cvterm_id' => $cvterm->cvterm_id);
+        chado_delete_record('cvterm', $match);
+      }
+    }
 
     // Check that the accession matches.  Sometimes an OBO can define a term
     // multiple times but with different accessions.  If this is the case we

+ 0 - 1
tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop_formatter.inc

@@ -22,7 +22,6 @@ class chado_linker__prop_formatter extends ChadoFieldFormatter {
    */
   public function view(&$element, $entity_type, $entity, $langcode, $items, $display) {
     $field_name = $this->field['field_name'];
-    dpm($this->instance);
     $chado_table = $this->instance['settings']['chado_table'];
 
     foreach ($items as $delta => $item) {

+ 9 - 12
tripal_chado/includes/tripal_chado.bundle.inc

@@ -37,10 +37,10 @@ function tripal_chado_bundle_create($bundle, $storage_args) {
   // Before adding fields to this bundle, let's make sure we associate
   // what table in Chado this bundle is mapped to
   $chado_bundle = db_select('chado_bundle', 'cb')
-    ->fields('cb', array('chado_bundle_id'))
+    ->fields('cb')
     ->condition('bundle_id', $bundle->id)
     ->execute()
-    ->fetchField();
+    ->fetchObject();
   if (!$chado_bundle) {
     $record = array(
       'bundle_id' => $bundle->id,
@@ -57,19 +57,16 @@ function tripal_chado_bundle_create($bundle, $storage_args) {
     if (!$success) {
       throw new Exception('Cannot create content type. Problem associating type with Chado.');
     }
+    $chado_bundle = db_select('chado_bundle', 'cb')
+      ->fields('cb')
+      ->condition('bundle_id', $bundle->id)
+      ->execute()
+      ->fetchObject();
   }
 
-
-  // Before adding fields to the bundle we need to story the Chado table that
-  // this bundle maps to.  That information is in the $args['form_values']
-  // array.  The $args['form_values'] array contains values that indicate the
-  // Chado table.
-  // TODO: we need to store the chado table and type field used for this
-  // bundle.
-
   // Create/Add the new fields for this bundle.
-  tripal_chado_bundle_create_fields($entity_type, $bundle, $record);
+  tripal_chado_bundle_create_fields($entity_type, $bundle, $chado_bundle);
 
   // Create/Add the new field instances for this bundle.
-  tripal_chado_bundle_create_instances($entity_type, $bundle, $record);
+  tripal_chado_bundle_create_instances($entity_type, $bundle, $chado_bundle);
 }

+ 8 - 8
tripal_chado/includes/tripal_chado.fields.inc

@@ -10,10 +10,10 @@ function tripal_chado_bundle_create_fields($entity_type, $bundle, $chado_bundle)
 
   // Get the details about the mapping of this bundle to the Chado table:
   $details = array(
-    'chado_cvterm_id' => $chado_bundle['type_id'],
-    'chado_table' => $chado_bundle['data_table'],
-    'chado_type_table' => $chado_bundle['type_linker_table'],
-    'chado_type_column' => $chado_bundle['type_column'],
+    'chado_cvterm_id' => $chado_bundle->type_id,
+    'chado_table' => $chado_bundle->data_table,
+    'chado_type_table' => $chado_bundle->type_linker_table,
+    'chado_type_column' => $chado_bundle->type_column,
   );
 
   $info = array();
@@ -517,10 +517,10 @@ function tripal_chado_bundle_create_fields_linker(&$info, $details, $entity_type
 function tripal_chado_bundle_create_instances($entity_type, $bundle, $chado_bundle) {
 
   $details = array(
-    'chado_cvterm_id' => $chado_bundle['type_id'],
-    'chado_table' => $chado_bundle['data_table'],
-    'chado_type_table' => $chado_bundle['type_linker_table'],
-    'chado_type_column' => $chado_bundle['type_column'],
+    'chado_cvterm_id' => $chado_bundle->type_id,
+    'chado_table' => $chado_bundle->data_table,
+    'chado_type_table' => $chado_bundle->type_linker_table,
+    'chado_type_column' => $chado_bundle->type_column,
   );
 
   tripal_chado_bundle_create_instances_base($info, $entity_type, $bundle, $details);

+ 524 - 41
tripal_chado/includes/tripal_chado.semweb.inc

@@ -5,6 +5,20 @@
  */
 function tripal_chado_populate_chado_semweb_table() {
 
+  // Insert commonly used ontologies into the tables.
+  $ontologies = array(
+    // array('Relationship Ontology', 'http://purl.obolibrary.org/obo/ro.obo'),
+    array('Relationship Ontology (legacy)', '{tripal_chado}/files/legacy_ro.obo'),
+    array('Sequence Ontology', 'http://purl.obolibrary.org/obo/so.obo'),
+    array('Gene Ontology', 'http://purl.obolibrary.org/obo/go.obo'),
+    //    array('Cell Ontology', 'https://raw.githubusercontent.com/obophenotype/cell-ontology/master/cl.obo'),
+    //    array('Plant Structure Ontology', 'http://palea.cgrb.oregonstate.edu/viewsvn/Poc/trunk/ontology/OBO_format/po_anatomy.obo?view=co'),
+    //    array('Plant Growth and Development Stages Ontology', 'http://palea.cgrb.oregonstate.edu/viewsvn/Poc/trunk/ontology/OBO_format/po_temporal.obo?view=co')
+  );
+  foreach ($ontologies as $o) {
+  db_query("INSERT INTO {tripal_cv_obo} (name,path) VALUES (:name, :path)", array(':name' => $o[0], ':path' => $o[1]));
+  }
+
   // Add in all tables and fields into the chado_semweb table.
   $chado_tables = chado_get_table_names(TRUE);
   foreach ($chado_tables as $chado_table) {
@@ -36,6 +50,51 @@ function tripal_chado_populate_chado_semweb_table() {
   tripal_chado_populate_vocab_TAXRANK();
   tripal_chado_populate_vocab_TPUB();
   tripal_chado_populate_vocab_UO();
+
+  // Add TAXRANK vocabulary for full import.
+  $obo_id = tripal_insert_obo('Taxonomic Rank', 'http://purl.obolibrary.org/obo/taxrank.obo');
+  $cv = chado_select_record('cv', array('name'), array('name' => 'taxonomic_rank'));
+  if (count($cv) == 0 and $obo_id) {
+    tripal_chado_load_obo_v1_2_id($obo_id);
+  }
+  //tripal_submit_obo_job(array('obo_id' => $obo_id));
+
+  // Add Tripal Contact vocabulary for full import.
+  $obo_path = '{tripal_chado}/files/tcontact.obo';
+  $obo_id = tripal_insert_obo('Tripal Contacts', $obo_path);
+  $cv = chado_select_record('cv', array('name'), array('name' => 'tripal_contact'));
+  if (count($cv) == 0 and $obo) {
+    tripal_chado_load_obo_v1_2_id($obo_id);
+  }
+  //tripal_submit_obo_job(array('obo_id' => $obo_id));
+
+  // Add Tripal Publication vocabulary for full import.
+  $obo_path = '{tripal_chado}/files/tpub.obo';
+  $obo_id = tripal_insert_obo('Tripal Publication', $obo_path);
+  $cv = chado_select_record('cv', array('name'), array('name' => 'tripal_pub'));
+  if (count($cv) == 0 and $obo) {
+    tripal_chado_load_obo_v1_2_id($obo_id);
+  }
+
+  // Load the sequence ontology if it isn't already loaded
+  $cv = chado_select_record('cv', array('name'), array('name' => 'sequence'));
+  $obo = tripal_get_obo(array('obo_name' => 'Sequence Ontology'));
+  if (count($cv) == 0 and $obo) {
+    print "Installing the Sequence Ontology... This may take a while...\n";
+    tripal_chado_load_obo_v1_2_id($obo->obo_id);
+  }
+
+  // Add the Chado ontology CV.
+  //$obo_path = '{tripal_chado}/files/cv_property.obo';
+  //$obo_id = tripal_insert_obo('Chado CV Properties', $obo_path);
+  //tripal_chado_load_obo_v1_2_id($obo_id);
+  //tripal_submit_obo_job(array('obo_id' => $obo_id));
+
+  // $obo_path = '{tripal_feature}/files/feature_property.obo';
+  // $obo_id = tripal_insert_obo('Chado Feature Properties', $obo_path);
+  // tripal_chado_load_obo_v1_2_id($obo_id);
+  //// tripal_submit_obo_job(array('obo_id' => $obo_id));
+
 }
 
 /**
@@ -381,6 +440,7 @@ function tripal_chado_populate_vocab_IAO() {
  * ontology.
  */
 function tripal_chado_populate_vocab_LOCAL() {
+
   tripal_insert_db(array(
     'name' => 'local',
     'description' => 'Terms created for this site.',
@@ -388,6 +448,152 @@ function tripal_chado_populate_vocab_LOCAL() {
     'urlprefix' => '/cv/lookup/{db}/{accession}',
   ));
 
+
+  // ----------------
+  // Add the various CV's that fall under the local DB.
+  // ----------------
+  tripal_insert_cv(
+    'local',
+    'Locally created terms.'
+  );
+  tripal_insert_cv(
+    'organism_property',
+    'A local vocabulary that contains locally defined properties for organisms'
+  );
+  tripal_insert_cv(
+    'tripal_phylogeny',
+    'Terms used by the Tripal phylotree module for phylogenetic and taxonomic trees.'
+  );
+  tripal_insert_cv(
+    'synonym_type',
+    'A local vocabulary that contains synonym types (e.g. exact, broad, narrow, related).'
+  );
+  // Add cv for relationship types
+  tripal_insert_cv(
+    'feature_relationship',
+    'A local vocabulary that contains types of relationships between features.'
+  );
+
+  // The feature_property CV may already exists. It comes with Chado, but
+  // we need to  add it just in case it doesn't get added before the feature
+  // module is installed. But as of Tripal v3.0 the Chado version of this
+  // vocabulary is no longer loaded by default.
+  tripal_insert_cv(
+    'feature_property',
+    'A local vocabulary that contains properties for genomic features'
+  );
+  // Add the cv for contact properties. This is a default vocabulary in the event
+  // that a user does not want to use the tripal_contact vocabulary
+  tripal_insert_cv(
+    'contact_property',
+    'A local vocabulary that contains properties for contacts. This can be used if the tripal_contact vocabulary (which is default for contacts in Tripal) is not desired.'
+  );
+
+  // add the cv for the contact type. This is a default vocabulary in the event
+  // that a user does not want to use the tripal_contact vocabulary
+  tripal_insert_cv(
+    'contact_type',
+    'A local vocabulary that contains types of contacts. This can be used if the tripal_contact vocabulary (which is default for contacts in Tripal) is not desired.'
+  );
+
+  // Add the cv for the tripal_contact vocabulary which is loaded via the OBO
+  tripal_insert_cv(
+    'tripal_contact',
+    'A local vocabulary that contains a heirarchical set of terms for describing a contact. It is intended to be used as the default vocabularies in Tripal for contact types and contact properties.'
+  );
+
+  // add the cv for contact relationships
+  tripal_insert_cv(
+    'contact_relationship',
+    'A local vocabulary that contains types of relationships between contacts.'
+  );
+  tripal_insert_cv(
+    'featuremap_units',
+    'A local vocabulary that contains map unit types for the unittype_id column of the featuremap table.'
+  );
+
+  tripal_insert_cv(
+    'featurepos_property',
+    'A local vocabulary that contains terms map properties.'
+  );
+
+  tripal_insert_cv(
+    'featuremap_property',
+    'A local vocabulary that contains positional types for the feature positions'
+  );
+  tripal_insert_cv(
+    'library_property',
+    'A local vocabulary that contains properties for libraries.'
+  );
+  tripal_insert_cv(
+    'library_type',
+    'A local vocabulary that contains terms for types of libraries (e.g. BAC, cDNA, FOSMID, etc).'
+  );
+  // Add the cv for project properties
+  tripal_insert_cv(
+    'project_property',
+    'A local vocabulary that contains properties for projects'
+  );
+  // Add cv for relationship types
+  tripal_insert_cv(
+    'project_relationship',
+    'A local vocabulary that contains Types of relationships between projects.'
+  );
+  // Add the cv for pub properties
+  tripal_insert_cv(
+    'tripal_pub',
+    'A local vocabulary that contains a heirarchical set of terms for describing a publication. It is intended to be used as the default vocabularies in Tripal for publication types and contact properties.'
+  );
+
+  // Add the cv for pub types
+  tripal_insert_cv(
+    'pub_type',
+    'A local vocabulary that contains types of publications. This can be used if the tripal_pub vocabulary (which is default for publications in Tripal) is not desired.'
+  );
+
+  // Add the cv for pub properties
+  tripal_insert_cv(
+    'pub_property',
+    'A local vocabulary that contains properties for publications. This can be used if the tripal_pub vocabulary (which is default for publications in Tripal) is not desired.'
+  );
+
+  // Add cv for relationship types
+  tripal_insert_cv(
+    'pub_relationship',
+    'A local vocabulary that contains types of relationships between publications.'
+  );
+
+  // Add cv for relationship types
+  tripal_insert_cv(
+    'stock_relationship',
+    'A local vocabulary that contains types of relationships between stocks.'
+  );
+  tripal_insert_cv(
+    'stock_property',
+    'A local vocabulary that contains properties for stocks.'
+  );
+  tripal_insert_cv(
+    'stock_type',
+    'A local vocabulary that contains a list of types for stocks.'
+  );
+  tripal_insert_cv(
+    'tripal_analysis',
+    'A local vocabulary that contains terms used for analyses.'
+  );
+
+  //-----------------------------
+  // Misc Terms
+  //-----------------------------
+  $term = tripal_insert_cvterm(array(
+    'id' => 'local:property',
+    'name' => 'property',
+    'cv_name' => 'local',
+    'definition' => 'A generic term indicating that represents an attribute, quality or characteristic of something.',
+  ));
+
+  //-----------------------------
+  // Terms for base table fields
+  //-----------------------------
   $term = tripal_insert_cvterm(array(
     'id' => 'local:timelastmodified',
     'name' => 'time_last_modified',
@@ -396,7 +602,6 @@ function tripal_chado_populate_vocab_LOCAL() {
   ));
   tripal_associate_chado_semweb_term(NULL, 'timelastmodified', $term);
 
-
   $term = tripal_insert_cvterm(array(
     'id' => 'local:timeaccessioned',
     'name' => 'time_accessioned',
@@ -452,6 +657,10 @@ function tripal_chado_populate_vocab_LOCAL() {
   ));
   tripal_associate_chado_semweb_term(NULL, 'is_obsolete', $term);
 
+
+  //-----------------------------
+  // Relationship Terms
+  //-----------------------------
   $term = tripal_insert_cvterm(array(
     'id' => 'local:relationship_subject',
     'name' => 'clause subject',
@@ -461,6 +670,7 @@ function tripal_chado_populate_vocab_LOCAL() {
   tripal_associate_chado_semweb_term(NULL, 'subject_id', $term);
   tripal_associate_chado_semweb_term(NULL, 'subject_reagent_id', $term);
   tripal_associate_chado_semweb_term(NULL, 'subject_project_id', $term);
+
   $term = tripal_insert_cvterm(array(
     'id' => 'local:relationship_object',
     'name' => 'clause predicate',
@@ -470,6 +680,7 @@ function tripal_chado_populate_vocab_LOCAL() {
   tripal_associate_chado_semweb_term(NULL, 'object_id', $term);
   tripal_associate_chado_semweb_term(NULL, 'object_reagent_id', $term);
   tripal_associate_chado_semweb_term(NULL, 'object_project_id', $term);
+
   $term = tripal_insert_cvterm(array(
     'id' => 'local:relationship_type',
     'name' => 'relationship type',
@@ -490,6 +701,11 @@ function tripal_chado_populate_vocab_LOCAL() {
   tripal_associate_chado_semweb_term('quantification_relationship', 'type_id', $term);
   tripal_associate_chado_semweb_term('stock_relationship', 'type_id', $term);
 
+  //-----------------------------
+  // NCBI Organism Property Terms
+  //-----------------------------
+  // TODO: these probably have real terms we can use.
+
   $term = tripal_insert_cvterm(array(
     'id' => 'locak:rank',
     'name' => 'rank',
@@ -497,11 +713,6 @@ function tripal_chado_populate_vocab_LOCAL() {
     'cv_name' => 'local',
   ));
 
-
-  tripal_insert_cv(
-    'organism_property',
-    'Contains locally defined properties for organisms'
-  );
   $terms = array(
     'lineage',
     'genetic_code',
@@ -527,11 +738,9 @@ function tripal_chado_populate_vocab_LOCAL() {
     tripal_insert_cvterm($value, $options);
   }
 
-
-  tripal_insert_cv(
-      'tripal_phylogeny',
-      'Terms used by the Tripal phylotree module for phylogenetic and taxonomic trees.'
-  );
+  //---------------------
+  // Phylogeny Tree Terms
+  //---------------------
 
   // Add the terms used to identify nodes in the tree.
   tripal_insert_cvterm(
@@ -545,38 +754,312 @@ function tripal_chado_populate_vocab_LOCAL() {
       array('update_existing' => TRUE)
   );
   // Add the terms used to identify nodes in the tree.
-  tripal_insert_cvterm(
-      array(
-        'name' => 'phylo_root',
-        'definition' => 'The root node of a phylogenetic tree.',
-        'cv_name' => 'tripal_phylogeny',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
+  tripal_insert_cvterm(array(
+    'name' => 'phylo_root',
+    'definition' => 'The root node of a phylogenetic tree.',
+    'cv_name' => 'tripal_phylogeny',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ));
+
   // Add the terms used to identify nodes in the tree.
-  tripal_insert_cvterm(
-      array(
-        'name' => 'phylo_interior',
-        'definition' => 'An interior node in a phylogenetic tree.',
-        'cv_name' => 'tripal_phylogeny',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
+  tripal_insert_cvterm(array(
+    'name' => 'phylo_interior',
+    'definition' => 'An interior node in a phylogenetic tree.',
+    'cv_name' => 'tripal_phylogeny',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ));
+
   // Add the terms used to identify nodes in the tree.
-  tripal_insert_cvterm(
-      array(
-        'name' => 'taxonomy',
-        'definition' => 'A term used to indicate if a phylotree is a taxonomic tree',
-        'cv_name' => 'tripal_phylogeny',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
+  tripal_insert_cvterm(array(
+    'name' => 'taxonomy',
+    'definition' => 'A term used to indicate if a phylotree is a taxonomic tree',
+    'cv_name' => 'tripal_phylogeny',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ));
+
+  //---------------------
+  // Synonym Types Terms
+  //---------------------
+  tripal_insert_cvterm(array(
+    'name' => 'exact',
+    'definition' => 'An exact equivalent; interchangeable with the term name.',
+    'cv_name' => 'synonym_type',
+    'db_name' => 'local',
+  ), array('force_db_change' => TRUE));
+
+  tripal_insert_cvterm(array(
+    'name' => 'broad',
+    'definition' => 'The synonym is broader than the name.',
+    'cv_name' => 'synonym_type',
+    'db_name' => 'local',
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'narrow',
+    'definition' => 'The synonym is narrower or more precise than the name.',
+    'cv_name' => 'synonym_type',
+    'db_name' => 'local',
+  ), array('force_db_change' => TRUE));
+
+  tripal_insert_cvterm(array(
+    'name' => 'related',
+    'definition' => 'The synonym is related in some way.',
+    'cv_name' => 'synonym_type',
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+
+
+  //--------------
+  // Project Terms
+  //--------------
+  // Insert cvterm 'Project Description' into cvterm table of chado
+  // database. This CV term is used to keep track of the project
+  // description in the projectprop table.
+  tripal_insert_cvterm(array(
+    'name' => 'Project Description',
+    'definition'  => 'Description of a project',
+    'cv_name' => 'project_property',
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+
+  //--------------
+  // Natural Diversity Terms
+  //--------------
+  // add cvterms for the nd_experiment_types
+  tripal_insert_cvterm(array(
+    'name' => 'Genotyping',
+    'definition' => 'An experiment where genotypes of individuals are identified.',
+    'cv_name' => 'nd_experiment_types',
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+
+  tripal_insert_cvterm(array(
+    'name' => 'Phenotyping',
+    'definition' => 'An experiment where phenotypes of individuals are identified.',
+    'cv_name' => 'nd_experiment_types',
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+
+  tripal_insert_cvterm(array(
+    'name' => 'Location',
+    'definition' => 'The name of the location.',
+    'cv_name' => 'nd_geolocation_property',
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+
+
+  //--------------
+  // Library Terms
+  //--------------
+  // Insert cvterm 'library_description' into cvterm table of chado
+  // database. This CV term is used to keep track of the library
+  // description in the libraryprop table.
+  tripal_insert_cvterm(array(
+    'id' => 'local:library_description',
+    'name' => 'Library Description',
+    'definition' => 'Description of a library',
+    'cv_name' => 'library_property',
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+
+  // add cvterms for the map unit types
+  tripal_insert_cvterm(array(
+    'id' => 'local:cdna_library',
+    'name' => 'cdna_library',
+    'definition' => 'cDNA library',
+    'cv_name' => 'library_type',
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'id' => 'local:bac_library',
+    'name' => 'bac_library',
+    'definition' => 'Bacterial Artifical Chromsome (BAC) library',
+    'cv_name' => 'library_type',
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'id' => 'local:fosmid_library',
+    'name' => 'fosmid_library',
+    'definition' => 'Fosmid library',
+    'cv_name' => 'library_type',
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'id' => 'local:cosmid_library',
+    'name' => 'cosmid_library',
+    'definition' => 'Cosmid library',
+    'cv_name' => 'library_type',
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'id' => 'local:yac_library',
+    'name' => 'yac_library',
+    'definition' => 'Yeast Artificial Chromosome (YAC) library',
+    'cv_name' => 'library_type',
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'id' => 'local:genomic_library',
+    'name' => 'genomic_library',
+    'definition' => 'Genomic Library',
+    'cv_name' => 'library_type',
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+
+  //--------------
+  // Feature Map
+  //--------------
+  // add cvterms for the map unit types
+  tripal_insert_cvterm(array(
+    'name' => 'cM',
+    'definition' => 'Centimorgan units',
+    'cv_name' => 'featuremap_units',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'bp',
+    'definition' => 'Base pairs units',
+    'cv_name' => 'featuremap_units',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'bin_unit',
+    'definition' => 'The bin unit',
+    'cv_name' => 'featuremap_units',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'marker_order',
+    'definition' => 'Units simply to define marker order.',
+    'cv_name' => 'featuremap_units',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'undefined',
+    'definition' => 'A catch-all for an undefined unit type',
+    'cv_name' => 'featuremap_units',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  // featurepos properties
+  tripal_insert_cvterm(array(
+    'name' => 'start',
+    'definition' => 'The start coordinate for a map feature.',
+    'cv_name' => 'featurepos_property',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'stop',
+    'definition' => 'The end coordinate for a map feature',
+    'cv_name' => 'featurepos_property',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  // add cvterms for map properties
+  tripal_insert_cvterm(array(
+    'name' => 'Map Dbxref',
+    'definition' => 'A unique identifer for the map in a remote database.  The '
+      . 'format is a database abbreviation and a unique accession separated '
+      . 'by a colon.  (e.g. Gramene:tsh1996a)',
+    'cv_name' => 'featuremap_property',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'Map Type',
+    'definition' => 'The type of Map (e.g. QTL, Physical, etc.)',
+    'cv_name' => 'featuremap_property',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'Genome Group',
+    'definition' => '',
+    'cv_name' => 'featuremap_property',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'URL',
+    'definition' => 'A univeral resource locator (URL) reference where the '
+      . 'publication can be found.  For maps found online, this would be '
+      . 'the web address for the map.',
+    'cv_name' => 'featuremap_property',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'Population Type',
+    'definition' => 'A brief description of the population type used to generate '
+    . 'the map (e.g. RIL, F2, BC1, etc).',
+    'cv_name' => 'featuremap_property',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'Population Size',
+    'definition' => 'The size of the population used to construct the map.',
+    'cv_name' => 'featuremap_property',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'Methods',
+    'definition' => 'A brief description of the methods used to construct the map.',
+    'cv_name' => 'featuremap_property',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+  tripal_insert_cvterm(array(
+    'name' => 'Software',
+    'definition' => 'The software used to construct the map.',
+    'cv_name' => 'featuremap_property',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('force_db_change' => TRUE));
+
+
+  //--------------
+  // Analysis Terms
+  //--------------
+  // add analysis_date.  This is no longer used (as far as we can tell) but we don't
+  // get rid of it in case it is used, so just keep it in the Tripal CV
+  tripal_insert_cvterm(array(
+    'name' => 'analysis_date',
+    'definition' => 'The date that an analysis was performed.',
+    'cv_name' => 'tripal_analysis',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('update_existing' => TRUE));
+
+  // add analysis_short_name.  This is no longer used (as far as we can tell) but we don't
+  // get rid of it in case it is used, so just keep it in the Tripal CV
+  tripal_insert_cvterm(array(
+      'name' => 'analysis_short_name',
+      'definition' => 'A computer legible (no spaces or special characters) '
+        . 'abbreviation for the analysis.',
+      'cv_name' => 'tripal_analysis',
+      'is_relationship' => 0,
+      'db_name' => 'local'
+    ), array('update_existing' => TRUE));
+
+
+  // the 'analysis_property' vocabulary is for user definable properties wo we
+  // will add an 'Analysis Type' to this vocubulary
+  tripal_insert_cvterm(array(
+    'name' => 'Analysis Type',
+    'definition' => 'The type of analysis that was performed.',
+    'cv_name' => 'analysis_property',
+    'is_relationship' => 0,
+    'db_name' => 'local'
+  ), array('update_existing' => TRUE));
 }
 /**
  * Adds the Systems Biology Ontology database and terms.

+ 0 - 742
tripal_chado/includes/tripal_chado.setup.inc

@@ -95,57 +95,10 @@ function tripal_chado_prepare_chado() {
     // Add the cv_root_mview.
     tripal_cv_add_cv_root_mview();
 
-    // Add defaults to the tables that correlate OBO files/references with
-    // a chado CV.
-    tripal_cv_add_obo_defaults();
 
     // Create the temp table we will use for loading OBO files.
     tripal_cv_create_tripal_obo_temp();
 
-    // Add the synonym_type vocabulary.
-    tripal_insert_cv(
-      'synonym_type',
-      'A vocabulary used for synonym types (e.g. exact, broad, narrow, related).'
-    );
-
-    // Add the Chado ontology CV.
-    //$obo_path = '{tripal_chado}/files/cv_property.obo';
-    //$obo_id = tripal_insert_obo('Chado CV Properties', $obo_path);
-    //tripal_chado_load_obo_v1_2_id($obo_id);
-    //tripal_submit_obo_job(array('obo_id' => $obo_id));
-
-
-    ///////////////////////////////////////////////////////////////////////////
-    //                          Chado Misc
-    ///////////////////////////////////////////////////////////////////////////
-    tripal_insert_cv(
-      'synonym_type',
-      'A vocabulary for storing synonym types.'
-    );
-    // set the default vocabularies
-    //tripal_set_default_cv('synonym', 'type_id', 'synonym_type');
-
-    // Add cvterms.
-    tripal_insert_misc_cvterms();
-
-
-    /////////////////////////////////////////////////////////////////////////////
-    //                          Chado Organism Module
-    /////////////////////////////////////////////////////////////////////////////
-    tripal_insert_cv(
-      'organism_property',
-      'Contains properties for organisms'
-    );
-
-    // Set the default vocabularies.
-    //tripal_set_default_cv('organismprop', 'type_id', 'organism_property');
-
-    // Add taxonomic terms.
-    $obo_id = tripal_insert_obo('Taxonomic Rank', 'http://purl.obolibrary.org/obo/taxrank.obo');
-    $cv = chado_select_record('cv', array('name'), array('name' => 'taxonomic_rank'));
-    if (count($cv) == 0 and $obo_id) {
-      tripal_chado_load_obo_v1_2_id($obo_id);
-    }
 
     /////////////////////////////////////////////////////////////////////////////
     //                        Chado CompAnalysis Module
@@ -153,9 +106,6 @@ function tripal_chado_prepare_chado() {
     // we may need the analysisfeatureprop table if it doesn't already exist
     tripal_analysis_create_analysisfeatureprop();
 
-    // add cvterms
-    tripal_analysis_add_cvterms();
-
     // add materialized views
     tripal_analysis_add_mview_analysis_organism();
 
@@ -177,18 +127,6 @@ function tripal_chado_prepare_chado() {
       'description' => 'The Tripal Publication controlled vocabulary.',
     ));
 
-    // Add loading of the the tripal contact ontology to the job queue.
-    $obo_path = '{tripal_chado}/files/tcontact.obo';
-    $obo_id = tripal_insert_obo('Tripal Contacts', $obo_path);
-    $cv = chado_select_record('cv', array('name'), array('name' => 'tripal_contact'));
-    if (count($cv) == 0 and $obo) {
-      tripal_chado_load_obo_v1_2_id($obo_id);
-    }
-    //tripal_submit_obo_job(array('obo_id' => $obo_id));
-
-      // Add cvterms for relationship types.
-    tripal_contact_add_cvs();
-
     // Set the default vocabularies.
     //('contact', 'type_id', 'tripal_contact');
     //tripal_set_default_cv('contactprop', 'type_id', 'tripal_contact');
@@ -201,13 +139,6 @@ function tripal_chado_prepare_chado() {
     // be automatically installed.  Some of the terms are duplicates of
     // others in better maintained vocabularies.  New Tripal sites should
     // use those.
-    // $obo_path = '{tripal_feature}/files/feature_property.obo';
-    // $obo_id = tripal_insert_obo('Chado Feature Properties', $obo_path);
-    // tripal_chado_load_obo_v1_2_id($obo_id);
-    //// tripal_submit_obo_job(array('obo_id' => $obo_id));
-
-    // Add the vocabularies used by the feature module.
-    tripal_feature_add_cvs();
 
     // Add the materialized view.
     tripal_feature_add_organism_count_mview();
@@ -217,14 +148,6 @@ function tripal_chado_prepare_chado() {
     tripal_feature_add_tripal_gffcds_temp_table();
     tripal_feature_add_tripal_gffprotein_temp_table();
 
-    // Load the sequence ontology if it isn't already loaded
-    $cv = chado_select_record('cv', array('name'), array('name' => 'sequence'));
-    $obo = tripal_get_obo(array('obo_name' => 'Sequence Ontology'));
-    if (count($cv) == 0 and $obo) {
-      print "Installing the Sequence Ontology... This may take a while...\n";
-      tripal_chado_load_obo_v1_2_id($obo->obo_id);
-    }
-
     // Set the default vocabularies.
     //tripal_set_default_cv('feature', 'type_id', 'sequence');
     //tripal_set_default_cv('featureprop', 'type_id', 'feature_property');
@@ -236,10 +159,6 @@ function tripal_chado_prepare_chado() {
     // add the featuremapprop table to Chado
     tripal_featuremap_add_custom_tables();
 
-    // Add cvterms
-    tripal_featuremap_add_cvs();
-    tripal_featuremap_add_cvterms();
-
     // set the default vocabularies
     //tripal_set_default_cv('featuremapprop', 'type_id', 'featuremap_property');
     //tripal_set_default_cv('featureposprop', 'type_id', 'featurepos_property');
@@ -251,25 +170,14 @@ function tripal_chado_prepare_chado() {
     // add the materialized view
     tripal_library_add_mview_library_feature_count();
 
-    // add cvterms
-    tripal_library_add_cvs();
-    tripal_library_add_cvterms();
-
     // set the default vocabularies
     //tripal_set_default_cv('libraryprop', 'type_id', 'library_property');
     //tripal_set_default_cv('library', 'type_id', 'library_type');
 
-    /////////////////////////////////////////////////////////////////////////////
-    //                          Chado NatDiv Module
-    /////////////////////////////////////////////////////////////////////////////
-    // add cvterms
-    tripal_natural_diversity_add_cvterms();
 
     /////////////////////////////////////////////////////////////////////////////
     //                          Chado Project Module
     /////////////////////////////////////////////////////////////////////////////
-    tripal_project_add_cvs();
-    tripal_project_add_cvterms();
 
     // set the default vocabularies
     //tripal_set_default_cv('projectprop', 'type_id', 'project_property');
@@ -280,15 +188,6 @@ function tripal_chado_prepare_chado() {
     /////////////////////////////////////////////////////////////////////////////
     global $base_path;
 
-    // add loading of the the tripal pub ontology to the job queue
-    $obo_path = '{tripal_chado}/files/tpub.obo';
-    $obo_id = tripal_insert_obo('Tripal Publication', $obo_path);
-    $cv = chado_select_record('cv', array('name'), array('name' => 'tripal_pub'));
-    if (count($cv) == 0 and $obo) {
-      tripal_chado_load_obo_v1_2_id($obo_id);
-    }
-
-    tripal_pub_add_cvs();
     tripal_pub_add_dbs();
 
     // add the custom tables
@@ -305,9 +204,6 @@ function tripal_chado_prepare_chado() {
     /////////////////////////////////////////////////////////////////////////////
       //                          Chado Stock Module
       /////////////////////////////////////////////////////////////////////////////
-    // add some controlled vocabularies
-    tripal_stock_add_cvs();
-
     // set the default vocabularies
     //tripal_set_default_cv('stock', 'type_id', 'stock_type');
     //tripal_set_default_cv('stockprop', 'type_id', 'stock_property');
@@ -377,30 +273,6 @@ function tripal_chado_prepare_chado() {
       'cv_name' => 'local',
     ));
 
-    // For the TripalBundle entities we will want to associate the cvterm_id,
-    // and the chado table and field that it maps to.  We will use a few
-    // variables to do this:
-    tripal_insert_variable(
-      'chado_cv_id',
-      'The ID of the controlled vocabulary in the chado.cv table..'
-    );
-    tripal_insert_variable(
-      'chado_cvterm_id',
-      'The ID of the controlled vocabulary term in the chado.cvterm table.'
-    );
-    tripal_insert_variable(
-      'chado_table',
-      'The name of the table to which a TripalBundle maps.'
-    );
-    tripal_insert_variable(
-      'chado_type_table',
-      'The table that houses the foreign key the cvterm table.'
-    );
-    tripal_insert_variable(
-      'chado_type_column',
-      'The name of the column within the type table that houses the cvterm.'
-    );
-
     // We want to provide a set of commonly used entity types by default. This
     // way when a user first installs Tripal there are some commonly used
     // formats.
@@ -557,27 +429,6 @@ function tripal_stock_add_organism_count_mview() {
 
   tripal_add_mview($view_name, 'tripal_stock', $schema, $sql, $comment);
 }
-/**
- * Add cvs related to publications
- *
- * @ingroup tripal_pub
- */
-function tripal_stock_add_cvs() {
-
-  // Add cv for relationship types
-  tripal_insert_cv(
-      'stock_relationship',
-      'Contains types of relationships between stocks.'
-  );
-  tripal_insert_cv(
-      'stock_property',
-      'Contains properties for stocks.'
-  );
-  tripal_insert_cv(
-      'stock_type',
-      'Contains a list of types for stocks.'
-  );
-}
 
 /**
  * Add custom table related to publications
@@ -654,119 +505,7 @@ function tripal_pub_add_dbs() {
       array('update_existing' => TRUE)
   );
 }
-/**
- * Add cvs related to publications
- *
- * @ingroup tripal_pub
- */
-function tripal_pub_add_cvs() {
-
-
-  // Add the cv for pub properties
-  tripal_insert_cv(
-      'tripal_pub',
-      'A heirarchical set of terms for describing a publication. It is intended to be used as the default vocabularies in Tripal for publication types and contact properties.'
-  );
 
-  // Add the cv for pub types
-  tripal_insert_cv(
-      'pub_type',
-      'Contains types of publications. This can be used if the tripal_pub vocabulary (which is default for publications in Tripal) is not desired.'
-  );
-
-  // Add the cv for pub properties
-  tripal_insert_cv(
-      'pub_property',
-      'Contains properties for publications. This can be used if the tripal_pub vocabulary (which is default for publications in Tripal) is not desired.'
-  );
-
-  // Add cv for relationship types
-  tripal_insert_cv(
-      'pub_relationship',
-      'Contains types of relationships between publications.'
-  );
-}
-/**
- * Add cvs pertaining to projects
- *
- * @ingroup tripal_project
- */
-function tripal_project_add_cvs() {
-  // Add the cv for project properties
-  tripal_insert_cv(
-      'project_property',
-      'Contains properties for projects'
-  );
-
-  // Add cv for relationship types
-  tripal_insert_cv(
-      'project_relationship',
-      'Contains Types of relationships between projects.'
-  );
-}
-
-/**
- * Add cvterms pertaining to projects
- *
- * @ingroup tripal_project
- */
-function tripal_project_add_cvterms() {
-
-  // Insert cvterm 'Project Description' into cvterm table of chado
-  // database. This CV term is used to keep track of the project
-  // description in the projectprop table.
-  tripal_insert_cvterm(
-      array(
-        'name' => 'Project Description',
-        'definition'  => 'Description of a project',
-        'cv_name' => 'project_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-}
-/**
- * Add cvterms related to natural diversity
- *
- * @ingroup tripal_natural_diversity
- */
-function tripal_natural_diversity_add_cvterms(){
-
-  // add cvterms for the nd_experiment_types
-  tripal_insert_cvterm(
-      array(
-        'name' => 'Genotyping',
-        'definition' => 'An experiment where genotypes of individuals are identified.',
-        'cv_name' => 'nd_experiment_types',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-
-  tripal_insert_cvterm(
-      array(
-        'name' => 'Phenotyping',
-        'definition' => 'An experiment where phenotypes of individuals are identified.',
-        'cv_name' => 'nd_experiment_types',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-
-  tripal_insert_cvterm(
-      array(
-        'name' => 'Location',
-        'definition' => 'The name of the location.',
-        'cv_name' => 'nd_geolocation_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-}
 /**
  * Adds a materialized view keeping track of the type of features associated with each library
  *
@@ -819,111 +558,7 @@ function tripal_library_add_mview_library_feature_count(){
 
   tripal_add_mview($view_name, 'tripal_library', $schema, $sql, $comment);
 }
-/**
- * Adds cvterms needed for the library module
- *
- * @ingroup tripal_library
- */
-function tripal_library_add_cvterms() {
-
-  // Insert cvterm 'library_description' into cvterm table of chado
-  // database. This CV term is used to keep track of the library
-  // description in the libraryprop table.
-  tripal_insert_cvterm(
-      array(
-        'id' => 'local:library_description',
-        'name' => 'Library Description',
-        'definition' => 'Description of a library',
-        'cv_name' => 'library_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
 
-  // add cvterms for the map unit types
-  tripal_insert_cvterm(
-      array(
-        'id' => 'local:cdna_library',
-        'name' => 'cdna_library',
-        'definition' => 'cDNA library',
-        'cv_name' => 'library_type',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'id' => 'local:bac_library',
-        'name' => 'bac_library',
-        'definition' => 'Bacterial Artifical Chromsome (BAC) library',
-        'cv_name' => 'library_type',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'id' => 'local:fosmid_library',
-        'name' => 'fosmid_library',
-        'definition' => 'Fosmid library',
-        'cv_name' => 'library_type',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'id' => 'local:cosmid_library',
-        'name' => 'cosmid_library',
-        'definition' => 'Cosmid library',
-        'cv_name' => 'library_type',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'id' => 'local:yac_library',
-        'name' => 'yac_library',
-        'definition' => 'Yeast Artificial Chromosome (YAC) library',
-        'cv_name' => 'library_type',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'id' => 'local:genomic_library',
-        'name' => 'genomic_library',
-        'definition' => 'Genomic Library',
-        'cv_name' => 'library_type',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-}
-/**
- * Adds new CV's used by this module
- *
- * @ingroup tripal_library
- */
-function tripal_library_add_cvs(){
-  tripal_insert_cv(
-      'library_property',
-      'Contains properties for libraries.'
-  );
-  tripal_insert_cv(
-      'library_type',
-      'Contains terms for types of libraries (e.g. BAC, cDNA, FOSMID, etc).'
-  );
-}
 /**
  * Add custom tables needed by the feature map module
  *  - featuremapprop
@@ -1106,227 +741,7 @@ function tripal_featuremap_add_custom_tables(){
   );
   chado_create_custom_table('featureposprop', $schema, TRUE);
 }
-/**
- * Add cv terms needed by the featuremap module
- *
- * @ingroup tripal_featuremap
- */
-function tripal_featuremap_add_cvterms() {
-
-  // add cvterms for the map unit types
-  tripal_insert_cvterm(
-      array(
-        'name' => 'cM',
-        'definition' => 'Centimorgan units',
-        'cv_name' => 'featuremap_units',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'name' => 'bp',
-        'definition' => 'Base pairs units',
-        'cv_name' => 'featuremap_units',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'name' => 'bin_unit',
-        'definition' => 'The bin unit',
-        'cv_name' => 'featuremap_units',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'name' => 'marker_order',
-        'definition' => 'Units simply to define marker order.',
-        'cv_name' => 'featuremap_units',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'name' => 'undefined',
-        'definition' => 'A catch-all for an undefined unit type',
-        'cv_name' => 'featuremap_units',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-
-  // featurepos properties
-  tripal_insert_cvterm(
-      array(
-        'name' => 'start',
-        'definition' => 'The start coordinate for a map feature.',
-        'cv_name' => 'featurepos_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'name' => 'stop',
-        'definition' => 'The end coordinate for a map feature',
-        'cv_name' => 'featurepos_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-
-  // add cvterms for map properties
-  tripal_insert_cvterm(
-      array(
-        'name' => 'Map Dbxref',
-        'definition' => 'A unique identifer for the map in a remote database.  The '
-        . 'format is a database abbreviation and a unique accession separated '
-        . 'by a colon.  (e.g. Gramene:tsh1996a)',
-        'cv_name' => 'featuremap_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'name' => 'Map Type',
-        'definition' => 'The type of Map (e.g. QTL, Physical, etc.)',
-        'cv_name' => 'featuremap_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'name' => 'Genome Group',
-        'definition' => '',
-        'cv_name' => 'featuremap_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'name' => 'URL',
-        'definition' => 'A univeral resource locator (URL) reference where the '
-        . 'publication can be found.  For maps found online, this would be '
-        . 'the web address for the map.',
-        'cv_name' => 'featuremap_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'name' => 'Population Type',
-        'definition' => 'A brief description of the population type used to generate '
-        . 'the map (e.g. RIL, F2, BC1, etc).',
-        'cv_name' => 'featuremap_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'name' => 'Population Size',
-        'definition' => 'The size of the population used to construct the map.',
-        'cv_name' => 'featuremap_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'name' => 'Methods',
-        'definition' => 'A brief description of the methods used to construct the map.',
-        'cv_name' => 'featuremap_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-      array(
-        'name' => 'Software',
-        'definition' => 'The software used to construct the map.',
-        'cv_name' => 'featuremap_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-
-}
-/**
- * Add cvs needed by the featuremap module
- *
- * @ingroup tripal_featuremap
- */
-function tripal_featuremap_add_cvs() {
-
-  tripal_insert_cv(
-      'featuremap_units',
-      'Contains map unit types for the unittype_id column of the featuremap table.'
-  );
 
-  tripal_insert_cv(
-      'featurepos_property',
-      'Contains terms map properties.'
-  );
-
-  tripal_insert_cv(
-      'featuremap_property',
-      'Contains positional types for the feature positions'
-  );
-}
-/**
- * Add cvs related to features
- *
- * @ingroup tripal_pub
- */
-function tripal_feature_add_cvs() {
-
-  // Add cv for relationship types
-  tripal_insert_cv(
-      'feature_relationship',
-      'Contains types of relationships between features.'
-  );
-
-  // The feature_property CV may already exists. It comes with Chado, but
-  // we need to  add it just in case it doesn't get added before the feature
-  // module is installed. But as of Tripal v3.0 the Chado version of this
-  // vocabulary is no longer loaded by default.
-  tripal_insert_cv(
-      'feature_property',
-      'Stores properties about features'
-  );
-
-  // the feature type vocabulary should be the sequence ontology, and even though
-  // this ontology should get loaded we will create it here just so that we can
-  // set the default vocabulary for the feature.type_id field
-  tripal_insert_cv(
-      'sequence',
-      'The Sequence Ontology'
-  );
-}
 /**
  *
  */
@@ -1508,39 +923,6 @@ function tripal_feature_add_organism_count_mview() {
 
   tripal_add_mview($view_name, 'tripal_feature', $schema, $sql, $comment);
 }
-/**
- * Adds any cvs needed by this module.
- *
- * @ingroup tripal_contact
- */
-function tripal_contact_add_cvs() {
-
-  // Add the cv for contact properties. This is a default vocabulary in the event
-  // that a user does not want to use the tripal_contact vocabulary
-  tripal_insert_cv(
-    'contact_property',
-    'Contains properties for contacts. This can be used if the tripal_contact vocabulary (which is default for contacts in Tripal) is not desired.'
-  );
-
-  // add the cv for the contact type. This is a default vocabulary in the event
-  // that a user does not want to use the tripal_contact vocabulary
-  tripal_insert_cv(
-    'contact_type',
-    'Contains types of contacts. This can be used if the tripal_contact vocabulary (which is default for contacts in Tripal) is not desired.'
-  );
-
-  // Add the cv for the tripal_contact vocabulary which is loaded via the OBO
-  tripal_insert_cv(
-    'tripal_contact',
-    'A heirarchical set of terms for describing a contact. It is intended to be used as the default vocabularies in Tripal for contact types and contact properties.'
-  );
-
-  // add the cv for contact relationships
-  tripal_insert_cv(
-    'contact_relationship',
-    'Contains types of relationships between contacts.'
-  );
-}
 /**
  * Add any custom tables needed by this module.
  * - Contactprop: keep track of properties of contact
@@ -1693,80 +1075,7 @@ function tripal_analysis_add_mview_analysis_organism() {
   // add the view
   tripal_add_mview($view_name, 'tripal_analysis', $schema, $sql, $comment);
 }
-/**
- * Adds controlled vocabulary terms needed by this module.
- *
- * @ingroup tripal_analysis
- */
-function tripal_analysis_add_cvterms() {
-
-  tripal_insert_cv(
-      'tripal_analysis',
-      'Terms used for managing analyses in Tripal'
-  );
-
-  // add analysis_date.  This is no longer used (as far as we can tell) but we don't
-  // get rid of it in case it is used, so just keep it in the Tripal CV
-  tripal_insert_cvterm(
-      array(
-        'name' => 'analysis_date',
-        'definition' => 'The date that an analysis was performed.',
-        'cv_name' => 'tripal_analysis',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-
-  // add analysis_short_name.  This is no longer used (as far as we can tell) but we don't
-  // get rid of it in case it is used, so just keep it in the Tripal CV
-  tripal_insert_cvterm(
-      array(
-        'name' => 'analysis_short_name',
-        'definition' => 'A computer legible (no spaces or special characters) '
-        . 'abbreviation for the analysis.',
-        'cv_name' => 'tripal_analysis',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
 
-
-  // the 'analysis_property' vocabulary is for user definable properties wo we
-  // will add an 'Analysis Type' to this vocubulary
-  tripal_insert_cvterm(
-      array(
-        'name' => 'Analysis Type',
-        'definition' => 'The type of analysis that was performed.',
-        'cv_name' => 'analysis_property',
-        'is_relationship' => 0,
-        'db_name' => 'local'
-      ),
-      array('update_existing' => TRUE)
-  );
-}
-/**
- * Add's defaults to the tripal_cv_obo table
- *
- * @ingroup tripal_cv
- */
-function tripal_cv_add_obo_defaults() {
-
-  // Insert commonly used ontologies into the tables.
-  $ontologies = array(
-    // array('Relationship Ontology', 'http://purl.obolibrary.org/obo/ro.obo'),
-    array('Relationship Ontology (legacy)', '{tripal_chado}/files/legacy_ro.obo'),
-    array('Sequence Ontology', 'http://purl.obolibrary.org/obo/so.obo'),
-    array('Gene Ontology', 'http://purl.obolibrary.org/obo/go.obo'),
-    //    array('Cell Ontology', 'https://raw.githubusercontent.com/obophenotype/cell-ontology/master/cl.obo'),
-    //    array('Plant Structure Ontology', 'http://palea.cgrb.oregonstate.edu/viewsvn/Poc/trunk/ontology/OBO_format/po_anatomy.obo?view=co'),
-    //    array('Plant Growth and Development Stages Ontology', 'http://palea.cgrb.oregonstate.edu/viewsvn/Poc/trunk/ontology/OBO_format/po_temporal.obo?view=co')
-  );
-  foreach ($ontologies as $o) {
-    db_query("INSERT INTO {tripal_cv_obo} (name,path) VALUES (:name, :path)", array(':name' => $o[0], ':path' => $o[1]));
-  }
-}
 /**
  * Add a materialized view of root terms for all chado cvs. This is needed for viewing cv trees
  *
@@ -1846,54 +1155,3 @@ function tripal_cv_create_tripal_obo_temp() {
   }
 }
 
-/**
- * Adds generic CVterms.
- */
-function tripal_insert_misc_cvterms() {
-  tripal_insert_cvterm(
-    array(
-      'name' => 'exact',
-      'id' => "local:exact",
-      'definition' => 'An exact equivalent; interchangeable with the term name.',
-      'is_obsolete' => 0,
-      'cv_name' => 'synonym_type',
-      'is_relationship' => FALSE
-    ),
-    array('update_existing' => TRUE)
-  );
-
-  tripal_insert_cvterm(
-    array(
-      'name' => 'broad',
-      'id' => "local:broad",
-      'definition' => 'The synonym is broader than the name.',
-      'is_obsolete' => 0,
-      'cv_name' => 'synonym_type',
-      'is_relationship' => FALSE
-    ),
-    array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-    array(
-      'name' => 'narrow',
-      'id' => "local:narrow",
-      'definition' => 'The synonym is narrower or more precise than the name.',
-      'is_obsolete' => 0,
-      'cv_name' => 'synonym_type',
-      'is_relationship' => FALSE
-    ),
-    array('update_existing' => TRUE)
-  );
-  tripal_insert_cvterm(
-    array(
-      'name' => 'related',
-      'id' => "local:related",
-      'definition' => 'The synonym is related in some way.',
-      'is_obsolete' => 0,
-      'cv_name' => 'synonym_type',
-      'is_relationship' => FALSE
-    ),
-    array('update_existing' => TRUE)
-  );
-}
-