NCBI C++ ToolKit
Classes | Functions | Variables
TestUtil Namespace Reference

Classes

struct  CRandomIntGen
 
class  CBlastOM
 Class which registers the BLAST database and Genbank data loaders as a non-default data loaders with the object manager upon construction. More...
 

Functions

objects::CSeq_id * GenerateRandomSeqid_Gi ()
 
vector< EBlastProgramTypeGetAllBlastProgramTypes ()
 
CRef< CSeq_align_setFlattenSeqAlignSet (const CSeq_align_set &sset)
 
void PrintSequence (const Uint1 *seq, TSeqPos len, ostream &out, bool show_markers, TSeqPos chars_per_line)
 
void PrintSequence (const CSeqVector svector, ostream &out, bool show_markers, TSeqPos chars_per_line)
 
char GetResidue (unsigned int res)
 Returns character representation of a residue from ncbistdaa. More...
 
BlastQueryInfoCreateProtQueryInfo (unsigned int query_size)
 Creates and initializes a BlastQueryInfo structure for a single protein sequence. More...
 
void CheckForBlastSeqSrcErrors (const BlastSeqSrc *seqsrc)
 
Uint4 EndianIndependentBufferHash (const char *buffer, Uint4 byte_length, Uint4 swap_size=1, Uint4 hash_seed=1)
 Endianness independent hash function. More...
 
template<class T >
ncbi::CRef< TReadObject (const std::string &filename)
 
ncbi::CRef< ncbi::objects::CSeq_align_set > FlattenSeqAlignSet (const ncbi::objects::CSeq_align_set &sset)
 Converts bl2seq and blast style seq-align-sets to the seq-align-set format that the new formatter understands (same flat format as C toolkit seq-aligns) More...
 
void PrintSequence (const ncbi::objects::CSeqVector &svector, std::ostream &out, bool show_markers=true, ncbi::TSeqPos chars_per_line=80)
 
void PrintFormattedSeqAlign (ostream &out, const CSeq_align_set *sas, CScope &scope)
 
template<class T >
void PrintTextAsn1Object (std::string filename, T *obj)
 Convenience template function to print ASN.1 objects to a new file. More...
 
void PrintFormattedSeqAlign (std::ostream &out, const ncbi::objects::CSeq_align_set *sas, ncbi::objects::CScope &scope)
 Assumes that the sas argument is a bl2seq and blast style seq-align-set. More...
 

Variables

template<class T >
void CheckForBlastSeqSrcErrors(const BlastSeqSrc *seqsrc) THROWS((ncbi voi PrintTextAsn1Object )(std::string filename, T *obj)
 Convenience template function to print ASN.1 objects to a new file. More...
 

Function Documentation

◆ CheckForBlastSeqSrcErrors()

void TestUtil::CheckForBlastSeqSrcErrors ( const BlastSeqSrc seqsrc)

◆ CreateProtQueryInfo()

BlastQueryInfo * TestUtil::CreateProtQueryInfo ( unsigned int  query_size)

Creates and initializes a BlastQueryInfo structure for a single protein sequence.

Definition at line 215 of file blast_test_util.cpp.

References BlastQueryInfoNew(), BlastQueryInfo::contexts, eBlastTypeBlastp, BlastQueryInfo::max_length, NULL, and BlastContextInfo::query_length.

Referenced by InitializeBlastScoreBlk().

◆ EndianIndependentBufferHash()

Uint4 TestUtil::EndianIndependentBufferHash ( const char *  buffer,
Uint4  byte_length,
Uint4  swap_size = 1,
Uint4  hash_seed = 1 
)

Endianness independent hash function.

This function computes a hash value for an array of any primitive type. The hash assumes the data is the array is in "host" order with respect to endianness and should produce the same value on any platform for the same numerical values of the array elements.

The algorithm attempts to be robust against changes in values in the array, the length of the array, zeroes appended to the array), and will not normally be fooled by naturally occurring patterns in the buffer. 9However, it is not intended to be secure against deliberate attempts to produce a collision).

The size of an element of the array must be uniform and is specified as an argument to the function. It must exactly divide the byte length of the array. If the size element is specified as 1, no swapping will be done. This can be used to hash a string.

Parameters
bufferPoints to the beginning of the array.
byte_lengthThe length of the array in bytes.
swap_sizeThe size of one array element (specify 1 to disable swapping).
hash_seed.The starting value of the hash.

Definition at line 242 of file blast_test_util.cpp.

References _ASSERT, buffer, end_bytes, end_value, and int.

Referenced by BOOST_AUTO_TEST_CASE().

◆ FlattenSeqAlignSet() [1/2]

CRef< CSeq_align_set > TestUtil::FlattenSeqAlignSet ( const CSeq_align_set sset)

◆ FlattenSeqAlignSet() [2/2]

ncbi::CRef< ncbi::objects::CSeq_align_set > TestUtil::FlattenSeqAlignSet ( const ncbi::objects::CSeq_align_set &  sset)

Converts bl2seq and blast style seq-align-sets to the seq-align-set format that the new formatter understands (same flat format as C toolkit seq-aligns)

◆ GenerateRandomSeqid_Gi()

ncbi::objects::CSeq_id * TestUtil::GenerateRandomSeqid_Gi ( )

Definition at line 70 of file blast_test_util.cpp.

References CSeq_id_Base::e_Gi, and CRandom::GetRand().

Referenced by x_TestGetSeqLocInfoVector().

◆ GetAllBlastProgramTypes()

std::vector< EBlastProgramType > TestUtil::GetAllBlastProgramTypes ( )

◆ GetResidue()

char TestUtil::GetResidue ( unsigned int  res)

Returns character representation of a residue from ncbistdaa.

Definition at line 203 of file blast_test_util.cpp.

References BLASTAA_SIZE, and NCBISTDAA_TO_AMINOACID.

Referenced by BOOST_AUTO_TEST_CASE().

◆ PrintFormattedSeqAlign() [1/2]

void TestUtil::PrintFormattedSeqAlign ( ostream &  out,
const CSeq_align_set sas,
CScope scope 
)

◆ PrintFormattedSeqAlign() [2/2]

void TestUtil::PrintFormattedSeqAlign ( std::ostream &  out,
const ncbi::objects::CSeq_align_set *  sas,
ncbi::objects::CScope &  scope 
)

Assumes that the sas argument is a bl2seq and blast style seq-align-set.

◆ PrintSequence() [1/3]

void TestUtil::PrintSequence ( const CSeqVector  svector,
ostream &  out,
bool  show_markers,
TSeqPos  chars_per_line 
)

Definition at line 169 of file blast_test_util.cpp.

References GetResidue(), i, out(), and bm::sparse_vector< Val, BV >::size().

◆ PrintSequence() [2/3]

void TestUtil::PrintSequence ( const ncbi::objects::CSeqVector &  svector,
std::ostream &  out,
bool  show_markers = true,
ncbi::TSeqPos  chars_per_line = 80 
)

◆ PrintSequence() [3/3]

void TestUtil::PrintSequence ( const Uint1 seq,
TSeqPos  len,
ostream &  out,
bool  show_markers,
TSeqPos  chars_per_line 
)

Definition at line 135 of file blast_test_util.cpp.

References GetResidue(), i, len, and out().

◆ PrintTextAsn1Object()

template<class T >
void TestUtil::PrintTextAsn1Object ( std::string  filename,
T obj 
)

Convenience template function to print ASN.1 objects to a new file.

Definition at line 115 of file blast_test_util.hpp.

References MSerial_AsnText, and out().

◆ ReadObject()

template<class T >
ncbi::CRef< T > TestUtil::ReadObject ( const std::string filename)

Definition at line 81 of file blast_test_util.hpp.

References in(), MSerial_AsnBinary, MSerial_AsnText, MSerial_Xml, and T.

Variable Documentation

◆ PrintTextAsn1Object

template<class T >
void CheckForBlastSeqSrcErrors (const BlastSeqSrc* seqsrc) THROWS((ncbi voi TestUtil::PrintTextAsn1Object) (std::string filename, T *obj) ( std::string  filename,
T obj 
)

Convenience template function to print ASN.1 objects to a new file.

Definition at line 109 of file blast_test_util.hpp.

Modified on Fri Jul 19 17:13:58 2024 by modify_doxy.py rev. 669887