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.
external_blast_tool.hpp
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2016 The Earlham Institute
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 
21 /*
22  * external_blast_tool.hpp
23  *
24  * Created on: 22 Apr 2015
25  * Author: tyrrells
26  */
27 
28 #ifndef EXTERNAL_BLAST_TOOL_HPP_
29 #define EXTERNAL_BLAST_TOOL_HPP_
30 
31 #include "blast_tool.hpp"
32 #include "byte_buffer.h"
33 #include "temp_file.hpp"
34 
35 
43 {
44 public:
49  static const char * const EBT_INPUT_SUFFIX_S;
50 
55 // static const char * const EBT_LOG_SUFFIX_S;
56 
62  static const char * const EBT_ASYNC_S;
63 
64 
75  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);
76 
77 
86  ExternalBlastTool (BlastServiceJob *job_p, const BlastServiceData *data_p, const json_t *json_p);
87 
88 
92  virtual ~ExternalBlastTool ();
93 
106  virtual bool ParseParameters (ParameterSet *param_set_p, BlastAppParameters *app_params_p);
107 
108 
116  virtual bool SetInputFilename (const char * const filename_s);
117 
118 
125  virtual bool SetUpOutputFile ();
126 
127 
137  virtual char *GetResults (BlastFormatter *formatter_p);
138 
139 
149  virtual char *GetLog ();
150 
151 
152 protected:
153 
159 
167 
173  char *ebt_blast_s;
174 
175 
183 
184 
193  virtual ArgsProcessor *GetArgsProcessor () = 0;
194 
195 
208  virtual bool AddBlastArg (const char * const arg_s, const bool hyphen_flag);
209 
210 
220  virtual bool AddBlastArgsPair (const char *key_s, const char *value_s);
221 
222 
223 
234  char *GetJobFilename (const char * const prefix_s, const char * const suffix_s);
235 
236 
247  virtual bool AddToJSON (json_t *root_p);
248 
249 
250 
251 private:
252  static const char * const EBT_COMMAND_LINE_EXECUTABLE_S;
253  static const char * const EBT_WORKING_DIR_S;
254  static const char * const EBT_RESULTS_FILE_S;
255 };
256 #endif /* EXTERNAL_BLAST_TOOL_HPP_ */
257 
BlastServiceJob
This datatype stores the ServiceJob and its associated BlastTool.
Definition: blast_service_job.h:66
ExternalBlastTool::ebt_results_filename_s
char * ebt_results_filename_s
The filename which the Blast results will be written to if the job runs successfully.
Definition: external_blast_tool.hpp:158
BlastAppParameters
This datatype is used to parse a given ParameterSet in a method suitable for a particular BLAST confi...
Definition: blast_app_parameters.h:47
ExternalBlastTool::ebt_blast_s
char * ebt_blast_s
The name of the blast command line executable to use.
Definition: external_blast_tool.hpp:173
BlastTool::AddToJSON
virtual bool AddToJSON(json_t *root_p)
This method is used to serialise this BlastTool so that it can be recreated from another calling proc...
BlastServiceData
The configuration data for the Blast Service.
Definition: blast_service.h:143
BlastTool::ParseParameters
virtual bool ParseParameters(ParameterSet *param_set_p, BlastAppParameters *app_params_p)=0
Parse a ParameterSet to configure a BlastTool prior to it being ran.
ExternalBlastTool::EBT_ASYNC_S
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.
Definition: external_blast_tool.hpp:62
BlastTool::GetLog
virtual char * GetLog()=0
Get the log after the BlastTool has finished running.
blast_tool.hpp
BLAST_SERVICE_LOCAL
#define BLAST_SERVICE_LOCAL
Definition: blast_service_api.h:48
BlastTool
The base class for running Blast.
Definition: blast_tool.hpp:43
ExternalBlastTool
A class that will run Blast using an external application such as blastn rather than calling Blast li...
Definition: external_blast_tool.hpp:42
BlastTool::GetResults
virtual char * GetResults(BlastFormatter *formatter_p)=0
Get the results after the ExternalBlastTool has finished running.
byte_buffer.h
ExternalBlastTool::ebt_async_flag
bool ebt_async_flag
If this is true, then the ExternalBlastTool will run asynchronously.
Definition: external_blast_tool.hpp:182
BlastTool::SetInputFilename
virtual bool SetInputFilename(const char *const filename_s)=0
Set the input filename for the BlastTool to use.
BlastTool::SetUpOutputFile
virtual bool SetUpOutputFile()=0
Set the output file parameter.
BlastFormatter
This class is for converting the output of a blast job between the available different formats.
Definition: blast_formatter.h:47
ExternalBlastTool::EBT_INPUT_SUFFIX_S
static const char *const EBT_INPUT_SUFFIX_S
This is the string that will get appended to each input file used by the ExternalBlastTool.
Definition: external_blast_tool.hpp:49
ParameterSet
A set of Parameters along with an optional name and description.
Definition: parameter_set.h:46
temp_file.hpp
ExternalBlastTool::ebt_working_directory_s
char * ebt_working_directory_s
The working directory where all of the input, output and log files will be created.
Definition: external_blast_tool.hpp:166
ArgsProcessor
An ArgsProcessor is a class to abstract out how a particular BlastTool stores a value when an argumen...
Definition: args_processor.hpp:46