Reynold Tan 3 роки тому
батько
коміт
d5bb292d82

+ 32 - 0
config/schema/tripal_blast.schema.yml

@@ -0,0 +1,32 @@
+# @file
+# Tripal Blast Configuration Entity Schema
+
+tripal_blast.blastdb.*:
+  type: config_entity
+  label: 'BLAST Configuration Entity'
+  mapping:
+    nid:
+      type: 'integer'
+      label: 'Node ID'
+    name:
+      type: 'string'
+      label: 'Name'
+    path:
+      type: 'string'
+      label: 'Path'
+    dbtype:
+      type: 'string'
+      label 'Database Type'
+    dbxref_id_regexp:
+      type: 'string'
+      label: 'DB Xref Id Regexp'
+    dbxref_db_id:
+      type: 'integer'
+      label: 'DB Xref Id'
+    dbxref_linkout_type:
+      type: 'string'
+      label: 'DB Xref Type'
+    cvitjs_enabled:
+      type: 'boolean'
+      label: 'CvitJS Enabled'
+    

+ 90 - 0
tripal_blast.install

@@ -0,0 +1,90 @@
+<?php
+/**
+ * @file
+ * .install file of Tripal BLAST.
+ *
+ * Contains hooks to handle installation of this module.
+ *
+ * Specifically, a database table (blastdb) is created to store additional information
+ * related to blast database nodes such as the name/path to the NCBI BLAST database files
+ * and the type (protein or nucleotide) of the database.
+ */
+
+
+use Drupal\node\Entity\Node;
+
+/**
+ * Implements hook_install().
+ * 
+ * @see tripal.info
+ */
+function tripal_blast_install() {
+  // Retreives the Drupal relative directory for a Tripal module.
+  tripal_create_files_dir('tripal_blast');
+}
+
+/**
+ * Implements hook_uninstall().
+ */
+function tripal_blast_uninstall() {
+  // @TODO: Removes nodes.
+}
+
+/**
+ * Implements hook_schema().
+ * Create the blast job database table for storing blast job requests.
+ */
+function tripal_blast_schema() {  
+  // BLAST JOBS
+  // ------------------------
+  // Keeps track of additional information related to tripal blast jobs.
+  $schema['blastjob'] = array(
+    'description' => t('Keeps track of additional information related to tripal blast jobs.'),
+    'fields' => array(
+      'job_id' => array(
+        'description' => t('The Tripal job_id for the blast job.'),
+        'type' => 'int',
+        'unsigned' => true,
+        'not null' => true,
+      ),
+      'blast_program' => array(
+        'description' => t('The program to use to run the blast (ie: blastn, blastp, etc.).'),
+        'type' => 'varchar',
+        'length' => 20,
+        'not null' => true,
+      ),
+      'target_blastdb' => array(
+        'description' => t('The nid of the blastdb used to search against; NULL if target was uploaded.'),
+        'type' => 'int',
+        'unsigned' => true,
+      ),
+      'target_file' => array(
+        'description' => t('The absolute path to the uploaded blast database after it was run through makeblastdb; NULL if target was NOT uploaded.'),
+        'type' => 'text',
+      ),
+      'query_file' => array(
+        'description' => t('The absolute path to the query file.'),
+        'type' => 'text',
+      ),
+      'result_filestub' => array(
+        'description' => t('The absolute path and filename (without extension) of the blast results.'),
+        'type' => 'text',
+      ),
+      'options' => array(
+        'description' => t('A serialized array of options selected for the blast job where the key is the machine name of the option used when calling blast (ie: gapextend) and the value is the value of the option.'),
+        'type' => 'text',
+      ),
+    ),
+    'primary key' => array('job_id'),
+    'foreign keys' => array(
+      'job_id' => array(
+        'table' => 'tripal_jobs',
+        'columns' => array(
+          'job_id' => 'job_id',
+        ),
+      ),
+    ),
+  );
+  
+  return $schema;
+}

+ 8 - 1
tripal_blast.links.task.yml

@@ -21,4 +21,11 @@ tripal_blast.tab2:
   title: 'Tripal BLAST: Help'
   route_name: tripal_blast.help
   base_route: tripal_blast.configuration
-  weight: 1 
+  weight: 1 
+
+# Tripal BLAST Entity Configuration Tab.
+tripal_blast.tab3:
+  title: 'Tripal BLAST: Entity Configuration'
+  route_name: entity.tripal_blast.blastdb  
+  base_route: tripal_blast.configuration
+  weight: 1 

+ 13 - 2
tripal_blast.routing.yml

@@ -80,7 +80,7 @@ tripal_blast.configuration:
     _title: 'Tripal Blast: Configuration'
     _form: '\Drupal\tripal_blast\Form\TripalBlastConfigurationForm'
   requirements:
-    _permission: 'access content'
+    _permission: 'administer tripal'
 
 tripal_blast.help:
   path: '/admin/tripal/extension/tripal_blast/configuration/help'
@@ -88,4 +88,15 @@ tripal_blast.help:
     _title: 'Tripal Blast: Help'
     _controller: '\Drupal\tripal_blast\Controller\TripalBlastHelpController::help'
   requirements:
-    _permission: 'access content'
+    _permission: 'administer tripal'
+
+
+# Route set below defines routes for the management of 
+# configuration entity (list, add, edit and delete).    
+entity.tripal_blast.blastdb:
+  path: '/admin/tripal/extension/tripal_blast/configuration/entity'
+  defaults:
+    _entity_list: 'blastdb_entity'
+    _title: 'Tripal BLAST Query Database'
+  requirements:
+    _permission: 'administer tripal'