NCBI C++ ToolKit
seq_masker_util.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: seq_masker_util.hpp 33815 2007-05-04 17:18:18Z kazimird $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Aleksandr Morgulis
27  *
28  * File Description:
29  * Header file for CSeqMaskerUtil class.
30  *
31  */
32 
33 #ifndef C_SEQ_MASKER_UTIL_H
34 #define C_SEQ_MASKER_UTIL_H
35 
36 #include <corelib/ncbistd.hpp>
37 
39 
40 
41 /**
42  **\brief Collection of various support utilities.
43  **
44  ** This class is used as a namespace for different utility
45  ** functions that can be used by other winmasker classes.
46  **
47  **/
49 {
50 public:
51 
52  /**
53  **\brief Count the bits with given value in a given bit pattern.
54  **
55  **\param mask the bit pattern
56  **\param bit_value if 0 then 0-bits will be counted;
57  ** otherwise 1-bits will be counted
58  **\return the bit count
59  **
60  **/
61  static Uint1 BitCount( Uint4 mask, Uint1 bit_value = 1 );
62 
63  /**
64  **\brief Reverse complement of a unit.
65  **
66  **\param seq the unit
67  **\param size the unit length
68  **\return the reverse complement of seq
69  **
70  **/
71  static Uint4 reverse_complement( Uint4 seq, Uint1 size );
72 
73  /**
74  **\brief Compute a hash code of a unit.
75  **\param unit the target unit
76  **\param k length (int bits) of the hash key
77  **\param roff offset in bits from the right end of the unit
78  **\return the hash code and concatenation of high and
79  ** low remaining bits
80  **/
81  static pair< Uint4, Uint1 > hash_code( Uint4 unit,
82  Uint1 k, Uint1 roff )
83  {
84  return make_pair( (unit>>roff)&((((Uint4)1)<<k) - 1),
85  (Uint1)(((unit>>(roff + k))<<roff)
86  + (unit&((1<<roff) - 1))) );
87  }
88 };
89 
91 
92 #endif
ncbi::TMaskedQueryRegions mask
Collection of various support utilities.
static pair< Uint4, Uint1 > hash_code(Uint4 unit, Uint1 k, Uint1 roff)
Compute a hash code of a unit.
Include a standard set of the NCBI C++ Toolkit most basic headers.
uint8_t Uint1
1-byte (8-bit) unsigned integer
Definition: ncbitype.h:99
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_XALGOWINMASK_EXPORT
Definition: ncbi_export.h:1033
const struct ncbi::grid::netcache::search::fields::SIZE size
static Uint4 reverse_complement(Uint4 seq, Uint1 size)
Modified on Fri Sep 20 14:58:11 2024 by modify_doxy.py rev. 669887