/usr/include/kmer/seq/merStream.H is in libkmer-dev 0~20150903+r2013-3.
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 | #ifndef MERSTREAM_H
#define MERSTREAM_H
#include "util++.H"
#include "bio++.H"
#include "seqFile.H"
#include "seqStream.H"
//
// merStream needs exclusive use of a kMerBuilder and a seqStream.
//
// The kMerBuilder can be used over and over. I think snapper is the
// only one that does this though.
//
// The seqStream can be used elsewhere, but ONLY for looking up
// positions.
//
// The merStream does NOT assume ownership of either of these, unless
// the own flags are set.
//
// The stream is not valid until nextMer is called; allowing loops of
// while (MS->nextMer()) {
// process(MS->theFMer());
// }
//
// setRange() positions refer to ACGT letters in the input, NOT mers.
// rewind() repositions the file to the start of the range.
//
class merStream {
public:
merStream(kMerBuilder *kb, seqStream *ss, bool kbown=false, bool ssown=false);
~merStream();
kMer const & theFMer(void) { assert(_invalid == false); return(_kb->theFMer()); };
kMer const & theRMer(void) { assert(_invalid == false); return(_kb->theRMer()); };
kMer const & theCMer(void) { assert(_invalid == false); return(_kb->theCMer()); };
bool nextMer(uint32 skip=0) {
char ch;
do {
ch = _ss->get();
if (ch == 0)
return(false);
} while ((_kb->addBase(ch) == true) || (skip-- > 0));
_kb->mask();
_invalid = false;
#if 0
char merstring[256];
fprintf(stderr, "merStream::nextMer()-- seqPos="uint64FMT" merPos="uint64FMT" span="uint32FMT" base0span="uint32FMT" end="uint64FMT" %s %s\n",
_ss->strPos(),
_ss->strPos() - theFMer().getMerSpan(),
theFMer().getMerSpan(),
_kb->baseSpan(0),
_end,
_kb->theFMer().merToString(merstring),
(_ss->strPos() - theFMer().getMerSpan() < _end) ? "" : "STOP");
#endif
// The mer is out of range if:
// o it begins at or past the _end
// o the span of the first base ends at or past the _end
//
// If the mer isn't spaced, the base span is always 1. If it is spaced, the span will be
// between 1 and ... who knows.
return(_ss->strPos() - theFMer().getMerSpan() + _kb->baseSpan(0) - 1 < _end);
};
void rewind(void);
void rebuild(void);
void setBaseRange(uint64 beg, uint64 end);
uint64 thePositionInSequence(void) { assert(_invalid == false); return(_ss->seqPos() - theFMer().getMerSpan()); };
uint64 thePositionInStream(void) { assert(_invalid == false); return(_ss->strPos() - theFMer().getMerSpan()); };
uint64 theSequenceNumber(void) { assert(_invalid == false); return(_ss->seqIID()); };
uint64 approximateNumberOfMers(void);
private:
kMerBuilder *_kb;
seqStream *_ss;
bool _kbdelete;
bool _ssdelete;
bool _invalid;
uint64 _beg;
uint64 _end;
};
#endif // MERSTREAM_H
|