|
@@ -41,6 +41,7 @@ class TripalBlastDatabaseForm extends EntityForm {
|
|
|
*/
|
|
|
public function form(array $form, FormStateInterface $form_state) {
|
|
|
$form = parent::form($form, $form_state);
|
|
|
+ $blast_db = $this->entity;
|
|
|
|
|
|
//
|
|
|
// # BLAST DATABASE NAME:
|
|
@@ -49,6 +50,7 @@ class TripalBlastDatabaseForm extends EntityForm {
|
|
|
'#title' => $this->t('Tripal BLAST database name'),
|
|
|
'#description' => $this->t('The human-readable name of the BLAST database.'),
|
|
|
'#required' => TRUE,
|
|
|
+ '#default_value' => $blast_db->getName()
|
|
|
];
|
|
|
|
|
|
//
|
|
@@ -58,6 +60,7 @@ class TripalBlastDatabaseForm extends EntityForm {
|
|
|
'#title' => $this->t('Database source path'),
|
|
|
'#description' => $this->t('The full path and filename prefix of the BLAST database.'),
|
|
|
'#required' => TRUE,
|
|
|
+ '#default_value' => $blast_db->getPath()
|
|
|
];
|
|
|
|
|
|
//
|
|
@@ -67,6 +70,7 @@ class TripalBlastDatabaseForm extends EntityForm {
|
|
|
'#title' => $this->t('Database type'),
|
|
|
'#options' => ['n' => 'Nucleotide', 'p' => 'Protein'],
|
|
|
'#description' => $this->t('Type of the blast database (Nucleotide or Protein).'),
|
|
|
+ '#default_value' => $blast_db->getDbType()
|
|
|
];
|
|
|
|
|
|
//
|
|
@@ -83,7 +87,8 @@ class TripalBlastDatabaseForm extends EntityForm {
|
|
|
'#type' => 'textfield',
|
|
|
'#title' => $this->t('Extract Regular Expression'),
|
|
|
'#description' => $this->t('The Regular Expression to use to extract the id from the FASTA header of the BLAST database hit.'),
|
|
|
- '#required' => TRUE,
|
|
|
+ '#required' => TRUE,
|
|
|
+ '#default_value' => $blast_db->getDbXrefRegExp()
|
|
|
];
|
|
|
|
|
|
//
|
|
@@ -92,7 +97,8 @@ class TripalBlastDatabaseForm extends EntityForm {
|
|
|
'#type' => 'textfield',
|
|
|
'#title' => $this->t('BLAST database reference'),
|
|
|
'#description' => $this->t('The Database records from this BLAST Database reference.'),
|
|
|
- '#required' => TRUE,
|
|
|
+ '#required' => TRUE,
|
|
|
+ '#default_value' => $blast_db->getDbXref()
|
|
|
];
|
|
|
|
|
|
//
|
|
@@ -101,7 +107,8 @@ class TripalBlastDatabaseForm extends EntityForm {
|
|
|
'#type' => 'textfield',
|
|
|
'#title' => $this->t('BLAST database reference linkout type'),
|
|
|
'#description' => $this->t('Type of linkout to be used for this database reference.'),
|
|
|
- '#required' => TRUE,
|
|
|
+ '#required' => TRUE,
|
|
|
+ '#default_value' => $blast_db->getDbXrefLinkout()
|
|
|
];
|
|
|
|
|
|
// # SUPPORT CVITJS:
|
|
@@ -109,7 +116,7 @@ class TripalBlastDatabaseForm extends EntityForm {
|
|
|
'#type' => 'checkbox',
|
|
|
'#title' => $this->t('Visualize using CVITJS'),
|
|
|
'#description' => $this->t('Indicate if CViTjs should be used to display hits on a whole genome.'),
|
|
|
- '#default_value' => TRUE,
|
|
|
+ '#default_value' => $blast_db->getCvitjsEnabled()
|
|
|
];
|
|
|
|
|
|
return $form;
|
|
@@ -119,6 +126,38 @@ class TripalBlastDatabaseForm extends EntityForm {
|
|
|
* {@inheritdoc}
|
|
|
*/
|
|
|
public function save(array $form, FormStateInterface $form_state) {
|
|
|
-
|
|
|
+ $blast_db = $this->entity;
|
|
|
+
|
|
|
+ $blast_db->set('id', uniqid());
|
|
|
+ // Database Name.
|
|
|
+ $dbname = $form_state->getValue('fld_text_name');
|
|
|
+ $dbname = trim($dbname);
|
|
|
+ $blast_db->set('name', $dbname);
|
|
|
+ // Database Path.
|
|
|
+ $dbpath = $form_state->getValue('fld_text_path');
|
|
|
+ $dbpath = trim($dbpath);
|
|
|
+ $blast_db->set('path', $dbpath);
|
|
|
+ // Database Type.
|
|
|
+ $dbtype = $form_state->getValue('fld_text_type');
|
|
|
+ $dbtype = trim($dbtype);
|
|
|
+ $blast_db->set('dbtype', $dbtype);
|
|
|
+ // Database REGEXP.
|
|
|
+ $dbregexp = $form_state->getValue('fld_text_dbxref_id_regexp');
|
|
|
+ $dbregexp = trim($dbregexp);
|
|
|
+ $blast_db->set('dbxref_id_regexp', $dbregexp);
|
|
|
+ // Database XRef.
|
|
|
+ $dbxref = $form_state->getValue('fld_text_dbxref_db_id');
|
|
|
+ $dbxref = trim($dbxref);
|
|
|
+ $blast_db->set('dbxref_db_id', $dbxref);
|
|
|
+ // Database Linkout.
|
|
|
+ $dblinkout = $form_state->getValue('fld_text_dbxref_linkout_type');
|
|
|
+ $dblinkout = trim($dblinkout);
|
|
|
+ $blast_db->set('dbxref_linkout_type', $dblinkout);
|
|
|
+ // CVITJS Support.
|
|
|
+ $cvitjs_enabled = $form_state->getValue('fld_checkbox_cvitjs');
|
|
|
+ $blast_db->set('cvitjs_enabled', $cvitjs_enabled);
|
|
|
+
|
|
|
+ $blast_db->save();
|
|
|
+ $form_state->setRedirect('entity.tripal_blast.blast_database');
|
|
|
}
|
|
|
}
|