Skip to content

Commit

Permalink
make rolling hash mode as default, and use --legacy to support old mode
Browse files Browse the repository at this point in the history
  • Loading branch information
sfchen committed Mar 17, 2017
1 parent ef6d1f8 commit a10b067
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ options:
-h, --html filename of html report, no html report if not specified (string [=])
-t, --thread worker thread number, default is 4 (int [=4])
-k, --mark when mutation file is a vcf file, --mark means only process the records with FILTER column is M
-f, --fast use fast mode, with stricter matching
-l, --legacy use legacy mode, usually much slower but may be able to find a little more reads in certain case
-?, --help print this message
```
The plain text result, contains the detected mutations and their support reads, will be printed directly. You can use `>` to redirect output to a file, like:
Expand Down
2 changes: 1 addition & 1 deletion src/globalsettings.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "globalsettings.h"

bool GlobalSettings::markedOnlyForVCF = false;
bool GlobalSettings::fastMode = false;
bool GlobalSettings::legacyMode = false;
6 changes: 3 additions & 3 deletions src/globalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class GlobalSettings{
inline static void setMarkedOnlyForVCF(bool flag){
markedOnlyForVCF = flag;
}
inline static void setFastMode(bool flag){
fastMode = flag;
inline static void setLegacyMode(bool flag){
legacyMode = flag;
}

public:
static bool markedOnlyForVCF;
static bool fastMode;
static bool legacyMode;
};


Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int main(int argc, char* argv[]){
cmd.add<string>("html", 'h', "filename of html report, no html report if not specified", false, "");
cmd.add<int>("thread", 't', "worker thread number, default is 4", false, 4);
cmd.add("mark", 'k', "when mutation file is a vcf file, --mark means only process the records with FILTER column is M");
cmd.add("fast", 'f', "use fast mode, with stricter matching");
cmd.add("legacy", 'l', "use legacy mode, usually much slower but may be able to find a little more reads in certain case");
cmd.parse_check(argc, argv);
string r1file = cmd.get<string>("read1");
string r2file = cmd.get<string>("read2");
Expand All @@ -41,8 +41,8 @@ int main(int argc, char* argv[]){
bool markedOnlyForVCF = cmd.exist("mark");
GlobalSettings::setMarkedOnlyForVCF(markedOnlyForVCF);

bool fastMode = cmd.exist("fast");
GlobalSettings::setFastMode(fastMode);
bool legacyMode = cmd.exist("legacy");
GlobalSettings::setLegacyMode(legacyMode);

stringstream ss;
for(int i=0;i<argc;i++){
Expand Down
4 changes: 2 additions & 2 deletions src/pescanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bool PairEndScanner::scan(){
else
mutationList = Mutation::parseBuiltIn();

if(GlobalSettings::fastMode){
if(!GlobalSettings::legacyMode){
mRollingHash = new RollingHash();
mRollingHash->initMutations(mutationList);
}
Expand Down Expand Up @@ -130,7 +130,7 @@ bool PairEndScanner::scanPairEnd(ReadPairPack* pack){
}

bool PairEndScanner::scanRead(Read* r, ReadPair* originalPair, bool reversed) {
if(GlobalSettings::fastMode){
if(!GlobalSettings::legacyMode){
vector<int> targets = mRollingHash->hitTargets(r->mSeq.mStr);
for(int t=0; t<targets.size(); t++) {
Match* match = mutationList[targets[t]].searchInRead(r);
Expand Down
4 changes: 2 additions & 2 deletions src/sescanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bool SingleEndScanner::scan(){
else
mutationList = Mutation::parseBuiltIn();

if(GlobalSettings::fastMode){
if(!GlobalSettings::legacyMode){
mRollingHash = new RollingHash();
mRollingHash->initMutations(mutationList);
}
Expand Down Expand Up @@ -102,7 +102,7 @@ bool SingleEndScanner::scanSingleEnd(ReadPack* pack){
}

bool SingleEndScanner::scanRead(Read* r, Read* originalRead, bool reversed) {
if(GlobalSettings::fastMode){
if(!GlobalSettings::legacyMode){
vector<int> targets = mRollingHash->hitTargets(r->mSeq.mStr);
for(int t=0; t<targets.size(); t++) {
Match* match = mutationList[targets[t]].searchInRead(r);
Expand Down

0 comments on commit a10b067

Please sign in to comment.