60 const int kNumQueries = 10;
61 const int kNumThreads = 40;
62 int num_hsp_lists = 1000;
64 int num_reads=0, num_hsps=0;
65 int status, write_status=0;
69 const bool kIsGapped =
true;
88 BOOST_REQUIRE(writer_info ==
NULL);
96 BOOST_REQUIRE(scoring_options ==
NULL);
98 BOOST_REQUIRE(ext_options ==
NULL);
100 num_reads = kNumQueries;
114 vector<CRef<CHspStreamWriteThread> > write_thread_v;
115 write_thread_v.reserve(kNumThreads);
118 for (index = 0; index < kNumThreads; ++index) {
121 num_hsp_lists, kNumQueries));
122 write_thread_v.push_back(write_thread);
126 for (index = 0; index < kNumThreads; ++index) {
127 write_thread_v[index]->Join();
136 for (index = 0; index < num_hsp_lists*num_reads; ++index) {
139 BOOST_REQUIRE(hsp_list->
oid >= last_oid);
140 last_oid = hsp_list->
oid;
141 BOOST_REQUIRE_EQUAL(num_hsps, hsp_list->
hspcnt);
143 BOOST_REQUIRE(hsp_list ==
NULL);
149 BOOST_REQUIRE_EQUAL(write_status, status);
155 BOOST_REQUIRE(hsp_list ==
NULL);
166 BOOST_REQUIRE(hsp_list ==
NULL);
168 BOOST_REQUIRE(hsp_stream ==
NULL);
170 BOOST_REQUIRE(hit_options ==
NULL);
182 const int kNumSubjects = 10;
201 BOOST_REQUIRE(writer_info ==
NULL);
204 kProgram, ext_options,
FALSE, 1, writer);
207 BOOST_REQUIRE(scoring_options ==
NULL);
209 BOOST_REQUIRE(ext_options ==
NULL);
214 for (index = 1; index < kNumSubjects; index += 2) {
221 for (index = 1; index < kNumSubjects; index += 2) {
227 BOOST_REQUIRE_EQUAL(index, (
int)hsp_list->
oid);
232 BOOST_REQUIRE(hsp_list ==
NULL);
234 BOOST_REQUIRE(hsp_stream ==
NULL);
237 BOOST_REQUIRE(hit_options ==
NULL);
BlastHSPResults * Blast_HSPResultsFree(BlastHSPResults *results)
Deallocate memory for BLAST results.
Int2 Blast_HSPResultsInsertHSPList(BlastHSPResults *results, BlastHSPList *hsp_list, Int4 hitlist_size)
Blast_HSPResultsInsertHSPList Insert an HSP list to the appropriate place in the results structure.
BlastHSPList * Blast_HSPListNew(Int4 hsp_max)
Creates HSP list structure with a default size HSP array.
BlastHSPResults * Blast_HSPResultsNew(Int4 num_queries)
Initialize the results structure.
BlastHSPList * Blast_HSPListFree(BlastHSPList *hsp_list)
Deallocate memory for an HSP list structure as well as all it's components.
BlastHSPWriter * BlastHSPWriterNew(BlastHSPWriterInfo **writer_info, BlastQueryInfo *query_info, BLAST_SequenceBlk *query)
A generic function to create writer.
Declaration of ADT to save and retrieve lists of HSPs in the BLAST engine.
void BlastHSPStreamClose(BlastHSPStream *hsp_stream)
Closes the BlastHSPStream structure for writing.
int BlastHSPStreamWrite(BlastHSPStream *hsp_stream, BlastHSPList **hsp_list)
Invokes the user-specified write function for this BlastHSPStream implementation.
BlastHSPStream * BlastHSPStreamFree(BlastHSPStream *hsp_stream)
Frees the BlastHSPStream structure by invoking the destructor function set by the user-defined constr...
BlastHSPStream * BlastHSPStreamNew(EBlastProgramType program, const BlastExtensionOptions *extn_opts, Boolean sort_on_read, Int4 num_queries, BlastHSPWriter *writer)
Initialize the HSP stream.
const int kBlastHSPStream_Eof
Return value when the end of the stream is reached (applicable to read method only)
int BlastHSPStreamRegisterMTLock(BlastHSPStream *hsp_stream, MT_LOCK lock)
Attach a mutex lock to a stream to protect multiple access during writing.
const int kBlastHSPStream_Success
Standard success return value for BlastHSPStream methods.
int BlastHSPStreamRead(BlastHSPStream *hsp_stream, BlastHSPList **hsp_list)
Invokes the user-specified read function for this BlastHSPStream implementation.
const int kBlastHSPStream_Error
Standard error return value for BlastHSPStream methods.
C++ version of the initialization for the mutex locking interface.
BlastHitSavingOptions * BlastHitSavingOptionsFree(BlastHitSavingOptions *options)
Deallocate memory for BlastHitSavingOptions.
Int2 BlastScoringOptionsNew(EBlastProgramType program, BlastScoringOptions **options)
Allocate memory for BlastScoringOptions and fill with default values.
BlastExtensionOptions * BlastExtensionOptionsFree(BlastExtensionOptions *options)
Deallocate memory for BlastExtensionOptions.
Int2 BlastHitSavingOptionsNew(EBlastProgramType program, BlastHitSavingOptions **options, Boolean gapped_calculation)
Allocate memory for BlastHitSavingOptions.
BlastScoringOptions * BlastScoringOptionsFree(BlastScoringOptions *options)
Deallocate memory for BlastScoringOptions.
Int2 BlastExtensionOptionsNew(EBlastProgramType program, BlastExtensionOptions **options, Boolean gapped)
Allocate memory for BlastExtensionOptions and fill with default values.
EBlastProgramType
Defines the engine's notion of the different applications of the BLAST algorithm.
void setupHSPList(BlastHSPList **hsp_list_ptr, int chunk)
MT_LOCK Blast_CMT_LOCKInit(void)
Initialize a mutex locking mechanism for BLAST.
int32_t Int4
4-byte (32-bit) signed integer
Implementation of a number of BlastHSPWriters to save hits from a BLAST search, and subsequently retu...
BlastHSPCollectorParams * BlastHSPCollectorParamsNew(const BlastHitSavingOptions *hit_options, Int4 compositionBasedStats, Boolean gapped_calculation)
Sets up parameter set for use by collector.
BlastHSPWriterInfo * BlastHSPCollectorInfoNew(BlastHSPCollectorParams *params)
WriterInfo to create a default writer: the collecter.
Auxiliary utilities needed for testing HSP stream interface.
BOOST_AUTO_TEST_CASE(testCollectorHSPStream)
void testHSPStream(EHSPStreamType stream_type)
Magic spell ;-) needed for some weird compilers... very empiric.
#define MIN(a, b)
returns smaller of a and b.
#define TRUE
bool replacment for C indicating true.
#define FALSE
bool replacment for C indicating false.
BOOST_AUTO_TEST_SUITE(psiblast_iteration)
Options used for gapped extension These include: a.
Int4 compositionBasedStats
mode of compositional adjustment to use; if zero then compositional adjustment is not used
Keeps prelim_hitlist_size and HitSavingOptions together.
Int4 prelim_hitlist_size
number of hits saved during preliminary part of search.
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.
The structure to contain all BLAST results, for multiple queries.
Default implementation of BlastHSPStream.
A wrap of data structure used to create a writer.
ADT definition of BlastHSPWriter.
Options used when evaluating and saving hits These include: a.
Scoring options block Used to produce the BlastScoreBlk structure This structure may be needed for lo...
Boolean gapped_calculation
gap-free search if FALSE
Utility stuff for more convenient using of Boost.Test library.