57 #define NCBI_MODULE NETBLAST
77 static const string no_msg(
"<no message>");
79 if (reply->CanGetErrors() && (! reply->GetErrors().empty())) {
84 const string & message((*iter)->CanGetMessage()
85 ? (*iter)->GetMessage()
129 if (reply->CanGetBody() && reply->GetBody().IsGet_sequences()) {
130 list< CRef<CBioseq> > & bslist =
131 reply->SetBody().SetGet_sequences().Set();
133 bioseqs.reserve(bslist.size());
136 bioseqs.push_back(*iter);
156 errors =
"Error: invalid residue type specified.";
195 errors =
"Error: database name may not be blank.";
199 if (seqids.empty()) {
200 errors =
"Error: no sequences requested.";
223 list< CRef< CSeq_id > > & seqid_list =
227 seqid_list.push_back(*iter);
267 if (request.
Empty()) {
282 "No response from server, cannot complete request.");
324 errors =
"Error: database name may not be blank.";
327 if (seqids.empty()) {
328 errors =
"Error: no sequences requested.";
360 bool found_all =
false;
361 vector< CRef<objects::CBlast4_database_info> >
result =
364 if (found_all && !
result.empty())
379 if ((*dbinfo)->GetDatabase() == *blastdb) {
388 vector< CRef<objects::CBlast4_database_info> >
394 vector< CRef<objects::CBlast4_database_info> > retval;
397 if ((*dbinfo)->GetDatabase().GetName().find(
"repeat_") !=
NPOS) {
398 retval.push_back(*dbinfo);
411 databases =
client.AskGet_databases();
416 "No response from server, cannot complete request.");
424 if (blastdb.
Empty()) {
426 "NULL argument specified: blast database description");
437 vector< CRef<objects::CBlast4_database_info> >
440 vector<string> *missing_names)
442 vector<CRef<objects::CBlast4_database_info> > retval;
467 if( missing_names ) missing_names->push_back( blastdb->
GetName() );
473 vector< CRef<objects::CBlast4_database_info> >
476 vector<string> *missing_names)
478 vector<CRef<objects::CBlast4_database_info> > retval;
481 vector<string> all_db_names;
482 vector<string>::iterator it_db;
483 bool l_multiple_db =
false;
490 l_multiple_db = ( all_db_names.size() > 1 );
499 db_ex_req->SetParams().Add(
"FILTER_TYPE",
string(
"EXACT"));
500 db_ex_req->SetParams().Add(
"DBNAME",
dbname);
502 db_ex_req->SetParams().Add(
"DBTYPE",
string(
"prot"));
504 db_ex_req->SetParams().Add(
"DBTYPE",
string(
"nucl"));
512 "No response from server, cannot complete request.");
515 if( reply->GetBody().GetGet_databases_ex().Get().empty() ){
519 if( !reply->CanGetBody() || !reply->GetBody().IsGet_databases_ex() ) {
520 if(found_all ) *found_all =
false;
522 "Unexpected response from server, cannot complete request. (GetDatabaseInfoEx)");
525 list< CRef< CBlast4_database_info > >::const_iterator it;
526 it = reply->GetBody().GetGet_databases_ex().Get().begin();
527 for( ; it != reply->GetBody().GetGet_databases_ex().
Get().end(); it++){
528 retval.push_back( *it );
530 if( l_multiple_db ) {
531 string current_dbname = (*(*it)).GetDatabase().GetName();
532 it_db = find(all_db_names.begin(),all_db_names.end(),current_dbname);
533 if( it_db != all_db_names.end() ){
534 all_db_names.erase( it_db);
540 all_db_names.clear();
546 if( all_db_names.empty() ) {
550 if( missing_names ) missing_names->assign(all_db_names.begin(),all_db_names.end());
603 if (reply->CanGetBody() && reply->GetBody().IsGet_sequence_parts()) {
605 reply->SetBody().SetGet_sequence_parts().Set();
606 ids.reserve(parts_rep.size());
607 seq_data.reserve(parts_rep.size());
631 if (request.
Empty()) {
646 "No response from server, cannot complete request.");
655 objects::CBlast4_get_windowmasked_taxids_reply::Tdata
662 reply =
client.AskGet_windowmasked_taxids();
670 "No response from server, cannot complete request.");
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
Declares the CBlastServices class.
User-defined methods of the data storage class.
CBlast4_get_databases_ex_request –.
CBlast4_get_seq_parts_request –.
static void s_ProcessErrorsFromReply(CRef< objects::CBlast4_reply > reply, string &errors, string &warnings)
Process error messages from a reply object.
static void GetSequenceParts(const TSeqIntervalVector &seqids, const string &database, char seqtype, TSeqIdVector &ids, TSeqDataVector &seq_data, string &errors, string &warnings, bool verbose=false)
This retrieves (partial) sequence data from the remote BLAST server.
static void GetSequencesInfo(TSeqIdVector &seqids, const string &database, char seqtype, TBioseqVector &bioseqs, string &errors, string &warnings, bool verbose=false, bool target_only=false)
Get a set of Bioseqs without their sequence data given an input set of.
vector< CRef< objects::CBlast4_database_info > > GetDatabaseInfoLegacy(const string &dbname, bool is_protein, bool *found_all, vector< string > *missing_names=NULL)
Same as GetDatabaseInfo but retrieving whole list of database.
static void s_GetSeqsFromReply(CRef< objects::CBlast4_reply > reply, CBlastServices::TBioseqVector &bioseqs, string &errors, string &warnings)
Get bioseqs from a sequence fetching reply.
bool IsValidBlastDb(const string &dbname, bool is_protein)
Returns true if the BLAST database specified exists in the NCBI servers.
bool m_Verbose
Display verbose output to stdout?
static EBlast4_residue_type s_SeqTypeToResidue(char p, string &errors)
static void GetSequences(TSeqIdVector &seqids, const string &database, char seqtype, TBioseqVector &bioseqs, string &errors, string &warnings, bool verbose=false, bool target_only=false)
Get a set of Bioseqs given an input set of Seq-ids.
vector< CRef< objects::CSeq_data > > TSeqDataVector
Defines a std::vector of CRef<CSeq_data>
static void s_GetPartsFromReply(CRef< objects::CBlast4_reply > reply, CBlastServices::TSeqIdVector &ids, CBlastServices::TSeqDataVector &seq_data, string &errors, string &warnings)
Extract information from the get-seq-parts reply object.
vector< CRef< objects::CBioseq > > TBioseqVector
Defines a std::vector of CRef<CBioseq>
CRef< objects::CBlast4_database_info > GetDatabaseInfo(CRef< objects::CBlast4_database > blastdb)
Retrieve detailed information for one BLAST database If information about multiple databases is neede...
objects::CBlast4_get_windowmasked_taxids_reply::Tdata m_WindowMaskedTaxIds
Taxonomy IDs for which there's windowmasker masking data at NCBI.
static CRef< objects::CBlast4_request > s_BuildGetSeqRequest(CBlastServices::TSeqIdVector &seqids, const string &database, char seqtype, bool skip_seq_data, bool target_only, string &errors)
Build Sequence Fetching Request.
vector< CRef< objects::CSeq_interval > > TSeqIntervalVector
Defines a std::vector of CRef<CSeq_interval>
vector< CRef< objects::CSeq_id > > TSeqIdVector
Defines a std::vector of CRef<CSeq_id>
objects::CBlast4_get_databases_reply::Tdata m_AvailableDatabases
BLAST databases available to search.
static CRef< objects::CBlast4_request > s_BuildGetSeqPartsRequest(const CBlastServices::TSeqIntervalVector &seqids, const string &database, char seqtype, string &errors)
Build Sequence Parts Fetching Request.
static void s_GetSequences(CBlastServices::TSeqIdVector &seqids, const string &database, char seqtype, bool skip_seq_data, bool target_only, CBlastServices::TBioseqVector &bioseqs, string &errors, string &warnings, bool verbose)
Main function to issue a Blast4-get-sequences-request and collect its results from the remote BLAST s...
CRef< objects::CBlast4_database_info > x_FindDbInfoFromAvailableDatabases(CRef< objects::CBlast4_database > blastdb)
Look for a database matching this method's argument and returned detailed information about it.
objects::CBlast4_get_windowmasked_taxids_reply::Tdata GetTaxIdWithWindowMaskerSupport()
Retrieve a list of NCBI taxonomy IDs for which there exists windowmasker masking data to support an a...
vector< CRef< objects::CBlast4_database_info > > GetOrganismSpecificRepeatsDatabases()
Retrieve organism specific repeats databases.
void x_GetAvailableDatabases()
Retrieve the BLAST databases available for searching.
#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 NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define MSerial_AsnText
I/O stream manipulators –.
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.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define USING_SCOPE(ns)
Use the specified namespace.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
void SetDatabase(TDatabase &value)
Assign a value to Database data member.
TSeq_ids & SetSeq_ids(void)
Assign a value to Seq_ids data member.
void SetName(const TName &value)
Assign a value to Name data member.
TGet_sequence_parts & SetGet_sequence_parts(void)
Select the variant.
void SetTarget_only(TTarget_only value)
Assign a value to Target_only data member.
list< CRef< CBlast4_seq_part_data > > Tdata
const TName & GetName(void) const
Get the Name member data.
void SetBody(TBody &value)
Assign a value to Body data member.
TGet_sequences & SetGet_sequences(void)
Select the variant.
list< CRef< CBlast4_database_info > > Tdata
void SetType(TType value)
Assign a value to Type data member.
TGet_databases_ex & SetGet_databases_ex(void)
Select the variant.
EBlast4_residue_type
Access to EBlast4_residue_type's attributes (values, names) as defined in spec.
TSeq_locations & SetSeq_locations(void)
Assign a value to Seq_locations data member.
void SetDatabase(TDatabase &value)
Assign a value to Database data member.
virtual void Ask(const TRequest &request, TReply &reply)
void SetSkip_seq_data(TSkip_seq_data value)
Assign a value to Skip_seq_data data member.
@ eBlast4_error_flags_warning
@ eBlast4_residue_type_nucleotide
@ eBlast4_residue_type_unknown
@ eBlast4_residue_type_protein
char * dbname(DBPROCESS *dbproc)
Get name of current database.
use only n Cassandra database for the lookups</td > n</tr > n< tr > n< td > yes</td > n< td > do not use tables BIOSEQ_INFO and BLOB_PROP in the Cassandra database
const TYPE & Get(const CNamedParameterList *param)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static CNamedPipeClient * client