60 const size_t num_hsps_total = 12;
61 const size_t num_hsps_plus = 4;
62 const int scores[num_hsps_total] =
63 {62, 51, 49, 44, 44, 44, 43, 43, 43, 48, 45, 46};
79 const int q_offsets[num_hsps_total] =
80 {3244, 1045, 3133, 9204, 3163, 8179, 1090, 1328, 2300, 832, 6776, 3633};
81 const int s_offsets[num_hsps_total] =
82 {700, 662, 812, 1385, 146, 538, 930, 1340, 1373, 1917, 1467, 966};
83 const int q_ends[num_hsps_total] =
84 {3430, 1159, 3283, 9300, 3328, 8287, 1174, 1388, 2408, 937, 6968, 3759};
85 const int s_ends[num_hsps_total] =
86 {761, 699, 861, 1418, 205, 564, 958, 1360, 1403, 1952, 1531, 1007};
87 const double evalues[num_hsps_total] =
88 {0.0546847, 1.0657, 2.00126, 7.04787, 7.83533, 8.12416, 9.05612, 9.84108, 9.90728, 2.53047, 5.47761, 3.70474};
91 size_t num_hsps = results.
Size();
99 BOOST_REQUIRE_EQUAL(num_hsps_plus, num_hsps);
102 BOOST_REQUIRE_EQUAL(num_hsps_total - num_hsps_plus, num_hsps);
105 BOOST_REQUIRE_EQUAL(num_hsps_total, num_hsps);
110 size_t align_num = 0;
117 const list<CRef<CStd_seg> >& stdseg = hitlist.
GetSegs().
GetStd();
119 stdseg.front()->GetLoc().front()->GetInt().GetStrand();
124 while (align_num < num_hsps_total &&
125 strands[align_num] != curr_strand)
127 BOOST_REQUIRE(align_num < num_hsps_total);
133 const CScore& curr_score = **sitr;
135 BOOST_REQUIRE_CLOSE(evalues[align_num],
139 BOOST_REQUIRE_EQUAL(scores[align_num],
148 int off1 = locs[0]->GetInt().GetFrom();
149 int off2 = locs[1]->GetInt().GetFrom();
150 BOOST_REQUIRE_EQUAL(q_offsets[align_num], off1);
151 BOOST_REQUIRE_EQUAL(s_offsets[align_num], off2);
155 if (seqloc[0]->IsEmpty()) {
156 off2 += seqloc[1]->GetInt().GetTo() -
157 seqloc[1]->GetInt().GetFrom() + 1;
159 else if (seqloc[1]->IsEmpty()) {
160 off1 += seqloc[0]->GetInt().GetTo() -
161 seqloc[0]->GetInt().GetFrom() + 1;
164 off1 += seqloc[0]->GetInt().GetTo() -
165 seqloc[0]->GetInt().GetFrom() + 1;
166 off2 += seqloc[1]->GetInt().GetTo() -
167 seqloc[1]->GetInt().GetFrom() + 1;
170 BOOST_REQUIRE_EQUAL(q_ends[align_num], off1);
171 BOOST_REQUIRE_EQUAL(s_ends[align_num], off2);
180 #if defined(WORDS_BIGENDIAN) || defined(IS_BIG_ENDIAN)
181 m_DbName =
"data/rpstest_be";
183 m_DbName =
"data/rpstest_le";
196 unique_ptr<SSeqLoc>
query(
199 query_v.push_back(*
query);
217 unique_ptr<SSeqLoc>
query(
220 query_v.push_back(*
query);
229 const CSeq_align& hitlist_sa = *results[0].GetSeqAlign()->Get().front();
234 BOOST_REQUIRE_EQUAL(0, off1);
235 BOOST_REQUIRE_EQUAL(0, off2);
238 BOOST_REQUIRE_EQUAL(1016, (
int)denseg.
GetLens()[0]);
253 const int kNumHits = 2;
254 const int kOids[kNumHits] = { 3, 1 };
255 const int kNumHsps[kNumHits] = { 2, 3 };
256 const int kTotalHsps = 5;
257 const int kScores[kTotalHsps] = { 7458, 6898, 7055, 6997, 6542};
258 const int kLengths[kTotalHsps] = { 36, 21, 15, 15, 10};
261 query_loc->
SetWhole().SetGi(kQueryGi);
265 query_v.push_back(
SSeqLoc(query_loc, query_scope));
281 BOOST_REQUIRE_EQUAL(kNumHits,
285 for (
int index = 0; index < kNumHits; ++index) {
288 BOOST_REQUIRE_EQUAL(kOids[index], hsp_list->
oid);
289 BOOST_REQUIRE_EQUAL(kNumHsps[index], hsp_list->
hspcnt);
290 for (
int index1 = 0; index1 < kNumHsps[index];
291 ++index1, ++hsp_index) {
293 BOOST_REQUIRE_EQUAL(kScores[hsp_index], hsp->
score);
295 BOOST_REQUIRE_EQUAL(kLengths[hsp_index],
299 BOOST_REQUIRE_EQUAL(kTotalHsps, hsp_index);
307 string dbname =
"data/deltatest_nocbs";
309 BOOST_REQUIRE(!freq_file.
Exists());
319 query_v.push_back(*
query);
325 BOOST_REQUIRE_THROW(
CLocalBlast(query_factory, opts, dbinfo),
User-defined methods of the data storage class.
Common definitions for protein and nucleotide lookup tables.
Declares the CBlastRPSOptionsHandle class.
Utility function to convert internal BLAST result structures into objects::CSeq_align_set objects.
@ eRPSBlast
protein-pssm (reverse-position-specific BLAST)
@ eRPSTblastn
nucleotide-pssm (RPS blast with translated query)
Defines BLAST error codes (user errors included)
Wrapper class for BlastHSPResults .
Search class to perform the preliminary stage of the BLAST search.
Handle to the rpsblast options to the BLAST algorithm.
Wrapper class for BlastSeqSrc .
Class to perform a BLAST search on local BLAST databases Note that PHI-BLAST can be run using this cl...
NCBI C++ Object Manager dependant implementation of IQueryFactory.
Handle to the options for translated nucleotide-RPS blast.
Search Results for All Queries.
Tdata::size_type Size() const
static CTestObjMgr & Instance()
void SetCompositionBasedStats(bool mode)
Set composition based statistics mode.
CRef< SInternalData > Run()
Borrow the internal data and results results.
BlastSeqSrc * SeqDbBlastSeqSrcInit(const string &dbname, bool is_prot, Uint4 first_seq=0, Uint4 last_seq=0, Int4 mask_algo_id=-1, ESubjectMaskingType mask_type=eNoSubjMasking)
Initialize the sequence source structure.
CRef< CSearchResultSet > Run()
Executes the search.
static CBlastOptionsHandle * Create(EProgram program, EAPILocality locality=CBlastOptions::eLocal)
Creates an options handle object configured with default options for the requested program,...
CBlastOptions & SetOptions()
Returns a reference to the internal options class which this object is a handle for.
void SetFilterString(const char *f, bool clear=true)
Sets FilterString.
CRef< TBlastHSPStream > m_HspStream
HSP output of the preliminary stage goes here.
BlastHSPResults * ComputeBlastHSPResults(BlastHSPStream *stream, Uint4 max_num_hsps=0, bool *rm_hsps=NULL, vector< bool > *rm_hsps_info=NULL) const
Return HSPs in a structure other than the HSPStream? Provide conversion? How to combine this with CBl...
@ eBlastDbIsProtein
protein
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
virtual bool Exists(void) const
Check existence of file.
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
TObjectType * GetNonNullPointer(void)
Get pointer value and throw a null pointer exception if pointer is null.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
const TStr & GetStr(void) const
Get the variant data.
const TDenseg & GetDenseg(void) const
Get the variant data.
vector< CRef< CSeq_loc > > TLoc
vector< CRef< CScore > > TScore
const TStarts & GetStarts(void) const
Get the Starts member data.
const TLens & GetLens(void) const
Get the Lens member data.
const TStd & GetStd(void) const
Get the variant data.
TInt GetInt(void) const
Get the variant data.
const TValue & GetValue(void) const
Get the Value member data.
bool IsStd(void) const
Check if variant Std is selected.
list< CRef< CSeq_align > > Tdata
const TScore & GetScore(void) const
Get the Score member data.
TReal GetReal(void) const
Get the variant data.
const TId & GetId(void) const
Get the Id member data.
const Tdata & Get(void) const
Get the member data.
const TSegs & GetSegs(void) const
Get the Segs member data.
ENa_strand
strand of nucleic acid
@ eNa_strand_both
in forward orientation
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Main class to perform a BLAST search on the local machine.
Wrapper for all lookup tables used in BLAST.
void CheckForBlastSeqSrcErrors(const BlastSeqSrc *seqsrc)
Magic spell ;-) needed for some weird compilers... very empiric.
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
void testNuclHitList(const CSeq_align_set &results, ENa_strand strand)
BOOST_AUTO_TEST_CASE(WholeSequenceMatch)
Declares the CRPSTBlastnOptionsHandle class.
Implementation of the BlastSeqSrc interface using the C++ BLAST databases API.
vector< SSeqLoc > TSeqLocVector
Vector of sequence locations.
The structure to hold all HSPs for a given sequence after the gapped alignment.
Int4 oid
The ordinal id of the subject sequence this HSP list is for.
Int4 hspcnt
Number of HSPs saved.
BlastHSP ** hsp_array
Array of pointers to individual HSPs.
BlastHitList ** hitlist_array
Array of results for individual query sequences.
Int4 num_queries
Number of query sequences.
Structure holding all information about an HSP.
BlastSeg query
Query sequence info.
Int4 score
This HSP's raw score.
BlastHSPList ** hsplist_array
Array of HSP lists for individual database hits.
Int4 hsplist_count
Filled size of the HSP lists array.
void NuclSearch(ENa_strand strand)
Structure to represent a single sequence to be fed to BLAST.
Utility stuff for more convenient using of Boost.Test library.