ソースを参照

Added fix to handle ontology subset files

Stephen Ficklin 6 年 前
コミット
43cc407ed1
1 ファイル変更17 行追加0 行削除
  1. 17 0
      tripal_chado/includes/TripalImporter/OBOImporter.inc

+ 17 - 0
tripal_chado/includes/TripalImporter/OBOImporter.inc

@@ -187,6 +187,14 @@ class OBOImporter extends TripalImporter {
    * @var string
    */
   private $ebi_warned = FALSE;
+  
+  /**
+   * A flag that indicates if this ontology is just a subset of a much larger
+   * one. Examples include the GO slims.
+   *  
+   * @var string
+   */
+  private $is_subset = FALSE;
 
   /**
    * @see TripalImporter::form()
@@ -811,6 +819,15 @@ class OBOImporter extends TripalImporter {
       $namespace = $header['default-namespace'][0];
     }
     
+    // The OBO specification allows the 'ontology' header tag to be nested for
+    // subsets (e.g. go/subsets/goslim_plant).  We need to simplify that down
+    // to the top-level item. 
+    $matches = [];
+    if (preg_match('/^(.+?)\/.*/', $short_name, $matches)) {
+      $short_name = $matches[1];
+      $this->is_subset = TRUE;
+    }
+    
     // If we have the DB short name (or ontology header) but not the default
     // namespace then we may be able to find it via an EBI lookup.
     if (!$namespace and $short_name) {