NCBI C++ ToolKit
deltablast_app.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: deltablast_app.cpp 73968 2016-08-03 14:09:45Z fongah2 $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Greg Boratyn
27  *
28  */
29 
30 /** @file deltablast_app.cpp
31  * DELTA-BLAST command line application
32  */
33 
34 #include <ncbi_pch.hpp>
35 #include <corelib/ncbistl.hpp>
36 #include <corelib/ncbiapp.hpp>
38 #include <algo/blast/api/psiblast.hpp> // needed for psiblast iterations
46 #include <objects/scoremat/Pssm.hpp> // needed for printing Pssm
47 #include <objects/scoremat/PssmIntermediateData.hpp> // needed for clearing
48  // information content in ascii Pssm
49 #include <objects/seq/Seq_descr.hpp> // needed for adding qurey title to Pssm
50 #include "blast_app_util.hpp"
51 
52 #ifndef SKIP_DOXYGEN_PROCESSING
56 #endif
57 
59 {
60 public:
61  /** @inheritDoc */
64  version->SetVersionInfo(new CBlastVersion());
65  SetFullVersion(version);
66  }
67 private:
68  /** @inheritDoc */
69  virtual void Init();
70  /** @inheritDoc */
71  virtual int Run();
72 
73 
74  /// Save Pssm to file
76 
77  /// Do PSI-BLAST iterations follwing DELTA-BLAST
80  CConstRef<CBioseq> query_bioseq,
83  const CArgs& args,
84  CRef<CLocalDbAdapter> db_adapter,
85  CRef<CScope> scope,
86  CBlastFormat& formatter);
87 
88  /// Compute PSSM for next PSI-BLAST iteration
90  const CBioseq& bioseq,
93  CRef<CScope> scope,
94  CRef<CBlastAncillaryData> ancillary_data);
95 
96 
97  /// This application's command line args
99 
101 
103 };
104 
106 {
107  // formulate command line arguments
108 
110 
111  // read the command line
112 
114  | fHideDryRun);
116 }
117 
118 void
120 {
121  if (pssm.Empty()) {
122  return;
123  }
124 
125  if (m_CmdLineArgs->SaveCheckpoint()) {
127  }
128 
129  if (m_CmdLineArgs->SaveAsciiPssm()) {
130  if (m_AncillaryData.Empty() && pssm.NotEmpty()) {
132  }
133 
137  }
138 }
139 
140 
141 // Add query sequence title from scope to computed Pssm
143  CRef<CBlastQueryVector> query_batch,
144  CRef<CScope> scope)
145 {
146  CConstRef<CSeq_id> query_id =
147  query_batch->GetBlastSearchQuery(0)->GetQueryId();
148 
149  CBioseq_Handle bhandle = scope->GetBioseqHandle(*query_id);
150  CConstRef<CBioseq> scope_bioseq = bhandle.GetCompleteBioseq();
151 
152  if (scope_bioseq->IsSetDescr()) {
153 
154  CBioseq& pssm_bioseq = pssm->SetQuery().SetSeq();
155  ITERATE (CSeq_descr::Tdata, it, scope_bioseq->GetDescr().Get()) {
156  pssm_bioseq.SetDescr().Set().push_back(*it);
157  }
158  }
159 }
160 
161 // Add sequence data to pssm query
163  CRef<CBlastQueryVector> query_batch,
164  CRef<CScope> scope)
165 {
166  CConstRef<CSeq_id> query_id =
167  query_batch->GetBlastSearchQuery(0)->GetQueryId();
168 
169  // first make sure that query id and pssm query id are the same
170  if (!pssm->GetPssm().GetQuery().GetSeq().GetFirstId()->Match(*query_id)) {
171  NCBI_THROW(CException, eInvalid, "Query and PSSM sequence ids do not "
172  "match");
173  }
174 
175  CBioseq_Handle bhandle = scope->GetBioseqHandle(*query_id);
176  CConstRef<CBioseq> scope_bioseq = bhandle.GetCompleteBioseq();
177 
178  // set sequence data only if query bioseq has them and pssm does not
179  if (scope_bioseq->GetInst().IsSetSeq_data()
180  && !pssm->GetPssm().GetQuery().GetSeq().GetInst().IsSetSeq_data()) {
181  const CSeq_data& seq_data = scope_bioseq->GetInst().GetSeq_data();
182  pssm->SetQuery().SetSeq().SetInst().SetSeq_data(
183  const_cast<CSeq_data&>(seq_data));
184  }
185 }
186 
188 {
189  int status = BLAST_EXIT_SUCCESS;
190 
191  try {
192 
193  // Allow the fasta reader to complain on invalid sequence input
195  SetDiagPostPrefix("deltablast");
196  SetDiagHandler(&m_bah, false);
197 
198  /*** Get the BLAST options ***/
199  const CArgs& args = GetArgs();
202  const CBlastOptions& opt = opts_hndl->GetOptions();
203 
204  /*** Initialize the database/subject ***/
206  CRef<CLocalDbAdapter> db_adapter;
207  CRef<CScope> scope;
208  InitializeSubject(db_args, opts_hndl, m_CmdLineArgs->ExecuteRemotely(),
209  db_adapter, scope);
210  _ASSERT(db_adapter && scope);
211 
212  /*** Get the query sequence(s) ***/
213  CRef<CQueryOptionsArgs> query_opts =
215  SDataLoaderConfig dlconfig =
217  db_adapter);
218  CBlastInputSourceConfig iconfig(dlconfig, query_opts->GetStrand(),
219  query_opts->UseLowercaseMasks(),
220  query_opts->GetParseDeflines(),
221  query_opts->GetRange());
223  ERR_POST(Warning << "Query is Empty!");
224  return BLAST_EXIT_SUCCESS;
225  }
227  size_t query_batch_size = m_CmdLineArgs->GetQueryBatchSize();
230 
231  query_batch_size = 1;
232  }
233  CBlastInput input(&fasta, query_batch_size);
234 
235  /*** Initialize the domain database ***/
236  CRef<CLocalDbAdapter> domain_db_adapter(new CLocalDbAdapter(
238  _ASSERT(domain_db_adapter);
239  CLocalDbAdapter* domain_db_ptr = NULL;
240 
241  // domain database does not need to be loaded into scope unless
242  // domain search results are requested
244  CRef<CSeqDB> seqdb(new CSeqDB(domain_db_adapter->GetDatabaseName(),
246  scope->AddDataLoader(RegisterOMDataLoader(seqdb),
248 
249  domain_db_ptr = domain_db_adapter.GetNonNullPointer();
250  }
251 
252  /*** Get the formatting options ***/
254  CBlastFormat formatter(opt, *db_adapter,
255  fmt_args->GetFormattedOutputChoice(),
256  query_opts->GetParseDeflines(),
258  fmt_args->GetNumDescriptions(),
259  fmt_args->GetNumAlignments(),
260  *scope,
261  opt.GetMatrixName(),
262  fmt_args->ShowGis(),
263  fmt_args->DisplayHtmlOutput(),
264  opt.GetQueryGeneticCode(),
265  opt.GetDbGeneticCode(),
266  opt.GetSumStatisticsMode(),
268  db_adapter->GetFilteringAlgorithm(),
269  fmt_args->GetCustomOutputFormatSpec(),
270  false, false, NULL,
271  domain_db_ptr,
273 
274  formatter.SetQueryRange(query_opts->GetRange());
275  formatter.SetLineLength(fmt_args->GetLineLength());
276  if(UseXInclude(*fmt_args, args[kArgOutput].AsString())) {
277  formatter.SetBaseFile(args[kArgOutput].AsString());
278  }
279  formatter.PrintProlog();
280 
281  /*** Process the input ***/
282  for (; !input.End(); formatter.ResetScopeHistory()) {
283 
284  CRef<CBlastQueryVector> query_batch(input.GetNextSeqBatch(*scope));
286  new CObjMgr_QueryFactory(*query_batch));
287 
288  SaveSearchStrategy(args, m_CmdLineArgs, queries, opts_hndl);
289 
291  CRef<blast::CSearchResultSet> domain_results;
292 
293  CRef<CDeltaBlast> deltablast;
295 
297 
298  // Remote BLAST
299 
300  CRef<CRemoteBlast> rmt_blast =
301  InitializeRemoteBlast(queries, db_args, opts_hndl,
304  results = rmt_blast->GetResultSet();
305  pssm = rmt_blast->GetPSSM();
306  } else {
307 
308  // Run locally
309 
311  dynamic_cast<CDeltaBlastOptionsHandle*>(&*opts_hndl));
312 
313  deltablast.Reset(new CDeltaBlast(queries, db_adapter,
314  domain_db_adapter,
315  delta_opts));
317  results = deltablast->Run();
318  domain_results = deltablast->GetDomainResults();
319  pssm = deltablast->GetPssm();
320  }
321 
322  // deltablast computed pssm does not have query title, so
323  // it must be added if pssm is requested
325  || fmt_args->GetFormattedOutputChoice()
327 
328  s_AddSeqTitleToPssm(pssm, query_batch, scope);
329  }
330 
331  // remote blast remves sequence data from pssm for known ids
332  // the data must be added if pssm is requested after remote search
335  || m_CmdLineArgs->SaveAsciiPssm())) {
336 
337  s_AddSeqDataToPssm(pssm, query_batch, scope);
338  }
339 
340  // only one PSI-BLAST iteration requested, then print results
341  // (the first PIS-BLAST iteration is done by DELTA-BLAST)
343 
344  SavePssmToFile(pssm);
345 
346  blast::CSearchResultSet::const_iterator domain_it;
348  domain_it = domain_results->begin();
349  }
350 
351  if (fmt_args->ArchiveFormatRequested(args)) {
352  formatter.WriteArchive(*queries, *opts_hndl, *results, 0, m_bah.GetMessages());
354  } else {
355  BlastFormatter_PreFetchSequenceData(*results, scope,
356  fmt_args->GetFormattedOutputChoice());
358  BlastFormatter_PreFetchSequenceData(*domain_results, scope,
359  fmt_args->GetFormattedOutputChoice());
360  }
361  ITERATE(blast::CSearchResultSet, result, *results) {
363  _ASSERT(domain_it != domain_results->end());
364  formatter.PrintOneResultSet(**domain_it,
365  query_batch,
367  blast::CPsiBlastIterationState::TSeqIds(),
368  true);
369  ++domain_it;
370  }
371  formatter.PrintOneResultSet(**result, query_batch);
372  }
373  }
374 
376  CConstRef<CBioseq> query_bioseq(&pssm->GetQuery().GetSeq());
377  blast::CSearchResults& res = (*results)[0];
378 
380  dynamic_cast<CPSIBlastOptionsHandle*>(&*opts_hndl));
381 
382  pssm = ComputePssmForNextPsiBlastIteration(*query_bioseq,
383  res.GetSeqAlign(),
384  psi_opts,
385  scope,
386  res.GetAncillaryData());
387 
388  SavePssmToFile(pssm);
389  }
390  }
391  else {
392 
393  // if more than 1 iterations are requested, then
394  // do PSI-BLAST iterations, this is not allowed for remote blast
395 
396  SavePssmToFile(pssm);
397 
398  // print domain search results if requested
399  // query_batch_size == 1 if number of iteratins > 1
401  ITERATE (blast::CSearchResultSet, result,
402  *deltablast->GetDomainResults()) {
403 
404  formatter.PrintOneResultSet(**result, query_batch,
406  blast::CPsiBlastIterationState::TSeqIds(),
407  true);
408  }
409  }
410 
411  // use pssm variable here, because it will contains query title
412  CConstRef<CBioseq> query_bioseq(&pssm->GetQuery().GetSeq());
413 
414  bool retval = DoPsiBlastIterations(opts_hndl,
415  query_batch,
416  query_bioseq,
417  results,
418  db_args,
419  args,
420  db_adapter,
421  scope,
422  formatter);
423 
424  if (retval && !fmt_args->HasStructuredOutputFormat()
425  && fmt_args->GetFormattedOutputChoice()
427 
429  << "Search has CONVERGED!"
430  << NcbiEndl;
431  }
432  // Reset for next query sequence.
434  }
435  }
436 
437  formatter.PrintEpilog(opt);
438 
440  opts_hndl->GetOptions().DebugDumpText(NcbiCerr, "BLAST options", 1);
441  }
442 
443  } CATCH_ALL(status)
444  if(!m_bah.GetMessages().empty()) {
445  const CArgs & a = GetArgs();
447  }
448  return status;
449 }
450 
451 // This is a simplified version of CPsiBlastApp::DoIterations()
452 bool
455  CConstRef<CBioseq> query_bioseq,
457  CRef<CBlastDatabaseArgs> db_args,
458  const CArgs& args,
459  CRef<CLocalDbAdapter> db_adapter,
460  CRef<CScope> scope,
461  CBlastFormat& formatter)
462 {
463  bool converged = false;
464 
465  const size_t kNumIterations = m_CmdLineArgs->GetNumberOfPsiBlastIterations();
466 
467 
468  CPsiBlastIterationState itr(kNumIterations);
470 
471 
472  psi_opts.Reset(dynamic_cast<CPSIBlastOptionsHandle*>(&*opts_hndl));
473  CRef<CPsiBlast> psiblast;
474 
475  CRef<IQueryFactory> query_factory(new CObjMgr_QueryFactory(*query));
476 
477  BlastFormatter_PreFetchSequenceData(*results, scope,
481  formatter.WriteArchive(*query_factory, *opts_hndl, *results,
484  }
485  else {
486  ITERATE(blast::CSearchResultSet, result, *results) {
487  formatter.PrintOneResultSet(**result, query,
488  itr.GetIterationNumber(),
490  }
491  }
492  // FIXME: what if there are no results!?!
493 
494  blast::CSearchResults& results_1st_query = (*results)[0];
495  if ( !results_1st_query.HasAlignments() ) {
496  return false;
497  }
498 
499  CConstRef<CSeq_align_set> aln(results_1st_query.GetSeqAlign());
501  CPsiBlastIterationState::GetSeqIds(aln, psi_opts, ids);
502 
503  itr.Advance(ids);
504 
505  while (itr) {
506 
508  pssm = ComputePssmForNextPsiBlastIteration(*query_bioseq, aln,
509  psi_opts,
510  scope,
511  (*results)[0].GetAncillaryData());
512 
513  if (psiblast.Empty()) {
514  psiblast.Reset(new CPsiBlast(pssm, db_adapter, psi_opts));
515  }
516  else {
517  psiblast->SetPssm(pssm);
518  }
519 
520  SavePssmToFile(pssm);
521 
523  results = psiblast->Run();
524 
525  BlastFormatter_PreFetchSequenceData(*results, scope,
529  formatter.WriteArchive(*pssm, *opts_hndl, *results,
530  itr.GetIterationNumber());
531  }
532  else {
533  ITERATE(blast::CSearchResultSet, result, *results) {
534  formatter.PrintOneResultSet(**result, query,
535  itr.GetIterationNumber(),
537  }
538  }
539  // FIXME: what if there are no results!?!
540 
541  blast::CSearchResults& results_1st_query = (*results)[0];
542  if ( !results_1st_query.HasAlignments() ) {
543  break;
544  }
545 
546  aln.Reset(results_1st_query.GetSeqAlign());
548  CPsiBlastIterationState::GetSeqIds(aln, psi_opts, new_ids);
549 
550  itr.Advance(new_ids);
551  }
552  if (itr.HasConverged()) {
553  converged = true;
554  }
555 
558  pssm = ComputePssmForNextPsiBlastIteration(*query_bioseq, aln,
559  psi_opts,
560  scope,
561  results_1st_query.GetAncillaryData());
562 
563  SavePssmToFile(pssm);
564  }
565 
566  return converged;
567 }
568 
573  CRef<CScope> scope,
574  CRef<CBlastAncillaryData> ancillary_data)
575 {
578 
579  m_AncillaryData = ancillary_data;
580  return PsiBlastComputePssmFromAlignment(bioseq, sset, scope, *opts_handle,
581  m_AncillaryData, diags);
582 }
583 
584 
585 #ifndef SKIP_DOXYGEN_PROCESSING
586 int main(int argc, const char* argv[] /*, const char* envp[]*/)
587 {
588  return CDeltaBlastApp().AppMain(argc, argv);
589 }
590 #endif /* SKIP_DOXYGEN_PROCESSING */
591 
592 
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
CBioseq_Handle –.
TObjectType * GetNonNullPointer(void)
Get pointer value and throw a null pointer exception if pointer is null.
Definition: ncbiobj.hpp:940
const Tdata & Get(void) const
Get the member data.
Definition: Seq_descr_.hpp:167
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
Definition: Seq_inst_.hpp:802
void AddDataLoader(const string &loader_name, TPriority pri=kPriority_Default)
Add data loader by name.
Definition: scope.cpp:467
#define NcbiCerr
Definition: ncbistre.hpp:399
CConstRef –.
Definition: ncbiobj.hpp:1192
virtual int GetQueryBatchSize(void) const
Get query batch size.
CConstRef< objects::CPssmWithParameters > GetPssm(int index=0) const
Accessor for PSSM computd from CDD hits and used in protein search.
Definition: deltablast.cpp:177
static void s_AddSeqTitleToPssm(CRef< CPssmWithParameters > pssm, CRef< CBlastQueryVector > query_batch, CRef< CScope > scope)
TSeqRange GetRange() const
Get query sequence range restriction.
Definition: blast_args.hpp:762
const string version
version string
Definition: variables.hpp:66
#define MSerial_AsnText
I/O stream manipulators –.
Definition: serialbase.hpp:641
bool Match(const CSeq_id &sid2) const
Match() - TRUE if SeqIds are equivalent.
Definition: Seq_id.hpp:779
bool NotEmpty(void) const THROWS_NONE
Check if CConstRef is not empty – pointing to an object and has a non-null value.
Definition: ncbiobj.hpp:1296
This class formats the BLAST results for command line applications.
Class that centralizes the configuration data for sequences to be converted.
Definition: blast_input.hpp:48
PSIDiagnosticsRequest * PSIDiagnosticsRequestNewEx(Boolean save_ascii_pssm)
Allocates a PSIDiagnosticsRequest structure, setting fields to their default values for their use in ...
Definition: blast_psi.c:591
objects::ENa_strand GetStrand() const
Get strand to search in query sequence(s)
Definition: blast_args.hpp:766
void ResetMessages(void)
Reset messgae buffer, erase all saved message.
Class representing a text file containing sequences in fasta format.
CRef< CBlastQueryVector > GetNextSeqBatch(CScope &scope)
Read and convert the next batch of sequences.
CNcbiOstream * GetCheckpointStream(void)
Get stream for saving Pssm.
bool ProduceDebugOutput() const
Return whether debug (verbose) output should be produced on remote searches (only available when comp...
void SetFullVersion(CRef< CVersion > version)
Set version data for the program.
Definition: ncbiapp.cpp:905
CRef< CSearchResultSet > Run()
Run the DELTA-BLAST engine with one iteration.
Definition: deltablast.cpp:83
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
Definition: ncbiapp.cpp:926
TSeqIds GetPreviouslyFoundSeqIds() const
Retrieve the set of Seq-id's found in the previous iteration.
const string kArgOutput
Output file name.
Hide log file description.
Definition: ncbiapp.hpp:402
Utility functions for BLAST command line applications.
void Warning(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1008
#define CATCH_ALL(exit_code)
Standard catch statement for all BLAST command line programs.
The NCBI C++/STL use hints.
bool GetShowDomainHits(void) const
Was printing domain hits requested.
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
Definition: ncbidiag.cpp:5450
bool UseXInclude(const CFormattingArgs &f, const string &s)
Declares the CRemoteBlast class.
Hide XML help description.
Definition: ncbiapp.hpp:409
#define NcbiEndl
Definition: ncbistre.hpp:403
CRef< CBlastAncillaryData > m_AncillaryData
bool End()
Determine if we have reached the end of the BLAST input.
Generalized converter from an abstract source of biological sequence data to collections of blast inp...
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.
Hide configuration file description.
Definition: ncbiapp.hpp:403
CRef< CSearchResultSet > Run()
Run the PSI-BLAST engine for one iteration.
Definition: psiblast.cpp:95
Wrapper class for PSIDiagnosticsRequest .
Definition: blast_aux.hpp:321
Warning message.
Definition: ncbidiag.hpp:646
bool ProduceDebugRemoteOutput() const
Return whether debug (verbose) output should be produced on remote searches (only available when comp...
bool RecoverSearchStrategy(const CArgs &args, blast::CBlastAppArgs *cmdline_args)
Recover search strategy from input file.
#define NULL
Definition: ncbistd.hpp:225
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.
Definition: ncbiapp.cpp:611
static const unsigned char res[3][32]
Definition: ccm.c:389
size_t GetNumThreads() const
Get the number of threads to spawn.
bool SaveCheckpoint(void) const
Was saving Pssm requested.
Interface for reading SRA sequences into blast input.
User-defined methods of the data storage class.
unsigned int GetIterationNumber() const
Return the number of the current iteration.
Keeps track of the version of the BLAST engine in the NCBI C++ toolkit.
Definition: version.hpp:53
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:776
bool ExecuteRemotely() const
Determine whether the search should be executed remotely or not.
CVersion –.
Definition: version.hpp:247
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
int main(int argc, const char *argv[])
static void PrintAsciiPssm(const objects::CPssmWithParameters &pssm, CConstRef< blast::CBlastAncillaryData > ancillary_data, CNcbiOstream &out)
Prints the PSSM in ASCII format (as in blastpgp's -Q option)
CArgDescriptions * SetCommandLine()
Set the command line arguments.
User-defined methods of the data storage class.
blast::SDataLoaderConfig InitializeQueryDataLoaderConfiguration(bool query_is_protein, CRef< blast::CLocalDbAdapter > db_adapter)
Initialize the data loader configuration for the query.
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...
EOutputFormat GetFormattedOutputChoice() const
Get the choice of formatted output.
virtual void Init()
USING_SCOPE(objects)
const TQuery & GetQuery(void) const
Get the Query member data.
Definition: Pssm_.hpp:757
const TSeq & GetSeq(void) const
Get the variant data.
Definition: Seq_entry_.cpp:102
const TPssm & GetPssm(void) const
Get the Pssm member data.
static void s_AddSeqDataToPssm(CRef< CPssmWithParameters > pssm, CRef< CBlastQueryVector > query_batch, CRef< CScope > scope)
static string query
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
Definition: ncbidiag.hpp:185
string GetClientId() const
Retrieve the client ID for remote requests.
NCBI C++ Object Manager dependant implementation of IQueryFactory.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
Definition: ncbiobj.hpp:702
CRef< CBlastDatabaseArgs > GetBlastDatabaseArgs() const
Get the BLAST database arguments.
bool GetSaveLastPssm(void) const
Should PSSM after last database search be saved.
list< CRef< CBlast4_error > > & GetMessages(void)
Return list of saved diag messages.
void SetDescr(TDescr &value)
Assign a value to Descr data member.
Definition: Bioseq_.cpp:65
CRef< CFormattingArgs > GetFormattingArgs() const
Get the formatting options.
A simple realization of the DELTA-BLAST algorithm: seacrch domain database, compute PSSM...
Definition: deltablast.hpp:59
list< CRef< CSeqdesc > > Tdata
Definition: Seq_descr_.hpp:91
CRef< CBlastSearchQuery > GetBlastSearchQuery(size_type i) const
Get the CBlastSearchQuery object at index i.
Definition: sseqloc.hpp:367
Runs a single iteration of the PSI-BLAST algorithm on a BLAST database.
Definition: psiblast.hpp:78
string GetCmdlineArgs(const CNcbiArguments &a)
void SetDiagHandler(CDiagHandler *handler, bool can_delete=true)
Set the diagnostic handler using the specified diagnostic handler class.
Definition: ncbidiag.cpp:5597
Definition of classes which constitute the results of running a BLAST search.
CRef< CPssmWithParameters > ComputePssmForNextPsiBlastIteration(const CBioseq &bioseq, CConstRef< CSeq_align_set > sset, CConstRef< CPSIBlastOptionsHandle > opts_handle, CRef< CScope > scope, CRef< CBlastAncillaryData > ancillary_data)
Compute PSSM for next PSI-BLAST iteration.
void WriteArchive(blast::IQueryFactory &queries, blast::CBlastOptionsHandle &options_handle, const blast::CSearchResultSet &results, unsigned int num_iters=0, const list< CRef< objects::CBlast4_error > > &msg=list< CRef< objects::CBlast4_error > >())
Writes out the query and results as an "archive" format.
bool Empty(void) const THROWS_NONE
Check if CConstRef is empty – not pointing to any object which means having a null value...
Definition: ncbiobj.hpp:1289
void HideStdArgs(THideStdArgs hide_mask)
Set the hide mask for the Hide Std Flags.
Definition: ncbiapp.cpp:1061
Interface to create a BlastSeqSrc suitable for use in CORE BLAST from a a variety of BLAST database/s...
bool DoPsiBlastIterations(CRef< CBlastOptionsHandle > opts_hndl, CRef< CBlastQueryVector > query, CConstRef< CBioseq > query_bioseq, CRef< blast::CSearchResultSet > results, CRef< CBlastDatabaseArgs > db_args, const CArgs &args, CRef< CLocalDbAdapter > db_adapter, CRef< CScope > scope, CBlastFormat &formatter)
Do PSI-BLAST iterations follwing DELTA-BLAST.
BLAST archive format.
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
Definition: ncbiapp.cpp:190
void SavePssmToFile(CConstRef< CPssmWithParameters > pssm)
Save Pssm to file.
CNcbiOstream & GetOutputStream() const
Get the output stream.
bool HasConverged()
Determines if the PSI-BLAST search has converged (i.e.
T max(T x_, T y_)
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.
CNcbiOstream * GetAsciiPssmStream(void)
Get stream for saving ascii Pssm.
void SetInst(TInst &value)
Assign a value to Inst data member.
Definition: Bioseq_.cpp:86
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1084
size_t GetNumberOfPsiBlastIterations(void) const
Get number of PSI-BLAST iterations.
#define BLAST_EXIT_SUCCESS
Command line binary exit code: success.
string GetDatabaseName() const
Returns the database name if appropriate, else kEmptyStr for subject sequences.
void SetPssm(CConstRef< objects::CPssmWithParameters > pssm)
This method allows the same object to be reused when performing multiple iterations.
Definition: psiblast.cpp:83
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.
USING_NCBI_SCOPE
CException –.
Definition: ncbiexpt.hpp:709
CRef< CBlastOptionsHandle > SetOptions(const CArgs &args)
Extract the command line arguments into a CBlastOptionsHandle object.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
Definition: ncbiapp.hpp:681
void SetDiagPostPrefix(const char *prefix)
Specify a string to prefix all subsequent error postings with.
Definition: ncbidiag.cpp:5418
CNcbiIstream & GetInputStream() const
Get the input stream.
const CSeq_id * GetFirstId() const
Definition: Bioseq.cpp:271
void Advance(const TSeqIds &list)
Advance the iterator by passing it the list of Seq-ids which passed the inclusion criteria for the cu...
CArgs –.
Definition: ncbiargs.hpp:356
TSeq & SetSeq(void)
Select the variant.
Definition: Seq_entry_.cpp:108
CRef< objects::CPssmWithParameters > GetPSSM(void)
Get the PSSM produced by the search.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
string RegisterOMDataLoader(CRef< CSeqDB > db_handle)
Register the BLAST database data loader using the already initialized CSeqDB object.
CRef< CQueryOptionsArgs > GetQueryOptionsArgs() const
Get the options for the query sequence(s)
CRef< CSearchResultSet > GetResultSet()
Submit the search (if necessary) and return the results.
Hide full version description.
Definition: ncbiapp.hpp:405
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
static const int kSubjectsDataLoaderPriority
The default priority for subjects, should be used for subjects/databases.
Definition: blast_args.hpp:851
Handle command line arguments for deltablast binary.
Encapsulates ALL the BLAST algorithm's options.
void SetVersionInfo(int ver_major, int ver_minor, int patch_level=0, const string &ver_name=kEmptyStr)
Set version information.
Definition: version.cpp:580
else result
Definition: token2.c:20
virtual void SetNumberOfThreads(size_t nthreads)
Mutator for the number of threads.
CNcbiApplication –.
Definition: ncbiapp.hpp:120
Declares CPsiBlast, the C++ API for the PSI-BLAST engine.
CRef< CDeltaBlastAppArgs > m_CmdLineArgs
This application's command line args.
#define _ASSERT
bool IsIStreamEmpty(CNcbiIstream &in)
Configuration structure for the CBlastScopeSource.
void SetQueryRange(const TSeqRange &query_range)
Set query range.
CSeq_entry & SetQuery()
Retrieve the query sequence.
Declares CPsiBlast, the C++ API for the PSI-BLAST engine.
virtual int Run()
const TInst & GetInst(void) const
Get the Inst member data.
Definition: Bioseq_.hpp:326
CRef< CSearchDatabase > GetDomainDatabase(void)
Get conserved domain database.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string...
Definition: ncbiexpt.hpp:546
Main argument class for DELTA-BLAST application.
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...
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.
Definition: psiblast.cpp:102
const CSeq_entry & GetQuery() const
Retrieve the query sequence.
CRef< CBlastAncillaryData > ExtractPssmAncillaryData(const CPssmWithParameters &pssm)
Auxiliary function to extract the ancillary data from the PSSM.
bool IsSetDescr(void) const
descriptors Check if a value has been assigned to Descr data member.
Definition: Bioseq_.hpp:293
bool UseLowercaseMasks() const
Use lowercase masking in FASTA input?
Definition: blast_args.hpp:768
void PrintOneResultSet(const blast::CSearchResults &results, CConstRef< blast::CBlastQueryVector > queries, unsigned int itr_num=numeric_limits< unsigned int >::max(), blast::CPsiBlastIterationState::TSeqIds prev_seqids=blast::CPsiBlastIterationState::TSeqIds(), bool is_deltablast_domain_result=false)
Print all alignment information for a single query sequence along with any errors or warnings (errors...
Hide dryrun description.
Definition: ncbiapp.hpp:406
CConstRef< CBioseq > GetCompleteBioseq(void) const
Get the complete bioseq.
CBlastAppDiagHandler m_bah
bool QueryIsProtein() const
Is the query sequence protein?
Definition: blast_args.hpp:773
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 IsSetSeq_data(void) const
the sequence Check if a value has been assigned to Seq_data data member.
Definition: Seq_inst_.hpp:790
Class to capture message from diag handler.
bool SaveAsciiPssm(void) const
Was saving ascii Pssm requested.
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:756
CRef< CSearchResultSet > GetDomainResults()
Get results of conserved domain search (intermediate results)
Definition: deltablast.hpp:112
Represents the iteration state in PSI-BLAST.
CSeqDB.
Definition: seqdb.hpp:159
bool GetParseDeflines() const
Should the defline be parsed?
Definition: blast_args.hpp:770
const TDescr & GetDescr(void) const
Get the Descr member data.
Definition: Bioseq_.hpp:305
static int input()
Modified on Mon May 29 16:59:06 2017 by modify_doxy.py rev. 533848