/usr/include/fastahack/Region.h is in libfastahack-dev 0.0+20160702-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 | #ifndef FASTA_REGION_H
#define FASTA_REGION_H
#include <string>
#include <stdlib.h>
using namespace std;
class FastaRegion {
public:
string startSeq;
int startPos;
int stopPos;
FastaRegion(string& region) {
startPos = -1;
stopPos = -1;
size_t foundFirstColon = region.find(":");
// we only have a single string, use the whole sequence as the target
if (foundFirstColon == string::npos) {
startSeq = region;
} else {
startSeq = region.substr(0, foundFirstColon);
size_t foundRangeDots = region.find("..", foundFirstColon);
size_t foundRangeDash = region.find("-", foundFirstColon);
if (foundRangeDots == string::npos && foundRangeDash == string::npos) {
startPos = atoi(region.substr(foundFirstColon + 1).c_str());
stopPos = startPos; // just print one base if we don't give an end
} else {
if (foundRangeDash == string::npos) {
startPos = atoi(region.substr(foundFirstColon + 1, foundRangeDots - foundRangeDots - 1).c_str());
stopPos = atoi(region.substr(foundRangeDots + 2).c_str()); // to the start of this chromosome
} else {
startPos = atoi(region.substr(foundFirstColon + 1, foundRangeDash - foundRangeDash - 1).c_str());
stopPos = atoi(region.substr(foundRangeDash + 1).c_str()); // to the start of this chromosome
}
}
}
}
int length(void) {
if (stopPos > 0) {
return stopPos - startPos + 1;
} else {
return 1;
}
}
};
#endif
|