60 #if defined(NCBI_OS_UNIX)
87 const list< CRef<objects::CBlast4_error> > & errors = reply->GetErrors();
89 TErrorList::const_iterator
i;
91 for(
i = errors.begin();
i != errors.end();
i++) {
102 const list< CRef<CBlast4_error> > & errors = reply->GetErrors();
104 TErrorList::const_iterator
i;
106 for(
i = errors.begin();
i != errors.end();
i++) {
109 if ((*i)->CanGetMessage() && (! (*i)->GetMessage().empty())) {
111 msg += (*i)->GetMessage();
114 switch((*i)->GetCode()) {
121 m_Warn.push_back(
string(
"conversion_warning") +
msg);
126 m_Errs.push_back(
string(
"internal_error") +
msg);
130 m_Errs.push_back(
string(
"not_implemented") +
msg);
134 m_Errs.push_back(
string(
"not_allowed") +
msg);
138 m_Errs.push_back(
string(
"bad_request") +
msg);
142 m_Errs.push_back(
string(
"Invalid/unknown RID (bad_request_id)") +
159 string cfg(
"Configuration required:");
187 if ( !errors.empty() ) {
235 "No response from server, cannot complete request.");
251 gsrr->SetRequest_id(
m_RID);
332 }
else if (!
done && errors.find(
"bad_request_id") !=
NPOS) {
384 m_Reply->GetBody().IsGet_search_results()) {
386 rv = & (
m_Reply->SetBody().SetGet_search_results());
398 if (gsrr && gsrr->CanGetAlignments()) {
399 rv = & (gsrr->SetAlignments());
421 const int query_index = 0;
426 temp.push_back(cur_set);
429 current_id = this_id;
431 cur_set->
Set().push_back(*it);
436 temp.push_back(cur_set);
443 TSeqAlignVector::size_type sap_index = 0;
445 const int query_index = 0;
446 if (sap_index < temp.size())
448 list< CRef< CSeq_align > > sal = temp[sap_index]->Get();
450 if (
CSeq_id::e_YES == (*it)->Compare(sal.front()->GetSeq_id(query_index) ))
452 rv.push_back(temp[sap_index]);
458 rv.push_back(cur_set);
464 rv.push_back(cur_set);
477 if (gsrr && gsrr->CanGetPhi_alignments()) {
478 rv = & (gsrr->SetPhi_alignments());
495 if (network_masks.empty()) {
502 size_t query_index = 0;
504 ITERATE(TGSRR::TMasks, masks_for_frame, network_masks) {
506 _ASSERT(masks_for_frame->NotEmpty());
509 ((*masks_for_frame)->GetLocations().front()->GetId());
510 if (previous_seqid.
Empty()) {
511 previous_seqid = current_seqid;
517 mqr = &retval[query_index];
519 mqr = &retval[++query_index];
520 previous_seqid = current_seqid;
525 _ASSERT((*masks_for_frame)->GetLocations().size() == (
size_t) 1);
526 _ASSERT((*masks_for_frame)->GetLocations().front().NotEmpty());
528 (*masks_for_frame)->GetLocations().front();
536 (*mask)->GetFrom(), (*mask)->GetTo()));
554 if (gsrr && gsrr->CanGetMasks()) {
555 rv = gsrr->SetMasks();
563 list< CRef<CBlast4_ka_block > > rv;
567 if (gsrr && gsrr->CanGetKa_blocks()) {
568 rv = (gsrr->SetKa_blocks());
580 if (gsrr && gsrr->CanGetSearch_stats()) {
581 rv = (gsrr->SetSearch_stats());
593 if (gsrr && gsrr->CanGetPssm()) {
594 rv = & (gsrr->SetPssm());
616 }
else if (
m_RID.empty()) {
631 m_Errs.push_back(
"No request exists and no RID was specified.");
652 m_Errs.push_back(
"No response from server, cannot complete request.");
656 if (reply->CanGetBody() &&
657 reply->GetBody().GetQueue_search().CanGetRequest_id()) {
659 m_RID = reply->GetBody().GetQueue_search().GetRequest_id();
681 bool try_again =
true;
693 m_Errs.push_back(
"No response from server, "
694 "cannot complete request.");
707 }
else if (
r->CanGetBody() &&
r->GetBody().IsGet_search_results()) {
710 m_Errs.push_back(
"Results were not a get-search-results reply");
737 cout <<
"polling " << 0 << endl;
741 double start_sec = 10.0;
742 double increment = 1.30;
743 double max_sleep = 300.0;
744 double max_time = timeout;
747 cout <<
"polling " << start_sec <<
"/" << increment <<
"/" << max_sleep <<
"/" << max_time <<
"/" << endl;
751 double sleep_next = start_sec;
752 double sleep_totl = 0.0;
755 cout <<
"line " << __LINE__ <<
" sleep next " << sleep_next <<
" sleep totl " << sleep_totl << endl;
761 while (
m_Pending && (sleep_totl < max_time)) {
763 cout <<
" about to sleep " << sleep_next << endl;
765 double max_left = max_time - sleep_totl;
768 if (sleep_next > max_left) {
769 sleep_next = max_left;
772 if (sleep_next < 2.0)
777 sleep_totl += sleep_next;
780 cout <<
" done, total = " << sleep_totl << endl;
782 if (sleep_next < max_sleep) {
783 sleep_next *= increment;
784 if (sleep_next > max_sleep) {
785 sleep_next = max_sleep;
790 cout <<
" next sleep time = " << sleep_next << endl;
816 "BLAST archive must be one of text ASN.1, binary ASN.1 or XML.");
836 const string & program,
837 const string & service)
839 if ((! opts_handle) || program.empty() || service.empty()) {
842 "NULL argument specified: options handle");
844 if (program.empty()) {
846 "NULL argument specified: program");
849 "NULL argument specified: service");
874 "CRemoteBlast: No remote API options.");
883 "Empty RID string specified");
900 m_CBOH->SetOptions().GetBlast4AlgoOpts();
902 string user_ipv6_address;
905 user_ipv6_address =
env.Get(
"HTTP_X_FORWARDED_FOR_IPV6");
906 if( !user_ipv6_address.empty() ){
907 algo_opts->
Add(
string(
"HTTP_X_FORWARDED_FOR_IPV6"), user_ipv6_address );
910 m_QSR->SetAlgorithm_options().Set() = *algo_opts;
921 p->SetName(field.GetName());
925 m_QSR->SetProgram_options().Set().push_back(p);
936 p->SetName(field.GetName());
940 m_QSR->SetProgram_options().Set().push_back(p);
950 p->SetName(field.GetName());
954 m_QSR->SetProgram_options().Set().push_back(p);
958 const list<Int8> * x)
964 p->SetName(field.GetName());
968 m_QSR->SetProgram_options().Set().push_back(p);
976 v->
SetString().assign((x && (*x)) ? (*x) :
"");
979 p->SetName(field.GetName());
983 m_QSR->SetProgram_options().Set().push_back(p);
988 if (bioseqs.
Empty()) {
990 "Empty reference for query.");
1009 if (!
m_QSR->IsSetQueries())
1012 "Queries must be set before setting the masks.");
1019 if (seqlocs.empty()) {
1021 "Empty list for query.");
1043 if (masking_locations.empty()) {
1047 if (
m_QSR->GetQueries().GetNumQueries() != masking_locations.size()) {
1049 oss <<
"Mismatched number of queries ("
1050 <<
m_QSR->GetQueries().GetNumQueries()
1051 <<
") and masking locations (" << masking_locations.size() <<
")";
1072 (*masked_region)->GetFrom(),
1073 (*masked_region)->GetTo()));
1074 if ((*masked_region)->CanGetStrand() &&
1082 retval->SetLocations().push_back(seqloc);
1090 retval->SetFrame(frame);
1098 vector<string>* warnings )
1105 if (query_masks->empty()) {
1109 int current_frame = query_masks->front()->GetFrame();
1113 if (!packed_seqint.
Empty())
1117 retval.push_back(network_mask);
1119 current_frame = (*mask_locs)->GetFrame();
1123 packed_seqint->AddInterval((*mask_locs)->GetSeqId(),
1124 (*mask_locs)->GetInterval().GetFrom(),
1125 (*mask_locs)->GetInterval().GetTo());
1128 if (!packed_seqint.
Empty())
1133 retval.push_back(network_mask);
1135 packed_seqint.
Reset();
1166 "Empty reference for query pssm.");
1171 string psi_program(
"blastp");
1172 string old_service(
"plain");
1173 string new_service(
"psi");
1174 string delta_service(
"delta_blast");
1176 if (
m_QSR->GetProgram() != psi_program) {
1178 "PSI-Blast is only supported for blastp.");
1181 if (
m_QSR->GetService().empty()) {
1183 "Internal error: service is not set.");
1186 if ((
m_QSR->GetService() != old_service) &&
1187 (
m_QSR->GetService() != new_service) &&
1188 (
m_QSR->GetService() != delta_service)) {
1193 string(
"PSI-Blast cannot also be ") +
1194 m_QSR->GetService() +
".");
1200 m_QSR->SetQueries(*queries_p);
1203 if(
m_QSR->GetService() != delta_service) {
1204 m_QSR->SetService(new_service);
1214 string rvalue =
m_Errs[0];
1216 for(
unsigned i = 1;
i<
m_Errs.size();
i++) {
1230 string rvalue =
m_Warn[0];
1232 for(
unsigned i = 1;
i<
m_Warn.size();
i++) {
1282 if (iter->NotEmpty()) {
1285 if (entry.
IsSeq()) {
1309 if (queries.
Empty()) {
1312 "Error: No queries specified");
1319 if (bss.
Empty() && sll.empty()) {
1322 "Error: No query data.");
1328 bool has_local_ids =
false;
1330 if ( !sll.empty() ) {
1332 if (sll.front()->IsInt()) {
1335 const int kRangeLength = kStop -
kStart + 1;
1341 const int kFullLength =
1342 bss->
GetSeq_set().front()->GetSeq().GetInst().GetLength();
1344 if (kFullLength != kRangeLength) {
1352 has_local_ids =
true;
1361 if (has_local_ids) {
1386 "Error: No PSSM specified");
1397 if (opts_handle.
Empty()) {
1400 "Error: No options specified");
1406 "Error: No database specified");
1416 if ( !tmplist.empty() ) {
1418 copy(tmplist.begin(), tmplist.end(), back_inserter(gilist));
1427 if ( !tmplist.empty() ) {
1429 copy(tmplist.begin(), tmplist.end(), back_inserter(gilist));
1447 string l_disk_cache_flag =
env.Get(
"BLAST4_DISK_CACHE");
1462 if (gi_list.empty()) {
1466 "Submitting gi lists remotely is currently not supported");
1469 #ifdef NCBI_STRICT_GI
1470 list<int> int_gi_list;
1471 ITERATE ( list<TGi>, it, gi_list ) {
1472 int_gi_list.push_back(
GI_TO(
int, *it));
1479 copy(gi_list.begin(), gi_list.end(), back_inserter(
m_GiList));
1499 const char *
key = algo_key.c_str();
1515 if (gi_list.empty()) {
1519 "Submitting negative gi lists remotely is currently not supported");
1521 #ifdef NCBI_STRICT_GI
1522 list<int> int_gi_list;
1523 ITERATE ( list<TGi>, it, gi_list ) {
1524 int_gi_list.push_back(
GI_TO(
int, *it));
1550 m_Dbs->SetType(rtype);
1559 "NULL specified for database.");
1564 m_QSR->SetSubject(*subject_p);
1578 "Error: No query data.");
1581 list< CRef<CBioseq> > seqs;
1593 m_QSR->SetSubject(*subject_p);
1610 "NULL specified for entrez query.");
1637 return int(3600*3.5);
1668 const list< CRef< CBlast4_error > > & msgs =
m_Archive->GetMessages();
1670 if((*itr)->IsSetMessage()) {
1671 string msg = (*itr)->GetMessage();
1672 if((*itr)->IsSetCode()) {
1673 switch ((*itr)->GetCode()) {
1728 if (
strategy.GetSubject()->IsDatabase())
1744 "Could not get information from archive file.");
1752 if (
m_RID.empty()) {
1763 "Polling terminated, but search is in incomplete state.");
1799 "No response from server, cannot complete request.");
1806 if (reply->CanGetBody()) {
1807 if (reply->GetBody().IsGet_request_info()) {
1809 (& reply->SetBody().SetGet_request_info());
1811 if (grir->GetDatabase().GetName() !=
"n/a") {
1824 if( grir->IsSetFormat_options() )
1832 "Could not get information from search.");
1860 list< CRef<objects::CBioseq> >
1944 if (service ==
"rpsblast") {
1946 if (program ==
"blastp") {
1948 }
else if (program ==
"tblastn" || program ==
"blastx") {
1956 if (service ==
"psi") {
1982 _ASSERT(frame == -1 || frame == 1);
2084 for (; itr; ++itr) {
2099 if (seq_entry.
IsSeq()) {
2110 query_ids.push_back(
id);
2143 query_messages.push_back(sm);
2152 query_messages.push_back(sm);
2157 search_messages.insert(search_messages.end(),
2158 alignments.empty() ? 1 : alignments.size(),
2162 NcbiCout <<
"Error/Warning messages: '"
2163 << search_messages.
ToString() <<
"'" << endl;
2170 if (alignments.empty()) {
2172 alignments.resize(1);
2187 const string kTarget(
"Effective search space used: ");
2188 const string kLength_Adj(
"Length adjustment: ");
2190 Int8 effective_search_space = 0;
2191 Int8 length_adjustment = 0;
2195 effective_search_space =
2207 const string kTmp(
"Matrix: ");
2211 m_CBOH->SetOptions().SetMatrixName((*itr).c_str());
2218 bool found_gapped =
false, found_ungapped =
false;
2219 pair<double, double> lambdas, Ks, Hs;
2223 if ((*itr)->GetGapped()) {
2224 lambdas.second = (*itr)->GetLambda();
2225 Ks.second = (*itr)->GetK();
2226 Hs.second = (*itr)->GetH();
2227 found_gapped =
true;
2229 lambdas.first = (*itr)->GetLambda();
2230 Ks.first = (*itr)->GetK();
2231 Hs.first = (*itr)->GetH();
2232 found_ungapped =
true;
2235 if (found_gapped && found_ungapped) {
2246 ancill_vector.insert(ancill_vector.end(), alignments.size(),
2252 ancill_vector, &masks));
2262 bool succeeded =
false;
2279 unique_ptr<CObjectIStream> is(
2282 (is.get())->SetEnforcedStdXml(
true);
2284 *is >> *b4_ss_reply;
2298 retval.
Reset(&b4_ss_reply->Set());
2301 b4_ss_reply.
Reset();
2317 unique_ptr<CObjectIStream> is(
2320 (is.get())->SetEnforcedStdXml(
true);
2327 "Unrecognized input format ");
2336 const string&
value)
2339 info_request->SetRequest_id(rid);
2340 info_request->SetInfo().Add(name,
value);
2349 const string&
value)
2352 if (reply.
Empty() || !reply->CanGetBody()) {
2355 if (reply->GetBody().IsGet_search_info()) {
2360 const string reply_name =
2364 if( search_param.
NotEmpty() && search_param->GetValue().IsString()) {
2365 retval = search_param->GetValue().GetString();
2409 bool try_again =
true;
2422 m_Errs.push_back(
"No response from server, "
2423 "cannot complete request.");
2439 if( !
r->CanGetBody() ) {
2440 m_Errs.push_back(
"Results were not a get-search-results reply 2");
2443 if(
r->CanGetBody() && !
r->GetBody().IsGet_search_results()) {
2444 m_Errs.push_back(
"Results were not a get-search-results reply");
2451 m_Errs.push_back(
"Results were not a get-search-results reply 3");
2454 if(
r->CanGetBody() && !
r->GetBody().IsGet_search_results()) {
2455 m_Errs.push_back(
"Results were not a get-search-results reply 4");
2471 gsrr->SetRequest_id(
m_RID);
2473 gsrr->ResetResult_types();
2474 gsrr->SetResult_types( 16) ;
2490 string BLAST4_CONN_SERVICE_NAME =
"blast4";
2492 BLAST4_CONN_SERVICE_NAME =
env.Get(
"BLAST4_CONN_SERVICE_NAME");
2496 gsrr->SetRequest_id(
m_RID);
2509 char incoming_buffer[8192];
2510 int read_max = 8192;
2511 int l_total_bytes=0, n_read;
2512 bool l_cached_ok =
true;
2518 l_total_bytes += n_read;
2520 tmp_stream->write(incoming_buffer,n_read);
2521 if( tmp_stream->bad() || tmp_stream->fail() )
2523 l_cached_ok =
false;
2524 LOG_POST(
Error <<
"CRemoteBlast::x_GetSearchResultsHTTP CAN'T WRITE CACHED DATA: BAD/FAIL STATE" );
2530 LOG_POST(
Error <<
"CRemoteBlast::x_GetSearchResultsHTTP CAN'T WRITE CACHED DATA: "<<err.what() );
2531 l_cached_ok =
false;
2542 LOG_POST(
Info <<
"CRemoteBlast::x_GetSearchResultsHTTP: DISABLE CACHE, RE-READ");
2548 tmp_stream->seekg(0);
2552 unique_ptr<CObjectIStream>
2558 LOG_POST(
Info <<
"CRemoteBlast::x_GetSearchResultsHTTP: DISABLE CACHE, CAN'T READ CACHED FILE, RE-READ");
2603 "No response from server, cannot complete request.");
2611 if (reply->CanGetBody()) {
2612 if (reply->GetBody().IsGet_search_info()) {
2623 if( search_param.
NotEmpty() && search_param->GetValue().IsSeq_loc_list())
2628 else if( search_param.
NotEmpty() && search_param->GetValue().IsBioseq_list())
2636 "Obtained database name for remote bl2seq search");
2647 unsigned int iter_num = 0;
2653 iter_num = param->GetValue().GetInteger();
2656 else if(!
m_RID.empty())
2666 unsigned int retval=0;
2676 if ( !num.empty() ) {
2686 m_Archive->GetRequest().GetBody().IsGet_request_info() &&
2687 m_Archive->GetRequest().GetBody().GetGet_request_info().IsSetRequest_id() &&
2688 (
m_Archive->GetRequest().GetBody().GetGet_request_info().GetRequest_id() ==
"Error")) {
@ eExtreme_Positional
numerical value
User-defined methods of the data storage class.
User-defined methods of the data storage class.
ESubjectMaskingType
Define the possible subject masking types.
const int kBlastMessageNoContext
Declared in blast_message.h as extern const.
Declares the CBlastOptionsBuilder class.
Boolean Blast_QueryIsTranslated(EBlastProgramType p)
Returns true if the query is translated.
Boolean Blast_QueryIsNucleotide(EBlastProgramType p)
Returns true if the query is nucleotide.
EBlastProgramType
Defines the engine's notion of the different applications of the BLAST algorithm.
vector< CRef< objects::CSeq_align_set > > TSeqAlignVector
Vector of Seq-align-sets.
Int2 BlastProgram2Number(const char *program, EBlastProgramType *number)
Set number for a given program type.
User-defined methods of the data storage class.
const string & GetName() const
Get field name (key).
static CBlast4Field & Get(EBlastOptIdx opt)
CBlast4_get_search_info_reply –.
CBlast4_get_search_info_request –.
CBlast4_get_search_results_request –.
CBlast4_get_search_strategy_reply –.
CRef< CBlast4_parameter > GetParamByName(const string name) const
Returns Blast4_parameter with specified name.
CRef< CBlast4_parameter > Add(const string name, const int &value)
Append Blast4_parameter.
size_t GetNumQueries() const
Retrieve the number of queries in this object.
CBlast4_queue_search_request –.
Class used to return ancillary data from a blast search, i.e.
Defines BLAST error codes (user errors included)
Class to build CBlastOptionsHandle from blast4 ASN objects.
Handle to the options to the BLAST algorithm.
@ eRemote
To be used when running BLAST remotely.
virtual void GetRemoteProgramAndService_Blast3(string &p, string &s) const
Get the program and service name for remote blast.
This stream exchanges data with a named service, in a constraint that the service is implemented as o...
Class to return parts of the CBlast4_request, or data associated with a CBlast4_request,...
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
NCBI C++ Object Manager dependant implementation of IQueryFactory.
CObjectIStreamAsnBinary –.
const CSeq_entry & GetQuery() const
Retrieve the query sequence.
Exception class for the CRemoteBlast class.
Error or Warning Message from search.
Search Results for All Queries.
structure for seqloc info
Root class for all serialization exceptions.
Template class for iteration on objects of class C (non-medifiable version)
Collection of masked regions for a single query sequence.
Class for the messages for an individual query sequence.
typedef for the messages for an entire BLAST search, which could be comprised of multiple query seque...
iterator_bool insert(const value_type &val)
static const char si[8][64]
bool LoadFromArchive()
Loads next chunk of archive from file.
CRef< CBlastOptionsHandle > GetSearchOptions()
Get the search options used for this search.
string GetTitle(void)
Get the title assigned for this search.
void x_SearchErrors(CRef< objects::CBlast4_reply > reply)
Iterate over error list, splitting into errors and warnings.
string GetDatabaseName() const
Accessor for the database name.
void x_CheckResultsDC(void)
Try to get and process results using disk cache.
int GetFirstDbSeq()
Get the OID range start point.
CRef< objects::CPssmWithParameters > GetPSSM(void)
Get the PSSM produced by the search.
objects::CBlast4_get_search_results_reply TGSRR
An alias for the most commonly used part of the Blast4 search results.
ENeedConfig m_NeedConfig
Bitfield to track whether all necessary configuration is done.
static CRef< CBlast4_mask > s_CreateBlastMask(const CPacked_seqint &packed_int, EBlastProgramType program)
Creates a Blast4-mask which is supposed to contain all masked locations for a given query sequence an...
string x_GetStringFromSearchInfoReply(CRef< CBlast4_reply > reply, const string &name, const string &value)
CRef< objects::CBlast4_reply > x_GetSearchResults(void)
Try to get the search results.
list< CRef< objects::CBioseq > > m_SubjectSequences
Subject Sequences.
CRef< objects::CBlast4_queries > m_Queries
Queries associated with this search.
objects::EBlast4_frame_type FrameNumber2NetworkFrame(int frame, EBlastProgramType program)
Converts the return value of CSeqLocInfo::GetFrame into the Blast4-frame-type field.
list< CRef< objects::CBlast4_ka_block > > TKarlinAltschulBlocks
Convenience typedef for a list of CRef<CBlast4_ka_block>
CRef< objects::CBlast4_reply > x_GetSearchResultsHTTP(void)
list< TGi > m_GiList
GI list.
bool HaveFirstDbSeq()
Check whether an OID range start point is specified.
string m_RID
Request ID of submitted or pre-existing search.
int GetDbFilteringAlgorithmId()
Get the database filtering algorithm ID.
string GetErrors(void)
This returns a string containing any errors that were produced by the search.
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)
void x_CheckResults(void)
Try to get and process results.
TSeqLocInfoVector m_QueryMaskingLocations
Masking locations for queries.
TSeqAlignVector GetSeqAlignSets()
Get the seqalign vector from the results.
list< TGi > m_NegativeGiList
Negative GI list.
CFormatGuess::EFormat m_ObjectType
Type of object CBlast4_archive as determined by CFormatGuess.
bool x_IsUnknownRID(void)
Determine if this is an unknown RID.
bool HaveNegativeTaxidList()
Check whether a negative tax id list is specified.
int GetFilteringAlgorithm() const
Accessor for the filtering algorithm ID.
const TGiList GetNegativeGiListLimitation() const
bool m_use_disk_cache
Use disk cache for retrieving results default: false.
ENeedConfig
This class attempts to verify whether all necessary configuration is complete before attempting to su...
CRef< objects::CBlast4_archive > m_Archive
Archive of BLAST search and results.
void x_InitQueries(CRef< IQueryFactory > queries)
Initialize queries based on a query factory.
static CRef< CBlast4_request_body > s_BuildSearchInfoRequest(const string &rid, const string &name, const string &value)
ESearchStatus CheckStatus()
Returns the status of a previously submitted search/RID.
void SetVerbose(EDebugMode verb=eDebug)
Adjust the debugging level.
void x_GetRequestInfoFromRID()
Fetch the requested info from splitd.
list< TGi > GetNegativeGiList()
Get the negative GI list.
string GetFilteringAlgorithmKey() const
Accessor for the filtering algorithm key.
CRef< objects::CBlast4_reply > x_GetSearchStatsOnly(void)
const string & GetRID(void)
Gets the request id (RID) associated with the search.
CRef< blast::CBlastOptionsHandle > m_CBOH
Options for new search.
void SetRID(const string &rid)
Sets the RID for these results.
ESearchStatus
Represents the status of previously submitted search/RID.
vector< CConstRef< objects::CSeq_id > > TQueryIdVector
List of query ids.
void SetDatabase(const string &x)
Set the name of the database to search against.
CRef< objects::CBlast4_parameters > m_FormatOpts
Options relevant to the format application.
void x_ExtractQueryIds(CSearchResultSet::TQueryIdVector &query_ids)
Extract the query IDs from the CBlast4_queries for a given search.
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.
TGSRR::TMasks x_GetMasks(void)
Get the query masks from the results.
vector< string > m_Warn
List of warnings encountered.
bool HaveGiList()
Check whether a GI list is specified.
CBlastOptions & SetOptions()
Returns a reference to the internal options class which this object is a handle for.
EDebugMode
Debugging support can be turned on with eDebug or off with eSilent.
void SetSubjectSequences(CRef< IQueryFactory > subj)
Set a list of subject sequences to search against.
list< CRef< objects::CSeq_loc > > TSeqLocs
Type definition for CSeq_loc set used as queries in the BLAST remote search class.
CRef< objects::CBlast4_request_body > x_GetBlast4SearchRequestBody()
Retrieve the request body for a search submission.
static const string kNoRIDSpecified("Cannot fetch query info: No RID was specified.")
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)...
CRef< objects::CBlast4_queries > GetQueries()
Get the queries used for this search.
list< TTaxId > GetTaxidList()
Get the Tax list.
void SetQueryMasks(const TSeqLocInfoVector &masking_locations)
Set the masking locations for queries.
int m_DbFilteringAlgorithmId
filtering algorithm to use in the database
EDebugMode m_Verbose
Verbosity mode: whether to produce debugging info on stdout.
EImmediacy
Indicates whether to use async mode.
ESubjectMaskingType GetSubjectMaskingType() const
set< TTaxId > m_NegativeTaxidList
vector< string > m_Errs
List of errors encountered.
void x_SetSubjectSequences(const list< CRef< objects::CBioseq > > &subj)
Set a list of subject sequences to search against (only m_SubjectSequences)
bool HaveEntrezQuery()
Check whether an Entrez query is specified.
list< TTaxId > GetNegativeTaxidList()
Get the negative tax id list.
void x_PollUntilDone(EImmediacy poll_immed, int seconds)
Poll until results are found, error occurs, or timeout expires.
~CRemoteBlast()
Destruct the search object.
void x_Init(CNcbiIstream &f)
Uses the file to populate results.
void x_ExtractUserSpecifiedMasks(CRef< IQueryFactory > query_factory, TSeqLocInfoVector &masks)
Extract the user specified masking locations from the query factory.
vector< TGi > TGiList
Define a list of gis.
void FlattenBioseqSet(const CBioseq_set &bss, list< CRef< CBioseq > > &seqs)
void SetQueries(CRef< objects::CBioseq_set > bioseqs)
Set the query as a Bioseq_set.
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...
unique_ptr< CObjectIStream > m_ObjectStream
Use to ready CBlast4_archive.
CRef< objects::CBlast4_request > ExtractBlast4Request(CNcbiIstream &in)
Extract a Blast4-request (a.k.a.
list< CRef< objects::CBlast4_error > > TErrorList
Error value type used by Blast4 ASN.1 objects.
void x_SetMaskingLocationsForQueries(const TSeqLocInfoVector &masking_locations)
Set the masking locations AFTER the queries have been set in the m_QSR field.
string m_Service
Service value used when submitting this search.
bool HasDbFilteringAlgorithmKey()
Check whether a database filtering algorithm key is specified.
static void s_ExtractQueryIdsFromBioseqSet(const CBioseq_set &bss, CSearchResultSet::TQueryIdVector &query_ids)
Extract the query IDs from a CBioseq_set.
CRef< objects::CSeq_align_set > GetAlignments(void)
Get the seqalign set from the results.
bool IsLocalId(const objects::CSeq_id *seqid)
Returns true if the CSeq_id is a local id.
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)
string ToString() const
Converts messages to a string, which is returned.
const CBlastOptions & GetOptions() const
Return the object which this object is a handle for.
virtual CRef< objects::CBioseq_set > GetBioseqSet()=0
Accessor for the CBioseq_set.
void x_InitDiskCache(void)
Initialize disk caching.
bool Submit(void)
This submits the search (if necessary) and returns immediately.
bool m_ReadFile
true if a CBlast4_archive should be read in.
int GetFinalDbSeq()
Get the OID range end point.
CBlast4_subject::TSeq_loc_list m_SubjectSeqLocs
This field is populated when dealing with a remote bl2seq search (e.g.
TSeqLocInfoVector GetMasks(void)
Get the queries' masked locations.
string m_FinalDbSeq
Final database sequence.
CRef< objects::CBlast4_database > GetDatabases()
Get the database used by the search.
list< TGi > GetGiList()
Get the GI list.
CRef< objects::CBlast4_parameters > m_AlgoOpts
Options relevant to the search algorithm.
const vector< string > & GetErrorVector()
This returns any errors encountered as a vector of strings.
string m_FirstDbSeq
First database sequence.
EState
Various states the search can be in.
void x_SubmitSearch(void)
Submit the search and process results (of submit action).
CRef< objects::CBlast4_database > m_Dbs
Databases.
CRef< objects::CBlast4_request > GetSearchStrategy()
Fetch the search strategy for this object without submitting the search.
CRef< IRemoteQueryData > MakeRemoteQueryData()
Creates and caches an IRemoteQueryData.
EBlastProgramType NetworkProgram2BlastProgramType(const string &program, const string &service)
Function to convert from program and service name into the CORE BLAST program type This is based on t...
string m_ClientId
Client ID submitting requests throw this interface.
TSeqLocInfoVector ExtractUserSpecifiedMasks()
Retrieve any user specified masking locations.
CRef< objects::CBlast4_parameters > m_ProgramOpts
Options relevant to the search application.
CRef< objects::CBlast4_reply > x_SendRequest(CRef< objects::CBlast4_request_body > body)
Send a Blast4 request and get a reply.
static void Pssm(const objects::CPssmWithParameters &pssm, bool require_scores=false)
Perform validation on the PSSM.
list< string > GetSearchStats(void)
Get the search statistics block as a list of strings.
const TGiList GetGiListLimitation() const
void x_GetRequestInfo()
Fetch the request info (wait for completion if necessary).
CRef< CSearchResultSet > GetResultSet()
Submit the search (if necessary) and return the results.
CRef< CBlastOptionsHandle > GetSearchOptions(const objects::CBlast4_parameters *aopts, const objects::CBlast4_parameters *popts, const objects::CBlast4_parameters *fopts, string *task_name=NULL)
Build and return options as a CBlastOptionsHandle.
void SetLengthAdjustment(int len_adj)
Set the length adjustment for boundary conditions.
CRef< objects::CBlast4_queue_search_request > m_QSR
Request object for new search.
set< TTaxId > m_TaxidList
int x_DefaultTimeout(void)
The default timeout is 3.5 hours.
void x_QueryMaskingLocationsToNetwork()
Converts the provided query masking locations (if any) to the network representation following the BL...
string GetService()
Get the service used for this search.
bool CheckDone(void)
Check whether the search has completed.
TKarlinAltschulBlocks GetKABlocks(void)
Get the Karlin/Altschul parameter blocks produced by the search.
string m_DbFilteringAlgorithmKey
filtering algorithm key to use in the database
CRef< objects::CBlast4_reply > m_Reply
Results of BLAST search.
CBlast4_subject::TSeq_loc_list GetSubjectSeqLocs()
list< CRef< objects::CSeq_loc > > TSeqLocList
Typedef for a list of Seq-locs.
string GetCreatedBy()
Get the created-by string associated with this search.
const vector< string > & GetWarningVector()
This returns any warnings encountered as a vector of strings.
string GetWarnings(void)
This returns any warnings encountered.
bool HaveNegativeGiList()
Check whether a negative GI list is specified.
string m_disk_cache_error_msg
disk cache error message
static const string kNoArchiveFile("Cannot fetch query info: No archive file.")
bool IsErrMsgArchive(void)
bool m_Pending
Pending state: indicates that search still needs to be queued.
string m_Task
Task used when the search was submitted (recovered via CBlastOptionsBuilder)
virtual TSeqLocs GetSeqLocs()=0
Accessor for the TSeqLocs.
bool m_disk_cache_error_flag
disk cache error flag
string GetEntrezQuery()
Get the Entrez query.
void x_SetAlgoOpts(void)
Configure new search from options handle passed to constructor.
ESubjectMaskingType m_SubjectMaskingType
string m_Program
Program value used when submitting this search.
void x_CheckConfig(void)
Verify that search object contains mandatory fields.
vector< CRef< CBlastAncillaryData > > TAncillaryVector
typedef for a vector of CRef<CBlastAncillaryData>
list< CRef< objects::CBioseq > > GetSubjectSequences()
Returns subject sequences if "bl2seq" mode used.
void x_GetRequestInfoFromFile()
Fetch the requested info from an archive file.
TGSRR * x_GetGSRR(void)
Poll until done, return the CBlast4_get_search_results_reply.
string m_EntrezQuery
Entrez Query, if any.
bool x_HasRetrievedSubjects() const
string GetDbFilteringAlgorithmKey()
Get the database filtering algorithm key.
TBlast4Opts * GetBlast4AlgoOpts()
CRemoteBlast(const string &RID)
Use the specified RID to get results for an existing search.
string m_CreatedBy
Created-by attribution for this search.
bool HasDbFilteringAlgorithmId()
Check whether a database filtering algorithm ID is specified.
void x_SetDatabase(const string &x)
Sets a subset (only m_Dbs) of what the public SetDatabase sets.
int m_ErrIgn
Count of server glitches (communication errors) to ignore.
bool IsDbSearch()
Return values states whether GetDatabases or GetSubjectSequences call should be used.
string GetEntrezQueryLimitation() const
Accessor for the entrez query.
string GetProgram()
Get the program used for this search.
bool HaveFinalDbSeq()
Check whether an OID range end point is specified.
void x_SetOneParam(objects::CBlast4Field &field, const int *value)
Set an integer parameter (not used yet).
CRef< objects::CBlast4_phi_alignments > GetPhiAlignments(void)
Get the results of a PHI-Align request, if PHI pattern was set.
void SetEntrezQuery(const char *x)
Restrict search to sequences matching this Entrez query.
EState x_GetState(void)
Determine what state the search is in.
unsigned int x_GetPsiIterationsFromServer(void)
unsigned int GetPsiNumberOfIterations(void)
static bool s_SearchPending(CRef< objects::CBlast4_reply > reply)
Determine whether the search is still running.
CSeqLocInfo::ETranslationFrame NetworkFrame2FrameNumber(objects::EBlast4_frame_type frame, EBlastProgramType program)
Converts Blast4-frame-type into CSeqLocInfo::ETranslationFrame.
bool SubmitSync(void)
This submits the search (if necessary) and polls for results.
@ eStatus_Failed
Completed but failed, call GetErrors/GetErrorVector()
@ eStatus_Pending
Not completed yet.
@ eStatus_Unknown
Never submitted or purged from the system.
@ eStatus_Done
Completed successfully.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
@ eDiag_Trace
Trace message.
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error – guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
void Critical(CExceptionArgs_Base &args)
void Error(CExceptionArgs_Base &args)
#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 & GetMsg(void) const
Get message string.
void Trace(CExceptionArgs_Base &args)
void Warning(CExceptionArgs_Base &args)
void Fatal(CExceptionArgs_Base &args)
void Info(CExceptionArgs_Base &args)
static fstream * CreateTmpFile(const string &filename=kEmptyStr, ETextBinary text_binary=eBinary, EAllowRead allow_read=eAllowRead)
Create temporary file and return pointer to corresponding stream.
#define MSerial_AsnBinary
#define MSerial_AsnText
I/O stream manipulators –.
@ eSerial_AsnBinary
ASN.1 binary.
static int BestRank(const CRef< CSeq_id > &id)
E_SIC Compare(const CSeq_id &sid2) const
Compare() - more general.
@ e_YES
SeqIds compared, but are different.
void SetPacked_int(TPacked_int &v)
CConstBeginInfo ConstBegin(const C &obj)
Get starting point of non-modifiable object hierarchy.
pair< TObjectPtr, TTypeInfo > ObjectInfo(C &obj)
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
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.
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.
int16_t Int2
2-byte (16-bit) signed integer
int64_t Int8
8-byte (64-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define USING_SCOPE(ns)
Use the specified namespace.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
static streamsize Readsome(CNcbiIstream &is, CT_CHAR_TYPE *buf, streamsize buf_size)
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static Int8 StringToInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to Int8.
static bool MatchesMask(CTempString str, CTempString mask, ECase use_case=eCase)
Match "str" against the "mask".
static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)
Find the pattern in the string.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
@ fConvErr_NoThrow
Do not throw an exception on error.
@ eNocase
Case insensitive compare.
double Restart(void)
Return time elapsed since first Start() or last Restart() call (in seconds).
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
void Stop(void)
Suspend the timer.
void Start(void)
Start the timer.
@ eStart
Start timer immediately after creating.
C::value_type FindBestChoice(const C &container, F score_func)
Find the best choice (lowest score) for values in a container.
strategy
Block allocation strategies.
void SetIdent(const TIdent &value)
Assign a value to Ident data member.
bool IsSeq_loc_list(void) const
Check if variant Seq_loc_list is selected.
const TInfo & GetInfo(void) const
Get the Info member data.
bool CanGetRequest_id(void) const
Check if it is safe to call GetRequest_id method.
TQuery_mask & SetQuery_mask(void)
Select the variant.
bool CanGetInfo(void) const
Check if it is safe to call GetInfo method.
TGet_search_results & SetGet_search_results(void)
Select the variant.
TInteger_list & SetInteger_list(void)
Select the variant.
bool IsPssm(void) const
Check if variant Pssm is selected.
void SetBody(TBody &value)
Assign a value to Body data member.
TSequences & SetSequences(void)
Select the variant.
list< CRef< CSeq_loc > > TSeq_loc_list
TGet_request_info & SetGet_request_info(void)
Select the variant.
const TBioseq_set & GetBioseq_set(void) const
Get the variant data.
bool IsBioseq_set(void) const
Check if variant Bioseq_set is selected.
const TSeq_loc_list & GetSeq_loc_list(void) const
Get the variant data.
TGet_search_info & SetGet_search_info(void)
Select the variant.
EBlast4_frame_type
Access to EBlast4_frame_type's attributes (values, names) as defined in spec.
const TRequest_id & GetRequest_id(void) const
Get the Request_id member data.
const TPssm & GetPssm(void) const
Get the variant data.
TQueue_search & SetQueue_search(void)
Select the variant.
TString & SetString(void)
Select the variant.
EBlast4_residue_type
Access to EBlast4_residue_type's attributes (values, names) as defined in spec.
TBig_integer_list & SetBig_integer_list(void)
Select the variant.
void SetRequest_id(const TRequest_id &value)
Assign a value to Request_id data member.
TInteger & SetInteger(void)
Select the variant.
list< CRef< CBlast4_mask > > TMasks
TPssm & SetPssm(void)
Select the variant.
list< CRef< CSeq_loc > > TSeq_loc_list
virtual void Ask(const TRequest &request, TReply &reply)
TDatabase & SetDatabase(void)
Select the variant.
@ eBlast4_error_code_bad_request_id
The RID requested is unknown or it has expired.
@ eBlast4_error_code_not_implemented
Request type is not implemented in the blast4 server.
@ eBlast4_error_code_search_pending
The search is pending.
@ eBlast4_error_code_conversion_warning
A conversion issue was found when converting to/from blast3 from/to blast4 protocol in the blast4 ser...
@ eBlast4_error_code_not_allowed
Request type is not allowed in the blast4 server.
@ eBlast4_error_code_bad_request
Malformed/invalid requests (e.g.: parsing errors or invalid data in request)
@ eBlast4_error_code_internal_error
Indicates internal errors in the blast4 server.
@ eBlast4_frame_type_minus2
@ eBlast4_frame_type_plus2
@ eBlast4_frame_type_plus3
@ eBlast4_frame_type_plus1
@ eBlast4_frame_type_minus3
@ eBlast4_frame_type_notset
@ eBlast4_frame_type_minus1
@ eBlast4_residue_type_nucleotide
@ eBlast4_residue_type_unknown
@ eBlast4_residue_type_protein
Tdata & Set(void)
Assign a value to data member.
list< CRef< CSeq_align > > Tdata
const Tdata & Get(void) const
Get the member data.
list< CRef< CSeq_interval > > Tdata
const Tdata & Get(void) const
Get the member data.
bool IsPacked_int(void) const
Check if variant Packed_int is selected.
const TPacked_int & GetPacked_int(void) const
Get the variant data.
const TSeq & GetSeq(void) const
Get the variant data.
bool CanGetSeq_set(void) const
Check if it is safe to call GetSeq_set method.
const TSet & GetSet(void) const
Get the variant data.
bool IsSeq(void) const
Check if variant Seq is selected.
bool IsSet(void) const
Check if variant Set is selected.
const TSeq_set & GetSeq_set(void) const
Get the Seq_set member data.
list< CRef< CSeq_entry > > TSeq_set
const TId & GetId(void) const
Get the Id member data.
unsigned int
A callback function used to compare two keys in a database.
Names used in blast4 network communications.
@ eBlastOpt_Web_StepNumber
@ eBlastOpt_DbFilteringAlgorithmKey
@ eBlastOpt_NegativeGiList
@ eBlastOpt_DbFilteringAlgorithmId
@ eBlastOpt_RequiredStart
@ eBlastOpt_SubjectMaskingType
string Blast4SearchInfo_BuildReplyName(const string &name, const string &value)
This function builds the reply name token in the get-search-info reply objects, provided a pair of st...
const char * kBlast4SearchInfoReqValue_Title
Used to retrieve the BLAST search title.
const char * kBlast4SearchInfoReqValue_Subjects
Used to retrieve the BLAST search subjects.
const char * kBlast4SearchInfoReqValue_PsiIterationNum
Used to retrieve the PSI-BLAST iteration number.
const char * kBlast4SearchInfoReqName_Search
Used to retrieve information about the BLAST search.
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
#define TRUE
bool replacment for C indicating true.
void SleepSec(unsigned long sec, EInterruptOnSignal onsignal=eRestartOnSignal)
Sleep.
Defines: CTimeFormat - storage class for time format.
std::istream & in(std::istream &in_, double &x_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
Declarations of auxiliary functions/classes for PSI-BLAST.
Declares the CRemoteBlast class.
Declares the CImportStrategy and CExportStrategy.
vector< TMaskedQueryRegions > TSeqLocInfoVector
Collection of masked regions for all queries in a BLAST search.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static string kStart("Start")