]> git.donarmstrong.com Git - mothur.git/blob - mothur.h
precluster command finished
[mothur.git] / mothur.h
1 #ifndef MOTHUR_H
2 #define MOTHUR_H
3
4
5
6 /*
7  *  mothur.h
8  *  Mothur
9  *
10  *  Created by Sarah Westcott on 2/19/09.
11  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
12  *
13  */
14
15 /* This file contains all the standard incudes we use in the project as well as some common utilities. */
16
17 //#include <cstddef>
18
19 //io libraries
20 #include <iostream>
21 #include <iomanip>
22 #include <fstream>
23 #include <sstream>
24 #include <signal.h>
25
26 //exception
27 #include <stdexcept>
28 #include <exception>
29 #include <cstdlib> 
30
31
32 //containers
33 #include <vector>
34 #include <set>
35 #include <map>
36 #include <string>
37 #include <list>
38
39 //math
40 #include <cmath>
41 #include <math.h>
42 #include <algorithm>
43
44 //misc
45 #include <cerrno>
46 #include <ctime>
47 #include <limits>
48
49 /***********************************************************************/
50
51 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
52         #include <sys/wait.h>
53         #include <unistd.h>
54         
55         #ifdef USE_READLINE
56                 #include <readline/readline.h>
57                 #include <readline/history.h>
58         #endif
59
60         //#include <readline/readline.h>
61         //#include <readline/history.h>
62 #else
63         #include <conio.h> //allows unbuffered screen capture from stdin
64 #endif
65
66 using namespace std;
67
68 #define exp(x) (exp((double) x))
69 #define sqrt(x) (sqrt((double) x))
70 #define log10(x) (log10((double) x))
71 #define log2(x) (log10(x)/log10(2))
72 #define isnan(x) ((x) != (x))
73 #define isinf(x) (fabs(x) == std::numeric_limits<double>::infinity())
74
75
76 typedef unsigned long ull;
77
78 struct IntNode {
79         int lvalue;
80         int rvalue;
81         int lcoef;
82         int rcoef;
83         IntNode* left;
84         IntNode* right;
85         
86         IntNode(int lv, int rv, IntNode* l, IntNode* r) : lvalue(lv), rvalue(rv), left(l), right(r) {};
87         IntNode() {};
88 };
89
90 struct ThreadNode {
91         int* pid;
92         IntNode* left;
93         IntNode* right;
94 };
95
96 /************************************************************/
97 struct clusterNode {
98         int numSeq;
99         int parent;
100         int smallChild; //used to make linkTable work with list and rabund. represents bin number of this cluster node
101         clusterNode(int num, int par, int kid) : numSeq(num), parent(par), smallChild(kid) {};
102 };
103 /************************************************************/
104 struct seqDist {
105         int seq1;
106         int seq2;
107         float dist;
108         seqDist() {}
109         seqDist(int s1, int s2, float d) : seq1(s1), seq2(s2), dist(d) {}
110         ~seqDist() {}
111 };
112 /***********************************************************************/
113
114 // snagged from http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.2
115 // works for now, but there should be a way to do it without killing the whole program
116
117 class BadConversion : public runtime_error {
118 public:
119         BadConversion(const string& s) : runtime_error(s){ }
120 };
121
122 //**********************************************************************************************************************
123
124 template<typename T>
125 inline void convert(const string& s, T& x, bool failIfLeftoverChars = true){
126         istringstream i(s);
127         char c;
128         if (!(i >> x) || (failIfLeftoverChars && i.get(c)))
129                 throw BadConversion(s);
130 }
131
132 //**********************************************************************************************************************
133
134 template<typename T>
135 inline bool convertTestFloat(const string& s, T& x, bool failIfLeftoverChars = true){
136         istringstream i(s);
137         char c;
138         if (!(i >> x) || (failIfLeftoverChars && i.get(c)))
139         {
140                 return false;
141         } 
142         return true;
143 }
144
145 //**********************************************************************************************************************
146
147 template<typename T>
148 inline bool convertTest(const string& s, T& x, bool failIfLeftoverChars = true){
149         istringstream i(s);
150         char c;
151         if (!(i >> x) || (failIfLeftoverChars && i.get(c)))
152         {
153                 cout << "unable to be converted into an integer.\n" << endl;
154                 return false;
155         } 
156         return true;
157 }
158
159 //**********************************************************************************************************************
160
161 template<typename T>
162 string toString(const T&x){
163     stringstream output;
164     output << x;
165     return output.str();
166 }
167
168 //**********************************************************************************************************************
169
170 template<typename T>
171 string toHex(const T&x){
172         stringstream output;
173         
174         output << hex << x;
175
176     return output.str();
177 }
178 //**********************************************************************************************************************
179
180 template<typename T>
181 string toString(const T&x, int i){
182         stringstream output;
183         
184         output.precision(i);
185     output << fixed << x;
186         
187     return output.str();
188 }
189 /***********************************************************************/
190
191 inline int openOutputFileAppend(string fileName, ofstream& fileHandle){
192         
193         fileHandle.open(fileName.c_str(), ios::app);
194         if(!fileHandle) {
195                 cout << "Error: Could not open " <<  fileName << endl; 
196                 return 1;
197         }
198         else {
199                 return 0;
200         }
201
202 }
203 /***********************************************************************/
204
205 inline void gobble(istream& f){
206         
207         char d;
208     while(isspace(d=f.get()))           {;}
209         f.putback(d);
210         
211 }
212 /***********************************************************************/
213
214 inline string getline(ifstream& fileHandle) {
215         try {
216         
217                 string line = "";
218                 
219                 while (!fileHandle.eof())       {
220                         //get next character
221                         char c = fileHandle.get(); 
222                         
223                         //are you at the end of the line
224                         if ((c == '\n') || (c == '\r') || (c == '\f')){  break; }       
225                         else {          line += c;              }
226                 }
227                 
228                 return line;
229                 
230         }
231         catch(exception& e) {
232                 cout << "Error in mothur function getline" << endl;
233                 exit(1);
234         }
235 }
236
237 /**************************************************************************************************/
238
239 inline void mothurOut(string message) {
240         try{
241                 ofstream out;
242                 string logFileName = "mothur.logFile";
243                 openOutputFileAppend(logFileName, out);
244                 
245                 cout << message;
246                 out << message;
247                 
248                 out.close();
249         }
250         catch(exception& e) {
251                 cout << "Error in mothur class mothurOut" << endl;
252                 exit(1);
253         }
254 }
255 /**************************************************************************************************/
256
257 inline void mothurOut(string message, string precision) {
258         try{
259                 ofstream out;
260                 string logFileName = "mothur.logFile";
261                 openOutputFileAppend(logFileName, out);
262                 
263                 cout << precision << message;
264                 out << precision << message;
265                 
266                 out.close();
267         }
268         catch(exception& e) {
269                 cout << "Error in mothur class mothurOut" << endl;
270                 exit(1);
271         }
272 }
273
274 /**************************************************************************************************/
275
276 inline void mothurOutEndLine() {
277         try {
278                 ofstream out;
279                 string logFileName = "mothur.logFile";
280                 openOutputFileAppend(logFileName, out);
281                 
282                 cout << endl;  
283                 out << endl;
284                 
285                 out.close();
286         }
287         catch(exception& e) {
288                 cout << "error in mothur mothurOutEndLine" << endl;
289                 exit(1);
290         }
291 }
292
293
294 /**************************************************************************************************/
295
296 inline void errorOut(exception& e, string object, string function) {
297         
298                 mothurOut("Error: ");
299                 mothurOut(toString(e.what()));
300                 mothurOut(" has occurred in the " + object + " class function " + function + ". Please contact Pat Schloss at mothur.bugs@gmail.com, and be sure to include the mothur.logFile with your inquiry.");
301                 mothurOutEndLine();
302         
303 }
304
305 /***********************************************************************/
306
307 inline bool isTrue(string f){
308         
309         if ((f == "TRUE") || (f == "T") || (f == "true") || (f == "t")) {       return true;    }
310         else {  return false;  }
311 }
312
313 /***********************************************************************/
314
315 inline float roundDist(float dist, int precision){
316         
317         return int(dist * precision + 0.5)/float(precision);
318         
319 }
320
321 /***********************************************************************/
322
323 inline int getNumNames(string names){
324         
325         int count = 0;
326         
327         if(names != ""){
328                 count = 1;
329                 for(int i=0;i<names.size();i++){
330                         if(names[i] == ','){
331                                 count++;
332                         }
333                 }
334         }
335         
336         return count;
337         
338 }
339
340 /**************************************************************************************************/
341
342 inline vector<vector<double> > binomial(int maxOrder){
343         
344         vector<vector<double> > binomial(maxOrder+1);
345         
346     for(int i=0;i<=maxOrder;i++){
347                 binomial[i].resize(maxOrder+1);
348                 binomial[i][0]=1;
349                 binomial[0][i]=0;
350     }
351     binomial[0][0]=1;
352         
353     binomial[1][0]=1;
354     binomial[1][1]=1;
355         
356     for(int i=2;i<=maxOrder;i++){
357                 binomial[1][i]=0;
358     }
359         
360     for(int i=2;i<=maxOrder;i++){
361                 for(int j=1;j<=maxOrder;j++){
362                         if(i==j){       binomial[i][j]=1;                                                                       }
363                         if(j>i) {       binomial[i][j]=0;                                                                       }
364                         else    {       binomial[i][j]=binomial[i-1][j-1]+binomial[i-1][j];     }
365                 }
366     }
367         
368         return binomial;
369 }
370
371 /***********************************************************************/
372
373 inline string getRootName(string longName){
374  
375         string rootName = longName;
376         
377         if(longName.find_last_of(".") != longName.npos){
378                 int pos = longName.find_last_of('.')+1;
379                 rootName = longName.substr(0, pos);
380         }
381
382         return rootName;
383 }
384 /***********************************************************************/
385
386 inline string getSimpleName(string longName){
387  
388         string simpleName = longName;
389         
390         if(longName.find_last_of("/") != longName.npos){
391                 int pos = longName.find_last_of('/')+1;
392                 simpleName = longName.substr(pos, longName.length());
393         }
394
395         return simpleName;
396 }
397
398 /***********************************************************************/
399
400 inline int factorial(int num){
401         int total = 1;
402         
403         for (int i = 1; i <= num; i++) {
404                 total *= i;
405         }
406         
407         return total;
408 }
409 /**************************************************************************************************
410
411 double min(double x, double y)
412 {
413     if(x<y){    return x;    }
414     else   {    return y;    }
415 }
416
417 /***********************************************************************/
418
419 inline string getPathName(string longName){
420  
421         string rootPathName = longName;
422         
423         if(longName.find_last_of('/') != longName.npos){
424                 int pos = longName.find_last_of('/')+1;
425                 rootPathName = longName.substr(0, pos);
426         }
427
428         return rootPathName;
429 }
430
431 /***********************************************************************/
432
433 inline string getExtension(string longName){
434         
435         string extension = longName;
436         
437         if(longName.find_last_of('.') != longName.npos){
438                 int pos = longName.find_last_of('.');
439                 extension = longName.substr(pos, longName.length());
440         }
441         
442         return extension;
443 }
444 /***********************************************************************/
445 inline bool isBlank(string fileName){
446         
447         ifstream fileHandle;
448         fileHandle.open(fileName.c_str());
449         if(!fileHandle) {
450                 mothurOut("Error: Could not open " + fileName);  mothurOutEndLine();
451                 return false;
452         }else {
453                 //check for blank file
454                 gobble(fileHandle);
455                 if (fileHandle.eof()) { fileHandle.close(); return true;  }
456         }
457         return false;
458 }
459 /***********************************************************************/
460
461 inline int openInputFile(string fileName, ifstream& fileHandle){
462
463         fileHandle.open(fileName.c_str());
464         if(!fileHandle) {
465                 mothurOut("Error: Could not open " + fileName);  mothurOutEndLine();
466                 return 1;
467         }
468         else {
469                 //check for blank file
470                 gobble(fileHandle);
471                 if (fileHandle.eof()) { mothurOut(fileName + " is blank. Please correct."); mothurOutEndLine();  return 1;  }
472                 
473                 return 0;
474         }
475         
476 }
477
478 /***********************************************************************/
479
480 inline int openOutputFile(string fileName, ofstream& fileHandle){
481         
482         fileHandle.open(fileName.c_str(), ios::trunc);
483         if(!fileHandle) {
484                 mothurOut("Error: Could not open " + fileName);  mothurOutEndLine();
485                 return 1;
486         }
487         else {
488                 return 0;
489         }
490
491 }
492
493 /***********************************************************************/
494
495 inline int getNumSeqs(ifstream& file){
496         
497         int numSeqs = count(istreambuf_iterator<char>(file),istreambuf_iterator<char>(), '>');
498         file.seekg(0);
499         return numSeqs;
500
501 }
502 /***********************************************************************/
503
504 inline bool inVector(string member, vector<string> group){
505         
506         for (int i = 0; i < group.size(); i++) {
507                 if (group[i] == member) {  return true;         }
508         }
509         
510         return false;
511 }
512 /***********************************************************************/
513
514 //This function parses the estimator options and puts them in a vector
515 inline void splitAtDash(string& estim, vector<string>& container) {
516         try {
517                 string individual;
518                 
519                 while (estim.find_first_of('-') != -1) {
520                         individual = estim.substr(0,estim.find_first_of('-'));
521                         if ((estim.find_first_of('-')+1) <= estim.length()) { //checks to make sure you don't have dash at end of string
522                                 estim = estim.substr(estim.find_first_of('-')+1, estim.length());
523                                 container.push_back(individual);
524                         }
525                 }
526                 //get last one
527                 container.push_back(estim);
528         }
529         catch(exception& e) {
530                 errorOut(e, "mothur", "splitAtDash");
531                 exit(1);
532         }
533 }
534
535 /***********************************************************************/
536 //This function parses the label options and puts them in a set
537 inline void splitAtDash(string& estim, set<string>& container) {
538         try {
539                 string individual;
540                 
541                 while (estim.find_first_of('-') != -1) {
542                         individual = estim.substr(0,estim.find_first_of('-'));
543                         if ((estim.find_first_of('-')+1) <= estim.length()) { //checks to make sure you don't have dash at end of string
544                                 estim = estim.substr(estim.find_first_of('-')+1, estim.length());
545                                 container.insert(individual);
546                         }
547                 }
548                 //get last one
549                 container.insert(estim);
550         }
551         catch(exception& e) {
552                 errorOut(e, "mothur", "splitAtDash");
553                 exit(1);
554         }
555 }
556 /***********************************************************************/
557 //This function parses the line options and puts them in a set
558 inline void splitAtDash(string& estim, set<int>& container) {
559         try {
560                 string individual;
561                 int lineNum;
562                 
563                 while (estim.find_first_of('-') != -1) {
564                         individual = estim.substr(0,estim.find_first_of('-'));
565                         if ((estim.find_first_of('-')+1) <= estim.length()) { //checks to make sure you don't have dash at end of string
566                                 estim = estim.substr(estim.find_first_of('-')+1, estim.length());
567                                 convert(individual, lineNum); //convert the string to int
568                                 container.insert(lineNum);
569                         }
570                 }
571                 //get last one
572                 convert(estim, lineNum); //convert the string to int
573                 container.insert(lineNum);
574         }
575         catch(exception& e) {
576                 errorOut(e, "mothur", "splitAtDash");
577                 exit(1);
578         }
579 }
580 /***********************************************************************/
581 //This function parses the a string and puts peices in a vector
582 inline void splitAtComma(string& estim, vector<string>& container) {
583         try {
584                 string individual;
585                 
586                 while (estim.find_first_of(',') != -1) {
587                         individual = estim.substr(0,estim.find_first_of(','));
588                         if ((estim.find_first_of(',')+1) <= estim.length()) { //checks to make sure you don't have comma at end of string
589                                 estim = estim.substr(estim.find_first_of(',')+1, estim.length());
590                                 container.push_back(individual);
591                         }
592                 }
593                 //get last one
594                 container.push_back(estim);
595         }
596         catch(exception& e) {
597                 errorOut(e, "mothur", "splitAtComma");
598                 exit(1);
599         }
600 }
601 /***********************************************************************/
602
603 //This function splits up the various option parameters
604 inline void splitAtComma(string& prefix, string& suffix){
605         try {
606                 prefix = suffix.substr(0,suffix.find_first_of(','));
607                 if ((suffix.find_first_of(',')+2) <= suffix.length()) {  //checks to make sure you don't have comma at end of string
608                         suffix = suffix.substr(suffix.find_first_of(',')+1, suffix.length());
609                         string space = " ";
610                         while(suffix.at(0) == ' ')
611                                 suffix = suffix.substr(1, suffix.length());
612                 }
613
614         }
615         catch(exception& e) {
616                 errorOut(e, "mothur", "splitAtComma");
617                 exit(1);
618         }
619 }
620 /***********************************************************************/
621
622 //This function separates the key value from the option value i.e. dist=96_...
623 inline void splitAtEquals(string& key, string& value){          
624         try {
625                 if(value.find_first_of('=') != -1){
626                         key = value.substr(0,value.find_first_of('='));
627                         if ((value.find_first_of('=')+1) <= value.length()) {
628                                 value = value.substr(value.find_first_of('=')+1, value.length());
629                         }
630                 }else{
631                         key = value;
632                         value = 1;
633                 }
634         }
635         catch(exception& e) {
636                 errorOut(e, "mothur", "splitAtEquals");
637                 exit(1);
638         }
639 }
640 /**************************************************************************************************/
641
642 inline bool inUsersGroups(string groupname, vector<string> Groups) {
643         try {
644                 for (int i = 0; i < Groups.size(); i++) {
645                         if (groupname == Groups[i]) { return true; }
646                 }
647                 return false;
648         }
649         catch(exception& e) {
650                 errorOut(e, "mothur", "inUsersGroups");
651                 exit(1);
652         }
653 }
654
655 /**************************************************************************************************/
656
657 inline void mothurOutJustToLog(string message) {
658         try {
659                 ofstream out;
660                 string logFileName = "mothur.logFile";
661                 openOutputFileAppend(logFileName, out);
662                 
663                 out << message;
664                 
665                 out.close();
666         }
667         catch(exception& e) {
668                 errorOut(e, "mothur", "mothurOutJustToLog");
669                 exit(1);
670         }
671 }
672
673
674 /**************************************************************************************************/
675
676 inline void mothurOut(float num) {
677         try {
678                 ofstream out;
679                 string logFileName = "mothur.logFile";
680                 openOutputFileAppend(logFileName, out);
681                 
682                 cout << num;  
683                 out << num;
684                 
685                 out.close();
686         }
687         catch(exception& e) {
688                 cout << "Error in mothur class mothurOut float" << endl;
689                 exit(1);
690         }
691 }
692 /***********************************************************************/
693 inline void mothurOut(double value) {
694         try {
695                 ofstream out;
696                 string logFileName = "mothur.logFile";
697                 openOutputFileAppend(logFileName, out);
698                 
699                 cout << value;  
700                 out << value;
701                 
702                 out.close();
703         }
704         catch(exception& e) {
705                 cout << "Error in mothur class mothurOut double" << endl;
706                 exit(1);
707         }
708 }
709
710 /***********************************************************************/
711 //this function determines if the user has given us labels that are smaller than the given label.
712 //if so then it returns true so that the calling function can run the previous valid distance.
713 //it's a "smart" distance function.  It also checks for invalid labels.
714 inline bool anyLabelsToProcess(string label, set<string>& userLabels, string errorOff) {
715         try {
716                 set<string>::iterator it;
717                 vector<float> orderFloat;
718                 map<string, float> userMap;  //the conversion process removes trailing 0's which we need to put back
719                 map<string, float>::iterator it2;
720                 float labelFloat;
721                 bool smaller = false;
722                 
723                 //unique is the smallest line
724                 if (label == "unique") {  return false;  }
725                 else { convert(label, labelFloat); }
726                 
727                 //go through users set and make them floats
728                 for(it = userLabels.begin(); it != userLabels.end(); ++it) {
729                         
730                         float temp;
731                         if ((*it != "unique") && (convertTestFloat(*it, temp) == true)){
732                                 convert(*it, temp);
733                                 orderFloat.push_back(temp);
734                                 userMap[*it] = temp;
735                         }else if (*it == "unique") { 
736                                 orderFloat.push_back(-1.0);
737                                 userMap["unique"] = -1.0;
738                         }else {
739                                 if (errorOff == "") {  mothurOut(*it + " is not a valid label."); mothurOutEndLine();  }
740                                 userLabels.erase(*it); 
741                                 it--;
742                         }
743                 }
744                 
745                 //sort order
746                 sort(orderFloat.begin(), orderFloat.end());
747                 
748                 /*************************************************/
749                 //is this label bigger than any of the users labels
750                 /*************************************************/
751                                 
752                 //loop through order until you find a label greater than label
753                 for (int i = 0; i < orderFloat.size(); i++) {
754                         if (orderFloat[i] < labelFloat) {
755                                 smaller = true;
756                                 if (orderFloat[i] == -1) { 
757                                         if (errorOff == "") { mothurOut("Your file does not include the label unique."); mothurOutEndLine(); }
758                                         userLabels.erase("unique");
759                                 }
760                                 else {  
761                                         if (errorOff == "") { mothurOut("Your file does not include the label "); mothurOutEndLine(); }
762                                         string s = "";
763                                         for (it2 = userMap.begin(); it2!= userMap.end(); it2++) {  
764                                                 if (it2->second == orderFloat[i]) {  
765                                                         s = it2->first;  
766                                                         //remove small labels
767                                                         userLabels.erase(s);
768                                                         break;
769                                                 }
770                                         }
771                                         if (errorOff == "") { mothurOut(s + ". I will use the next smallest distance. "); mothurOutEndLine(); }
772                                 }
773                         //since they are sorted once you find a bigger one stop looking
774                         }else { break; }
775                 }
776                 
777                 return smaller;
778                                                 
779         }
780         catch(exception& e) {
781                 errorOut(e, "mothur", "anyLabelsToProcess");
782                 exit(1);
783         }
784 }
785
786 /**************************************************************************************************/
787 inline void appendFiles(string temp, string filename) {
788         try{
789                 ofstream output;
790                 ifstream input;
791         
792                 //open output file in append mode
793                 openOutputFileAppend(filename, output);
794                 openInputFile(temp, input);
795                 
796                 while(char c = input.get()){
797                         if(input.eof())         {       break;                  }
798                         else                            {       output << c;    }
799                 }
800                 
801                 input.close();
802                 output.close();
803         }
804         catch(exception& e) {
805                 errorOut(e, "mothur", "appendFiles");
806                 exit(1);
807         }
808 }
809
810 /**************************************************************************************************/
811 inline string sortFile(string distFile){
812         try {   
813                 string outfile = getRootName(distFile) + "sorted.dist";
814                 
815                 //if you can, use the unix sort since its been optimized for years
816                 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
817                         string command = "sort -n -k +3 " + distFile + " -o " + outfile;
818                         system(command.c_str());
819                 #else //you are stuck with my best attempt...
820                         //windows sort does not have a way to specify a column, only a character in the line
821                         //since we cannot assume that the distance will always be at the the same character location on each line
822                         //due to variable sequence name lengths, I chose to force the distance into first position, then sort and then put it back.
823                 
824                         //read in file line by file and put distance first
825                         string tempDistFile = distFile + ".temp";
826                         ifstream input;
827                         ofstream output;
828                         openInputFile(distFile, input);
829                         openOutputFile(tempDistFile, output);
830
831                         string firstName, secondName;
832                         float dist;
833                         while (input) {
834                                 input >> firstName >> secondName >> dist;
835                                 output << dist << '\t' << firstName << '\t' << secondName << endl;
836                                 gobble(input);
837                         }
838                         input.close();
839                         output.close();
840                 
841         
842                         //sort using windows sort
843                         string tempOutfile = outfile + ".temp";
844                         string command = "sort " + tempDistFile + " /O " + tempOutfile;
845                         system(command.c_str());
846                 
847                         //read in sorted file and put distance at end again
848                         ifstream input2;
849                         openInputFile(tempOutfile, input2);
850                         openOutputFile(outfile, output);
851                 
852                         while (input2) {
853                                 input2 >> dist >> firstName >> secondName;
854                                 output << firstName << '\t' << secondName << '\t' << dist << endl;
855                                 gobble(input2);
856                         }
857                         input2.close();
858                         output.close();
859                 
860                         //remove temp files
861                         remove(tempDistFile.c_str());
862                         remove(tempOutfile.c_str());
863                 #endif
864                 
865                 return outfile;
866         }
867         catch(exception& e) {
868                 errorOut(e, "mothur", "sortFile");
869                 exit(1);
870         }
871 }
872 /**************************************************************************************************/
873 #endif
874