Skip to content

Commit

Permalink
dont output deletion and untranslated fusions by default
Browse files Browse the repository at this point in the history
  • Loading branch information
sfchen committed Jun 14, 2018
1 parent bf58774 commit 7999ce9
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef COMMON_H
#define COMMON_H

#define FUSIONSCAN_VER "0.5.0"
#define FUSIONSCAN_VER "0.6.0"

#define _DEBUG true

Expand Down
6 changes: 6 additions & 0 deletions src/fusionmapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ void FusionMapper::clusterMatches() {
frs[f].calcUnique();
frs[f].updateInfo(fusionList);
if(frs[f].isQualified()) {
if(!GlobalSettings::outputDeletions && frs[f].isDeletion())
continue;
if(frs[f].isLeftProteinForward() != frs[f].isRightProteinForward()) {
if(!GlobalSettings::outputUntranslated)
continue;
}
frs[f].print(fusionList);
mFusionResults.push_back(frs[f]);
}
Expand Down
4 changes: 3 additions & 1 deletion src/globalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

bool GlobalSettings::markedOnlyForVCF = false;
int GlobalSettings::uniqueRequirement = 2;
int GlobalSettings::deletionThreshold = 50;
int GlobalSettings::deletionThreshold = 50;
bool GlobalSettings::outputDeletions = false;
bool GlobalSettings::outputUntranslated = false;
8 changes: 8 additions & 0 deletions src/globalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,19 @@ class GlobalSettings{
inline static void setDeletionThreshold(int val){
deletionThreshold = val;
}
inline static void setOutputDeletions(bool flag){
outputDeletions = flag;
}
inline static void setOutputUntranslated(bool flag){
outputUntranslated = flag;
}

public:
static bool markedOnlyForVCF;
static int uniqueRequirement;
static int deletionThreshold;
static bool outputDeletions;
static bool outputUntranslated;
};


Expand Down
10 changes: 9 additions & 1 deletion src/htmlreporter.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "htmlreporter.h"
#include "common.h"
#include <chrono>
#include "globalsettings.h"

const std::string getCurrentSystemTime()
{
Expand Down Expand Up @@ -62,8 +63,15 @@ void HtmlReporter::printFusions() {
mFile<<"</ul></div>";
id=0;
for(int i=0;i<mFusionResults.size();i++){
FusionResult fusion = mFusionResults[i];
if(!GlobalSettings::outputDeletions && fusion.isDeletion())
continue;
if(fusion.isLeftProteinForward() != fusion.isRightProteinForward()) {
if(!GlobalSettings::outputUntranslated)
continue;
}
id++;
printFusion(id, mFusionResults[i]);
printFusion(id, fusion);
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/jsonreporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ void JsonReporter::run() {
for(int i=0;i<mFusionResults.size();i++){
FusionResult fusion = mFusionResults[i];
vector<Match*> matches = fusion.mMatches;
if(!GlobalSettings::outputDeletions && fusion.isDeletion())
continue;
if(fusion.isLeftProteinForward() != fusion.isRightProteinForward()) {
if(!GlobalSettings::outputUntranslated)
continue;
}

if(isFirstMut) {
mFile << endl;
Expand Down
8 changes: 7 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ int main(int argc, char* argv[]){
cmd.add<string>("fusion", 'f', "fusion file name, in CSV format", true, "");
cmd.add<string>("ref", 'r', "reference fasta file name", true, "");
cmd.add<int>("unique", 'u', "specify the least supporting read number is required to report a fusion, default is 2", false, 2);
cmd.add<int>("deletion", 'd', "specify the least deletion length of a intra-gene deletion to report, default is 50", false, 50);
cmd.add<string>("html", 'h', "file name to store HTML report, default is genefuse.html", false, "genefuse.html");
cmd.add<string>("json", 'j', "file name to store JSON report, default is genefuse.json", false, "genefuse.json");
cmd.add<int>("thread", 't', "worker thread number, default is 4", false, 4);
cmd.add<int>("deletion", 'd', "specify the least deletion length of a intra-gene deletion to report, default is 50", false, 50);
cmd.add("output_deletions", 'D', "long deletions are not output by default, enable this option to output them");
cmd.add("output_untranslated_fusions", 'U', "the fusions that cannot be transcribed or translated are not output by default, enable this option to output them");
cmd.parse_check(argc, argv);
string r1file = cmd.get<string>("read1");
string r2file = cmd.get<string>("read2");
Expand All @@ -36,9 +38,13 @@ int main(int argc, char* argv[]){
int threadNum = cmd.get<int>("thread");
int unique = cmd.get<int>("unique");
int deletion = cmd.get<int>("deletion");
bool outputDeletion = cmd.exist("output_deletions");
bool outputUntranslated = cmd.exist("output_untranslated_fusions");

GlobalSettings::setUniqueRequirement(unique);
GlobalSettings::setDeletionThreshold(deletion);
GlobalSettings::setOutputDeletions(outputDeletion);
GlobalSettings::setOutputUntranslated(outputUntranslated);


if(ends_with(refFile, ".gz") || ends_with(refFile, ".gz")) {
Expand Down

0 comments on commit 7999ce9

Please sign in to comment.