Skip to content
Snippets Groups Projects
Commit f12f568c authored by Aaron's avatar Aaron
Browse files

Added -S to closestBed

parent 1348016b
No related branches found
No related tags found
No related merge requests found
......@@ -21,11 +21,13 @@ const int SLOPGROWTH = 2048000;
/*
Constructor
*/
BedClosest::BedClosest(string &bedAFile, string &bedBFile, bool forceStrand, string &tieMode, bool reportDistance, bool ignoreOverlaps)
BedClosest::BedClosest(string &bedAFile, string &bedBFile, bool sameStrand, bool diffStrand,
string &tieMode, bool reportDistance, bool ignoreOverlaps)
: _bedAFile(bedAFile)
, _bedBFile(bedBFile)
, _tieMode(tieMode)
, _forceStrand(forceStrand)
, _sameStrand(sameStrand)
, _diffStrand(diffStrand)
, _reportDistance(reportDistance)
, _ignoreOverlaps(ignoreOverlaps)
{
......@@ -76,7 +78,7 @@ void BedClosest::FindWindowOverlaps(BED &a, vector<BED> &hits) {
// THE HEAVY LIFTING
// search for hits with the current slop added
_bedB->FindOverlapsPerBin(a.chrom, aFudgeStart, aFudgeEnd, a.strand, hits, _forceStrand);
_bedB->FindOverlapsPerBin(a.chrom, aFudgeStart, aFudgeEnd, a.strand, hits, _sameStrand, _diffStrand);
vector<BED>::const_iterator h = hits.begin();
vector<BED>::const_iterator hitsEnd = hits.end();
......
......@@ -28,7 +28,7 @@ public:
// constructor
BedClosest(string &bedAFile, string &bedBFile,
bool forceStrand, string &tieMode,
bool sameStrand, bool diffStrand, string &tieMode,
bool reportDistance, bool ignoreOverlaps);
// destructor
......@@ -43,7 +43,8 @@ private:
string _bedAFile;
string _bedBFile;
string _tieMode;
bool _forceStrand;
bool _sameStrand;
bool _diffStrand;
bool _reportDistance;
bool _ignoreOverlaps;
......
......@@ -36,7 +36,8 @@ int main(int argc, char* argv[]) {
bool haveBedA = false;
bool haveBedB = false;
bool haveTieMode = false;
bool forceStrand = false;
bool sameStrand = false;
bool diffStrand = false;
bool ignoreOverlaps = false;
bool reportDistance = false;
......@@ -75,7 +76,10 @@ int main(int argc, char* argv[]) {
}
}
else if (PARAMETER_CHECK("-s", 2, parameterLength)) {
forceStrand = true;
sameStrand = true;
}
else if (PARAMETER_CHECK("-S", 2, parameterLength)) {
diffStrand = true;
}
else if (PARAMETER_CHECK("-d", 2, parameterLength)) {
reportDistance = true;
......@@ -108,8 +112,13 @@ int main(int argc, char* argv[]) {
showHelp = true;
}
if (sameStrand && diffStrand) {
cerr << endl << "*****" << endl << "*****ERROR: Request either -s OR -S, not both." << endl << "*****" << endl;
showHelp = true;
}
if (!showHelp) {
BedClosest *bc = new BedClosest(bedAFile, bedBFile, forceStrand, tieMode, reportDistance, ignoreOverlaps);
BedClosest *bc = new BedClosest(bedAFile, bedBFile, sameStrand, diffStrand, tieMode, reportDistance, ignoreOverlaps);
delete bc;
return 0;
}
......@@ -131,8 +140,12 @@ void ShowHelp(void) {
cerr << "Usage: " << PROGRAM_NAME << " [OPTIONS] -a <bed/gff/vcf> -b <bed/gff/vcf>" << endl << endl;
cerr << "Options: " << endl;
cerr << "\t-s\t" << "Force strandedness. That is, find the closest feature in B" << endl;
cerr << "\t\tthat overlaps A on the same strand." << endl;
cerr << "\t-s\t" << "Require same strandedness. That is, find the closest feature in B" << endl;
cerr << "\t\tthat overlaps A on the _same_ strand." << endl;
cerr << "\t\t- By default, overlaps are reported without respect to strand." << endl << endl;
cerr << "\t-s\t" << "Require opposite strandedness. That is, find the closest feature in B" << endl;
cerr << "\t\tthat overlaps A on the _opposite_ strand." << endl;
cerr << "\t\t- By default, overlaps are reported without respect to strand." << endl << endl;
cerr << "\t-d\t" << "In addition to the closest feature in B, " << endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment