]> git.donarmstrong.com Git - mothur.git/blob - bayesian.cpp
removed some testing changes i made to classify.seqs
[mothur.git] / bayesian.cpp
1 /*
2  *  bayesian.cpp
3  *  Mothur
4  *
5  *  Created by westcott on 11/3/09.
6  *  Copyright 2009 Schloss Lab. All rights reserved.
7  *
8  */
9
10 #include "bayesian.h"
11 #include "kmer.hpp"
12 #include "phylosummary.h"
13
14 /**************************************************************************************************/
15 Bayesian::Bayesian(string tfile, string tempFile, string method, int ksize, int cutoff, int i) : 
16 Classify(), kmerSize(ksize), confidenceThreshold(cutoff), iters(i)  {
17         try {
18                 
19                 /************calculate the probablity that each word will be in a specific taxonomy*************/
20                 string tfileroot = tfile.substr(0,tfile.find_last_of(".")+1);
21                 string tempfileroot = m->getRootName(m->getSimpleName(tempFile));
22                 string phyloTreeName = tfileroot + "tree.train";
23                 string phyloTreeSumName = tfileroot + "tree.sum";
24                 string probFileName = tfileroot + tempfileroot + char('0'+ kmerSize) + "mer.prob";
25                 string probFileName2 = tfileroot + tempfileroot + char('0'+ kmerSize) + "mer.numNonZero";
26                 
27                 ofstream out;
28                 ofstream out2;
29                 
30                 ifstream phyloTreeTest(phyloTreeName.c_str());
31                 ifstream probFileTest2(probFileName2.c_str());
32                 ifstream probFileTest(probFileName.c_str());
33                 ifstream probFileTest3(phyloTreeSumName.c_str());
34                 
35                 int start = time(NULL);
36                 
37                 //if they are there make sure they were created after this release date
38                 bool FilesGood = false;
39                 if(probFileTest && probFileTest2 && phyloTreeTest && probFileTest3){
40                         FilesGood = checkReleaseDate(probFileTest, probFileTest2, phyloTreeTest, probFileTest3);
41                 }
42                 
43                 if(probFileTest && probFileTest2 && phyloTreeTest && probFileTest3 && FilesGood){       
44                         m->mothurOut("Reading template taxonomy...     "); cout.flush();
45                         
46                         phyloTree = new PhyloTree(phyloTreeTest, phyloTreeName);
47                         
48                         m->mothurOut("DONE."); m->mothurOutEndLine();
49                         
50                         genusNodes = phyloTree->getGenusNodes(); 
51                         genusTotals = phyloTree->getGenusTotals();
52                 
53                         m->mothurOut("Reading template probabilities...     "); cout.flush();
54                         readProbFile(probFileTest, probFileTest2, probFileName, probFileName2); 
55                         
56                 }else{
57                 
58                         //create search database and names vector
59                         generateDatabaseAndNames(tfile, tempFile, method, ksize, 0.0, 0.0, 0.0, 0.0);
60                         
61                         //prevents errors caused by creating shortcut files if you had an error in the sanity check.
62                         if (m->control_pressed) {  remove(phyloTreeName.c_str());  remove(probFileName.c_str()); remove(probFileName2.c_str()); }
63                         else{ 
64                                 genusNodes = phyloTree->getGenusNodes(); 
65                                 genusTotals = phyloTree->getGenusTotals();
66                                 
67                                 m->mothurOut("Calculating template taxonomy tree...     "); cout.flush();
68                                 
69                                 phyloTree->printTreeNodes(phyloTreeName);
70                                                         
71                                 m->mothurOut("DONE."); m->mothurOutEndLine();
72                                 
73                                 m->mothurOut("Calculating template probabilities...     "); cout.flush();
74                                 
75                                 numKmers = database->getMaxKmer() + 1;
76                         
77                                 //initialze probabilities
78                                 wordGenusProb.resize(numKmers);
79                         //cout << numKmers << '\t' << genusNodes.size() << endl;
80                                 for (int j = 0; j < wordGenusProb.size(); j++) {        wordGenusProb[j].resize(genusNodes.size());             }
81                         //cout << numKmers << '\t' << genusNodes.size() << endl;        
82                                 ofstream out;
83                                 ofstream out2;
84                                 
85                                 #ifdef USE_MPI
86                                         int pid;
87                                         MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
88
89                                         if (pid == 0) {  
90                                 #endif
91
92                                 
93                                 m->openOutputFile(probFileName, out);
94                                 
95                                 //output mothur version
96                                 out << "#" << m->getVersion() << endl;
97                                 
98                                 out << numKmers << endl;
99                                 
100                                 m->openOutputFile(probFileName2, out2);
101                                 
102                                 //output mothur version
103                                 out2 << "#" << m->getVersion() << endl;
104                                 
105                                 #ifdef USE_MPI
106                                         }
107                                 #endif
108
109                                 
110                                 //for each word
111                                 for (int i = 0; i < numKmers; i++) {
112                                         if (m->control_pressed) {  break; }
113                                         
114                                         #ifdef USE_MPI
115                                                 MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
116
117                                                 if (pid == 0) {  
118                                         #endif
119
120                                         out << i << '\t';
121                                         
122                                         #ifdef USE_MPI
123                                                 }
124                                         #endif
125                                         
126                                         vector<int> seqsWithWordi = database->getSequencesWithKmer(i);
127                                         
128                                         map<int, int> count;
129                                         for (int k = 0; k < genusNodes.size(); k++) {  count[genusNodes[k]] = 0;  }                     
130                                                         
131                                         //for each sequence with that word
132                                         for (int j = 0; j < seqsWithWordi.size(); j++) {
133                                                 int temp = phyloTree->getIndex(names[seqsWithWordi[j]]);
134                                                 count[temp]++;  //increment count of seq in this genus who have this word
135                                         }
136                                         
137                                         //probabilityInTemplate = (# of seqs with that word in template + 0.50) / (total number of seqs in template + 1);
138                                         float probabilityInTemplate = (seqsWithWordi.size() + 0.50) / (float) (names.size() + 1);
139                                         
140                                         int numNotZero = 0;
141                                         for (int k = 0; k < genusNodes.size(); k++) {
142                                                 //probabilityInThisTaxonomy = (# of seqs with that word in this taxonomy + probabilityInTemplate) / (total number of seqs in this taxonomy + 1);
143                                                 
144                                                 
145                                                 wordGenusProb[i][k] = log((count[genusNodes[k]] + probabilityInTemplate) / (float) (genusTotals[k] + 1));  
146                                                                         
147                                                 if (count[genusNodes[k]] != 0) { 
148                                                         #ifdef USE_MPI
149                                                                 int pid;
150                                                                 MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
151                                                 
152                                                                 if (pid == 0) {  
153                                                         #endif
154
155                                                         out << k << '\t' << wordGenusProb[i][k] << '\t'; 
156                                                         
157                                                         #ifdef USE_MPI
158                                                                 }
159                                                         #endif
160
161                                                         numNotZero++;  
162                                                 }
163                                         }
164                                         
165                                         #ifdef USE_MPI
166                                                 MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
167                                 
168                                                 if (pid == 0) {  
169                                         #endif
170                                         
171                                         out << endl;
172                                         out2 << probabilityInTemplate << '\t' << numNotZero << endl;
173                                         
174                                         #ifdef USE_MPI
175                                                 }
176                                         #endif
177                                 }
178                                 
179                                 #ifdef USE_MPI
180                                         MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
181                                 
182                                         if (pid == 0) {  
183                                 #endif
184                                 
185                                 out.close();
186                                 out2.close();
187                                 
188                                 #ifdef USE_MPI
189                                         }
190                                 #endif
191                                 
192                                 //read in new phylotree with less info. - its faster
193                                 ifstream phyloTreeTest(phyloTreeName.c_str());
194                                 delete phyloTree;
195                                 
196                                 phyloTree = new PhyloTree(phyloTreeTest, phyloTreeName);
197                         }
198                 }
199         
200                 m->mothurOut("DONE."); m->mothurOutEndLine();
201                 m->mothurOut("It took " + toString(time(NULL) - start) + " seconds get probabilities. "); m->mothurOutEndLine();
202         }
203         catch(exception& e) {
204                 m->errorOut(e, "Bayesian", "Bayesian");
205                 exit(1);
206         }
207 }
208 /**************************************************************************************************/
209 Bayesian::~Bayesian() {
210         try {
211                 
212                  delete phyloTree; 
213                  if (database != NULL) {  delete database; }
214         }
215         catch(exception& e) {
216                 m->errorOut(e, "Bayesian", "~Bayesian");
217                 exit(1);
218         }
219 }
220
221 /**************************************************************************************************/
222 string Bayesian::getTaxonomy(Sequence* seq) {
223         try {
224                 string tax = "";
225                 Kmer kmer(kmerSize);
226                 
227                 //get words contained in query
228                 //getKmerString returns a string where the index in the string is hte kmer number 
229                 //and the character at that index can be converted to be the number of times that kmer was seen
230                 
231                 string queryKmerString = kmer.getKmerString(seq->getUnaligned()); 
232
233                 vector<int> queryKmers;
234                 for (int i = 0; i < queryKmerString.length()-1; i++) {  // the -1 is to ignore any kmer with an N in it
235                         if (queryKmerString[i] != '!') { //this kmer is in the query
236                                 queryKmers.push_back(i);
237                         }
238                 }
239                 
240                 if (queryKmers.size() == 0) {  m->mothurOut(seq->getName() + "is bad."); m->mothurOutEndLine(); return "bad seq"; }
241                 
242                 
243                 int index = getMostProbableTaxonomy(queryKmers);
244                 
245                 if (m->control_pressed) { return tax; }
246                                         
247                 //bootstrap - to set confidenceScore
248                 int numToSelect = queryKmers.size() / 8;
249         
250                 tax = bootstrapResults(queryKmers, index, numToSelect);
251                                 
252                 return tax;     
253         }
254         catch(exception& e) {
255                 m->errorOut(e, "Bayesian", "getTaxonomy");
256                 exit(1);
257         }
258 }
259 /**************************************************************************************************/
260 string Bayesian::bootstrapResults(vector<int> kmers, int tax, int numToSelect) {
261         try {
262                                 
263                 map<int, int> confidenceScores; 
264                 
265                 //initialize confidences to 0 
266                 int seqIndex = tax;
267                 TaxNode seq = phyloTree->get(tax);
268                 confidenceScores[tax] = 0;
269                 
270                 while (seq.level != 0) { //while you are not at the root
271                         seqIndex = seq.parent;
272                         confidenceScores[seqIndex] = 0;
273                         seq = phyloTree->get(seq.parent);
274                 }
275                                 
276                 map<int, int>::iterator itBoot;
277                 map<int, int>::iterator itBoot2;
278                 map<int, int>::iterator itConvert;
279                         
280                 for (int i = 0; i < iters; i++) {
281                         if (m->control_pressed) { return "control"; }
282                         
283                         vector<int> temp;
284                         for (int j = 0; j < numToSelect; j++) {
285                                 int index = int(rand() % kmers.size());
286                                 
287                                 //add word to temp
288                                 temp.push_back(kmers[index]);
289                         }
290                         
291                         //get taxonomy
292                         int newTax = getMostProbableTaxonomy(temp);
293                         //int newTax = 1;
294                         TaxNode taxonomyTemp = phyloTree->get(newTax);
295                         
296                         //add to confidence results
297                         while (taxonomyTemp.level != 0) { //while you are not at the root
298                                 itBoot2 = confidenceScores.find(newTax); //is this a classification we already have a count on
299                                 
300                                 if (itBoot2 != confidenceScores.end()) { //this is a classification we need a confidence for
301                                         (itBoot2->second)++;
302                                 }
303                                 
304                                 newTax = taxonomyTemp.parent;
305                                 taxonomyTemp = phyloTree->get(newTax);
306                         }
307         
308                 }
309                 
310                 string confidenceTax = "";
311                 simpleTax = "";
312                 
313                 int seqTaxIndex = tax;
314                 TaxNode seqTax = phyloTree->get(tax);
315                 
316                 while (seqTax.level != 0) { //while you are not at the root
317                                         
318                                 itBoot2 = confidenceScores.find(seqTaxIndex); //is this a classification we already have a count on
319                                 
320                                 int confidence = 0;
321                                 if (itBoot2 != confidenceScores.end()) { //already in confidence scores
322                                         confidence = itBoot2->second;
323                                 }
324                                 
325                                 if (((confidence/(float)iters) * 100) >= confidenceThreshold) {
326                                         confidenceTax = seqTax.name + "(" + toString(((confidence/(float)iters) * 100)) + ");" + confidenceTax;
327                                         simpleTax = seqTax.name + ";" + simpleTax;
328                                 }
329                                 
330                                 seqTaxIndex = seqTax.parent;
331                                 seqTax = phyloTree->get(seqTax.parent);
332                 }
333                 
334                 if (confidenceTax == "") { confidenceTax = "unclassified;"; simpleTax = "unclassified;"; }
335                 return confidenceTax;
336                 
337         }
338         catch(exception& e) {
339                 m->errorOut(e, "Bayesian", "bootstrapResults");
340                 exit(1);
341         }
342 }
343 /**************************************************************************************************/
344 int Bayesian::getMostProbableTaxonomy(vector<int> queryKmer) {
345         try {
346                 int indexofGenus = 0;
347                 
348                 double maxProbability = -1000000.0;
349                 //find taxonomy with highest probability that this sequence is from it
350                 
351                 
352 //              cout << genusNodes.size() << endl;
353                 
354                 
355                 for (int k = 0; k < genusNodes.size(); k++) {
356                         //for each taxonomy calc its probability
357                         
358                         double prob = 0.0000;
359                         for (int i = 0; i < queryKmer.size(); i++) {
360                                 prob += wordGenusProb[queryKmer[i]][k];
361                         }
362                         
363 //                      cout << phyloTree->get(genusNodes[k]).name << '\t' << prob << endl;
364
365                         //is this the taxonomy with the greatest probability?
366                         if (prob > maxProbability) { 
367                                 indexofGenus = genusNodes[k];
368                                 maxProbability = prob;
369                         }
370                 }
371                 
372                         
373                 return indexofGenus;
374         }
375         catch(exception& e) {
376                 m->errorOut(e, "Bayesian", "getMostProbableTaxonomy");
377                 exit(1);
378         }
379 }
380 /*************************************************************************************************
381 map<string, int> Bayesian::parseTaxMap(string newTax) {
382         try{
383         
384                 map<string, int> parsed;
385                 
386                 newTax = newTax.substr(0, newTax.length()-1);  //get rid of last ';'
387         
388                 //parse taxonomy
389                 string individual;
390                 while (newTax.find_first_of(';') != -1) {
391                         individual = newTax.substr(0,newTax.find_first_of(';'));
392                         newTax = newTax.substr(newTax.find_first_of(';')+1, newTax.length());
393                         parsed[individual] = 1;
394                 }
395                 
396                 //get last one
397                 parsed[newTax] = 1;
398
399                 return parsed;
400                 
401         }
402         catch(exception& e) {
403                 m->errorOut(e, "Bayesian", "parseTax");
404                 exit(1);
405         }
406 }
407 /**************************************************************************************************/
408 void Bayesian::readProbFile(ifstream& in, ifstream& inNum, string inName, string inNumName) {
409         try{
410                 
411                 #ifdef USE_MPI
412                         
413                         int pid, num, num2, processors;
414                         vector<unsigned long int> positions;
415                         vector<unsigned long int> positions2;
416                         
417                         MPI_Status status; 
418                         MPI_File inMPI;
419                         MPI_File inMPI2;
420                         MPI_Comm_rank(MPI_COMM_WORLD, &pid); //find out who we are
421                         MPI_Comm_size(MPI_COMM_WORLD, &processors);
422                         int tag = 2001;
423
424                         char inFileName[1024];
425                         strcpy(inFileName, inNumName.c_str());
426                         
427                         char inFileName2[1024];
428                         strcpy(inFileName2, inName.c_str());
429
430                         MPI_File_open(MPI_COMM_WORLD, inFileName, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI);  //comm, filename, mode, info, filepointer
431                         MPI_File_open(MPI_COMM_WORLD, inFileName2, MPI_MODE_RDONLY, MPI_INFO_NULL, &inMPI2);  //comm, filename, mode, info, filepointer
432
433                         if (pid == 0) {
434                                 positions = m->setFilePosEachLine(inNumName, num);
435                                 positions2 = m->setFilePosEachLine(inName, num2);
436                                 
437                                 for(int i = 1; i < processors; i++) { 
438                                         MPI_Send(&num, 1, MPI_INT, i, tag, MPI_COMM_WORLD);
439                                         MPI_Send(&positions[0], (num+1), MPI_LONG, i, tag, MPI_COMM_WORLD);
440                                         
441                                         MPI_Send(&num2, 1, MPI_INT, i, tag, MPI_COMM_WORLD);
442                                         MPI_Send(&positions2[0], (num2+1), MPI_LONG, i, tag, MPI_COMM_WORLD);
443                                 }
444
445                         }else{
446                                 MPI_Recv(&num, 1, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
447                                 positions.resize(num+1);
448                                 MPI_Recv(&positions[0], (num+1), MPI_LONG, 0, tag, MPI_COMM_WORLD, &status);
449                                 
450                                 MPI_Recv(&num2, 1, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
451                                 positions2.resize(num2+1);
452                                 MPI_Recv(&positions2[0], (num2+1), MPI_LONG, 0, tag, MPI_COMM_WORLD, &status);
453                         }
454                         
455                         //read version
456                         int length = positions2[1] - positions2[0];
457                         char* buf5 = new char[length];
458
459                         MPI_File_read_at(inMPI2, positions2[0], buf5, length, MPI_CHAR, &status);
460                         delete buf5;
461
462                         //read numKmers
463                         length = positions2[2] - positions2[1];
464                         char* buf = new char[length];
465
466                         MPI_File_read_at(inMPI2, positions2[1], buf, length, MPI_CHAR, &status);
467
468                         string tempBuf = buf;
469                         if (tempBuf.length() > length) { tempBuf = tempBuf.substr(0, length); }
470                         delete buf;
471
472                         istringstream iss (tempBuf,istringstream::in);
473                         iss >> numKmers;  
474                         
475                         //initialze probabilities
476                         wordGenusProb.resize(numKmers);
477                         
478                         for (int j = 0; j < wordGenusProb.size(); j++) {        wordGenusProb[j].resize(genusNodes.size());             }
479                         
480                         int kmer, name;  
481                         vector<int> numbers; numbers.resize(numKmers);
482                         float prob;
483                         vector<float> zeroCountProb; zeroCountProb.resize(numKmers);    
484                         
485                         //read version
486                         length = positions[1] - positions[0];
487                         char* buf6 = new char[length];
488
489                         MPI_File_read_at(inMPI2, positions[0], buf6, length, MPI_CHAR, &status);
490                         delete buf6;
491                         
492                         //read file 
493                         for(int i=1;i<num;i++){
494                                 //read next sequence
495                                 length = positions[i+1] - positions[i];
496                                 char* buf4 = new char[length];
497
498                                 MPI_File_read_at(inMPI, positions[i], buf4, length, MPI_CHAR, &status);
499
500                                 tempBuf = buf4;
501                                 if (tempBuf.length() > length) { tempBuf = tempBuf.substr(0, length); }
502                                 delete buf4;
503
504                                 istringstream iss (tempBuf,istringstream::in);
505                                 iss >> zeroCountProb[i] >> numbers[i];  
506                         }
507                         
508                         MPI_File_close(&inMPI);
509                         
510                         for(int i=2;i<num2;i++){
511                                 //read next sequence
512                                 length = positions2[i+1] - positions2[i];
513                                 char* buf4 = new char[length];
514
515                                 MPI_File_read_at(inMPI2, positions2[i], buf4, length, MPI_CHAR, &status);
516
517                                 tempBuf = buf4;
518                                 if (tempBuf.length() > length) { tempBuf = tempBuf.substr(0, length); }
519                                 delete buf4;
520
521                                 istringstream iss (tempBuf,istringstream::in);
522                                 
523                                 iss >> kmer;
524                                 
525                                 //set them all to zero value
526                                 for (int i = 0; i < genusNodes.size(); i++) {
527                                         wordGenusProb[kmer][i] = log(zeroCountProb[kmer] / (float) (genusTotals[i]+1));
528                                 }
529                                 
530                                 //get probs for nonzero values
531                                 for (int i = 0; i < numbers[kmer]; i++) {
532                                         iss >> name >> prob;
533                                         wordGenusProb[kmer][name] = prob;
534                                 }
535                                 
536                         }
537                         MPI_File_close(&inMPI2);
538                         MPI_Barrier(MPI_COMM_WORLD); //make everyone wait - just in case
539                 #else
540                         //read version
541                         string line = m->getline(in); m->gobble(in);
542                         
543                         in >> numKmers; m->gobble(in);
544                         
545                         //initialze probabilities
546                         wordGenusProb.resize(numKmers);
547                         
548                         for (int j = 0; j < wordGenusProb.size(); j++) {        wordGenusProb[j].resize(genusNodes.size());             }
549                         
550                         int kmer, name, count;  count = 0;
551                         vector<int> num; num.resize(numKmers);
552                         float prob;
553                         vector<float> zeroCountProb; zeroCountProb.resize(numKmers);            
554                         
555                         //read version
556                         string line2 = m->getline(inNum); m->gobble(inNum);
557                         
558                         while (inNum) {
559                                 inNum >> zeroCountProb[count] >> num[count];  
560                                 count++;
561                                 m->gobble(inNum);
562                         }
563                         inNum.close();
564                 
565                         while(in) {
566                                 in >> kmer;
567                                 
568                                 //set them all to zero value
569                                 for (int i = 0; i < genusNodes.size(); i++) {
570                                         wordGenusProb[kmer][i] = log(zeroCountProb[kmer] / (float) (genusTotals[i]+1));
571                                 }
572                                 
573                                 //get probs for nonzero values
574                                 for (int i = 0; i < num[kmer]; i++) {
575                                         in >> name >> prob;
576                                         wordGenusProb[kmer][name] = prob;
577                                 }
578                                 
579                                 m->gobble(in);
580                         }
581                         in.close();
582                         
583                 #endif
584         }
585         catch(exception& e) {
586                 m->errorOut(e, "Bayesian", "readProbFile");
587                 exit(1);
588         }
589 }
590 /**************************************************************************************************/
591 bool Bayesian::checkReleaseDate(ifstream& file1, ifstream& file2, ifstream& file3, ifstream& file4) {
592         try {
593                 
594                 bool good = true;
595                 
596                 vector<string> lines;
597                 lines.push_back(m->getline(file1));  
598                 lines.push_back(m->getline(file2)); 
599                 lines.push_back(m->getline(file3)); 
600                 lines.push_back(m->getline(file4)); 
601
602                 //before we added this check
603                 if ((lines[0][0] != '#') || (lines[1][0] != '#') || (lines[2][0] != '#') || (lines[3][0] != '#')) {  good = false;  }
604                 else {
605                         //rip off #
606                         for (int i = 0; i < lines.size(); i++) { lines[i] = lines[i].substr(1);  }
607                         
608                         //get mothurs current version
609                         string version = m->getVersion();
610                         
611                         vector<string> versionVector;
612                         m->splitAtChar(version, versionVector, '.');
613                         
614                         //check each files version
615                         for (int i = 0; i < lines.size(); i++) { 
616                                 vector<string> linesVector;
617                                 m->splitAtChar(lines[i], linesVector, '.');
618                         
619                                 if (versionVector.size() != linesVector.size()) { good = false; break; }
620                                 else {
621                                         for (int j = 0; j < versionVector.size(); j++) {
622                                                 int num1, num2;
623                                                 convert(versionVector[j], num1);
624                                                 convert(linesVector[j], num2);
625                                                 
626                                                 //if mothurs version is newer than this files version, then we want to remake it
627                                                 if (num1 > num2) {  good = false; break;  }
628                                         }
629                                 }
630                                 
631                                 if (!good) { break; }
632                         }
633                 }
634                 
635                 if (!good) {  file1.close(); file2.close(); file3.close(); file4.close();  }
636                 else { file1.seekg(0);  file2.seekg(0);  file3.seekg(0);  file4.seekg(0);  }
637                 
638                 return good;
639         }
640         catch(exception& e) {
641                 m->errorOut(e, "Bayesian", "checkReleaseDate");
642                 exit(1);
643         }
644 }
645 /**************************************************************************************************/
646
647
648
649
650
651