Prechádzať zdrojové kódy

Merge branch '525-tv3-obo_speed_colon' of github.com:tripal/tripal into 525-tv3-obo_speed_colon

Stephen Ficklin 6 rokov pred
rodič
commit
3c2ec8cf11

+ 3 - 2
tests/tripal_chado/loaders/GFF3ImporterTest.php

@@ -123,6 +123,7 @@ class GFF3ImporterTest extends TripalTestCase {
    * The GFF importer should still create explicitly defined proteins if
    * skip_protein is true.
    *
+   * @group gff
    * @ticket 77
    */
   public function testGFFImporterLoadsExplicitProteins() {
@@ -176,11 +177,11 @@ class GFF3ImporterTest extends TripalTestCase {
 
   private function loadLandmarks($analysis, $organism) {
     $landmark_file = ['file_remote' => 'https://raw.githubusercontent.com/statonlab/tripal_dev_seed/master/Fexcel_mini/sequences/empty_landmarks.fasta'];
-
+    
     $run_args = [
       'organism_id' => $organism->organism_id,
       'analysis_id' => $analysis->analysis_id,
-      'seqtype' => 'scaffold',
+      'seqtype' => 'supercontig',
       'method' => 2, //default insert and update
       'match_type' => 1, //unique name default
       //optional

+ 10 - 11
tests/tripal_chado/loaders/OBOImporterTest.php

@@ -39,17 +39,16 @@ class OBOImporterTest extends TripalTestCase {
    * @group obo
    */
 
-//   public function testGO_SLIM_load() {
-// //    $this->load_goslim_plant();
-// //
-// //    $exists = db_select('chado.cv', 'c')
-// //      ->fields('c', ['cv_id'])
-// //      ->condition('name', 'core_test_goslim_plant')
-// //      ->execute()
-// //      ->fetchField();
-// //    $this->assertNotFalse($exists);
-// //
-//   }
+   public function testGO_SLIM_load() {
+     $this->load_goslim_plant();
+
+     $exists = db_select('chado.cv', 'c')
+       ->fields('c', ['cv_id'])
+       ->condition('name', 'core_test_goslim_plant')
+       ->execute()
+       ->fetchField();
+     $this->assertNotFalse($exists);
+   }
 
   private function load_pto_mini() {
 

+ 16 - 3
tripal_chado/includes/TripalImporter/OBOImporter.inc

@@ -967,7 +967,7 @@ class OBOImporter extends TripalImporter {
         throw new Exception(t('Cannot find the ontology via an EBI OLS lookup: !short_name. ' .
           'EBI Reported: !message. ' .
           'Consider finding the OBO file for this ontology and manually loading it first.',
-          ['!message' => $results['message'], '!short_name' => $short_name]));
+          ['!message' => $ontology_results['message'], '!short_name' => $short_name]));
       }
       $base_iri = $ontology_results['config']['baseUris'][0];
       $ontologyID = $ontology_results['ontologyId'];
@@ -1173,6 +1173,7 @@ class OBOImporter extends TripalImporter {
         }
       }
       else {
+
         // The term doesnt exist, so let's just do our insert.
         $cvterm->setValues([
           'cv_id' => $cv->cv_id,
@@ -1556,12 +1557,23 @@ class OBOImporter extends TripalImporter {
         // First try to lookup the term and replace the stanza with the updated
         // details. 
         $found = $this->lookupTerm($short_name, $accession);
+
         if ($found) {
           $stanza = $found;
         }
         // If we can't find the term in the database then do an EBI lookup.
         else {          
           $stanza = $this->findEBITerm($id);
+          $db_name = $stanza['db_name'][0];
+          $db = $this->all_dbs[$db_name];
+          if (!$db){
+            $db = $this->addDB($short_name);
+          }
+          $cv_name = $stanza['namespace'][0];
+          $cv = $this->all_cvs[$cv_name];
+          if (!$cv){
+            $cv = $this->addCV($cv_name);
+          }
         }
       }
       // If the term belongs to this OBO then let's set the 'db_name'.
@@ -1616,7 +1628,7 @@ class OBOImporter extends TripalImporter {
     if (array_key_exists('synonym', $stanza)) {
       foreach ($stanza['synonym'] as $index => $synonym) {
         if (preg_match('/\"(.*?)\".*(EXACT|NARROW|BROAD|RELATED)/', $synonym, $matches)) {
-          $stanza['synonym'][$index] = '"' . $matches[1] . '" ' . $maches[2];
+          $stanza['synonym'][$index] = '"' . $matches[1] . '" ' . $matches[2];
         }
       }
     }
@@ -1664,7 +1676,7 @@ class OBOImporter extends TripalImporter {
     if ($this->cache_type == 'table') {
       $sql = "SELECT id FROM {tripal_obo_temp} WHERE type = 'Typedef' ";
       $typedefs = chado_query($sql);
-      return $typdefs; 
+      return $typedefs;
     }
     return $this->termStanzaCache['types'][$type];
   }
@@ -2013,6 +2025,7 @@ class OBOImporter extends TripalImporter {
     }
     $this->all_cvs[$cvname] = (object) $cv->getValues();
     $this->obo_namespaces[$cvname] = $cv->getID();
+    return $cv->getValues();
   }
   
   /**