/usr/include/pbseq/alignment/tuples/CompressedDNATuple.hpp is in libblasr-dev 0~20161219-1.
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 | #ifndef _BLASR_COMPRESSED_DNA_TUPLE_HPP_
#define _BLASR_COMPRESSED_DNA_TUPLE_HPP_
#include "DNATuple.hpp"
#include "../../pbdata/CompressedSequence.hpp"
template<typename T_Sequence>
class CompressedDNATuple : public DNATuple {
static const unsigned char mask = 0xf;
public:
CompressedDNATuple(const CompressedDNATuple & rhs)
: DNATuple(rhs) { }
int FromStringLR(Nucleotide *strPtr, TupleMetrics &tm) {
//
// Make sure the sequence contains all valid characters.
//
if (!CompressedSequence<T_Sequence>::Only4BitACTG(strPtr, tm.tupleSize))
return 0;
if (tm.tupleSize == 0)
return 1;
tuple = 0;
Nucleotide *p;
Nucleotide *endPtr = &strPtr[tm.tupleSize - 1];
for (p = strPtr; p != endPtr; p++) {
tuple += TwoBit[*p & mask];
tuple <<=2;
}
//
// The tuple size is guaranteed to be at least
// 1, so it's safe to add the last value.
// This cannot be in the previous loop since
// the shift shouldn't happen.
tuple += TwoBit[*p & mask];
return 1;
}
int FromStringRL(Nucleotide *strPtr, TupleMetrics &tm) {
if (!CompressedSequence<T_Sequence>::Only4BitACTG((CompressedNucleotide*)strPtr, tm.tupleSize))
return 0;
if (tm.tupleSize == 0)
return 1;
tuple = 0;
Nucleotide *p;
for (p = strPtr + tm.tupleSize - 1; p > strPtr; p--) {
tuple += TwoBit[*p & mask];
tuple <<=2;
}
//
// The tuple size is guaranteed to be at least
// 1, so it's safe to add the last value.
// This cannot be in the previous loop since
// the shift shouldn't happen.
tuple += TwoBit[*p & mask];
return 1;
}
};
#endif // _BLASR_COMPRESSED_DNA_TUPLE_HPP_
|