Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
DrmaaBlastTool Class Reference

A class that will run Blast as a drmaa process. More...

#include <drmaa_blast_tool.hpp>

Inheritance diagram for DrmaaBlastTool:
[legend]
Collaboration diagram for DrmaaBlastTool:
[legend]

Public Member Functions

 DrmaaBlastTool (BlastServiceJob *job_p, const char *name_s, const char *factory_s, const BlastServiceData *data_p, const char *blast_program_name_s, const char *queue_name_s, const char *const output_path_s, bool async_flag)
 Create a DrmaaBlastTool for a given ServiceJob. More...
 
 DrmaaBlastTool (BlastServiceJob *job_p, const BlastServiceData *data_p, const json_t *json_p)
 Create a DrmaaBlastTool for a given ServiceJob using the configuration details from a serialised JSON fragment. More...
 
void SetDrmaaOptions (DrmaaTool *drmaa_p, bool async_flag)
 Set the Drmaa settings for this DrmaaBlastTool. More...
 
virtual ~DrmaaBlastTool ()
 The DrmaaBlastTool destructor. More...
 
virtual OperationStatus Run ()
 Run this DrmaaBlastTool. More...
 
virtual OperationStatus GetStatus (bool update_flag=true)
 Get the status of a DrmaaBlastTool. More...
 
void SetCoresPerSearch (uint32 cores)
 Set the number of cores that this DrmaaBlastTool that will try to use when it runs. More...
 
bool SetEmailNotifications (const char **email_addresses_ss)
 This sets up notification emails for each Blast job via DRMAA. More...
 
virtual bool SetUpOutputFile ()
 Set the output file parameter. More...
 
- Public Member Functions inherited from ExternalBlastTool
 ExternalBlastTool (BlastServiceJob *job_p, const char *name_s, const char *factory_s, const BlastServiceData *data_p, const char *blast_program_name_s, const bool async_flag)
 Create a ExternalBlastTool for a given ServiceJob. More...
 
 ExternalBlastTool (BlastServiceJob *job_p, const BlastServiceData *data_p, const json_t *json_p)
 Create a ExternalBlastTool for a given ServiceJob using the configuration details from a serialised JSON fragment. More...
 
virtual ~ExternalBlastTool ()
 The ExternalBlastTool destructor. More...
 
virtual bool ParseParameters (ParameterSet *param_set_p, BlastAppParameters *app_params_p)
 Parse a ParameterSet to configure a ExternalBlastTool prior to it being ran. More...
 
virtual bool SetInputFilename (const char *const filename_s)
 Set the input filename for the BlastTool to use. More...
 
virtual char * GetResults (BlastFormatter *formatter_p)
 Get the results after the ExternalBlastTool has finished running. More...
 
virtual char * GetLog ()
 Get a copy of the log data from the run of this ExternalBlastTool's run. More...
 
- Public Member Functions inherited from BlastTool
 BlastTool (BlastServiceJob *job_p, const char *name_s, const char *factory_s, const BlastServiceData *data_p, const uint32 output_format, const char *custom_output_s)
 Create a BlastTool for a given ServiceJob. More...
 
 BlastTool (BlastServiceJob *job_p, const BlastServiceData *data_p, const json_t *json_p)
 Create a BlastTool for a given ServiceJob. More...
 
virtual ~BlastTool ()
 The BlastTool destructor,. More...
 
uint32 GetOutputFormat () const
 Get the output format code that this BlastTool will produce its results in. More...
 
virtual bool PreRun ()
 Any custom functionality required before running a BlastTool. More...
 
virtual void PostRun ()
 Any custom functionality required after running a BlastTool. More...
 
virtual bool AddErrorDetails ()
 
const uuid_tGetUUID () const
 Get the uuid for the ServiceJob that this BlastTool is linked with. More...
 
const char * GetName () const
 Get the name asssociated with this BlastTool. More...
 
json_t * GetAsJSON ()
 Get the JSON-based persistent description of this BlastTool. More...
 
const char * GetFactoryName () const
 Get the name of the BlastToolFactory that created this BlastTool. More...
 
bool SetCustomOutputColumns (const char *custom_columns_s)
 
void FreeBlastTool (BlastTool *tool_p)
 Free a BlastTool. More...
 
OperationStatus RunBlast (BlastTool *tool_p)
 Run Blast using the parameters that have been previously using ConvertArguments. More...
 
OperationStatus GetBlastStatus (BlastTool *tool_p)
 Get the current OperationStatus of a BlastTool. More...
 
bool IsBlastToolSynchronous (BlastTool *tool_p)
 Is the BlastTool going to run asynchronously? More...
 

Static Public Member Functions

static DrmaaBlastToolGetFromJSON (const json_t *json_p, const char *name_s, const char *program_name_s, ServiceJob *job_p, BlastServiceData *service_data_p)
 Create a DrmaaBlastTool for a given ServiceJob using the configuration details from a serialised JSON fragment. More...
 

Protected Member Functions

virtual ArgsProcessorGetArgsProcessor ()
 Get the ArgsProcessor that this BlastTool will use to parse the input ParameterSet prior to running its job. More...
 
virtual bool AddBlastArg (const char *const arg_s, const bool hyphen_flag)
 Add the argument to the command line arguments that this DrmaaBlastTool will run with. More...
 
virtual bool AddToJSON (json_t *root_p)
 This method is used to serialise this DrmaaBlastTool so that it can be recreated from another calling process when required. More...
 
- Protected Member Functions inherited from ExternalBlastTool
virtual bool AddBlastArgsPair (const char *key_s, const char *value_s)
 Add a pair of arguments to the command line arguments that this BlastTool will run with. More...
 
char * GetJobFilename (const char *const prefix_s, const char *const suffix_s)
 Create the filename to use for a ServiceJob. More...
 

Protected Attributes

DrmaaToolArgsProcessordbt_args_processor_p
 The DrmaaToolArgsProcessor that this DrmaaBlastTool will use. More...
 
- Protected Attributes inherited from ExternalBlastTool
char * ebt_results_filename_s
 The filename which the Blast results will be written to if the job runs successfully. More...
 
char * ebt_working_directory_s
 The working directory where all of the input, output and log files will be created. More...
 
char * ebt_blast_s
 The name of the blast command line executable to use. More...
 
bool ebt_async_flag
 If this is true, then the ExternalBlastTool will run asynchronously. More...
 
- Protected Attributes inherited from BlastTool
uint32 bt_output_format
 The output format code to use. More...
 
char * bt_custom_output_columns_s
 Any custom columns for tabular output formats. More...
 

Additional Inherited Members

- Static Public Attributes inherited from ExternalBlastTool
static const char *const EBT_INPUT_SUFFIX_S
 This is the string that will get appended to each input file used by the ExternalBlastTool. More...
 
static const char *const EBT_ASYNC_S
 This is the string that will get appended to each log file created when an ExternalBlastTool is ran. More...
 

Detailed Description

A class that will run Blast as a drmaa process.

Constructor & Destructor Documentation

◆ DrmaaBlastTool() [1/2]

DrmaaBlastTool ( BlastServiceJob job_p,
const char *  name_s,
const char *  factory_s,
const BlastServiceData data_p,
const char *  blast_program_name_s,
const char *  queue_name_s,
const char *const  output_path_s,
bool  async_flag 
)

Create a DrmaaBlastTool for a given ServiceJob.

Parameters
job_pThe ServiceJob to associate with this DrmaaBlastTool.
name_sThe name to give to this DrmaaBlastTool.
factory_sThe name of the DrmaaBlastFactory that is creating this DrmaaBlastTool.
data_pThe BlastServiceData for the Service that will run this DrmaaBlastTool.
blast_program_name_sThe name of blast command line executable that this DrmaaBlastTool. will call to run its blast job.
queue_name_sThe name of the queue that this DrmaaBlastTool will use.
output_path_sThe folder where all of the Blast output and log files will be written to.
async_flagShould the DrmaaBlastTool run in asynchronous mode.

◆ DrmaaBlastTool() [2/2]

DrmaaBlastTool ( BlastServiceJob job_p,
const BlastServiceData data_p,
const json_t *  json_p 
)

Create a DrmaaBlastTool for a given ServiceJob using the configuration details from a serialised JSON fragment.

Parameters
job_pThe ServiceJob to associate with this DrmaaBlastTool.
data_pThe BlastServiceData for the Service that will run this DrmaaBlastTool.
json_pThe JSON fragment to fill in the serialised values such as factory, queue_name, etc. with.

◆ ~DrmaaBlastTool()

virtual ~DrmaaBlastTool ( )
virtual

The DrmaaBlastTool destructor.

Member Function Documentation

◆ GetFromJSON()

static DrmaaBlastTool* GetFromJSON ( const json_t *  json_p,
const char *  name_s,
const char *  program_name_s,
ServiceJob job_p,
BlastServiceData service_data_p 
)
static

Create a DrmaaBlastTool for a given ServiceJob using the configuration details from a serialised JSON fragment.

Parameters
json_pThe JSON fragment to fill in the serialised values such as factory, queue_name, etc. with.
name_sThe name to give to the DrmaaBlastTool.
program_name_sThe path of the BLAST program to run.
job_pThe ServiceJob to attach to the DrmaaBlastTool.
service_data_pThe BlastServiceData for the Service that will run this DrmaaBlastTool.
Returns
The newly-created DrmaaBlastTool or 0 upon error.

◆ SetDrmaaOptions()

void SetDrmaaOptions ( DrmaaTool drmaa_p,
bool  async_flag 
)

Set the Drmaa settings for this DrmaaBlastTool.

Parameters
drmaa_pThe DrmaaTool that will be used to rub the Blast job.
async_flagIf this is true then the call to run the Blast job will return immediately and can be polled for results as required. If this is false then the call to Run will not return until the Blast job has finished running.

◆ Run()

virtual OperationStatus Run ( )
virtual

Run this DrmaaBlastTool.

If this is set to run asynchronously, then the call to run the Blast job will return immediately and can be polled for results as required. If not, then this will not return until the Blast job has finished running.

Returns
The OperationStatus of this DrmaaBlastTool after it has started running.

Implements BlastTool.

◆ GetStatus()

virtual OperationStatus GetStatus ( bool  update_flag = true)
virtual

Get the status of a DrmaaBlastTool.

Returns
The OperationStatus of this DrmaaBlastTool.
Parameters
update_flagif this is true then the DrmaaBlastTool will check the status of its running jobs if necessary, if this is false it will return the last cached value.
See also
BlastTool::GetStatus

Reimplemented from BlastTool.

◆ SetCoresPerSearch()

void SetCoresPerSearch ( uint32  cores)

Set the number of cores that this DrmaaBlastTool that will try to use when it runs.

Parameters
coresThe number of cores.
See also
SetDrmaaToolCores

◆ SetEmailNotifications()

bool SetEmailNotifications ( const char **  email_addresses_ss)

This sets up notification emails for each Blast job via DRMAA.

Parameters
email_addresses_ssA NULL-terminated array of email addresses to send notification emails to
Returns
true if the notifications were set successfully, false otherwise.
See also
SetDrmaaToolEmailNotifications

◆ SetUpOutputFile()

virtual bool SetUpOutputFile ( )
virtual

Set the output file parameter.

Returns
true if the input filename was set successfully, false otherwise.

Reimplemented from ExternalBlastTool.

◆ GetArgsProcessor()

virtual ArgsProcessor* GetArgsProcessor ( )
protectedvirtual

Get the ArgsProcessor that this BlastTool will use to parse the input ParameterSet prior to running its job.

Returns
The ArgsProcessor for this BlastTool or 0 upon error.

Implements ExternalBlastTool.

◆ AddBlastArg()

virtual bool AddBlastArg ( const char *const  arg_s,
const bool  hyphen_flag 
)
protectedvirtual

Add the argument to the command line arguments that this DrmaaBlastTool will run with.

Parameters
arg_sThe argument to add.
hyphen_flagIf this is true then a hyphen will be prefixed the given value e.g. turning "foo" into "-foo" before being added, if this is false then the argument is added unaltered.
Returns
true if the argument was added successfully, false otherwise.

Reimplemented from ExternalBlastTool.

◆ AddToJSON()

virtual bool AddToJSON ( json_t *  root_p)
protectedvirtual

This method is used to serialise this DrmaaBlastTool so that it can be recreated from another calling process when required.

This is used to store the DrmaaBlastTool in the JobsManager.

Parameters
root_pThe json object to add the serialisation of this DrmaaBlastTool to.
Returns
true if the DrmaaBlastTool was serialised successfully, false otherwise.

Reimplemented from ExternalBlastTool.

Field Documentation

◆ dbt_args_processor_p

DrmaaToolArgsProcessor* dbt_args_processor_p
protected

The DrmaaToolArgsProcessor that this DrmaaBlastTool will use.

See also
GetArgsProcessor

The documentation for this class was generated from the following file: