51 #ifndef SKIP_DOXYGEN_PROCESSING
108 const size_t kNumIterations);
157 if (
query->GetQuerySeqLoc(0)->GetId()) {
200 const size_t kNumIterations)
202 bool converged =
false;
215 _TRACE(
"Run_token=" << run_token);
230 else if (run_token == 2)
241 psiblast.
Reset(
new CPsiBlast(query_factory, db_adapter, psi_opts));
255 results = lcl_blast.
Run();
262 results = psiblast->
Run();
273 else if (!pssm.
Empty())
337 _TRACE(
"PSI-BLAST running " << kNumIterations <<
" iterations");
361 else if (!pssm.
Empty())
378 opts_hndl, formatter, kNumIterations);
424 const bool recovered_from_search_strategy =
431 if(recovered_from_search_strategy) {
469 _TRACE(
"PSI-BLAST running with FASTA input");
471 _TRACE(
"PSI-BLAST running with PSSM input");
478 if(!isArchiveFormat) {
582 #ifndef SKIP_DOXYGEN_PROCESSING
583 int main(
int argc,
const char* argv[] )
User-defined methods of the data storage class.
CRef< blast::CRemoteBlast > InitializeRemoteBlast(CRef< blast::IQueryFactory > queries, CRef< blast::CBlastDatabaseArgs > db_args, CRef< blast::CBlastOptionsHandle > opts_hndl, bool verbose_output, const string &client_id, CRef< objects::CPssmWithParameters > pssm)
Initializes a CRemoteBlast instance for usage by command line BLAST binaries.
blast::SDataLoaderConfig InitializeQueryDataLoaderConfiguration(bool query_is_protein, CRef< blast::CLocalDbAdapter > db_adapter)
Initialize the data loader configuration for the query.
void SaveSearchStrategy(const CArgs &args, blast::CBlastAppArgs *cmdline_args, CRef< blast::IQueryFactory > queries, CRef< blast::CBlastOptionsHandle > opts_hndl, CRef< objects::CPssmWithParameters > pssm, unsigned int num_iters)
Save the search strategy corresponding to the current command line search.
void QueryBatchCleanup()
Clean up formatter scope and release.
CRef< CBlastAncillaryData > ExtractPssmAncillaryData(const CPssmWithParameters &pssm)
Auxiliary function to extract the ancillary data from the PSSM.
bool RecoverSearchStrategy(const CArgs &args, blast::CBlastAppArgs *cmdline_args)
Recover search strategy from input file.
void PrintErrorArchive(const CArgs &a, const list< CRef< CBlast4_error > > &msg)
Function to print blast archive with only error messages (search failed) to output stream.
void InitializeSubject(CRef< blast::CBlastDatabaseArgs > db_args, CRef< blast::CBlastOptionsHandle > opts_hndl, bool is_remote_search, CRef< blast::CLocalDbAdapter > &db_adapter, CRef< objects::CScope > &scope)
Initializes the subject/database as well as its scope.
string GetCmdlineArgs(const CNcbiArguments &a)
void BlastFormatter_PreFetchSequenceData(const blast::CSearchResultSet &results, CRef< CScope > scope, blast::CFormattingArgs::EOutputFormat format_type)
This method optimize the retrieval of sequence data to scope.
bool UseXInclude(const CFormattingArgs &f, const string &s)
bool IsIStreamEmpty(CNcbiIstream &in)
void LogQueryInfo(CBlastUsageReport &report, const CBlastInput &q_info)
Utility functions for BLAST command line applications.
#define CATCH_ALL(exit_code)
Standard catch statement for all BLAST command line programs.
#define BLAST_EXIT_SUCCESS
Command line binary exit code: success.
@ eAaLookupTable
standard protein (blastp) lookup table
Declares class to encapsulate all BLAST options.
Declares the CBlastOptionsHandle and CBlastOptionsFactory classes.
PSIDiagnosticsRequest * PSIDiagnosticsRequestNewEx(Boolean save_ascii_pssm)
Allocates a PSIDiagnosticsRequest structure, setting fields to their default values for their use in ...
const CSeq_id * GetFirstId() const
CRef< CBlastOptionsHandle > SetOptionsForSavedStrategy(const CArgs &args)
Combine the command line arguments into a CBlastOptions object recovered from saved search strategy.
virtual CNcbiIstream & GetInputStream()
Get the input stream.
size_t GetNumThreads() const
Get the number of threads to spawn.
CRef< CBlastOptionsHandle > SetOptions(const CArgs &args)
Extract the command line arguments into a CBlastOptionsHandle object.
CRef< CBlastDatabaseArgs > GetBlastDatabaseArgs() const
Get the BLAST database arguments.
CArgDescriptions * SetCommandLine()
Set the command line arguments.
bool ExecuteRemotely() const
Determine whether the search should be executed remotely or not.
bool ProduceDebugRemoteOutput() const
Return whether debug (verbose) output should be produced on remote searches (only available when comp...
CRef< CQueryOptionsArgs > GetQueryOptionsArgs() const
Get the options for the query sequence(s)
string GetClientId() const
Retrieve the client ID for remote requests.
CRef< CFormattingArgs > GetFormattingArgs() const
Get the formatting options.
bool ProduceDebugOutput() const
Return whether debug (verbose) output should be produced on remote searches (only available when comp...
virtual CNcbiOstream & GetOutputStream()
Get the output stream.
Class to capture message from diag handler.
Encapsulates ALL the BLAST algorithm's options.
void AddParam(EUsageParams p, int val)
Keeps track of the version of the BLAST engine in the NCBI C++ toolkit.
void DebugDumpText(ostream &out, const string &bundle, unsigned int depth) const
Class to perform a BLAST search on local BLAST databases Note that PHI-BLAST can be run using this cl...
NCBI C++ Object Manager dependant implementation of IQueryFactory.
Handle to the protein PHI BLAST options.
Handle to the protein-protein options to the BLAST algorithm.
Wrapper class for PSIDiagnosticsRequest .
Handle command line arguments for psiblast binary Programs supported: psiblast, phi-blastn,...
CNcbiOstream * GetCheckpointStream()
Retrieve the stream to write the checkpoint file.
bool GetSaveLastPssm() const
Should the PSSM after the last database search be saved.
size_t GetNumberOfIterations() const
Get the number of iterations to perform.
CRef< objects::CPssmWithParameters > GetInputPssm() const
Get the PSSM specified as input from the command line.
bool SaveAsciiPssm() const
Should a PSSM be saved as ASCII in a file?
CNcbiOstream * GetAsciiPssmStream()
Retrieve the stream to write the ASCII PSSM.
bool SaveCheckpoint() const
Should a PSSM be saved in a checkpoint file?
CRef< CPsiBlastAppArgs > m_CmdLineArgs
This application's command line args.
void SavePssmToFile(CRef< CPssmWithParameters > pssm, const CPsiBlastIterationState *itr=NULL)
Save the PSSM to a check point file and/or as an ASCII PSSM.
CBlastAppDiagHandler m_bah
virtual int Run()
@inheritDoc
CConstRef< CBlastAncillaryData > m_AncillaryData
Ancillary results for the previously executed PSI-BLAST iteration.
virtual void Init()
@inheritDoc
CPsiBlastApp()
@inheritDoc
bool DoIterations(CRef< CBlastOptionsHandle > opts_hndl, CRef< CBlastQueryVector > query, CRef< CPssmWithParameters > pssm, CRef< CBlastDatabaseArgs > db_args, CRef< CLocalDbAdapter > db_adapter, CRef< CScope > scope, CBlastFormat &formatter)
Performs iterations for either multiple queries or input PSSM.
CRef< CPssmWithParameters > ComputePssmForNextIteration(const CBioseq &bioseq, CConstRef< CSeq_align_set > sset, CConstRef< CPSIBlastOptionsHandle > opts_handle, CRef< CScope > scope, CRef< CBlastAncillaryData > ancillary_data)
Auxiliary function to create the PSSM for the next iteration.
CBlastUsageReport m_UsageReport
bool x_RunLocalPsiBlastIterations(CRef< CBlastQueryVector > query, CRef< CPssmWithParameters > pssm, CRef< CScope > scope, CRef< CLocalDbAdapter > db_adapter, CRef< CBlastOptionsHandle > opts_hndl, CBlastFormat &formatter, const size_t kNumIterations)
Represents the iteration state in PSI-BLAST.
Runs a single iteration of the PSI-BLAST algorithm on a BLAST database.
const CSeq_entry & GetQuery() const
Retrieve the query sequence.
CSeq_entry & SetQuery()
Retrieve the query sequence.
bool HasQuery() const
Has this PSSM a query in it?
objects::ENa_strand GetStrand() const
Get strand to search in query sequence(s)
bool GetParseDeflines() const
Should the defline be parsed?
bool QueryIsProtein() const
Is the query sequence protein?
TSeqRange GetRange() const
Get query sequence range restriction.
bool UseLowercaseMasks() const
Use lowercase masking in FASTA input?
Search Results for All Queries.
Search Results for One Query.
const string kArgOutput
Output file name.
const string kArgPHIPatternFile
Argument to specify a PHI-BLAST pattern file.
void Print(const CCompactSAMApplication::AlignInfo &ai)
ECompoAdjustModes
An collection of constants that specify all permissible modes of composition adjustment.
void SetPHIPattern(const char *pattern, bool is_dna)
CRef< CSearchResultSet > Run()
Run the PSI-BLAST engine for one iteration.
CRef< objects::CPssmWithParameters > GetPSSM(void)
Get the PSSM produced by the search.
int GetDbGeneticCode() const
void SetCompositionBasedStats(ECompoAdjustModes mode)
virtual void SetNumberOfThreads(size_t nthreads)
Mutator for the number of threads.
void ResetMessages(void)
Reset messgae buffer, erase all saved message.
const char * GetPHIPattern() const
unsigned int GetIterationNumber() const
Return the number of the current iteration.
CConstRef< objects::CSeq_align_set > GetSeqAlign() const
Accessor for the Seq-align results.
TSeqIds GetPreviouslyFoundSeqIds() const
Retrieve the set of Seq-id's found in the previous iteration.
CRef< CSearchResultSet > Run()
Executes the search.
CBlastOptions & SetOptions()
Returns a reference to the internal options class which this object is a handle for.
CRef< CBlastAncillaryData > GetAncillaryData() const
Accessor for the query's search ancillary.
int GetFilteringAlgorithm()
Retrieve the database filtering algorithm.
void SetPssm(CConstRef< objects::CPssmWithParameters > pssm)
This method allows the same object to be reused when performing multiple iterations.
bool HasConverged()
Determines if the PSI-BLAST search has converged (i.e.
EProgram GetProgram() const
Accessors/Mutators for individual options.
const CBlastOptions & GetOptions() const
Return the object which this object is a handle for.
int GetQueryGeneticCode() const
CRef< objects::CPssmWithParameters > PsiBlastComputePssmFromAlignment(const objects::CBioseq &query, CConstRef< objects::CSeq_align_set > alignment, CRef< objects::CScope > database_scope, const CPSIBlastOptionsHandle &opts_handle, CConstRef< CBlastAncillaryData > ancillary_data, PSIDiagnosticsRequest *diagnostics_req=0)
Computes a PSSM from the result of a PSI-BLAST iteration.
string EProgramToTaskName(EProgram p)
Convert a EProgram enumeration value to a task name (as those used in the BLAST command line binaries...
bool GetSumStatisticsMode() const
Sum statistics options.
ECompoAdjustModes GetCompositionBasedStats() const
CRef< CSearchResultSet > GetResultSet()
Submit the search (if necessary) and return the results.
void DoNotSaveMessages(void)
Call to turn off saving diag message, discard all saved message.
void Advance(const TSeqIds &list)
Advance the iterator by passing it the list of Seq-ids which passed the inclusion criteria for the cu...
static void GetSeqIds(CConstRef< objects::CSeq_align_set > seqalign, CConstRef< CPSIBlastOptionsHandle > opts, TSeqIds &retval)
Extract the sequence ids from the sequence alignment which identify those sequences that will be used...
const char * GetMatrixName() const
list< CRef< objects::CBlast4_error > > & GetMessages(void)
Return list of saved diag messages.
void SetLookupTableType(ELookupTableType type)
bool HasAlignments() const
Return true if there are any alignments for this query.
void SetFullVersion(CRef< CVersionAPI > version)
Set version data for the program.
void HideStdArgs(THideStdArgs hide_mask)
Set the hide mask for the Hide Std Flags.
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
CVersionInfo GetVersion(void) const
Get the program version information.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
@ fHideXmlHelp
Hide XML help description.
@ fHideLogfile
Hide log file description.
@ fHideFullVersion
Hide full version description.
@ fHideDryRun
Hide dryrun description.
@ fHideConffile
Hide configuration file description.
void Remove(const string &name)
Remove argument of name "name".
void SetDiagPostPrefix(const char *prefix)
Specify a string to prefix all subsequent error postings with.
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void SetDiagHandler(CDiagHandler *handler, bool can_delete=true)
Set the diagnostic handler using the specified diagnostic handler class.
@ eDiag_Warning
Warning message.
void Warning(CExceptionArgs_Base &args)
#define MSerial_AsnText
I/O stream manipulators –.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CSeq_entry_Handle AddTopLevelSeqEntry(CSeq_entry &top_entry, TPriority pri=kPriority_Default, EExist action=eExist_Default)
Add seq_entry, default priority is higher than for defaults or loaders Add object to the score with p...
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
TBioseqCore GetBioseqCore(void) const
Get bioseq core structure.
bool Empty(void) const THROWS_NONE
Check if CConstRef is empty – not pointing to any object which means having a null value.
void Reset(void)
Reset reference object.
void Reset(void)
Reset reference object.
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
bool IsEnabled(void)
Indicates whether application usage statistics collection is enabled for a current reporter instance.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
void Start(void)
Start the timer.
const TSeq & GetSeq(void) const
Get the variant data.
bool IsSeq(void) const
Check if variant Seq is selected.
TSeq & SetSeq(void)
Select the variant.
Main class to perform a BLAST search on the local machine.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
Declares CPsiBlast, the C++ API for the PSI-BLAST engine.
static CConstRef< CBioseq > s_GetQueryBioseq(CConstRef< CBlastQueryVector > query, CRef< CScope > scope, CRef< CPssmWithParameters > pssm)
Extract the bioseq which represents the query from either a PSSM or a CBlastQueryVector.
int main(int argc, const char *argv[])
static CRef< IQueryFactory > s_MakeQueryFactory(CRef< CPssmWithParameters > pssm, CRef< CBlastQueryVector > query)
Main argument class for PSI-BLAST application.
Defines class which represents the iteration state in PSI-BLAST.
Declares the CRemoteBlast class.
Implementation of the BlastSeqSrc interface using the C++ BLAST databases API.
Configuration structure for the CBlastScopeSource.