Kaynağa Gözat

Merge pull request #1158 from tripal/tv3.5-pre-release-fixes

Bug Fixes pre v3.5 release.
Stephen Ficklin 4 yıl önce
ebeveyn
işleme
1c504ae75a

+ 5 - 1
docs/user_guide/example_genomics/genomes_genes.rst

@@ -27,8 +27,12 @@ Enter the following:
   "File", "Upload the file name Citrus_sinensis-orange1.1g015632m.g.gff3"
   "Analysis", "Whole Genome Assembly and Annotation of Citrus sinensis"
   "Organism", "Citrus sinensis"
+  "Landmark Type", "supercontig"
   "All other options", "leave as default"
 
+.. note::
+    The Landmark Type is provided for this demo GFF3 file because the chromosome is not defined in the file, only the genomic features on the chromosomes.  The landmark type is not needed if the GFF3 file has the chromosomes (scaffolds or contigs) defined in the GFF3 file.
+
 Finally, click the Import GFF3 file button. You'll notice a job was submitted to the jobs subsystem. Now, to complete the process we need the job to run. We'll do this manually:
 
 ::
@@ -78,7 +82,7 @@ You should see output similar to the following:
     Step 22 of 26: Insert feature ontology terms...
     Step 23 of 26: Insert 'derives_from' relationships...
     Step 24 of 26: Insert Targets...
-    Step 25 of 26: Associate features with analysis....              
+    Step 25 of 26: Associate features with analysis....
     Step 26 of 26: Adding sequences data (Skipped: none available)...
 
     Done.

+ 32 - 22
tripal_chado/includes/TripalImporter/GFF3Importer.inc

@@ -2033,7 +2033,7 @@ class GFF3Importer extends TripalImporter {
     $batch_num = 1;
     $sql = '';
     $args = [];
-    foreach ($this->parent_lookup as $parent => $children) {
+    foreach ($this->parent_lookup as $parent => $starts) {
       $total++;
       $i++;
 
@@ -2041,21 +2041,22 @@ class GFF3Importer extends TripalImporter {
       $parent_uniquename = $parent_feature['uniquename'];
       $parent_feature_id = $this->features[$parent_uniquename]['feature_id'];
       if (!$parent_feature['skipped']) {
-
-        foreach ($children as $child_findex) {
-          $j++;
-          $child_feature = $this->getCachedFeature($child_findex);
-          $child_uniquename = $child_feature['uniquename'];
-          $child_feature_id = $this->features[$child_uniquename]['feature_id'];
-          $type_id = $part_of;
-          if ($child_feature['type'] == 'polypeptide' or $child_feature['type'] == 'protein') {
-            $type_id = $derives_from;
+        foreach ($starts as $start => $children) {
+          foreach ($children as $child_findex) {
+            $j++;
+            $child_feature = $this->getCachedFeature($child_findex);
+            $child_uniquename = $child_feature['uniquename'];
+            $child_feature_id = $this->features[$child_uniquename]['feature_id'];
+            $type_id = $part_of;
+            if ($child_feature['type'] == 'polypeptide' or $child_feature['type'] == 'protein') {
+              $type_id = $derives_from;
+            }
+            $sql .= "(:subject_id_$j, :object_id_$j, :type_id_$j, :rank_$j),\n";
+            $args[":subject_id_$j"] = $child_feature_id;
+            $args[":object_id_$j"] = $parent_feature_id;
+            $args[":type_id_$j"] = $type_id;
+            $args[":rank_$j"] = $this->features[$child_uniquename]['rank'];
           }
-          $sql .= "(:subject_id_$j, :object_id_$j, :type_id_$j, :rank_$j),\n";
-          $args[":subject_id_$j"] = $child_feature_id;
-          $args[":object_id_$j"] = $parent_feature_id;
-          $args[":type_id_$j"] = $type_id;
-          $args[":rank_$j"] = $this->features[$child_uniquename]['rank'];
         }
       }
 
@@ -2151,7 +2152,15 @@ class GFF3Importer extends TripalImporter {
         // Place features in order that they appear by their start coordinates.
         $parent = $feature['parent'];
         $start = $feature['start'];
-        $this->parent_lookup[$parent][$start] = $info['findex'];
+        // We can have multiple children that start at the same location
+        // so we'll store children in an array indexed by start position.
+        if (!array_key_exists($parent, $this->parent_lookup)) {
+          $this->parent_lookup[$parent] = [];
+        }
+        if (!array_key_exists($start, $this->parent_lookup[$parent])) {
+          $this->parent_lookup[$parent][$start] = [];
+        }
+        $this->parent_lookup[$parent][$start][] = $info['findex'];
       }
       $this->setItemsHandled($i);
     }
@@ -2168,15 +2177,16 @@ class GFF3Importer extends TripalImporter {
     $this->setItemsHandled(0);
     $this->setTotalItems(count(array_keys($this->parent_lookup)));
     $i = 0;
-    foreach ($this->parent_lookup as $parent => $children) {
-      $starts = array_keys($children);
+    foreach ($this->parent_lookup as $parent => $starts) {
+      $starts = array_keys($starts);
       sort($starts);
       $j = 0;
       foreach ($starts as $start) {
-        $child_findex = $children[$start];
-        $child = $this->getCachedFeature($child_findex);
-        $this->features[$child['uniquename']]['rank'] = $j;
-        $j++;
+        foreach ($this->parent_lookup[$parent][$start] as $child_findex) {
+          $child = $this->getCachedFeature($child_findex);
+          $this->features[$child['uniquename']]['rank'] = $j;
+          $j++;
+        }
       }
       $this->setItemsHandled($j);
     }