diff --git a/.ci/checkedList b/.ci/checkedList
index 8c7a90ef..c00b3e7a 100644
--- a/.ci/checkedList
+++ b/.ci/checkedList
@@ -1,3 +1,5 @@
+src/dEploidIO-operation.cpp
+src/dEploidIO-workflow.cpp
src/mcmc.hpp
src/dEploid.cpp
src/variantIndex.cpp
@@ -22,4 +24,3 @@ tests/unittest/test_runner.cpp
tests/unittest/test_utilities.cpp
src/export/dEploidIOExportPosteriorProb.cpp
src/export/writeMcmcRelated.cpp
-src/dEploidIO-workflow.cpp
diff --git a/.gitignore b/.gitignore
index 1657f355..51aac7bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -80,6 +80,8 @@ PG400*
PG0*
txt.*
vcf.*
+data/
+docs/
# coverage test
*.gcda
diff --git a/Makefile.am b/Makefile.am
index d8c6c757..17f42e54 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,6 +28,7 @@ common_src = src/random/fastfunc.cpp \
src/panel.cpp \
src/utility.cpp \
src/dEploidIO.cpp \
+ src/dEploidIO-operation.cpp \
src/dEploidIO-workflow.cpp \
src/updateHap.cpp \
src/txtReader.cpp \
diff --git a/src/dEploid.cpp b/src/dEploid.cpp
index 0a77e6fe..9844f1c4 100644
--- a/src/dEploid.cpp
+++ b/src/dEploid.cpp
@@ -32,12 +32,12 @@ int main(int argc, char *argv[]) {
std::ostream *output = &std::cout;
if ( dEploidIO.version() ) {
- dEploidIO.printVersion(*output);
+ dEploidIO.operation_printVersion(*output);
return EXIT_SUCCESS;
}
if ( dEploidIO.help() ) {
- dEploidIO.printHelp(*output);
+ dEploidIO.operation_printHelp(*output);
return EXIT_SUCCESS;
}
diff --git a/src/dEploidIO-operation.cpp b/src/dEploidIO-operation.cpp
new file mode 100644
index 00000000..04938f91
--- /dev/null
+++ b/src/dEploidIO-operation.cpp
@@ -0,0 +1,144 @@
+/*
+ * dEploid is used for deconvoluting Plasmodium falciparum genome from
+ * mix-infected patient sample.
+ *
+ * Copyright (C) 2016-2017 University of Oxford
+ *
+ * Author: Sha (Joe) Zhu
+ *
+ * This file is part of dEploid.
+ *
+ * dEploid is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+
+#include // std::setw
+#include "dEploidIO.hpp"
+
+
+void DEploidIO::operation_printVersion(std::ostream& out) {
+ out << endl
+ << "dEploid " << VERSION
+ << endl
+ << "Git commit (DEploid): " << dEploidGitVersion_ << endl
+ << "Git commit (Lasso): " << lassoGitVersion_ << endl;
+}
+
+
+void DEploidIO::operation_printHelp(std::ostream& out) {
+ out << endl
+ << "dEploid " << VERSION << endl
+ << endl;
+ out << "Contact: Joe Zhu " << endl
+ << endl;
+ out << "Usage:"
+ << endl;
+ out << setw(20) << "-h or -help" << " -- "
+ << "Help. List the following content." << endl;
+ out << setw(20) << "-v or -version" << " -- "
+ << "DEploid version." << endl;
+ out << setw(20) << "-vcf STR" << " -- "
+ << "VCF file path." << endl;
+ out << setw(20) << "-ref STR" << " -- "
+ << "File path of reference allele count." << endl;
+ out << setw(20) << "-alt STR" << " -- "
+ << "File path of alternative allele count." << endl;
+ out << setw(20) << "-plaf STR" << " -- "
+ << "File path of population level allele frequencies." << endl;
+ out << setw(20) << "-panel STR" << " -- "
+ << "File path of the reference panel." << endl;
+ out << setw(20) << "-exclude STR" << " -- "
+ << "File path of sites to be excluded." << endl;
+ out << setw(20) << "-o STR" << " -- "
+ << "Specify the file name prefix of the output." << endl;
+ out << setw(20) << "-p INT" << " -- "
+ << "Out put precision (default value 8)." << endl;
+ out << setw(20) << "-k INT" << " -- "
+ << "Number of strain (default value 5)." << endl;
+ out << setw(20) << "-seed INT" << " -- "
+ << "Random seed." << endl;
+ out << setw(20) << "-nSample INT" << " -- "
+ << "Number of MCMC samples." << endl;
+ out << setw(20) << "-rate INT" << " -- "
+ << "MCMC sample rate." << endl;
+ out << setw(20) << "-noPanel" << " -- "
+ << "Use population level allele frequency as prior." << endl;
+ out << setw(20) << "-forbidUpdateProp" << " -- "
+ << "Forbid MCMC moves to update proportions." << endl;
+ out << setw(20) << "-forbidUpdateSingle" << " -- "
+ << "Forbid MCMC moves to update single haplotype." << endl;
+ out << setw(20) << "-forbidUpdatePair" << " -- "
+ << "Forbid MCMC moves to update pair haplotypes." << endl;
+ out << setw(20) << "-initialP FLT ..." << " -- "
+ << "Initialize proportions." << endl;
+ out << setw(20) << "-ibd" << " -- "
+ << "Use DEploid-IBD" << endl;
+ out << setw(20) << "-lasso" << " -- "
+ << "Use DEploid-LASSO" << endl;
+ out << setw(20) << "-best" << " -- "
+ << "Use DEploid-Best-practice" << endl;
+ out << endl;
+ out << "Note: Please `man docs/_build/man/dEploid.1' for the manual."
+ << endl;
+ out << endl;
+ out << "Examples:" << endl;
+ out << endl;
+ out << "./dEploid -vcf data/testData/PG0390-C.test.vcf "
+ << "-plaf data/testData/labStrains.test.PLAF.txt "
+ << "-o PG0390-CNopanel -noPanel" << endl;
+ out << "./dEploid -vcf data/testData/PG0390-C.test.vcf "
+ << "-exclude data/testData/labStrains.test.exclude.txt "
+ << "-plaf data/testData/labStrains.test.PLAF.txt "
+ << "-o PG0390-CNopanelExclude -noPanel" << endl;
+ out << "./dEploid -vcf data/testData/PG0390-C.test.vcf "
+ << "-exclude data/testData/labStrains.test.exclude.txt "
+ << "-plaf data/testData/labStrains.test.PLAF.txt "
+ << "-o PG0390-C-ibd -panel data/testData/labStrains.test.panel.txt "
+ << "-ibd" << endl;
+ out << "./dEploid -vcf data/testData/PG0390-C.test.vcf "
+ << "-exclude data/testData/labStrains.test.exclude.txt "
+ << "-plaf data/testData/labStrains.test.PLAF.txt "
+ << "-o PG0390-C-best -panel data/testData/labStrains.test.panel.txt "
+ << "-best" << endl;
+ out << "./dEploid -vcf data/testData/PG0390-C.test.vcf.gz "
+ << "-exclude data/testData/labStrains.test.exclude.txt.gz "
+ << "-plaf data/testData/labStrains.test.PLAF.txt.gz -o PG0390-C-best "
+ << "-panel data/testData/labStrains.test.panel.txt.gz -best" << endl;
+ out << "./dEploid -vcf data/testData/PG0390-C.test.vcf "
+ << "-exclude data/testData/labStrains.test.exclude.txt "
+ << "-plaf data/testData/labStrains.test.PLAF.txt "
+ << "-o PG0390-CPanelExclude "
+ << "-panel data/testData/labStrains.test.panel.txt "
+ << "-painting PG0390-CPanelExclude.hap" << endl;
+ out << "./dEploid -vcf data/testData/PG0390-C.test.vcf "
+ << "-plaf data/testData/labStrains.test.PLAF.txt "
+ << "-o PG0390-CNopanel -noPanel -k 2 -nSample 250 -rate 8 -burn 0.67 "
+ << "-ibd " << endl;
+ out << "./dEploid -vcf data/testData/PG0390-C.test.vcf "
+ << "-plaf data/testData/labStrains.test.PLAF.txt "
+ << "-o PG0390-CNopanel -initialP 0.2 0.8 -ibdPainting" << endl;
+ out << "./dEploid -vcf data/testData/PG0390-C.test.vcf "
+ << "-exclude data/testData/labStrains.test.exclude.txt "
+ << "-plaf data/testData/labStrains.test.PLAF.txt "
+ << "-o PG0390-CLassoExclude "
+ << "-panel data/testData/labStrains.test.panel.txt "
+ << "-initialP 0.2 0.8 -writePanel -lasso" << endl;
+ out << "./dEploid -vcf data/testData/PG0390-C.test.vcf.gz "
+ << "-sample PG0390-C -plafFromVcf "
+ << "-exclude data/testData/labStrains.test.exclude.txt.gz "
+ << "-o PG0390-C-best "
+ << "-panel data/testData/labStrains.test.panel.txt.gz -best" << endl;
+}
+
diff --git a/src/dEploidIO-workflow.cpp b/src/dEploidIO-workflow.cpp
index 8e7e4b95..6e3603f6 100644
--- a/src/dEploidIO-workflow.cpp
+++ b/src/dEploidIO-workflow.cpp
@@ -104,8 +104,6 @@ void DEploidIO::workflow_ibd() {
this->paintIBD();
this->writeHap(mcmcSample->hap, "final");
delete mcmcSample;
-
-
}
@@ -281,9 +279,9 @@ void DEploidIO::workflow_best() {
this->writeHap(hap, "final");
this->writeVcf(hap, dEploidLassoIO.initialProp, "final");
}
- if (this->inferBestPracticeP() &
- (this->initialProp.size() > 1)) {
- this->paintIBD();
+
+ if (this->inferBestPracticeP() & (this->initialProp.size() > 1)) {
+ this->paintIBD();
}
}
diff --git a/src/dEploidIO.cpp b/src/dEploidIO.cpp
index de7093ad..cd593467 100644
--- a/src/dEploidIO.cpp
+++ b/src/dEploidIO.cpp
@@ -25,7 +25,6 @@
#include
#include
#include // assert
-#include // std::setw
#include "utility.hpp" // normailize by sum
#include "updateHap.hpp" // chromPainting
#include "dEploidIO.hpp"
@@ -652,61 +651,6 @@ void DEploidIO::readNextStringto( string &readto ) {
}
-void DEploidIO::printVersion(std::ostream& out) {
- out << endl
- << "dEploid " << VERSION
- << endl
- << "Git commit (DEploid): " << dEploidGitVersion_ << endl
- << "Git commit (Lasso): " << lassoGitVersion_ << endl;
-}
-
-void DEploidIO::printHelp(std::ostream& out) {
- out << endl
- << "dEploid " << VERSION << endl
- << endl;
- out << "Contact: Joe Zhu " << endl
- << endl;
- out << "Usage:"
- << endl;
- out << setw(20) << "-h or -help" << " -- " << "Help. List the following content."<