MCPcopy Create free account
hub / github.com/BoevaLab/FREEC / getSampleNameFromCommandLine

Function getSampleNameFromCommandLine

src/main.cpp:93–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91
92
93static const char* getSampleNameFromCommandLine(int argc, char *argv[])
94{
95 const char* sample_file;
96 bool sample_file_set=0;
97
98 if (argc >= 3 && (strcmp(argv[1], "-s") == 0 || strcmp(argv[1], "-sample") == 0 || strcmp(argv[1], "--s") == 0 || strcmp(argv[1], "--sample") == 0)) {
99 sample_file = argv[2];
100 sample_file_set=1;
101 } else {
102 if (argc >= 5 && (strcmp(argv[3], "-s") == 0 || strcmp(argv[3], "-sample") == 0 || strcmp(argv[3], "--s") == 0 || strcmp(argv[3], "--sample") == 0)) {
103 sample_file = argv[4];
104 sample_file_set=1;
105 } else {
106 if (argc >= 7 && (strcmp(argv[5], "-s") == 0 || strcmp(argv[5], "-sample") == 0 || strcmp(argv[5], "--s") == 0 || strcmp(argv[5], "--sample") == 0)) {
107 sample_file = argv[6];
108 sample_file_set=1;
109 }
110 }
111 }
112 if(!sample_file_set) {
113 cerr << "Error: You should provide a path to your sample either in the config file or in command line" << "\n";
114 usage();
115 exit(0);
116 }
117 ifstream ifile(sample_file);
118 if (!ifile) {
119 std::cerr << "\n\tCould not find your sample file.. Please, check the existance of "<< sample_file <<"\n\n";
120 usage();
121 exit(-1);
122 }
123 return sample_file;
124}
125
126static const char* getControlNameFromCommandLine(int argc, char *argv[])
127{

Callers 1

mainFunction · 0.85

Calls 1

usageFunction · 0.85

Tested by

no test coverage detected