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

Added -S to annotateBed

parent a3c8e702
No related branches found
No related tags found
No related merge requests found
...@@ -14,12 +14,13 @@ ...@@ -14,12 +14,13 @@
// build // build
BedAnnotate::BedAnnotate(const string &mainFile, const vector<string> &annoFileNames, BedAnnotate::BedAnnotate(const string &mainFile, const vector<string> &annoFileNames,
const vector<string> &annoTitles, bool forceStrand, bool reportCounts, bool reportBoth) : const vector<string> &annoTitles, bool sameStrand, bool diffStrand, bool reportCounts, bool reportBoth) :
_mainFile(mainFile), _mainFile(mainFile),
_annoFileNames(annoFileNames), _annoFileNames(annoFileNames),
_annoTitles(annoTitles), _annoTitles(annoTitles),
_forceStrand(forceStrand), _sameStrand(sameStrand),
_diffStrand(diffStrand),
_reportCounts(reportCounts), _reportCounts(reportCounts),
_reportBoth(reportBoth) _reportBoth(reportBoth)
{ {
...@@ -120,7 +121,7 @@ void BedAnnotate::AnnotateBed() { ...@@ -120,7 +121,7 @@ void BedAnnotate::AnnotateBed() {
// process each entry in the current anno file // process each entry in the current anno file
while ((bedStatus = anno->GetNextBed(a, lineNum)) != BED_INVALID) { while ((bedStatus = anno->GetNextBed(a, lineNum)) != BED_INVALID) {
if (bedStatus == BED_VALID) { if (bedStatus == BED_VALID) {
_bed->countListHits(a, annoIndex, _forceStrand); _bed->countListHits(a, annoIndex, _sameStrand, _diffStrand);
a = nullBed; a = nullBed;
} }
} }
......
...@@ -31,7 +31,7 @@ public: ...@@ -31,7 +31,7 @@ public:
// constructor // constructor
BedAnnotate(const string &mainFile, const vector<string> &annoFileNames, BedAnnotate(const string &mainFile, const vector<string> &annoFileNames,
const vector<string> &annoTitles, bool forceStrand, bool reportCounts, bool reportBoth); const vector<string> &annoTitles, bool sameStrand, bool diffStrand, bool reportCounts, bool reportBoth);
// destructor // destructor
~BedAnnotate(void); ~BedAnnotate(void);
...@@ -51,7 +51,9 @@ private: ...@@ -51,7 +51,9 @@ private:
vector<BedFile*> _annoFiles; vector<BedFile*> _annoFiles;
// do we care about strandedness when counting coverage? // do we care about strandedness when counting coverage?
bool _forceStrand; bool _sameStrand;
bool _diffStrand;
bool _reportCounts; bool _reportCounts;
bool _reportBoth; bool _reportBoth;
......
...@@ -32,7 +32,8 @@ int main(int argc, char* argv[]) { ...@@ -32,7 +32,8 @@ int main(int argc, char* argv[]) {
string mainFile; string mainFile;
// parm flags // parm flags
bool forceStrand = false; bool sameStrand = false;
bool diffStrand = false;
bool haveBed = false; bool haveBed = false;
bool haveFiles = false; bool haveFiles = false;
bool haveTitles = false; bool haveTitles = false;
...@@ -104,7 +105,10 @@ int main(int argc, char* argv[]) { ...@@ -104,7 +105,10 @@ int main(int argc, char* argv[]) {
reportBoth = true; reportBoth = true;
} }
else if (PARAMETER_CHECK("-s", 2, parameterLength)) { else if (PARAMETER_CHECK("-s", 2, parameterLength)) {
forceStrand = true; sameStrand = true;
}
else if (PARAMETER_CHECK("-S", 2, parameterLength)) {
diffStrand = true;
} }
else { else {
cerr << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; cerr << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl;
...@@ -117,9 +121,13 @@ int main(int argc, char* argv[]) { ...@@ -117,9 +121,13 @@ int main(int argc, char* argv[]) {
cerr << endl << "*****" << endl << "*****ERROR: Need -i and -files files. " << endl << "*****" << endl; cerr << endl << "*****" << endl << "*****ERROR: Need -i and -files files. " << endl << "*****" << endl;
showHelp = true; showHelp = true;
} }
if (sameStrand && diffStrand) {
cerr << endl << "*****" << endl << "*****ERROR: Request either -s OR -S, not both." << endl << "*****" << endl;
showHelp = true;
}
if (!showHelp) { if (!showHelp) {
BedAnnotate *ba = new BedAnnotate(mainFile, inputFiles, inputTitles, forceStrand, reportCounts, reportBoth); BedAnnotate *ba = new BedAnnotate(mainFile, inputFiles, inputTitles, sameStrand, diffStrand, reportCounts, reportBoth);
ba->AnnotateBed(); ba->AnnotateBed();
delete ba; delete ba;
return 0; return 0;
...@@ -151,9 +159,12 @@ void ShowHelp(void) { ...@@ -151,9 +159,12 @@ void ShowHelp(void) {
cerr << "\t-both\t" << "Report the counts followed by the % coverage." << endl; cerr << "\t-both\t" << "Report the counts followed by the % coverage." << endl;
cerr << "\t\t- Default is to report the fraction of -i covered by each file." << endl << endl; cerr << "\t\t- Default is to report the fraction of -i covered by each file." << endl << endl;
cerr << "\t-s\t" << "Force strandedness. That is, only include hits in A that" << endl; cerr << "\t-s\t" << "Require same strandedness. That is, only counts overlaps" << endl;
cerr << "\t\toverlap B on the same strand." << endl; cerr << "\t\ton the _same_ strand." << endl;
cerr << "\t\t- By default, hits are included without respect to strand." << endl << endl; cerr << "\t\t- By default, overlaps are counted without respect to strand." << endl << endl;
cerr << "\t-S\t" << "Require different strandedness. That is, only count overlaps" << endl;
cerr << "\t\ton the _opposite_ strand." << endl;
cerr << "\t\t- By default, overlaps are counted without respect to strand." << endl << endl;
exit(1); exit(1);
} }
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