Browse Source

Update tripal to use Feature & Publication API. Tripal now uses all it's own new APIs

Lacey Sanderson 10 years ago
parent
commit
d1e2c7bbe2

+ 1 - 1
tripal_feature/api/tripal_feature.api.inc

@@ -385,7 +385,7 @@ function tripal_get_feature_sequences($feature, $options) {
       $dir = 'forward';
       $length = strlen($seq);
       if ($parent->strand < 0) {
-        $seq = tripal_feature_reverse_complement($seq);
+        $seq = tripal_reverse_compliment_sequence($seq);
         $dir = 'reverse';
       }
       // now format for display

+ 2 - 2
tripal_feature/theme/tripal_feature.theme.inc

@@ -158,7 +158,7 @@ function tripal_feature_load_featureloc_sequences($feature_id, $featurelocs) {
       $sequence = chado_query($sql, $args)->fetchObject();
       $residues = $sequence->residues;
       if ($featureloc->strand < 0) {
-        $residues = tripal_feature_reverse_complement($residues);
+        $residues = tripal_reverse_compliment_sequence($residues);
       }
       $strand = '.';
       if ($featureloc->strand == 1) {
@@ -911,4 +911,4 @@ function tripal_feature_get_feature_relationships($feature) {
     }
   }
   return $relationships;
-}
+}

+ 5 - 5
tripal_pub/api/tripal_pub.api.inc

@@ -427,7 +427,7 @@ function tripal_publication_exists($pub_details) {
 
   // first try to find the publication using the accession number if that key exists in the details array
   if (array_key_exists('Publication Dbxref', $pub_details)) {
-    $pub = chado_get_publication(array('dbxref' => $pub_details['Publication Dbxref']));
+    $pub = tripal_get_publication(array('dbxref' => $pub_details['Publication Dbxref']));
     if($pub) {
       return array($pub->pub_id);
     }
@@ -435,7 +435,7 @@ function tripal_publication_exists($pub_details) {
 
   // make sure the citation is unique
   if (array_key_exists('Citation', $pub_details)) {
-    $pub = chado_get_publication(array('uniquename' => $pub_details['Citation']));
+    $pub = tripal_get_publication(array('uniquename' => $pub_details['Citation']));
     if($pub) {
       return array($pub->pub_id);
     }
@@ -460,13 +460,13 @@ function tripal_publication_exists($pub_details) {
   }
   else {
     tripal_report_error('tripal_pub', TRIPAL_ERROR, 
-      "chado_does_pub_exist(): The Publication Type is a " .
+      "tripal_publication_exists(): The Publication Type is a " .
       "required property but is missing", array());
     return array();
   }
   if (!$pub_type) {
     tripal_report_error('tripal_pub', TRIPAL_ERROR, 
-     "chado_does_pub_exist(): Cannot find publication type: '%type'",
+     "tripal_publication_exists(): Cannot find publication type: '%type'",
       array('%type' => $pub_details['Publication Type'][0]));
     return array();
   }
@@ -864,4 +864,4 @@ function tripal_import_pub_by_dbxref($pub_dbxref, $do_contact = FALSE, $do_updat
   }
 
   print "Done.\n";
-}
+}

+ 1 - 1
tripal_pub/includes/tripal_pub.chado_node.inc

@@ -441,7 +441,7 @@ function chado_pub_validate($node, $form, &$form_state) {
 function chado_pub_validate_check_uniquename($uniquename, $pub_id = NULL) {
 
   // check to see if a pub exists with this uniquename
-  $pub = chado_get_publication(array('uniquename' => $uniquename));
+  $pub = tripal_get_publication(array('uniquename' => $uniquename));
   if ($pub) {
     // if a $pub_id is provided to the function then this is an update
     // if the pub_id's don't match then a different pub with the same

+ 16 - 3
tripal_pub/includes/tripal_pub.pub_importers.inc

@@ -859,7 +859,20 @@ function tripal_pub_add_publications($pubs, $do_contact, $update = FALSE) {
     if ($pub_id){
       // add the publication cross reference (e.g. to PubMed)
       if ($pub_id and $pub['Publication Dbxref']) {
-        $pub_dbxref = tripal_pub_add_pub_dbxref($pub_id, $pub['Publication Dbxref']);
+        $dbxref = array();
+        if (preg_match('/^(.*?):(.*?)$/', trim($pub['Publication Dbxref']), $matches)) {
+          $dbxref['db_name']   = $matches[1];
+          $dbxref['accession'] = $matches[2];
+        }
+        else {
+          tripal_report_error(
+            'tripal_pub',
+            TRIPAL_ERROR,
+            'Unable to extract the dbxref to be associated with the publication (pub ID=@pub_id) from @dbxref. This reference should be [database-name]:[accession]',
+            array('@pub_id' => $pub_id, '@dbxref' => $pub['Publication Dbxref'])
+          );
+        }
+        $pub_dbxref = tripal_associate_dbxref('pub', $pub_id, $dbxref);
       }
       $pub['pub_id'] = $pub_id;
     }
@@ -923,7 +936,7 @@ function tripal_pub_add_publication($pub_details, &$action, $do_contact = FALSE,
 
   // before proceeding check to see if the publication already exists. If there is only one match
   // and the $update_if_exists is NOT set then return FALSE
-  $pub_ids = chado_does_pub_exist($pub_details);
+  $pub_ids = tripal_publication_exists($pub_details);
 
   if(count($pub_ids) == 1 and !$update_if_exists) {
     tripal_report_error('tripal_pub', TRIPAL_NOTICE,
@@ -1399,4 +1412,4 @@ function tripal_pub_get_publication_array($pub_id, $skip_existing = TRUE) {
     }
   }
   return $pub_array;
-}
+}

+ 1 - 1
tripal_pub/includes/tripal_pub.pub_search.inc

@@ -42,7 +42,7 @@ function tripal_pub_search_page() {
     $page = isset($_GET['page']) ? $_GET['page'] : '0';
     $offset = $page * $limit;
     $total_records = 0;
-    $pubs = pub_search($search_array, $offset, $limit, $total_records);
+    $pubs = tripal_search_publications($search_array, $offset, $limit, $total_records);
     pager_default_initialize($total_records, $limit, 0);
     
     // iterate through the results and construct the table displaying the publications

+ 1 - 1
tripal_pub/tripal_pub.drush.inc

@@ -99,5 +99,5 @@ function drush_tripal_pub_tripal_pubs_update() {
   $dbxref = drush_get_option('dbxref');
   $db = drush_get_option('db');
 
-  chado_reimport_publications($create_contacts, $dbxref, $db);
+  tripal_reimport_publications($create_contacts, $dbxref, $db);
 }