;
67 #if ((!defined(NCBI_COMPILER_WORKSHOP) || (NCBI_COMPILER_VERSION > 550)) && \ 68 (!defined(NCBI_COMPILER_MIPSPRO)) ) 105unique_ptr<SSeqLoc> ssl
119BOOST_REQUIRE_EQUAL(0, status);
121query_sequence.
length- 2);
122BOOST_REQUIRE_EQUAL(0, status);
124BOOST_REQUIRE(query_blk !=
NULL);
125BOOST_REQUIRE(query_blk->
sequence[0] != 0);
126BOOST_REQUIRE(query_blk->
sequence[query_blk->
length- 1] != 0);
138 CSeq_idsubject_id(
"gi|7481886");
140unique_ptr<SSeqLoc> subject_ssl
155BOOST_REQUIRE_EQUAL(0, status);
158subj_sequence.
length- 2);
159BOOST_REQUIRE_EQUAL(0, status);
162full_range.
left= 0;
165BOOST_REQUIRE_EQUAL(0, status);
167BOOST_REQUIRE(subject_blk !=
NULL);
168BOOST_REQUIRE(subject_blk->
sequence[0] != 0);
169BOOST_REQUIRE(subject_blk->
sequence[subject_blk->
length- 1] != 0);
178BOOST_REQUIRE_EQUAL(0, status);
184BOOST_REQUIRE_EQUAL(0, status);
189BOOST_REQUIRE_EQUAL(0, status);
199BOOST_REQUIRE_EQUAL(0, status);
204BOOST_REQUIRE(sbp !=
NULL);
207BOOST_REQUIRE_EQUAL(0, status);
220BOOST_REQUIRE_EQUAL(0, status);
229BOOST_REQUIRE(offset_pairs !=
NULL);
245 sfree(offset_pairs);
253 Int4query_length = query_blk->length;
254 Int4subject_length = subject_blk->length;
265BOOST_REQUIRE(scansub !=
NULL);
269scan_range[2] = subject_blk->length - lut->
word_length;
271 while(scan_range[1] < scan_range[2])
273hits = scansub(lookup_wrap_ptr,
299BOOST_REQUIRE(offset_pairs[0].qs_offsets.s_off > s_off);
306 for(
int i= 1;
i< hits;
i++)
308BOOST_REQUIRE(offset_pairs[
i].qs_offsets.q_off <
309(
Uint4)(query_length-2));
310BOOST_REQUIRE(offset_pairs[
i].qs_offsets.s_off <
311(
Uint4)(subject_length-2));
313 if(offset_pairs[
i].qs_offsets.s_off ==
314offset_pairs[
i-1].qs_offsets.s_off)
316BOOST_REQUIRE(offset_pairs[
i].qs_offsets.q_off >
317offset_pairs[
i-1].qs_offsets.q_off);
321BOOST_REQUIRE(offset_pairs[
i].qs_offsets.s_off >
322offset_pairs[
i-1].qs_offsets.s_off);
326s_off = offset_pairs[hits-1].qs_offsets.s_off;
327BOOST_REQUIRE((
Int4)s_off < scan_range[1]);
333 Int4hits, found_hits, expected_hits;
337found_hits = expected_hits = 0;
343BOOST_REQUIRE(scansub !=
NULL);
350scan_range[2] = subject_blk->length - lut->
word_length;
352 while(scan_range[1] < scan_range[2])
354hits = scansub(lookup_wrap_ptr,
361expected_hits += hits;
366scan_range[2] = subject_blk->length - lut->
word_length;
370 while(scan_range[1] < scan_range[2])
372hits = scansub(lookup_wrap_ptr,
377BOOST_REQUIRE(hits <= new_max_size);
381BOOST_REQUIRE_EQUAL(found_hits, expected_hits);
386 Int4subject_length = subject_blk->length;
388 Int4found_hits, expected_hits;
391found_hits = expected_hits = 0;
397BOOST_REQUIRE(scansub !=
NULL);
399 SSeqRangeranges2scan[] = { {0, 501}, {700, 1001}, {subject_length, subject_length} };
400 const size_tkNumRanges = (
sizeof(ranges2scan)/
sizeof(*ranges2scan));
407 while(scan_range[1] < scan_range[2])
409hits = scansub(lookup_wrap_ptr,
419 for(
int i= 0;
i< hits;
i++) {
420 const Uint4s_off = offset_pairs[
i].qs_offsets.s_off;
421 boolhit_found =
FALSE;
422 for(
size_tj = 0; j < kNumRanges; j++) {
423 if( s_off >= (
Uint4)ranges2scan[j].left &&
424s_off < (
Uint4)ranges2scan[j].right ) {
429BOOST_REQUIRE( hit_found );
436 Int4query_length = query_blk->length;
437 Int4subject_length = subject_blk->length;
439 Int4found_hits, expected_hits;
442found_hits = expected_hits = 0;
448BOOST_REQUIRE(scansub !=
NULL);
455scan_range[2] = subject_blk->length - lut->
word_length;
457 while(scan_range[1] < scan_range[2])
459hits = scansub(lookup_wrap_ptr,
468 for(
int i= 0;
i< hits;
i++)
470 Uint1*qres = query_blk->sequence + offset_pairs[
i].qs_offsets.q_off;
472subject_blk->sequence + offset_pairs[
i].qs_offsets.s_off;
473 Int4score = sbp->matrix->data[qres[0]][sres[0]] +
474sbp->matrix->data[qres[1]][sres[1]] +
475sbp->matrix->data[qres[2]][sres[2]];
476 Booleanexact = (sres[0] == qres[0]) &&
477(sres[1] == qres[1]) &&
478(sres[2] == qres[2]);
504 for(
int i= 0;
i< (query_length - 2);
i++)
506 Uint1*w = query_blk->sequence;
507 Uint1*s = subject_blk->sequence;
508 Int4*p0 = sbp->matrix->data[w[
i]];
509 Int4*p1 = sbp->matrix->data[w[
i+1]];
510 Int4*p2 = sbp->matrix->data[w[
i+2]];
512 for(
intj = 0; j < (subject_length - 2); j++)
514 Int4score = p0[s[j]] + p1[s[j+1]] + p2[s[j+2]];
515 Uint1different = (w[
i] ^ s[j]) |
516(w[
i+1] ^ s[j+1]) |
523BOOST_REQUIRE_EQUAL(found_hits, expected_hits);
546unique_ptr<SSeqLoc> ssl
560BOOST_REQUIRE_EQUAL(0, status);
562query_sequence.
length- 2);
563BOOST_REQUIRE_EQUAL(0, status);
572 CSeq_idsubject_id(
"APX54983.1");
574unique_ptr<SSeqLoc> subject_ssl
589BOOST_REQUIRE_EQUAL(0, status);
592subj_sequence.
length- 2);
593BOOST_REQUIRE_EQUAL(0, status);
596full_range.
left= 0;
599BOOST_REQUIRE_EQUAL(0, status);
605BOOST_REQUIRE_EQUAL(0, status);
611BOOST_REQUIRE_EQUAL(0, status);
616BOOST_REQUIRE_EQUAL(0, status);
626BOOST_REQUIRE_EQUAL(0, status);
631BOOST_REQUIRE(sbp !=
NULL);
634BOOST_REQUIRE_EQUAL(0, status);
647BOOST_REQUIRE_EQUAL(0, status);
656BOOST_REQUIRE(offset_pairs !=
NULL);
671 sfree(offset_pairs);
679 Int4query_length = query_blk->length;
680 Int4subject_length = subject_blk->length;
691BOOST_REQUIRE(scansub !=
NULL);
695scan_range[2] = subject_blk->length - lut->
word_length;
697 while(scan_range[1] < scan_range[2])
699hits = scansub(lookup_wrap_ptr,
725BOOST_REQUIRE(offset_pairs[0].qs_offsets.s_off > s_off);
732 for(
int i= 1;
i< hits;
i++)
734BOOST_REQUIRE(offset_pairs[
i].qs_offsets.q_off <
735(
Uint4)(query_length-2));
736BOOST_REQUIRE(offset_pairs[
i].qs_offsets.s_off <
737(
Uint4)(subject_length-2));
739 if(offset_pairs[
i].qs_offsets.s_off ==
740offset_pairs[
i-1].qs_offsets.s_off)
742BOOST_REQUIRE(offset_pairs[
i].qs_offsets.q_off >
743offset_pairs[
i-1].qs_offsets.q_off);
747BOOST_REQUIRE(offset_pairs[
i].qs_offsets.s_off >
748offset_pairs[
i-1].qs_offsets.s_off);
752s_off = offset_pairs[hits-1].qs_offsets.s_off;
753BOOST_REQUIRE((
Int4)s_off < scan_range[1]);
759 Int4query_length = query_blk->length;
760 Int4subject_length = subject_blk->length;
769BOOST_REQUIRE(scansub !=
NULL);
776scan_range[2] = subject_blk->length - lut->
word_length;
778 while(scan_range[1] < scan_range[2])
780hits = scansub(lookup_wrap_ptr, subject_blk, offset_pairs,
GetOffsetArraySize(lookup_wrap_ptr), scan_range);
786BOOST_REQUIRE_EQUAL(found_hits, 2098);
791 Int4subject_length = subject_blk->length;
793 Int4found_hits, expected_hits;
796found_hits = expected_hits = 0;
801BOOST_REQUIRE(scansub !=
NULL);
803 SSeqRangeranges2scan[] = { {0, 501}, {700, 1001}, {subject_length, subject_length} };
804 const size_tkNumRanges = (
sizeof(ranges2scan)/
sizeof(*ranges2scan));
811 while(scan_range[1] < scan_range[2])
813hits = scansub(lookup_wrap_ptr,
823 for(
int i= 0;
i< hits;
i++) {
824 const Uint4s_off = offset_pairs[
i].qs_offsets.s_off;
825 boolhit_found =
FALSE;
826 for(
size_tj = 0; j < kNumRanges; j++) {
827 if( s_off >= (
Uint4)ranges2scan[j].left &&
828s_off < (
Uint4)ranges2scan[j].right ) {
833BOOST_REQUIRE( hit_found );
int compare_offsets(const void *x, const void *y)
BOOST_AUTO_TEST_CASE(ScanOffsetTest)
Declares the CBl2Seq (BLAST 2 Sequences) class.
Routines for creating protein BLAST lookup tables.
Routines for creating protein BLAST lookup tables.
void BlastChooseProteinScanSubject(LookupTableWrap *lookup_wrap)
Choose the most appropriate function to scan through protein subject sequences.
Int4(* TAaScanSubjectFunction)(const LookupTableWrap *lookup_wrap, const BLAST_SequenceBlk *subject, BlastOffsetPair *offset_pairs, Int4 max_hits, Int4 *s_range)
Generic prototype for nucleotide subject scanning routines.
union BlastOffsetPair BlastOffsetPair
This symbol enables the verbose option in makeblastdb and other BLAST+ search command line applicatio...
#define sfree(x)
Safe free a pointer: belongs to a higher level header.
Declarations of static arrays used to define some NCBI encodings to be used in a toolkit independent ...
BlastSeqLoc * BlastSeqLocFree(BlastSeqLoc *loc)
Deallocate all BlastSeqLoc objects in a chain.
BlastSeqLoc * BlastSeqLocNew(BlastSeqLoc **head, Int4 from, Int4 to)
Create and initialize a new sequence interval.
Definitions which are dependant on the NCBI C++ Object Manager.
#define BLAST_GAP_OPEN_PROT
Protein gap costs are the defaults for the BLOSUM62 scoring matrix.
Int2 BLAST_FillScoringOptions(BlastScoringOptions *options, EBlastProgramType program, Boolean greedy_extension, Int4 penalty, Int4 reward, const char *matrix, Int4 gap_open, Int4 gap_extend)
Fill non-default values in the BlastScoringOptions structure.
#define BLAST_GAP_EXTN_PROT
cost to extend a gap.
Int2 BlastScoringOptionsNew(EBlastProgramType program, BlastScoringOptions **options)
Allocate memory for BlastScoringOptions and fill with default values.
Int2 BLAST_FillLookupTableOptions(LookupTableOptions *options, EBlastProgramType program, Boolean is_megablast, double threshold, Int4 word_size)
Allocate memory for lookup table options and fill with default values.
Int2 LookupTableOptionsNew(EBlastProgramType program, LookupTableOptions **options)
Allocate memory for lookup table options and fill with default values.
#define BLAST_WORD_THRESHOLD_BLASTP
neighboring word score thresholds; a threshold of zero means that only query and subject words that m...
@ eAaLookupTable
standard protein (blastp) lookup table
@ eCompressedAaLookupTable
compressed alphabet (blastp) lookup table
BlastScoringOptions * BlastScoringOptionsFree(BlastScoringOptions *options)
Deallocate memory for BlastScoringOptions.
LookupTableOptions * LookupTableOptionsFree(LookupTableOptions *options)
Deallocates memory for LookupTableOptions*.
Utilities initialize/setup BLAST.
Int2 Blast_ScoreBlkMatrixInit(EBlastProgramType program_number, const BlastScoringOptions *scoring_options, BlastScoreBlk *sbp, GET_MATRIX_PATH get_path)
Initializes the substitution matrix in the BlastScoreBlk according to the scoring options specified.
Definitions and prototypes used by blast_stat.c to calculate BLAST statistics.
BlastScoreBlk * BlastScoreBlkFree(BlastScoreBlk *sbp)
Deallocates BlastScoreBlk as well as all associated structures.
BlastScoreBlk * BlastScoreBlkNew(Uint1 alphabet, Int4 number_of_contexts)
Allocates and initializes BlastScoreBlk.
BLAST_SequenceBlk * BlastSequenceBlkFree(BLAST_SequenceBlk *seq_blk)
Deallocate memory for a sequence block.
Int2 BlastSeqBlkSetSeqRanges(BLAST_SequenceBlk *seq_blk, SSeqRange *seq_ranges, Uint4 num_seq_ranges, Boolean copy_seq_ranges, ESubjectMaskingType mask_type)
Sets the seq_range and related fields appropriately in the BLAST_SequenceBlk structure.
Int2 BlastSeqBlkSetSequence(BLAST_SequenceBlk *seq_blk, const Uint1 *sequence, Int4 seqlen)
Stores the sequence in the sequence block structure.
Int2 BlastSeqBlkNew(BLAST_SequenceBlk **retval)
Allocates a new sequence block structure.
BOOST_AUTO_TEST_SUITE_END() static int s_GetSegmentFlags(const CBioseq &bioseq)
static CTestObjMgr & Instance()
TSeqPos length
Length of the buffer above (not necessarily sequence length!)
#define BLASTAA_SEQ_CODE
== Seq_code_ncbistdaa
TAutoUint1Ptr data
Sequence data.
char * BlastFindMatrixPath(const char *matrix_name, Boolean is_prot)
Returns the path to a specified matrix.
SBlastSequence GetSequence(const objects::CSeq_loc &sl, EBlastEncoding encoding, objects::CScope *scope, objects::ENa_strand strand=objects::eNa_strand_plus, ESentinelType sentinel=eSentinels, std::string *warnings=NULL)
Retrieves a sequence using the object manager.
@ eBlastEncodingProtein
NCBIstdaa.
@ eNoSentinels
Do not use sentinel bytes.
element_type * release(void)
Release will release ownership of pointer to caller.
uint8_t Uint1
1-byte (8-bit) unsigned integer
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
Utility functions for lookup table generation.
Int4 GetOffsetArraySize(LookupTableWrap *lookup)
Determine the size of the offsets arrays to be filled by the ScanSubject function.
LookupTableWrap * LookupTableWrapFree(LookupTableWrap *lookup)
Deallocate memory for the lookup table.
Int2 LookupTableWrapInit(BLAST_SequenceBlk *query, const LookupTableOptions *lookup_options, const QuerySetUpOptions *query_options, BlastSeqLoc *lookup_segments, BlastScoreBlk *sbp, LookupTableWrap **lookup_wrap_ptr, const BlastRPSInfo *rps_info, Blast_Message **error_msg, BlastSeqSrc *seqsrc)
Create the lookup table for all query words.
Magic spell ;-) needed for some weird compilers... very empiric.
Uint1 Boolean
bool replacment for C
#define TRUE
bool replacment for C indicating true.
#define FALSE
bool replacment for C indicating false.
#define MAX(a, b)
returns larger of a and b.
Defines: CTimeFormat - storage class for time format.
The test fixture to use for all test cases in this file.
LookupTableWrap * lookup_wrap_ptr
BlastScoringOptions * score_options
BLAST_SequenceBlk * subject_blk
BlastOffsetPair * offset_pairs
BLAST_SequenceBlk * query_blk
LookupTableOptions * lookup_options
Structure to hold a sequence.
Uint1 * sequence_start
Start of sequence, usually one byte before sequence as that byte is a NULL sentinel byte.
Uint4 num_seq_ranges
Number of elements in seq_ranges.
Int4 length
Length of sequence.
Uint1 * sequence
Sequence used for search (could be translation).
The basic lookup table structure for blastp searches.
void * scansub_callback
function for scanning subject sequences
Int4 word_length
Length in letters of the full word match required to trigger extension.
The lookup table structure for protein searches using a compressed alphabet.
void * scansub_callback
function for scanning subject sequences
Int4 word_length
Length in letters of the full word match required to trigger extension.
Structure used for scoring calculations.
Scoring options block Used to produce the BlastScoreBlk structure This structure may be needed for lo...
Used to hold a set of positions, mostly used for filtering.
BlastScoringOptions * score_options
LookupTableOptions * lookup_options
BLAST_SequenceBlk * subject_blk
CompressedAascanTestFixture()
~CompressedAascanTestFixture()
BLAST_SequenceBlk * query_blk
BlastOffsetPair * offset_pairs
LookupTableWrap * lookup_wrap_ptr
Options needed to construct a lookup table Also needed: query sequence and query length.
Wrapper structure for different types of BLAST lookup tables.
Structure to store sequence data and its length for use in the CORE of BLAST (it's a malloc'ed array ...
A structure containing two integers, used e.g.
Int4 left
left endpoint of range (zero based)
Int4 right
right endpoint of range (zero based)
Utility stuff for more convenient using of Boost.Test library.
This symbol enables the verbose option in makeblastdb and other BLAST+ search command line applicatio...
Uint4 q_off
Query offset.
Uint4 s_off
Subject offset.
struct BlastOffsetPair::@6 qs_offsets
Query/subject offset pair.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4