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.
ThreadedBlastTool Class Reference

A class that will run Blast within a pthread. More...

#include <threaded_blast_tool.hpp>

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

Public Member Functions

 ThreadedBlastTool (BlastServiceJob *service_job_p, const char *name_s, const char *factory_s, const BlastServiceData *data_p, const char *blast_program_name_s)
 Create a new ThreadedBlastTool. More...
 
virtual ~ThreadedBlastTool ()
 The ThreadedBlastTool destructor. More...
 
virtual OperationStatus Run ()
 Run this ThreadedBlastTool. More...
 
virtual char * GetResults (BlastFormatter *formatter_p)
 Get the results after the ThreadedBlastTool has finished running. More...
 
virtual OperationStatus GetStatus (bool update_flag=true)
 Get the status of a ThreadedBlastTool. More...
 
- Public Member Functions inherited from SystemBlastTool
 SystemBlastTool (BlastServiceJob *service_job_p, const char *name_s, const char *factory_s, const BlastServiceData *data_p, const char *blast_program_name_s)
 Create a SystemBlastTool for a given ServiceJob. More...
 
 SystemBlastTool (BlastServiceJob *job_p, const BlastServiceData *data_p, const json_t *json_p)
 Create a SystemBlastTool for a given ServiceJob using the configuration details from a serialised JSON fragment. More...
 
virtual ~SystemBlastTool ()
 The SystemBlastTool destructor. More...
 
virtual bool ParseParameters (ParameterSet *params_p, BlastAppParameters *app_params_p)
 Parse a ParameterSet to configure a BlastTool prior to it being ran. 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 SetInputFilename (const char *const filename_s)
 Set the input filename for the BlastTool to use. More...
 
virtual bool SetUpOutputFile ()
 Set the output file parameter. 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...
 

Protected Attributes

pthread_t * tbt_thread_p
 The pthread to run this BlastTool in. More...
 
pthread_mutex_t * tbt_mutex_p
 The mutex to use to moderate access to the pthread. More...
 
int tbt_thread_id
 The id of the pthread to run this BlastTool in. More...
 
- Protected Attributes inherited from SystemBlastTool
ByteBufferArgsProcessorsbt_args_processor_p
 
- 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...
 
- Protected Member Functions inherited from SystemBlastTool
virtual ArgsProcessorGetArgsProcessor ()
 Get the ArgsProcessor that this BlastTool will use to parse the input ParameterSet prior to running its job. More...
 
bool Init (const char *prog_s)
 Initialise the SystemBlastTool prior to it being run. More...
 
bool SaveCommandLine (const char *command_line_s)
 
- Protected Member Functions inherited from ExternalBlastTool
virtual bool AddBlastArg (const char *const arg_s, const bool hyphen_flag)
 Add the argument to the command line arguments that this BlastTool will run with. More...
 
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...
 
virtual bool AddToJSON (json_t *root_p)
 This method is used to serialise this ExternalBlastTool so that it can be recreated from another calling process when required. More...
 

Detailed Description

A class that will run Blast within a pthread.

Constructor & Destructor Documentation

◆ ThreadedBlastTool()

ThreadedBlastTool ( BlastServiceJob service_job_p,
const char *  name_s,
const char *  factory_s,
const BlastServiceData data_p,
const char *  blast_program_name_s 
)

Create a new ThreadedBlastTool.

Parameters
service_job_pThe ServiceJob to associate with this ExternalBlastTool.
name_sThe name to give to this ExternalBlastTool.
factory_sThe name of the BlastToolFactory that is creating this ExternalBlastTool.
data_pThe BlastServiceData for the Service that will run this ExternalBlastTool.
blast_program_name_sThe name of blast command line executable that this ExternalBlastTool will call to run its blast job.

◆ ~ThreadedBlastTool()

virtual ~ThreadedBlastTool ( )
virtual

The ThreadedBlastTool destructor.

Member Function Documentation

◆ Run()

virtual OperationStatus Run ( )
virtual

Run this ThreadedBlastTool.

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

Reimplemented from SystemBlastTool.

◆ GetResults()

virtual char* GetResults ( BlastFormatter formatter_p)
virtual

Get the results after the ThreadedBlastTool has finished running.

Parameters
formatter_pThe BlastFormatter to convert the results into a different format. If this is 0, then the results will be returned without any conversion.
Returns
The results as a c-style string or 0 upon error.

Reimplemented from ExternalBlastTool.

◆ GetStatus()

virtual OperationStatus GetStatus ( bool  update_flag = true)
virtual

Get the status of a ThreadedBlastTool.

Parameters
update_flagif this is true then the ThreadedBlastTool will check the status of its running jobs if necessary, if this is false it will return the last cached value.
Returns
The OperationStatus of this ThreadedBlastTool.

Reimplemented from SystemBlastTool.

Field Documentation

◆ tbt_thread_p

pthread_t* tbt_thread_p
protected

The pthread to run this BlastTool in.

◆ tbt_mutex_p

pthread_mutex_t* tbt_mutex_p
protected

The mutex to use to moderate access to the pthread.

◆ tbt_thread_id

int tbt_thread_id
protected

The id of the pthread to run this BlastTool in.


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