From 7999ce920fd3b3307e3b05797259701fe51d705d Mon Sep 17 00:00:00 2001 From: Shifu Chen Date: Thu, 14 Jun 2018 16:40:40 +0800 Subject: [PATCH] dont output deletion and untranslated fusions by default --- src/common.h | 2 +- src/fusionmapper.cpp | 6 ++++++ src/globalsettings.cpp | 4 +++- src/globalsettings.h | 8 ++++++++ src/htmlreporter.cpp | 10 +++++++++- src/jsonreporter.cpp | 6 ++++++ src/main.cpp | 8 +++++++- 7 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/common.h b/src/common.h index 790abfb..ab94349 100644 --- a/src/common.h +++ b/src/common.h @@ -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 diff --git a/src/fusionmapper.cpp b/src/fusionmapper.cpp index 870cfad..eea535a 100644 --- a/src/fusionmapper.cpp +++ b/src/fusionmapper.cpp @@ -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]); } diff --git a/src/globalsettings.cpp b/src/globalsettings.cpp index 3710706..3d35309 100644 --- a/src/globalsettings.cpp +++ b/src/globalsettings.cpp @@ -2,4 +2,6 @@ bool GlobalSettings::markedOnlyForVCF = false; int GlobalSettings::uniqueRequirement = 2; -int GlobalSettings::deletionThreshold = 50; \ No newline at end of file +int GlobalSettings::deletionThreshold = 50; +bool GlobalSettings::outputDeletions = false; +bool GlobalSettings::outputUntranslated = false; \ No newline at end of file diff --git a/src/globalsettings.h b/src/globalsettings.h index 3e83bb6..1591e2e 100644 --- a/src/globalsettings.h +++ b/src/globalsettings.h @@ -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; }; diff --git a/src/htmlreporter.cpp b/src/htmlreporter.cpp index 0e0d18b..d52ed9b 100644 --- a/src/htmlreporter.cpp +++ b/src/htmlreporter.cpp @@ -1,6 +1,7 @@ #include "htmlreporter.h" #include "common.h" #include +#include "globalsettings.h" const std::string getCurrentSystemTime() { @@ -62,8 +63,15 @@ void HtmlReporter::printFusions() { mFile<<""; id=0; for(int i=0;i matches = fusion.mMatches; + if(!GlobalSettings::outputDeletions && fusion.isDeletion()) + continue; + if(fusion.isLeftProteinForward() != fusion.isRightProteinForward()) { + if(!GlobalSettings::outputUntranslated) + continue; + } if(isFirstMut) { mFile << endl; diff --git a/src/main.cpp b/src/main.cpp index 1ba8225..ddaed98 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,10 +22,12 @@ int main(int argc, char* argv[]){ cmd.add("fusion", 'f', "fusion file name, in CSV format", true, ""); cmd.add("ref", 'r', "reference fasta file name", true, ""); cmd.add("unique", 'u', "specify the least supporting read number is required to report a fusion, default is 2", false, 2); - cmd.add("deletion", 'd', "specify the least deletion length of a intra-gene deletion to report, default is 50", false, 50); cmd.add("html", 'h', "file name to store HTML report, default is genefuse.html", false, "genefuse.html"); cmd.add("json", 'j', "file name to store JSON report, default is genefuse.json", false, "genefuse.json"); cmd.add("thread", 't', "worker thread number, default is 4", false, 4); + cmd.add("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("read1"); string r2file = cmd.get("read2"); @@ -36,9 +38,13 @@ int main(int argc, char* argv[]){ int threadNum = cmd.get("thread"); int unique = cmd.get("unique"); int deletion = cmd.get("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")) {