Skip to content

Commit

Permalink
Add missing services for blast programs.
Browse files Browse the repository at this point in the history
  • Loading branch information
laceysanderson committed Mar 31, 2024
1 parent a8480a9 commit cc58946
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 3 deletions.
63 changes: 63 additions & 0 deletions src/Services/TripalBlastProgramBlastp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
/**
* @file
* Form definition of BLASTp program.
*/

namespace Drupal\tripal_blast\Services;

use Drupal\tripal_blast\Services\TripalBlastProgramHelper;

/**
* BLASTp program class.
*/
class TripalBlastProgramBlastp {
const BLASTp = 'blastp';

/**
* Advanced field names used - refer to this value when
* validating and submitting fields under advanced options.
*/
public function formFieldNames() {
// Keys match field names used in form definition below.
$field_name_validator = [];
return $field_name_validator;
}

/**
* Adds the BLASTp Advanced Options to the passed in form.
* This form function is meant to be called within another form definition.
*
* @param $blast_cache
* BLAST job history to reference information information contained.
*
* @return array
* Additional form field definitions.
*/
public function formOptions($blast_cache) {
$blast = self::BLASTp;

// Edit and Resubmit functionality.
// We want to pull up the details from a previous blast and fill them in as defaults
// for this blast.
$options = (isset($blast_cache)) ? $blast_cache : [];
$defaults = TripalBlastProgramHelper::programGetDefaultValues($options, $blast);

$form_alter = [];

return $form_alter;
}

/**
* Map advanced options specific to this program to BLAST keywords.
*
* @param $advanced_field_names
* Values set from form ($form_state).
*
* @return array
* Form values mapped to BLAST keywords.
*/
public function formFieldBlastKey($advanced_field_values) {
return [];
}
}
62 changes: 62 additions & 0 deletions src/Services/TripalBlastProgramBlastx.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
/**
* @file
* Form definition of BLASTx program.
*/

namespace Drupal\tripal_blast\Services;

use Drupal\tripal_blast\Services\TripalBlastProgramHelper;

/**
* BLASTx program class.
*/
class TripalBlastProgramBlastx {
const BLASTx = 'blastx';

/**
* Advanced field names used - refer to this value when
* validating and submitting fields under advanced options.
*/
public function formFieldNames() {
// Keys match field names used in form definition below.
$field_name_validator = [];
return $field_name_validator;
}

/**
* Adds the BLASTx Advanced Options to the passed in form.
* This form function is meant to be called within another form definition.
*
* @param $blast_cache
* BLAST job history to reference information information contained.
*
* @return array
* Additional form field definitions.
*/
public function formOptions($blast_cache) {
$blast = self::BLASTx;

// Edit and Resubmit functionality.
// We want to pull up the details from a previous blast and fill them in as defaults
// for this blast.
$options = (isset($blast_cache)) ? $blast_cache : [];
$defaults = TripalBlastProgramHelper::programGetDefaultValues($options, $blast);

$form_alter = [];
return $form_alter;
}

/**
* Map advanced options specific to this program to BLAST keywords.
*
* @param $advanced_field_names
* Values set from form ($form_state).
*
* @return array
* Form values mapped to BLAST keywords.
*/
public function formFieldBlastKey($advanced_field_values) {
return [];
}
}
63 changes: 63 additions & 0 deletions src/Services/TripalBlastProgramTblastn.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php
/**
* @file
* Form definition of tBLASTn program.
*/

namespace Drupal\tripal_blast\Services;

use Drupal\tripal_blast\Services\TripalBlastProgramHelper;

/**
* tBLASTn program class.
*/
class TripalBlastProgramTblastn {
const tBLASTn = 'tblastn';

/**
* Advanced field names used - refer to this value when
* validating and submitting fields under advanced options.
*/
public function formFieldNames() {
// Keys match field names used in form definition below.
$field_name_validator = [];
return $field_name_validator;
}

/**
* Adds the tBLASTn Advanced Options to the passed in form.
* This form function is meant to be called within another form definition.
*
* @param $blast_cache
* BLAST job history to reference information information contained.
*
* @return array
* Additional form field definitions.
*/
public function formOptions($blast_cache) {
$blast = self::tBLASTn;

// Edit and Resubmit functionality.
// We want to pull up the details from a previous blast and fill them in as defaults
// for this blast.
$options = (isset($blast_cache)) ? $blast_cache : [];
$defaults = TripalBlastProgramHelper::programGetDefaultValues($options, $blast);

$form_alter = [];

return $form_alter;
}

/**
* Map advanced options specific to this program to BLAST keywords.
*
* @param $advanced_field_names
* Values set from form ($form_state).
*
* @return array
* Form values mapped to BLAST keywords.
*/
public function formFieldBlastKey($advanced_field_values) {
return [];
}
}
12 changes: 9 additions & 3 deletions tripal_blast.services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@

services:
tripal_blast.database_service:
class: Drupal\tripal_blast\Services\TripalBlastDatabaseService
class: Drupal\tripal_blast\Services\TripalBlastDatabaseService
tripal_blast.job_service:
class: Drupal\tripal_blast\Services\TripalBlastJobService
class: Drupal\tripal_blast\Services\TripalBlastJobService
tripal_blast.program_blastn:
class: Drupal\tripal_blast\Services\TripalBlastProgramBlastn
class: Drupal\tripal_blast\Services\TripalBlastProgramBlastn
tripal_blast.program_blastx:
class: Drupal\tripal_blast\Services\TripalBlastProgramBlastx
tripal_blast.program_tblastn:
class: Drupal\tripal_blast\Services\TripalBlastProgramTblastn
tripal_blast.program_blastp:
class: Drupal\tripal_blast\Services\TripalBlastProgramBlastp

0 comments on commit cc58946

Please sign in to comment.