/usr/include/blasr/tuples/HashedTupleListImpl.hpp is in libblasr-dev 0~20151014+gitbe5d1bf-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | #ifndef _BLASR_HASHED_TUPLE_LIST_IMPL_HPP_
#define _BLASR_HASHED_TUPLE_LIST_IMPL_HPP_
template<typename T_Tuple>
HashedTupleList<T_Tuple>::
HashedTupleList() {
Initialize(5);
}
template<typename T_Tuple>
HashedTupleList<T_Tuple>::
HashedTupleList(int _hashLength) {
Initialize(_hashLength);
cout << hashTable.size() << endl;
}
template<typename T_Tuple>
void HashedTupleList<T_Tuple>::
Initialize(int _hashLength) {
mask = 0;
int i;
hashLength = _hashLength;
hashTable.resize(1L << (hashLength*2));
hashTableLength = hashTable.size();
for (i = 0; i < hashLength; i++ ){
mask = mask << 2L;
mask = mask + 3L;
}
}
template<typename T_Tuple>
void HashedTupleList<T_Tuple>::
clear() {
// Synonym.
Clear();
}
template<typename T_Tuple>
void HashedTupleList<T_Tuple>::
Clear() {
int i;
for (i = 0; i < hashTableLength; i++ ){
hashTable[i].tupleList.clear();
}
}
template<typename T_Tuple>
void HashedTupleList<T_Tuple>::
Sort() {
int i;
for (i = 0; i < hashTableLength; i++ ){
sort(hashTable[i].tupleList.begin(),
hashTable[i].tupleList.end());
}
}
template<typename T_Tuple>
void HashedTupleList<T_Tuple>::
Append(T_Tuple tuple) {
int hashValue = tuple.tuple & mask;
std::cout << "htl adding " << tuple.tuple << std::endl;
hashTable[hashValue].tupleList.push_back(tuple);
}
template<typename T_Tuple>
void HashedTupleList<T_Tuple>::
Insert(T_Tuple tuple) {
std::cout << "htl adding " << tuple.tuple << std::endl;
int hashValue = tuple.tuple & mask;
hashTable[hashValue].Insert(tuple);
}
template<typename T_Tuple>
int HashedTupleList<T_Tuple>::
Find(T_Tuple tuple) {
int hashValue, index;
return Find(tuple, hashValue, index);
}
template<typename T_Tuple>
void HashedTupleList<T_Tuple>::
Print() {
int i;
for (i = 0; i < hashTableLength; i++ ){
hashTable[i].Print();
}
}
//
// Provide a version of find that stores easy access to
// the original tuple.
//
template<typename T_Tuple>
int HashedTupleList<T_Tuple>::
Find(T_Tuple tuple, int &hashValue, int &index) {
hashValue = tuple.tuple & mask;
if (hashTable[hashValue].size()) {
return ((index = hashTable[hashValue].Find(tuple)) != -1);
}
else {
return 0;
}
}
template<typename T_Tuple>
void HashedTupleList<T_Tuple>::
FindAll(T_Tuple &tuple,
typename vector<T_Tuple>::const_iterator &firstPos,
typename vector<T_Tuple>::const_iterator &endPos ) {
int hashValue;
hashValue = tuple.tuple & mask;
hashTable[hashValue].FindAll(tuple, firstPos, endPos);
}
template<typename T_Tuple>
int HashedTupleList<T_Tuple>::
GetHashLength() {
return hashLength;
}
template<typename T_Tuple>
void SequenceToHash(DNASequence &seq, HashedTupleList<T_Tuple> &hash,
TupleMetrics &tm) {
int i;
T_Tuple tuple;
int res = 0;
for (i = 0; i < seq.length - hash.hashLength + 1; i++ ) {
if ((res and
(res = tuple.ShiftAddRL(seq.seq[i+tm.tupleSize-1], tm))) or
(!res and (res = tuple.FromStringRL(&seq.seq[i], tm)))) {
hash.Insert(tuple);
}
}
}
#endif
|