Quellcode durchsuchen

API Update: updated all modules to use the Analysis, Bulk Loader & Contact APIs

Lacey Sanderson vor 10 Jahren
Ursprung
Commit
257ae5eaa6

+ 3 - 3
tripal_analysis/tripal_analysis.install

@@ -131,7 +131,7 @@ function tripal_analysis_add_cvterms() {
   tripal_insert_cvterm(
     array(
       'name' => 'analysis_date',
-      'def' => 'The date that an analysis was performed.',
+      'definition' => 'The date that an analysis was performed.',
       'cv_name' => 'tripal',
       'is_relationship' => 0,
       'db_name' => 'tripal'
@@ -144,7 +144,7 @@ function tripal_analysis_add_cvterms() {
   tripal_insert_cvterm(
     array(
       'name' => 'analysis_short_name',
-      'def' => 'A computer legible (no spaces or special characters) '
+      'definition' => 'A computer legible (no spaces or special characters) '
         . 'abbreviation for the analysis.',
       'cv_name' => 'tripal',
       'is_relationship' => 0,
@@ -159,7 +159,7 @@ function tripal_analysis_add_cvterms() {
   tripal_insert_cvterm(
     array(
       'name' => 'Analysis Type',
-      'def' => 'The type of analysis that was performed.',
+      'definition' => 'The type of analysis that was performed.',
       'cv_name' => 'analysis_property',
       'is_relationship' => 0,
       'db_name' => 'tripal'

+ 1 - 1
tripal_bulk_loader/api/tripal_bulk_loader.api.templates.inc

@@ -127,7 +127,7 @@ function tripal_delete_bulk_loader_field($priority, $delete_field_index, $templa
 
   // If this field was the only one in the current record, also delete the record
   if (empty($new_template_array[$priority]['fields'])) {
-    $new_template_array = tripal_bulk_loader_delete_record($priority, $new_template_array);
+    $new_template_array = tripal_delete_bulk_loader_record($priority, $new_template_array);
   }
 
   return $new_template_array;

+ 12 - 12
tripal_bulk_loader/includes/tripal_bulk_loader.admin.templates.inc

@@ -53,7 +53,7 @@ function tripal_bulk_loader_modify_template_base_form($form, &$form_state = NULL
       $form_state['storage']['record2priority'] = array();
       foreach ($form_state['storage']['template'] as $priority => $record_array) {
         if (!is_array($record_array)) {
-          continue; 
+          continue;
         }
         $form_state['storage']['record2priority'][$record_array['record_id']] = $priority;
       }
@@ -205,11 +205,11 @@ function tripal_bulk_loader_modify_template_base_form($form, &$form_state = NULL
 
     // List Current Fields -------------------------------------------------------------
     $num_fields=0;
-    
+
     // pre-create the URLs for dealing with records & fields. We will substitute values as needed
     $record_href_template = 'admin/tripal/loaders/bulk/template/%template/%action/%priority';
     $field_href_template  = 'admin/tripal/loaders/bulk/template/%template/%action/%priority/%field';
-    
+
     foreach ($form_state['storage']['template'] as $priority => $table_array) {
       if (!is_array($table_array)) {
       continue; }
@@ -875,7 +875,7 @@ function tripal_bulk_loader_edit_template_record_form($form, &$form_state) {
   else {
     $template = $form_state['storage']['template'];
   }
-  
+
   // Tables and default table
   $tables = chado_get_table_names(TRUE);
   if (isset($form_state['values']['chado_table'])) {
@@ -1082,7 +1082,7 @@ function tripal_bulk_loader_edit_template_record_form_validate($form, &$form_sta
 
   // Don't worry about validation when Cancel button is clicked
   if ($form_state['clicked_button']['#value'] == 'Save Record') {
-    $is_unique = tripal_bulk_loader_is_record_name_unique(
+    $is_unique = tripal_is_bulk_loader_record_name_unique(
       $form_state['values']['record_name'],
       $form_state['values']['template_id'],
       $form_state['storage']['template_array'],
@@ -1282,7 +1282,7 @@ function tripal_bulk_loader_delete_template_record_form_submit($form, &$form_sta
   $form_state['storage']['template'] = unserialize($result->template_array);
 
   $form_state['storage']['record2priority'] = array();
-  $new_template = tripal_bulk_loader_delete_record($form_state['storage']['record_id'], $form_state['storage']['template']);
+  $new_template = tripal_delete_bulk_loader_record($form_state['storage']['record_id'], $form_state['storage']['template']);
   if (!empty($new_template)) {
     $form_state['storage']['template'] = $new_template;
   }
@@ -1432,7 +1432,7 @@ function tripal_bulk_loader_duplicate_template_record_form_submit($form, &$form_
  */
 function tripal_bulk_loader_template_field_form_default_values($mode, &$form_state) {
   $v = array();
-  
+
   // mode can be 'create' or 'edit'
   $v['mode'] = $mode;
 
@@ -1450,7 +1450,7 @@ function tripal_bulk_loader_template_field_form_default_values($mode, &$form_sta
   $v['no_field_index'] = (isset($form_state['build_info']['args'][3])) ? FALSE : TRUE;
   $form_state['storage']['field_index'] = $v['field_index'];
   $field_index = $v['field_index'];
-  
+
   if (!array_key_exists('values', $form_state)) {
     $form_state['values'] = array();
   }
@@ -1476,7 +1476,7 @@ function tripal_bulk_loader_template_field_form_default_values($mode, &$form_sta
       $template = $form_state['storage']['template'];
     }
   }
-  
+
   // initialize the record2priority array which keeps track of the order by
   // copying the priority information about each record from the template array
   // into the $form_state['storage']['record2priority'] array
@@ -1487,7 +1487,7 @@ function tripal_bulk_loader_template_field_form_default_values($mode, &$form_sta
     }
     $form_state['storage']['record2priority'][$record_array['record_id']] = $priority;
   }
-  
+
 
   // If we are editing then get the original values
   if ($mode == 'edit' && !$v['no_field_index']) {
@@ -2185,7 +2185,7 @@ function tripal_bulk_loader_template_field_form_validate($form, &$form_state) {
 
   // Don't worry about validation when Cancel button is clicked
   if ($form_state['clicked_button']['#value'] == 'Save Changes') {
-    $is_unique = tripal_bulk_loader_is_record_name_unique(
+    $is_unique = tripal_is_bulk_loader_record_name_unique(
       $form_state['values']['record_name'],
       $form_state['values']['template_id'],
       $form_state['storage']['template_array']
@@ -2459,7 +2459,7 @@ function tripal_bulk_loader_delete_template_field_form_submit($form, &$form_stat
   $result = db_query($sql, array(':template' => $form_state['storage']['template_id']))->fetchObject();
   $form_state['storage']['template'] = unserialize($result->template_array);
 
-  $new_template = tripal_bulk_loader_delete_field(
+  $new_template = tripal_delete_bulk_loader_field(
     $form_state['storage']['record_id'],
     $form_state['storage']['field_id'],
     $form_state['storage']['template']

+ 16 - 2
tripal_contact/api/tripal_contact.api.inc

@@ -74,12 +74,26 @@ function tripal_insert_contact($values) {
   // add the description property. We don't store this in the contact.description
   // field because it is only 255 characters long and may not be enough
   if ($description) {
-    tripal_contact_insert_property($contact['contact_id'], 'contact_description', $description, TRUE);
+    chado_insert_property(
+      'contact',
+      $contact['contact_id'],
+      'contact_description',
+      'tripal_contact',
+      $description,
+      TRUE
+    );
   }
 
   // add in the other properties provided
   foreach ($properties as $key => $value) {
-    $success = tripal_contact_insert_property($contact['contact_id'], $key,$value, TRUE);
+    $success = chado_insert_property(
+      'contact',
+      $contact['contact_id'],
+      $key,
+      'tripal_contact',
+      $value,
+      TRUE
+    );
     if (!$success) {
       tripal_report_error('tripal_contact', TRIPAL_ERROR,
         "Could not add the contact property '%prop'", array('%prop' => $key));

+ 6 - 1
tripal_contact/includes/tripal_contact.chado_node.inc

@@ -95,7 +95,12 @@ function chado_contact_form(&$node, $form_state) {
       $description = $contact->description;
     }
     if (!$description) {
-      $contactprop = tripal_contact_get_property($contact->contact_id, 'contact_description');
+      $contactprop = chado_get_property(
+        'contact',
+        $contact->contact_id,
+        'contact_description',
+        'tripal_contact'
+      );
       $description = (isset($contactprop->value)) ? $contactprop->value : '';
     }
 

+ 1 - 1
tripal_cv/includes/tripal_cv.cvterm_form.inc

@@ -437,7 +437,7 @@ function tripal_cv_cvterm_add_form_submit($form, &$form_state) {
     'name' => $name,
     'namespace' => $cv->name,
     'id' => $accession,
-    'def' => $definition,
+    'definition' => $definition,
     'is_obsolete' => $is_obsolete,
     'cv_name' => $cv->name,
     'is_relationship' => $is_relationship,

+ 2 - 2
tripal_cv/includes/tripal_cv.obo_loader.inc

@@ -559,7 +559,7 @@ function tripal_cv_obo_process_term($term, $defaultcv, $is_relationship = 0, &$n
   $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];
@@ -774,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];

+ 15 - 15
tripal_featuremap/tripal_featuremap.install

@@ -144,7 +144,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'cM',
-       'def' => 'Centimorgan units',
+       'definition' => 'Centimorgan units',
        'cv_name' => 'featuremap_units',
        'is_relationship' => 0,
        'db_name' => 'tripal'
@@ -154,7 +154,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'bp',
-       'def' => 'Base pairs units',
+       'definition' => 'Base pairs units',
        'cv_name' => 'featuremap_units',
        'is_relationship' => 0,
        'db_name' => 'tripal'
@@ -164,7 +164,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'bin_unit',
-       'def' => 'The bin unit',
+       'definition' => 'The bin unit',
        'cv_name' => 'featuremap_units',
        'is_relationship' => 0,
        'db_name' => 'tripal'
@@ -174,7 +174,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'marker_order',
-       'def' => 'Units simply to define marker order.',
+       'definition' => 'Units simply to define marker order.',
        'cv_name' => 'featuremap_units',
        'is_relationship' => 0,
        'db_name' => 'tripal'
@@ -184,7 +184,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'undefined',
-       'def' => 'A catch-all for an undefined unit type',
+       'definition' => 'A catch-all for an undefined unit type',
        'cv_name' => 'featuremap_units',
        'is_relationship' => 0,
        'db_name' => 'tripal'
@@ -196,7 +196,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'start',
-       'def' => 'The start coordinate for a map feature.',
+       'definition' => 'The start coordinate for a map feature.',
        'cv_name' => 'featurepos_property',
        'is_relationship' => 0,
        'db_name' => 'tripal'
@@ -206,7 +206,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'stop',
-       'def' => 'The end coordinate for a map feature',
+       'definition' => 'The end coordinate for a map feature',
        'cv_name' => 'featurepos_property',
        'is_relationship' => 0,
        'db_name' => 'tripal'
@@ -218,7 +218,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'Map Dbxref',
-       'def' => 'A unique identifer for the map in a remote database.  The '
+       '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',
@@ -230,7 +230,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'Map Type',
-       'def' => 'The type of Map (e.g. QTL, Physical, etc.)',
+       'definition' => 'The type of Map (e.g. QTL, Physical, etc.)',
        'cv_name' => 'featuremap_property',
        'is_relationship' => 0,
        'db_name' => 'tripal'
@@ -240,7 +240,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'Genome Group',
-       'def' => '',
+       'definition' => '',
        'cv_name' => 'featuremap_property',
        'is_relationship' => 0,
        'db_name' => 'tripal'
@@ -250,7 +250,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'URL',
-       'def' => 'A univeral resource locator (URL) reference where the '
+       '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',
@@ -262,7 +262,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'Population Type',
-       'def' => 'A brief description of the population type used to generate '
+       '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,
@@ -273,7 +273,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'Population Size',
-       'def' => 'The size of the population used to construct the map.',
+       'definition' => 'The size of the population used to construct the map.',
        'cv_name' => 'featuremap_property',
        'is_relationship' => 0,
        'db_name' => 'tripal'
@@ -283,7 +283,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'Methods',
-       'def' => 'A brief description of the methods used to construct the map.',
+       'definition' => 'A brief description of the methods used to construct the map.',
        'cv_name' => 'featuremap_property',
        'is_relationship' => 0,
        'db_name' => 'tripal'
@@ -293,7 +293,7 @@ function tripal_featuremap_add_cvterms() {
    tripal_insert_cvterm(
      array(
        'name' => 'Software',
-       'def' => 'The software used to construct the map.',
+       'definition' => 'The software used to construct the map.',
        'cv_name' => 'featuremap_property',
        'is_relationship' => 0,
        'db_name' => 'tripal'

+ 37 - 37
tripal_library/tripal_library.install

@@ -191,7 +191,7 @@ function tripal_library_add_cvterms() {
   tripal_insert_cvterm(
      array(
        'name' => 'Library Description',
-       'def' => 'Description of a library',
+       'definition' => 'Description of a library',
        'cv_name' => 'library_property',
        'is_relationship' => 0,
        'db_name' => 'tripal'
@@ -203,62 +203,62 @@ function tripal_library_add_cvterms() {
   tripal_insert_cvterm(
     array(
       'name' => 'cdna_library',
-      'def' => 'cDNA library',
-       'cv_name' => 'library_type',
-       'is_relationship' => 0,
-       'db_name' => 'tripal'
-      ),
-      array('update_existing' => TRUE)
+      'definition' => 'cDNA library',
+      'cv_name' => 'library_type',
+      'is_relationship' => 0,
+      'db_name' => 'tripal'
+    ),
+    array('update_existing' => TRUE)
   );
   tripal_insert_cvterm(
     array(
       'name' => 'bac_library',
-      'def' => 'Bacterial Artifical Chromsome (BAC) library',
-       'cv_name' => 'library_type',
-       'is_relationship' => 0,
-       'db_name' => 'tripal'
-      ),
-      array('update_existing' => TRUE)
+      'definition' => 'Bacterial Artifical Chromsome (BAC) library',
+      'cv_name' => 'library_type',
+      'is_relationship' => 0,
+      'db_name' => 'tripal'
+    ),
+    array('update_existing' => TRUE)
   );
   tripal_insert_cvterm(
     array(
       'name' => 'fosmid_library',
-      'def' => 'Fosmid library',
-       'cv_name' => 'library_type',
-       'is_relationship' => 0,
-       'db_name' => 'tripal'
-      ),
-      array('update_existing' => TRUE)
+      'definition' => 'Fosmid library',
+      'cv_name' => 'library_type',
+      'is_relationship' => 0,
+      'db_name' => 'tripal'
+    ),
+    array('update_existing' => TRUE)
   );
   tripal_insert_cvterm(
     array(
       'name' => 'cosmid_library',
-      'def' => 'Cosmid library',
-       'cv_name' => 'library_type',
-       'is_relationship' => 0,
-       'db_name' => 'tripal'
-      ),
-      array('update_existing' => TRUE)
+      'definition' => 'Cosmid library',
+      'cv_name' => 'library_type',
+      'is_relationship' => 0,
+      'db_name' => 'tripal'
+    ),
+    array('update_existing' => TRUE)
   );
   tripal_insert_cvterm(
     array(
       'name' => 'yac_library',
-      'def' => 'Yeast Artificial Chromosome (YAC) library',
-       'cv_name' => 'library_type',
-       'is_relationship' => 0,
-       'db_name' => 'tripal'
-      ),
-      array('update_existing' => TRUE)
+      'definition' => 'Yeast Artificial Chromosome (YAC) library',
+      'cv_name' => 'library_type',
+      'is_relationship' => 0,
+      'db_name' => 'tripal'
+    ),
+    array('update_existing' => TRUE)
   );
   tripal_insert_cvterm(
     array(
       'name' => 'genomic_library',
-      'def' => 'Genomic Library',
-       'cv_name' => 'library_type',
-       'is_relationship' => 0,
-       'db_name' => 'tripal'
-      ),
-      array('update_existing' => TRUE)
+      'definition' => 'Genomic Library',
+      'cv_name' => 'library_type',
+      'is_relationship' => 0,
+      'db_name' => 'tripal'
+    ),
+    array('update_existing' => TRUE)
   );
 }
 

+ 3 - 3
tripal_natural_diversity/tripal_natural_diversity.install

@@ -76,7 +76,7 @@ function tripal_natural_diversity_add_cvterms(){
   tripal_insert_cvterm(
     array(
      'name' => 'Genotyping',
-     'def' => 'An experiment where genotypes of individuals are identified.',
+     'definition' => 'An experiment where genotypes of individuals are identified.',
      'cv_name' => 'nd_experiment_types',
      'is_relationship' => 0,
      'db_name' => 'tripal'
@@ -87,7 +87,7 @@ function tripal_natural_diversity_add_cvterms(){
   tripal_insert_cvterm(
     array(
       'name' => 'Phenotyping',
-      'def' => 'An experiment where phenotypes of individuals are identified.',
+      'definition' => 'An experiment where phenotypes of individuals are identified.',
       'cv_name' => 'nd_experiment_types',
       'is_relationship' => 0,
       'db_name' => 'tripal'
@@ -98,7 +98,7 @@ function tripal_natural_diversity_add_cvterms(){
   tripal_insert_cvterm(
     array(
       'name' => 'Location',
-      'def' => 'The name of the location.',
+      'definition' => 'The name of the location.',
       'cv_name' => 'nd_geolocation_property',
       'is_relationship' => 0,
       'db_name' => 'tripal'

+ 1 - 1
tripal_project/tripal_project.install

@@ -128,7 +128,7 @@ function tripal_project_add_cvterms() {
   tripal_insert_cvterm(
     array(
       'name' => 'Project Description',
-      'def'  => 'Description of a project',
+      'definition'  => 'Description of a project',
       'cv_name' => 'project_property',
       'is_relationship' => 0,
       'db_name' => 'tripal'

+ 6 - 1
tripal_pub/includes/tripal_pub.pub_importers.inc

@@ -1184,7 +1184,12 @@ function tripal_pub_add_authors($pub_id, $authors, $do_contact) {
     // if the user wants us to create a contact for each author then do it.
     if ($do_contact) {
       // Add the contact
-      $contact = tripal_contact_add_contact($name, '', $type, $author);
+      $contact = tripal_insert_contact(array(
+        'name' => $name,
+        'description' => '',
+        'type_name' => $type,
+        'properties' => $author
+      ));
 
       // if we have succesfully added the contact and the pubauthor entries then we want to
       // link them together