Commit 731e5baf authored by Yannis Duffourd's avatar Yannis Duffourd

first implementation

parent 3b7da2fe
// C++ std libs
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <fstream>
#include <sstream>
#include <stdexcept>
#include <sys/time.h>
#include <sys/types.h>
// C++ Boost
#include <boost/program_options.hpp>
// utils
#include "utils.h"
// Classes
#include "Galacs.h"
using namespace std;
namespace po = boost::program_options;
int main(int argc, char* argv[])
{
cerr << "Starting Main" << endl;
int currentThread = 0;
int nbThread = 1;
int loggingLevel;
int window;
int step;
double ratioThreshold;
double pvalueThreshold;
double zscore;
string bamFile;
string outputFile;
string outputFilePairs;
string outputFileSplits;
string logFile;
string referenceFile;
po::options_description desc("Allowed options");
desc.add_options()
("help,h", "produce help message")
("input,i", po::value<string>(&bamFile), "Input BAM file containing aligned read from sample.")
("output,o", po::value<string>(&outputFile), "output result file variants.")
("outputPairs,p", po::value<string>(&outputFilePairs), "output result file containing discordant pairs.")
("outputSplits,S", po::value<string>(&outputFileSplits), "output result file containing split read.")
("logFile,l", po::value<string>(&logFile), "Log file output.")
("reference,r" , po::value<string>(&referenceFile) , "Reference Fasta file." )
("window,w", po::value<int>(&window)->default_value(50), "Depth treshold to call a variant. (optional)")
("step,s" , po::value<int>(&step)->default_value(0.1) , "Minimum ratio of alt reads to consider a mutation. (optional)" )
("zscore,z" , po::value<double>(&zscore)->default_value(0.05) , "pvalue threshold from FET to consider a mutation. (optional)" )
("thread,t", po::value<int>(&nbThread)->default_value(50), "Number of thread to use. (NYI)")
("loglevel,L", po::value<int>(&loggingLevel)->default_value(1), "Logging level.");
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);
// Verif que le nb de thread n'est pas négatif ...
if( nbThread < 1 )
{
nbThread = 1;
cerr << "You entered a null or negative value for thread number, positionning it to 1. " << endl;
}
if( argc <= 1 )
{
cerr << "Error while checking program arguments" << endl;
cerr << desc << "\n";
return 1;
}
// check provided files
if( bamFile.length( ) > 0 )
{
if( !IsFileReadable( bamFile ) )
{
cerr << "File provided as input BAM : " << bamFile << " is not accessible : stopping" << endl;
return -1;
}
}
else
{
cerr << "No file provided as input BAM file : stopping" << endl;
return -1;
}
if( referenceFile.length( ) > 0 )
{
if( !IsFileReadable( referenceFile ) )
{
cerr << "File provided as reference : " << referenceFile << " is not accessible : stopping" << endl;
return -1;
}
}
else
{
cerr << "No file provided as reference file : stopping" << endl;
return -1;
}
Galacs * App = new Galacs(bamFile, referenceFile, outputFile, outputFilePairs, outputFileSplits, window, step, zscore, nbThread, loggingLevel);
App->mainLoop();
delete App;
cerr << "end of main" << endl;
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment