This file is indexed.

/usr/include/pbseq/alignment/tuples/TupleCountTableImpl.hpp is in libblasr-dev 0~20161219-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
#ifndef _BLASR_TUPLE_COUNT_TABLE_IMPL_HPP_
#define _BLASR_TUPLE_COUNT_TABLE_IMPL_HPP_
#include "../../pbdata/utils.hpp"

using namespace std;

template<typename TSequence, typename TTuple>
void TupleCountTable<TSequence, TTuple>::InitCountTable(TupleMetrics &ptm) {
    Free();
    tm = ptm;
    tm.InitializeMask();
    assert(tm.tupleSize > 0);
    // create the mask just in case the ptm is not initialized 
    // properly.
    countTableLength = 4;
    countTableLength = countTableLength << ((tm.tupleSize - 1)*2);

    assert(countTableLength > 0);
    countTable = ProtectedNew<int>(countTableLength);
    deleteStructures = true;
    fill(&countTable[0], &countTable[countTableLength], 0);
    nTuples = 0;
}


template<typename TSequence, typename TTuple>
TupleCountTable<TSequence, TTuple>::TupleCountTable() {
    countTable = NULL;
    countTableLength = 0;
    nTuples = 0;
    deleteStructures = false;
}


template<typename TSequence, typename TTuple>
TupleCountTable<TSequence, TTuple>::~TupleCountTable() {
    Free();
}

template<typename TSequence, typename TTuple>
void TupleCountTable<TSequence, TTuple>::Free() {
    if (deleteStructures == false) {
        //
        // Do not delete this if it is referencing another structure
        //
        return;
    }
    if (countTable != NULL) {
        delete [] countTable;
        countTable = NULL;
    }
    countTableLength = nTuples = 0;
}


template<typename TSequence, typename TTuple>
void TupleCountTable<TSequence, TTuple>::IncrementCount(
    TTuple &tuple) {
    TupleData tupleIndex = TupleData(tuple.tuple);
    assert(tupleIndex < countTableLength);
    countTable[tupleIndex]++;
    ++nTuples;
}


template<typename TSequence, typename TTuple>
void TupleCountTable<TSequence, TTuple>::AddSequenceTupleCountsLR(
    TSequence &seq) {
    VectorIndex i;
    TTuple tuple;
    if (seq.length >= static_cast<DNALength>(tm.tupleSize)) {
        for (i = 0; i < seq.length - tm.tupleSize + 1; i++ ) { 
            if (tuple.FromStringLR(&seq.seq[i], tm)) {
                IncrementCount(tuple);
            }
        }
    }
}


template<typename TSequence, typename TTuple>
void TupleCountTable<TSequence, TTuple>::Write(ofstream &out) {
    out.write((char*) &countTableLength, sizeof(int));
    out.write((char*) &nTuples, sizeof(int));
    out.write((char*) &tm.tupleSize, sizeof(int));
    out.write((char*) countTable, sizeof(int) * countTableLength);
}


template<typename TSequence, typename TTuple>
void TupleCountTable<TSequence, TTuple>::Read(ifstream &in) {
    Free(); // Clear before reusing this object.
    in.read((char*) &countTableLength, sizeof(int));
    in.read((char*) &nTuples, sizeof(int));
    in.read((char*) &tm.tupleSize, sizeof(int));
    tm.InitializeMask();
    countTable = ProtectedNew<int>(countTableLength);
    deleteStructures = true;
    in.read((char*) countTable, sizeof(int) * countTableLength);
}

#endif