74 const vector<TGi>& gis);
79 void operator()(
void);
91 void x_TestSingleSequence_Local(
int index);
92 void x_TestSingleSequence_Remote(
int index);
94 void x_TestSingleProtein_Local(
int index,
97 void x_TestSingleNucleotide_Local(
int index,
100 void x_TestSingleTranslatedNucl_Local(
int index,
103 void x_TestSingleProtein_Remote(
const CSeq_id&
id,
105 void x_TestSingleNucleotide_Remote(
const CSeq_id&
id,
108 void x_TestLocalStrand(
const CSeq_id&
id,
114 const string& strand =
"");
119 : m_QueryFactory(query_factory), m_Gis(1, gi)
125 const vector<TGi>& gis)
126 : m_QueryFactory(query_factory), m_Gis(gis)
128 BOOST_REQUIRE(!gis.empty());
134 : m_QueryFactory(query_factory)
136 BOOST_REQUIRE(!seqlocs.empty());
145 bool is_protein_sequence =
false;
166 m_Gis.reserve(seqlocs->size());
181 BOOST_REQUIRE(index == seqlocs->size());
216 for (
size_t i = 0;
i <
m_Gis.size();
i++) {
229 int ctx_index = index * 2;
242 throw runtime_error(
"Internal error in " +
274 string msg(
"CSequenceDataTester::x_TestSingleTranslatedNucl_Local ");
275 msg +=
"not implemented";
276 throw runtime_error(msg);
281 const Uint1* sequence,
282 const string& strand)
292 string msg(
"Different ");
294 msg +=
" at position ";
301 msg +=
" (" + strand +
" strand)";
304 BOOST_REQUIRE_MESSAGE(
static_cast<int>(sequence[
i]) ==
static_cast<int>(kBase),
315 BOOST_REQUIRE(index <= qinfo->last_context);
338 BOOST_REQUIRE(qinfo !=
NULL);
339 BOOST_REQUIRE(seq_blk !=
NULL);
343 if ( !msgs.empty() ) {
346 message += (*m)->GetMessage();
351 BOOST_REQUIRE_EQUAL(
m_Gis.size(),
373 IRemoteQueryData::TSeqLocs::const_iterator itr = seqlocs.begin();
374 BOOST_REQUIRE_EQUAL(
m_Gis.size(), seqlocs.size());
375 BOOST_REQUIRE(index >= 0);
376 BOOST_REQUIRE(index <
static_cast<int>(seqlocs.size()));
377 for (
int i = 0; itr != seqlocs.end(); ++itr, ++
i) {
378 if (
i == index)
break;
380 BOOST_REQUIRE(itr != seqlocs.end());
386 const CSeq_id* seqid = (*itr)->GetId();
387 BOOST_REQUIRE(seqid !=
NULL);
390 cout << seqid_string << endl;
391 BOOST_REQUIRE_MESSAGE(seqid_string.find(gi_string) !=
ncbi::NPOS,
392 "Cannot find gi in Seq-id string for remote query "
400 for (; bioseq; ++bioseq) {
401 if (seq_index !=
static_cast<TSeqPos>(index)) {
407 BOOST_REQUIRE(seq_index <
m_Gis.size());
437 BOOST_REQUIRE_EQUAL(sv.
size(), nconv);
442 const char kResidue = sv[
i];
460 BOOST_REQUIRE_EQUAL(sv.
size(), nconv);
465 const char kBase = sv[
i];
471 BaseTest = (kCompressedBase & 0xF0) >> 4;
474 BaseTest = kCompressedBase & 0x0F;
477 BOOST_REQUIRE_MESSAGE(
static_cast<int>(kBase) ==
static_cast<int>(BaseTest),
503 ITERATE(vector<TGi>, itr, gis) {
518 ITERATE(vector<TGi>, itr, gis) {
521 queries.push_back(*sl);
534 ITERATE(vector<TGi>, itr, gis) {
574 ITERATE(vector<TGi>, itr, gis) {
583 size_t kExpectedSize = 416+624+310;
586 BOOST_REQUIRE_EQUAL(kExpectedSize,
594 kExpectedSize = 247249719;
596 BOOST_REQUIRE_EQUAL(kExpectedSize,
604 s_ObjMgr_QueryFactory_LocalDataFromTSeqLocVector(gis);
612 s_ObjMgr_QueryFactory_LocalDataFromTSeqLocVector(gis);
619 s_ObjMgr_QueryFactory_LocalDataFromBlastQueryVector(gis);
627 s_ObjMgr_QueryFactory_LocalDataFromBlastQueryVector(gis);
635 queries.push_back(*sl);
669 s_ObjMgrFree_QueryFactory_LocalDataFromBioseq(kGi);
674 s_ObjMgrFree_QueryFactory_LocalDataFromBioseq(kGi);
682 s_ObjMgrFree_QueryFactory_LocalDataFromBioseq_set(gis);
690 s_ObjMgrFree_QueryFactory_LocalDataFromBioseq_set(gis);
Declares the BLAST exception class.
Boolean Blast_QueryIsProtein(EBlastProgramType p)
Returns true if the query is protein.
EProgram
This enumeration is to evolve into a task/program specific list that specifies sets of default parame...
@ eBlastn
Nucl-Nucl (traditional blastn)
@ eBlastp
Protein-Protein.
Defines BLAST error codes (user errors included)
void AddQuery(CRef< CBlastSearchQuery > q)
Add a query to the set.
NCBI C++ Object Manager free implementation of IQueryFactory.
NCBI C++ Object Manager dependant implementation of IQueryFactory.
static bool IsAa(EMol mol)
static TSeqPos Convert(const CSeq_data &in_seq, CSeq_data *out_seq, CSeq_data::E_Choice to_code, TSeqPos uBeginIdx=0, TSeqPos uLength=0, bool bAmbig=false, Uint4 seed=17734276)
void x_TestSingleNucleotide_Remote(const CSeq_id &id, const CSeq_inst &seq_inst)
void x_CompareSequenceData(CSeqVector &sv, const Uint1 *sequence, const string &strand="")
void x_TestSingleTranslatedNucl_Local(int index, const BlastQueryInfo *qinfo, const BLAST_SequenceBlk *seqblk)
void x_TestSingleSequence_Local(int index)
void x_TestLocalStrand(const CSeq_id &id, int ctx_index, ENa_strand strand, const BlastQueryInfo *qinfo, const BLAST_SequenceBlk *seqblk)
void x_Init(const IRemoteQueryData::TSeqLocs *seqlocs=0)
vector< ENa_strand > m_Strands
void x_TestSingleProtein_Local(int index, const BlastQueryInfo *qinfo, const BLAST_SequenceBlk *seqblk)
CConstRef< CBlastOptions > m_Options
CRef< IQueryFactory > m_QueryFactory
void x_TestSingleSequence_Remote(int index)
CSequenceDataTester(CRef< IQueryFactory > query_factory, TGi gi)
void x_TestSingleProtein_Remote(const CSeq_id &id, const CSeq_inst &seq_inst)
void x_TestSingleNucleotide_Local(int index, const BlastQueryInfo *qinfo, const BLAST_SequenceBlk *seqblk)
ENa_strand x_GetStrand(int index)
static CRef< CScope > NewScope(bool with_defaults=true)
Return a new scope, possibly (by default) with default loaders, which will include the Genbank loader...
static CSeqVector GetSeqVector(const CSeq_id &id, ENa_strand strand=eNa_strand_plus)
Return a sequence vector for some kind of id or location.
static CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Return a biosequence handle for some kind of id.
static CTestObjMgr & Instance()
Template class for iteration on objects of class C (non-medifiable version)
Class for the messages for an individual query sequence.
objects::ENa_strand GetStrandOption() const
virtual BLAST_SequenceBlk * GetSequenceBlk()=0
Accessor for the BLAST_SequenceBlk structure.
CRef< ILocalQueryData > MakeLocalQueryData(const CBlastOptions *opts)
Creates and caches an ILocalQueryData.
static CBlastOptionsHandle * Create(EProgram program, EAPILocality locality=CBlastOptions::eLocal)
Creates an options handle object configured with default options for the requested program,...
list< CRef< objects::CSeq_loc > > TSeqLocs
Type definition for CSeq_loc set used as queries in the BLAST remote search class.
const Uint1 NCBI4NA_TO_BLASTNA[]
Translates between ncbi4na and blastna.
EBlastProgramType GetProgramType() const
Returns the CORE BLAST notion of program type.
virtual BlastQueryInfo * GetQueryInfo()=0
Accessor for the BlastQueryInfo structure.
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.
CRef< IRemoteQueryData > MakeRemoteQueryData()
Creates and caches an IRemoteQueryData.
void GetQueryMessages(size_t index, TQueryMessages &qmsgs)
Retrieve error/warning messages for a specific query.
virtual TSeqLocs GetSeqLocs()=0
Accessor for the TSeqLocs.
size_t GetSumOfSequenceLengths()
Compute the sum of all the sequence's lengths.
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NCBI_CURRENT_FUNCTION
Get current function name.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const TPrim & Get(void) const
const string AsFastaString(void) const
CConstBeginInfo ConstBegin(const C &obj)
Get starting point of non-modifiable object hierarchy.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
TGi GetGiForAccession(const string &acc, CScope &scope, EGetIdType flags=0)
Given an accession string retrieve the GI id.
TBioseqCore GetBioseqCore(void) const
Get bioseq core structure.
bool IsProtein(void) const
void SetCoding(TCoding coding)
bool IsNucleotide(void) const
TObjectType * GetNonNullPointer(void)
Get pointer value and throw a null pointer exception if pointer is null.
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.
uint8_t Uint1
1-byte (8-bit) unsigned integer
int32_t Int4
4-byte (32-bit) signed integer
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
ENa_strand
strand of nucleic acid
@ eNa_strand_both
in forward orientation
@ e_Gi
GenInfo Integrated Database.
TSeq & SetSeq(void)
Select the variant.
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
TRepr GetRepr(void) const
Get the Repr member data.
const TInst & GetInst(void) const
Get the Inst member data.
bool IsNcbistdaa(void) const
Check if variant Ncbistdaa is selected.
bool IsNcbi4na(void) const
Check if variant Ncbi4na is selected.
TLength GetLength(void) const
Get the Length member data.
const TNcbistdaa & GetNcbistdaa(void) const
Get the variant data.
const TNcbi4na & GetNcbi4na(void) const
Get the variant data.
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
@ eRepr_raw
continuous sequence
@ e_Ncbistdaa
consecutive codes for std aas
@ e_Ncbi4na
4 bit nucleic acid code
unsigned int
A callback function used to compare two keys in a database.
Implementation of the uniform BLAST search interface for searching locally installed BLAST databases.
Magic spell ;-) needed for some weird compilers... very empiric.
Defines NCBI C++ diagnostic APIs, classes, and macros.
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
BOOST_AUTO_TEST_CASE(ObjMgr_QueryFactory_LocalData_GetSumOfSequenceLengths)
vector< SSeqLoc > TSeqLocVector
Vector of sequence locations.
Structure to hold a sequence.
Uint1 * sequence
Sequence used for search (could be translation).
Int4 query_length
Length of this query, strand or frame.
Int4 query_offset
Offset of this query, strand or frame in the concatenated super-query.
The query related information.
Int4 first_context
Index of the first element of the context array.
BlastContextInfo * contexts
Information per context.
int num_queries
Number of query sequences.
static void create_EmptyBlastQueryVector()
static void s_ObjMgrFree_QueryFactory_LocalDataFromBioseq_set(const vector< TGi > &gis)
static void create_EmptyTSeqLocVector()
static void s_ObjMgr_QueryFactory_LocalDataFromTSeqLocVector(const vector< TGi > &gis)
static void s_ObjMgr_QueryFactory_LocalDataFromBlastQueryVector(const vector< TGi > &gis)
static void s_ObjMgrFree_QueryFactory_LocalDataFromBioseq(TGi kGi)
Utility stuff for more convenient using of Boost.Test library.