NCBI C++ ToolKit
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members

Search Toolkit Book for CRemoteBlast

API for Remote Blast Requests. More...

#include <algo/blast/api/remote_blast.hpp>

+ Inheritance diagram for CRemoteBlast:
+ Collaboration diagram for CRemoteBlast:

Public Types

enum  ESearchStatus { eStatus_Unknown , eStatus_Done , eStatus_Pending , eStatus_Failed }
 Represents the status of previously submitted search/RID. More...
 
enum  EDebugMode { eDebug = 0 , eSilent }
 Debugging support can be turned on with eDebug or off with eSilent. More...
 
typedef list< CRef< objects::CSeq_loc > > TSeqLocList
 Typedef for a list of Seq-locs. More...
 
typedef list< CRef< objects::CBlast4_ka_block > > TKarlinAltschulBlocks
 Convenience typedef for a list of CRef<CBlast4_ka_block> More...
 
typedef vector< CRef< objects::CSeq_interval > > TSeqIntervalVector
 Defines a std::vector of CRef<CSeq_interval> More...
 
typedef vector< CRef< objects::CSeq_data > > TSeqDataVector
 Defines a std::vector of CRef<CSeq_data> More...
 
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
 
typedef Uint8 TCount
 Alias for value type of counter. More...
 

Public Member Functions

 CRemoteBlast (const string &RID)
 Use the specified RID to get results for an existing search. More...
 
 CRemoteBlast (CNcbiIstream &f)
 Uses the file to populate results. More...
 
 CRemoteBlast (CBlastOptionsHandle *any_opts)
 Create a search using any kind of options handle. More...
 
 CRemoteBlast (CRef< IQueryFactory > queries, CRef< CBlastOptionsHandle > opts_handle, const CSearchDatabase &db)
 Create a sequence search and set options, queries, and database. More...
 
 CRemoteBlast (CRef< IQueryFactory > queries, CRef< CBlastOptionsHandle > opts_handle, CRef< IQueryFactory > subjects)
 Create a search and set options, queries, and subject sequences. More...
 
 CRemoteBlast (CRef< objects::CPssmWithParameters > pssm, CRef< CBlastOptionsHandle > opts_handle, const CSearchDatabase &db)
 Create a PSSM search and set options, queries, and database. More...
 
 ~CRemoteBlast ()
 Destruct the search object. More...
 
void SetGIList (const list< TGi > &gi_list)
 This restricts the subject database to this list of GIs (this is not supported yet on the server end). More...
 
void SetNegativeGIList (const list< TGi > &gi_list)
 This excludes the provided GIs from the subject database (this is not supported yet on the server end). More...
 
void SetDbFilteringAlgorithmId (int algo_id, ESubjectMaskingType mask_type=eSoftSubjMasking)
 Sets the filtering algorithm ID to be applied to the BLAST database (not supported by server yet) More...
 
void SetDbFilteringAlgorithmKey (string algo_key, ESubjectMaskingType mask_type=eSoftSubjMasking)
 Sets the filtering algorithm key to be applied to the BLAST database (not supported by server yet) More...
 
ESubjectMaskingType GetSubjectMaskingType () const
 
void SetDatabase (const string &x)
 Set the name of the database to search against. More...
 
void SetSubjectSequences (CRef< IQueryFactory > subj)
 Set a list of subject sequences to search against. More...
 
void SetSubjectSequences (const list< CRef< objects::CBioseq > > &subj)
 Set a list of subject sequences to search against. More...
 
void SetEntrezQuery (const char *x)
 Restrict search to sequences matching this Entrez query. More...
 
void SetQueries (CRef< objects::CBioseq_set > bioseqs)
 Set the query as a Bioseq_set. More...
 
void SetQueries (CRef< objects::CBioseq_set > bioseqs, const TSeqLocInfoVector &masking_locations)
 Set the query as a Bioseq_set along with the corresponding masking locations. More...
 
void SetQueryMasks (const TSeqLocInfoVector &masking_locations)
 Set the masking locations for queries. More...
 
void SetQueries (TSeqLocList &seqlocs)
 Set the query as a list of Seq_locs. More...
 
void SetQueries (TSeqLocList &seqlocs, const TSeqLocInfoVector &masking_locations)
 Set the query as a list of Seq_locs. More...
 
void SetQueries (CRef< objects::CPssmWithParameters > pssm)
 Set a PSSM query (as for PSI blast), which must include a bioseq set. More...
 
CRef< CSearchResultSetGetResultSet ()
 Submit the search (if necessary) and return the results. More...
 
bool SubmitSync (void)
 This submits the search (if necessary) and polls for results. More...
 
bool SubmitSync (int timeout)
 This submits the search (if necessary) and polls for results. More...
 
bool Submit (void)
 This submits the search (if necessary) and returns immediately. More...
 
ESearchStatus CheckStatus ()
 Returns the status of a previously submitted search/RID. More...
 
bool CheckDone (void)
 Check whether the search has completed. More...
 
string GetErrors (void)
 This returns a string containing any errors that were produced by the search. More...
 
string GetWarnings (void)
 This returns any warnings encountered. More...
 
const vector< string > & GetWarningVector ()
 This returns any warnings encountered as a vector of strings. More...
 
const vector< string > & GetErrorVector ()
 This returns any errors encountered as a vector of strings. More...
 
const stringGetRID (void)
 Gets the request id (RID) associated with the search. More...
 
CRef< objects::CSeq_align_set > GetAlignments (void)
 Get the seqalign set from the results. More...
 
TSeqAlignVector GetSeqAlignSets ()
 Get the seqalign vector from the results. More...
 
CRef< objects::CBlast4_phi_alignments > GetPhiAlignments (void)
 Get the results of a PHI-Align request, if PHI pattern was set. More...
 
TKarlinAltschulBlocks GetKABlocks (void)
 Get the Karlin/Altschul parameter blocks produced by the search. More...
 
TSeqLocInfoVector GetMasks (void)
 Get the queries' masked locations. More...
 
list< stringGetSearchStats (void)
 Get the search statistics block as a list of strings. More...
 
CRef< objects::CPssmWithParameters > GetPSSM (void)
 Get the PSSM produced by the search. More...
 
void SetVerbose (EDebugMode verb=eDebug)
 Adjust the debugging level. More...
 
bool IsDbSearch ()
 Return values states whether GetDatabases or GetSubjectSequences call should be used. More...
 
CRef< objects::CBlast4_database > GetDatabases ()
 Get the database used by the search. More...
 
list< CRef< objects::CBioseq > > GetSubjectSequences ()
 Returns subject sequences if "bl2seq" mode used. More...
 
CBlast4_subject::TSeq_loc_list GetSubjectSeqLocs ()
 
string GetProgram ()
 Get the program used for this search. More...
 
string GetService ()
 Get the service used for this search. More...
 
string GetCreatedBy ()
 Get the created-by string associated with this search. More...
 
CRef< objects::CBlast4_queries > GetQueries ()
 Get the queries used for this search. More...
 
CRef< CBlastOptionsHandleGetSearchOptions ()
 Get the search options used for this search. More...
 
CRef< objects::CBlast4_request > GetSearchStrategy ()
 Fetch the search strategy for this object without submitting the search. More...
 
Int4 GetDbFilteringAlgorithmId () const
 Returns the filtering algorithm ID used in the database. More...
 
string GetDbFilteringAlgorithmKey () const
 Returns the filtering algorithm key used in the database. More...
 
string GetTask () const
 Returns the task used to create the remote search (if any) More...
 
string GetClientId () const
 Retrieves the client ID used by this object to send requests. More...
 
void SetClientId (const string &client_id)
 Sets the client ID used by this object to send requests. More...
 
bool LoadFromArchive ()
 Loads next chunk of archive from file. More...
 
string GetTitle (void)
 Get the title assigned for this search. More...
 
void EnableDiskCacheUse ()
 Controls disk cache usage for results retrieval. More...
 
void DisableDiskCacheUse ()
 
bool IsDiskCacheActive (void)
 
bool IsDiskCacheError (void)
 disk cache error handling More...
 
void ClearDiskCacheError (void)
 
string GetDiskCacheErrorMessahe (void)
 
CRef< objects::CBlast4_reply > x_GetSearchStatsOnly (void)
 
CRef< objects::CBlast4_reply > x_GetSearchResultsHTTP (void)
 
unsigned int GetPsiNumberOfIterations (void)
 
bool IsErrMsgArchive (void)
 
set< TTaxId > & GetTaxidList ()
 
set< TTaxId > & GetNegativeTaxidList ()
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 

Static Public Member Functions

static objects::CBlast4_get_search_results_reply::TMasks ConvertToRemoteMasks (const TSeqLocInfoVector &masking_locations, EBlastProgramType program, vector< string > *warnings=NULL)
 Convert a TSeqLocInfoVector to a list< CRef<CBlast4_mask> > objects. More...
 
- Static Public Member Functions inherited from CObject
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 

Private Types

enum  EState { eStart = 0 , eFailed , eWait , eDone }
 Various states the search can be in. More...
 
enum  EImmediacy { ePollAsync = 0 , ePollImmed }
 Indicates whether to use async mode. More...
 
enum  ENeedConfig {
  eNoConfig = 0x0 , eProgram = 0x1 , eService = 0x2 , eQueries = 0x4 ,
  eSubject = 0x8 , eNeedAll = 0xF
}
 This class attempts to verify whether all necessary configuration is complete before attempting to submit the search. More...
 
typedef list< CRef< objects::CBlast4_parameter > > TValueList
 Value list. More...
 
typedef objects::CBlast4_get_search_results_reply TGSRR
 An alias for the most commonly used part of the Blast4 search results. More...
 

Private Member Functions

bool x_HasRetrievedSubjects () const
 
CRef< objects::CBlast4_request_body > x_GetBlast4SearchRequestBody ()
 Retrieve the request body for a search submission. More...
 
void x_SetDatabase (const string &x)
 Sets a subset (only m_Dbs) of what the public SetDatabase sets. More...
 
void x_SetSubjectSequences (const list< CRef< objects::CBioseq > > &subj)
 Set a list of subject sequences to search against (only m_SubjectSequences) More...
 
TGSRR::TMasks x_GetMasks (void)
 Get the query masks from the results. More...
 
int x_DefaultTimeout (void)
 The default timeout is 3.5 hours. More...
 
void x_Init (CNcbiIstream &f)
 Uses the file to populate results. More...
 
void x_Init (CBlastOptionsHandle *algo_opts, const string &program, const string &service)
 Called by new search constructors: initialize a new search. More...
 
void x_Init (CBlastOptionsHandle *algo_opts)
 Called by new search constructors: initialize a new search. More...
 
void x_Init (const string &RID)
 Called by RID constructor: set up monitoring of existing search. More...
 
void x_Init (CRef< CBlastOptionsHandle > opts_handle, const CSearchDatabase &db)
 Initialize a search with a database and options handle. More...
 
void x_InitQueries (CRef< IQueryFactory > queries)
 Initialize queries based on a query factory. More...
 
void x_InitDiskCache (void)
 Initialize disk caching. More...
 
void x_SetAlgoOpts (void)
 Configure new search from options handle passed to constructor. More...
 
void x_SetOneParam (objects::CBlast4Field &field, const int *value)
 Set an integer parameter (not used yet). More...
 
void x_SetOneParam (objects::CBlast4Field &field, const list< int > *value)
 Set a list of integers. More...
 
void x_SetOneParam (objects::CBlast4Field &field, const list< Int8 > *value)
 Set a list of 8 byte integers. More...
 
void x_SetOneParam (objects::CBlast4Field &field, const char **value)
 Set a string parameter. More...
 
void x_SetOneParam (objects::CBlast4Field &field, CRef< objects::CBlast4_mask > mask)
 Set a masking location for query. More...
 
EState x_GetState (void)
 Determine what state the search is in. More...
 
bool x_IsUnknownRID (void)
 Determine if this is an unknown RID. More...
 
TGSRRx_GetGSRR (void)
 Poll until done, return the CBlast4_get_search_results_reply. More...
 
CRef< objects::CBlast4_reply > x_SendRequest (CRef< objects::CBlast4_request_body > body)
 Send a Blast4 request and get a reply. More...
 
CRef< objects::CBlast4_reply > x_GetSearchResults (void)
 Try to get the search results. More...
 
void x_CheckConfig (void)
 Verify that search object contains mandatory fields. More...
 
void x_SubmitSearch (void)
 Submit the search and process results (of submit action). More...
 
void x_CheckResults (void)
 Try to get and process results. More...
 
void x_CheckResultsDC (void)
 Try to get and process results using disk cache. More...
 
void x_SearchErrors (CRef< objects::CBlast4_reply > reply)
 Iterate over error list, splitting into errors and warnings. More...
 
void x_PollUntilDone (EImmediacy poll_immed, int seconds)
 Poll until results are found, error occurs, or timeout expires. More...
 
void x_GetRequestInfo ()
 Fetch the request info (wait for completion if necessary). More...
 
void x_GetRequestInfoFromRID ()
 Fetch the requested info from splitd. More...
 
void x_GetRequestInfoFromFile ()
 Fetch the requested info from an archive file. More...
 
void x_ExtractQueryIds (CSearchResultSet::TQueryIdVector &query_ids)
 Extract the query IDs from the CBlast4_queries for a given search. More...
 
void x_SetMaskingLocationsForQueries (const TSeqLocInfoVector &masking_locations)
 Set the masking locations AFTER the queries have been set in the m_QSR field. More...
 
void x_ExtractUserSpecifiedMasks (CRef< IQueryFactory > query_factory, TSeqLocInfoVector &masks)
 Extract the user specified masking locations from the query factory. More...
 
void x_QueryMaskingLocationsToNetwork ()
 Converts the provided query masking locations (if any) to the network representation following the BLAST 4 ASN.1 spec. More...
 
void x_ProcessOneOption (CBlastOptionsHandle &opts, const string &nm, const objects::CBlast4_value &v, struct SInteractingOptions &io)
 Add an algorithm or program option to the provided handle. More...
 
void x_ProcessOptions (CBlastOptionsHandle &opts, const TValueList &L, struct SInteractingOptions &io)
 Add algorithm and program options to the provided handle. More...
 
EProgram x_AdjustProgram (const TValueList &L, const string &pstr, EProgram program)
 Adjust the EProgram based on option values. More...
 
void x_GetSubjects (void)
 
string x_GetStringFromSearchInfoReply (CRef< CBlast4_reply > reply, const string &name, const string &value)
 
unsigned int x_GetPsiIterationsFromServer (void)
 
 CRemoteBlast (const CRemoteBlast &)
 Prohibit copy construction. More...
 
CRemoteBlastoperator= (const CRemoteBlast &)
 Prohibit assignment. More...
 

Private Attributes

CRef< blast::CBlastOptionsHandle > m_CBOH
 Options for new search. More...
 
CRef< objects::CBlast4_queue_search_request > m_QSR
 Request object for new search. More...
 
CRef< objects::CBlast4_reply > m_Reply
 Results of BLAST search. More...
 
CRef< objects::CBlast4_archive > m_Archive
 Archive of BLAST search and results. More...
 
bool m_ReadFile
 true if a CBlast4_archive should be read in. More...
 
unique_ptr< CObjectIStreamm_ObjectStream
 Use to ready CBlast4_archive. More...
 
CFormatGuess::EFormat m_ObjectType
 Type of object CBlast4_archive as determined by CFormatGuess. More...
 
vector< stringm_Errs
 List of errors encountered. More...
 
vector< stringm_Warn
 List of warnings encountered. More...
 
string m_RID
 Request ID of submitted or pre-existing search. More...
 
int m_ErrIgn
 Count of server glitches (communication errors) to ignore. More...
 
bool m_Pending
 Pending state: indicates that search still needs to be queued. More...
 
EDebugMode m_Verbose
 Verbosity mode: whether to produce debugging info on stdout. More...
 
ENeedConfig m_NeedConfig
 Bitfield to track whether all necessary configuration is done. More...
 
CRef< objects::CBlast4_database > m_Dbs
 Databases. More...
 
list< CRef< objects::CBioseq > > m_SubjectSequences
 Subject Sequences. More...
 
CBlast4_subject::TSeq_loc_list m_SubjectSeqLocs
 This field is populated when dealing with a remote bl2seq search (e.g. More...
 
string m_Program
 Program value used when submitting this search. More...
 
string m_Service
 Service value used when submitting this search. More...
 
string m_CreatedBy
 Created-by attribution for this search. More...
 
CRef< objects::CBlast4_queries > m_Queries
 Queries associated with this search. More...
 
CRef< objects::CBlast4_parameters > m_AlgoOpts
 Options relevant to the search algorithm. More...
 
CRef< objects::CBlast4_parameters > m_ProgramOpts
 Options relevant to the search application. More...
 
CRef< objects::CBlast4_parameters > m_FormatOpts
 Options relevant to the format application. More...
 
TSeqLocInfoVector m_QueryMaskingLocations
 Masking locations for queries. More...
 
string m_EntrezQuery
 Entrez Query, if any. More...
 
string m_FirstDbSeq
 First database sequence. More...
 
string m_FinalDbSeq
 Final database sequence. More...
 
list< TGim_GiList
 GI list. More...
 
list< TGim_NegativeGiList
 Negative GI list. More...
 
int m_DbFilteringAlgorithmId
 filtering algorithm to use in the database More...
 
string m_DbFilteringAlgorithmKey
 filtering algorithm key to use in the database More...
 
ESubjectMaskingType m_SubjectMaskingType
 
string m_Task
 Task used when the search was submitted (recovered via CBlastOptionsBuilder) More...
 
string m_ClientId
 Client ID submitting requests throw this interface. More...
 
bool m_use_disk_cache
 Use disk cache for retrieving results default: false. More...
 
bool m_disk_cache_error_flag
 disk cache error flag More...
 
string m_disk_cache_error_msg
 disk cache error message More...
 
set< TTaxIdm_TaxidList
 
set< TTaxIdm_NegativeTaxidList
 

Additional Inherited Members

- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Detailed Description

API for Remote Blast Requests.

API Class to facilitate submission of Remote Blast requests. Provides an interface to build a Remote Blast request given an object of a subclass of CBlastOptionsHandle.

Definition at line 93 of file remote_blast.hpp.


The documentation for this class was generated from the following files:
Modified on Wed Apr 24 14:13:37 2024 by modify_doxy.py rev. 669887