Browse Source

Unit test - alias/synonym attribute verification

Risharde Ramnath 4 years ago
parent
commit
5da8b12b88
1 changed files with 44 additions and 0 deletions
  1. 44 0
      tests/tripal_chado/loaders/GFF3ImporterTest.php

+ 44 - 0
tests/tripal_chado/loaders/GFF3ImporterTest.php

@@ -94,6 +94,50 @@ class GFF3ImporterTest extends TripalTestCase {
     $this->assertEquals($hasException, true);
   }
 
+  /**
+   * Run the GFF loader on small_gene.gff for testing.
+   *
+   * This tests whether the GFF loader adds Alias attributes
+   * The GFF loader should allow it
+   */  
+  public function testGFFImporterTagAliasVerification() {
+    $gff_file = ['file_local' =>
+      __DIR__ . '/../data/small_gene.gff'];
+    $fasta = ['file_local' => __DIR__ . '/../data/short_scaffold.fasta'];      
+    $analysis = factory('chado.analysis')->create();
+    $organism = factory('chado.organism')->create();
+    $run_args = [
+      'analysis_id' => $analysis->analysis_id,
+      'organism_id' => $organism->organism_id,
+      'use_transaction' => 1,
+      'add_only' => 0,
+      'update' => 1,
+      'create_organism' => 0,
+      'create_target' => 0,
+      // regexps for mRNA and protein.
+      're_mrna' => NULL,
+      're_protein' => NULL,
+      // optional
+      'target_organism_id' => NULL,
+      'target_type' => NULL,
+      'start_line' => NULL,
+      'landmark_type' => NULL,
+      'alt_id_attr' => NULL,
+    ];
+
+  
+    $this->loadLandmarks($analysis, $organism, $fasta);
+    $this->runGFFLoader($run_args, $gff_file);
+
+    $results = db_query("SELECT * FROM chado.feature_synonym fs
+      LEFT JOIN chado.synonym s ON (fs.feature_synonym_id = s.synonym_id)
+      WHERE name = 'first_test_gene'
+    ;",array());
+
+    $this->assertEquals($results->rowCount(), 1);
+  }
+
+
   /**
    * Run the GFF loader on gff_tag_parent_verification.gff for testing.
    *