44 #ifndef SKIP_DOXYGEN_PROCESSING
73 in.getline(line, 128);
74 int len =
in.gcount();
75 if (
len < 4 || line[0]!=
'I' || line[1]!=
'D' || line[2]!=
' ')
return retv;
78 in.getline(line, 100);
80 if (
len < 4 || line[0]!=
'P' || line[1]!=
'A' || line[2]!=
' ')
return retv;
81 while (line[
len-2] ==
' ')
len -= 1;
82 if (line[
len-2] ==
'>') line[
len-2] =
'-';
83 else if (line[
len-2] ==
'.')
len -= 1;
106 static const string kDb(
"db");
116 arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
117 "Application to find pattern in BLAST databases or subject sequences, version "
120 arg_desc->AddDefaultKey(
kPattern,
"input_file",
121 "File containing the patterns to be searched",
124 arg_desc->AddOptionalKey(
kDb,
"database_name",
125 "Name of BLAST database to be searched",
128 arg_desc->AddOptionalKey(
kSubject,
"input_file",
129 "File containing the subject sequences in FASTA format",
132 arg_desc->AddDefaultKey(
kOutput,
"output_file",
133 "Output file to include results of the search",
184 "Either a BLAST database or subject sequence(s) must be specified");
191 if (
pattern.pattern ==
"")
break;
197 const CSeq_id *sid = (*it)->GetId();
202 f_output << endl << '>
';
203 ITERATE(CBioseq_Handle::TId, id, ids) {
204 string idst((*id).AsString());
205 int index = idst.find_last_not_of('|
');
206 f_output << string(idst, 0, index + 1) << "|" ;
209 f_output << sequence::CDeflineGenerator().GenerateDefline(bhl) << endl << endl;
210 f_output << "ID " << pattern.name << endl;;
211 f_output << "PA " << pattern.pattern << endl;
216 ITERATE(CPacked_seqint_Base::Tdata, range, (*it)->GetPacked_int().Get()) {
217 static const ESeqLocExtremes ex = eExtreme_Positional;
218 f_output << " (" << (*range)->GetStart(ex)+1 << " "
219 << (*range)->GetStop(ex)+1 << ")";
222 CSeqVector sv = bhl.GetSeqVector(CBioseq_Handle::eCoding_Iupac);
224 CSeq_loc::TRange tot_range = (*it)->GetTotalRange();
225 sv.GetSeqData(tot_range.GetFrom(), tot_range.GetTo()+1, sq);
226 f_output << "SQ " << sq << endl;
229 db_adapter->ResetBlastSeqSrcIteration();
236 #ifndef SKIP_DOXYGEN_PROCESSING
237 int main(int argc, const char* argv[] /*, const char* envp[]*/)
239 return CSeedTopApp().AppMain(argc, argv);
241 #endif /* SKIP_DOXYGEN_PROCESSING */
string RegisterOMDataLoader(CRef< CSeqDB > db_handle)
Register the BLAST database data loader using the already initialized CSeqDB object.
Utility functions for BLAST command line applications.
#define BLAST_EXIT_SUCCESS
Command line binary exit code: success.
@ eBlastp
Protein-Protein.
Main argument class for BLASTP application.
Keeps track of the version of the BLAST engine in the NCBI C++ toolkit.
Interface to create a BlastSeqSrc suitable for use in CORE BLAST from a a variety of BLAST database/s...
virtual void Init()
@inheritDoc
virtual int Run()
@inheritDoc
void Print(const CCompactSAMApplication::AlignInfo &ai)
TSeedTopResults Run(CRef< CLocalDbAdapter > db)
CRef< CSeqDB > GetSeqDb() const
Obtain a reference to the database.
static CBlastOptionsHandle * Create(EProgram program, EAPILocality locality=CBlastOptions::eLocal)
Creates an options handle object configured with default options for the requested program,...
vector< CConstRef< CSeq_loc > > TSeedTopResults
@ eBlastDbIsProtein
protein
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.
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.
bool Exist(const string &name) const
Check existence of argument description.
@ eExcludes
One argument excludes another.
@ eInputFile
Name of file (must exist and be readable)
@ eString
An arbitrary string.
@ eOutputFile
Name of file (must be writable)
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.
@ eDiag_Warning
Warning message.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string AsFastaString(void) const
void AddDataLoader(const string &loader_name, TPriority pri=kPriority_Default)
Add data loader by name.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
vector< CSeq_id_Handle > TId
const TId & GetId(void) const
void Reset(void)
Reset reference object.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
const string version
version string
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
std::istream & in(std::istream &in_, double &x_)
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
Declares the CSeedTop class.
static struct SSeedTopPattern s_ReadPattern(CNcbiIstream &in)
static const string kOutput("out")
static const string kSubject("subject")
static const string kPattern("pattern")
static const string kDb("db")
Configuration structure for the CBlastScopeSource.
void OptimizeForWholeLargeSequenceRetrieval(bool value=true)
Configures the BLAST database data loader to optimize the retrieval of *entire* large sequences.