]> git.donarmstrong.com Git - mothur.git/blob - unifracweightedcommand.cpp
working on parallelizing unifrac.weighted.
[mothur.git] / unifracweightedcommand.cpp
1 /*
2  *  unifracweightedcommand.cpp
3  *  Mothur
4  *
5  *  Created by Sarah Westcott on 2/9/09.
6  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
7  *
8  */
9
10 #include "unifracweightedcommand.h"
11
12 /***********************************************************/
13 UnifracWeightedCommand::UnifracWeightedCommand(string option) {
14         try {
15                 globaldata = GlobalData::getInstance();
16                 abort = false;
17                 Groups.clear();
18                         
19                 //allow user to run help
20                 if(option == "help") { help(); abort = true; }
21                 
22                 else {
23                         //valid paramters for this command
24                         string Array[] =  {"groups","iters","distance","random","processors","outputdir","inputdir"};
25                         vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
26                         
27                         OptionParser parser(option);
28                         map<string,string> parameters=parser.getParameters();
29                         
30                         ValidParameters validParameter;
31                 
32                         //check to make sure all parameters are valid for command
33                         for (map<string,string>::iterator it = parameters.begin(); it != parameters.end(); it++) { 
34                                 if (validParameter.isValidParameter(it->first, myArray, it->second) != true) {  abort = true;  }
35                         }
36                         
37                         if (globaldata->gTree.size() == 0) {//no trees were read
38                                 m->mothurOut("You must execute the read.tree command, before you may execute the unifrac.weighted command."); m->mothurOutEndLine(); abort = true;  }
39                         
40                         //if the user changes the output directory command factory will send this info to us in the output parameter 
41                         outputDir = validParameter.validFile(parameters, "outputdir", false);           if (outputDir == "not found"){  
42                                 outputDir = ""; 
43                                 outputDir += m->hasPath(globaldata->inputFileName); //if user entered a file with a path then preserve it       
44                         }
45                                                                                                                                         
46                         //check for optional parameter and set defaults
47                         // ...at some point should added some additional type checking...
48                         groups = validParameter.validFile(parameters, "groups", false);                 
49                         if (groups == "not found") { groups = ""; }
50                         else { 
51                                 m->splitAtDash(groups, Groups);
52                                 globaldata->Groups = Groups;
53                         }
54                                 
55                         itersString = validParameter.validFile(parameters, "iters", false);                     if (itersString == "not found") { itersString = "1000"; }
56                         convert(itersString, iters); 
57                         
58                         string temp = validParameter.validFile(parameters, "distance", false);                  if (temp == "not found") { temp = "false"; }
59                         phylip = m->isTrue(temp);
60                 
61                         temp = validParameter.validFile(parameters, "random", false);                                   if (temp == "not found") { temp = "F"; }
62                         random = m->isTrue(temp);
63                         
64                         temp = validParameter.validFile(parameters, "processors", false);       if (temp == "not found"){       temp = "1";                             }
65                         convert(temp, processors); 
66                         
67                         if (!random) {  iters = 0;  } //turn off random calcs
68
69                         
70                         if (abort == false) {
71                                 T = globaldata->gTree;
72                                 tmap = globaldata->gTreemap;
73                                 sumFile = outputDir + m->getSimpleName(globaldata->getTreeFile()) + ".wsummary";
74                                 m->openOutputFile(sumFile, outSum);
75                                 outputNames.push_back(sumFile);
76                                 
77                                 util = new SharedUtil();
78                                 string s; //to make work with setgroups
79                                 util->setGroups(globaldata->Groups, tmap->namesOfGroups, s, numGroups, "weighted");     //sets the groups the user wants to analyze
80                                 util->getCombos(groupComb, globaldata->Groups, numComp);
81                                 
82                                 weighted = new Weighted(tmap);
83                                 
84                         }
85                 }
86                 
87                 
88         }
89         catch(exception& e) {
90                 m->errorOut(e, "UnifracWeightedCommand", "UnifracWeightedCommand");
91                 exit(1);
92         }
93 }
94 //**********************************************************************************************************************
95
96 void UnifracWeightedCommand::help(){
97         try {
98                 m->mothurOut("The unifrac.weighted command can only be executed after a successful read.tree command.\n");
99                 m->mothurOut("The unifrac.weighted command parameters are groups, iters, distance and random.  No parameters are required.\n");
100                 m->mothurOut("The groups parameter allows you to specify which of the groups in your groupfile you would like analyzed.  You must enter at least 2 valid groups.\n");
101                 m->mothurOut("The group names are separated by dashes.  The iters parameter allows you to specify how many random trees you would like compared to your tree.\n");
102                 m->mothurOut("The distance parameter allows you to create a distance file from the results. The default is false.\n");
103                 m->mothurOut("The random parameter allows you to shut off the comparison to random trees. The default is false, meaning don't compare your trees with randomly generated trees.\n");
104                 m->mothurOut("The unifrac.weighted command should be in the following format: unifrac.weighted(groups=yourGroups, iters=yourIters).\n");
105                 m->mothurOut("Example unifrac.weighted(groups=A-B-C, iters=500).\n");
106                 m->mothurOut("The default value for groups is all the groups in your groupfile, and iters is 1000.\n");
107                 m->mothurOut("The unifrac.weighted command output two files: .weighted and .wsummary their descriptions are in the manual.\n");
108                 m->mothurOut("Note: No spaces between parameter labels (i.e. groups), '=' and parameters (i.e.yourGroups).\n\n");
109         }
110         catch(exception& e) {
111                 m->errorOut(e, "UnifracWeightedCommand", "help");
112                 exit(1);
113         }
114 }
115
116 /***********************************************************/
117 int UnifracWeightedCommand::execute() {
118         try {
119         
120                 if (abort == true) { return 0; }
121                 
122                 int start = time(NULL);
123                 
124                 //get weighted for users tree
125                 userData.resize(numComp,0);  //data[0] = weightedscore AB, data[1] = weightedscore AC...
126                 randomData.resize(numComp,0); //data[0] = weightedscore AB, data[1] = weightedscore AC...
127                                 
128                 //create new tree with same num nodes and leaves as users
129                 randT = new Tree();
130                 
131                 //get weighted scores for users trees
132                 for (int i = 0; i < T.size(); i++) {
133                         
134                         if (m->control_pressed) { delete randT; outSum.close(); for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());  } return 0; }
135
136                         counter = 0;
137                         rScores.resize(numComp);  //data[0] = weightedscore AB, data[1] = weightedscore AC...
138                         uScores.resize(numComp);  //data[0] = weightedscore AB, data[1] = weightedscore AC...
139                         
140                         if (random) {  
141                                 output = new ColumnFile(outputDir + m->getSimpleName(globaldata->getTreeFile())  + toString(i+1) + ".weighted", itersString);  
142                                 outputNames.push_back(outputDir + m->getSimpleName(globaldata->getTreeFile())  + toString(i+1) + ".weighted");
143                         } 
144
145                         userData = weighted->getValues(T[i], processors, outputDir);  //userData[0] = weightedscore
146                         
147                         if (m->control_pressed) { 
148                                 delete randT;
149                                 if (random) { delete output; }
150                                 outSum.close();
151                                 for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());  }
152                                 return 0; 
153                         }
154
155                         
156                         //save users score
157                         for (int s=0; s<numComp; s++) {
158                                 //add users score to vector of user scores
159                                 uScores[s].push_back(userData[s]);
160                                 
161                                 //save users tree score for summary file
162                                 utreeScores.push_back(userData[s]);
163                         }
164                         
165                         if (random) { 
166                                 vector<double> sums = weighted->getBranchLengthSums(T[i]); 
167                         
168                                 //calculate number of comparisons i.e. with groups A,B,C = AB, AC, BC = 3;
169                                 vector< vector<string> > namesOfGroupCombos;
170                                 for (int a=0; a<numGroups; a++) { 
171                                         for (int l = a+1; l < numGroups; l++) { 
172                                                 vector<string> groups; groups.push_back(globaldata->Groups[a]); groups.push_back(globaldata->Groups[l]);
173                                                 namesOfGroupCombos.push_back(groups);
174                                         }
175                                 }
176                         
177                                 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
178                                         if(processors != 1){
179                                                 int numPairs = namesOfGroupCombos.size();
180                                                 int numPairsPerProcessor = numPairs / processors;
181                                         
182                                                 for (int i = 0; i < processors; i++) {
183                                                         int startPos = i * numPairsPerProcessor;
184                                                         if(i == processors - 1){
185                                                                 numPairsPerProcessor = numPairs - i * numPairsPerProcessor;
186                                                         }
187                                                         lines.push_back(new linePair(startPos, numPairsPerProcessor));
188                                                 }
189                                         }
190                                 #endif
191
192                                 
193                                 //get scores for random trees
194                                 for (int j = 0; j < iters; j++) {
195                                         int count = 0;
196                                         
197                                         #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
198                                                 if(processors == 1){
199                                                         driver(T[i], randT, namesOfGroupCombos, 0, namesOfGroupCombos.size(), sums, rScores);
200                                                 }else{
201                                                         createProcesses(T[i], randT, namesOfGroupCombos, sums, rScores);
202                                                         for (int i = 0; i < lines.size(); i++) {  delete lines[i];  }  lines.clear();
203                                                 }
204                                         #else
205                                                 driver(T[i], randT, namesOfGroupCombos, 0, namesOfGroupCombos.size(), sums, rScores);
206                                         #endif
207                                         
208                                         if (m->control_pressed) { delete output; outSum.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str());  } return 0; }
209                                 }
210                                 
211                                 
212                                 //find the signifigance of the score for summary file
213                                 for (int f = 0; f < numComp; f++) {
214                                         //sort random scores
215                                         sort(rScores[f].begin(), rScores[f].end());
216                                         
217                                         //the index of the score higher than yours is returned 
218                                         //so if you have 1000 random trees the index returned is 100 
219                                         //then there are 900 trees with a score greater then you. 
220                                         //giving you a signifigance of 0.900
221                                         int index = findIndex(userData[f], f);    if (index == -1) { m->mothurOut("error in UnifracWeightedCommand"); m->mothurOutEndLine(); exit(1); } //error code
222                                         
223                                         //the signifigance is the number of trees with the users score or higher 
224                                         WScoreSig.push_back((iters-index)/(float)iters);
225                                 }
226                                 
227                                 //out << "Tree# " << i << endl;
228                                 calculateFreqsCumuls();
229                                 printWeightedFile();
230                                 
231                                 delete output;
232                         
233                         }
234                         
235                         //clear data
236                         rScores.clear();
237                         uScores.clear();
238                         validScores.clear();
239                 }
240                 
241                 
242                 if (m->control_pressed) { delete randT; outSum.close(); for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());  } return 0;  }
243                 
244                 printWSummaryFile();
245                 
246                 if (phylip) {   createPhylipFile();             }
247
248                 //clear out users groups
249                 globaldata->Groups.clear();
250                 
251                 delete randT;
252                 
253                 if (m->control_pressed) { 
254                         for (int i = 0; i < outputNames.size(); i++) {  remove(outputNames[i].c_str());  }
255                         return 0; 
256                 }
257                 
258                 m->mothurOut("It took " + toString(time(NULL) - start) + " secs to run unifrac.weighted."); m->mothurOutEndLine();
259                 
260                 m->mothurOutEndLine();
261                 m->mothurOut("Output File Names: "); m->mothurOutEndLine();
262                 for (int i = 0; i < outputNames.size(); i++) {  m->mothurOut(outputNames[i]); m->mothurOutEndLine();    }
263                 m->mothurOutEndLine();
264                 
265                 return 0;
266                 
267         }
268         catch(exception& e) {
269                 m->errorOut(e, "UnifracWeightedCommand", "execute");
270                 exit(1);
271         }
272 }
273 /**************************************************************************************************/
274
275 int UnifracWeightedCommand::createProcesses(Tree* t, Tree* randT, vector< vector<string> > namesOfGroupCombos, vector<double>& sums, vector< vector<double> >& scores) {
276         try {
277 #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
278                 int process = 0;
279                 int num = 0;
280                 vector<int> processIDS;
281                 
282                 EstOutput results;
283                 
284                 //loop through and create all the processes you want
285                 while (process != processors) {
286                         int pid = fork();
287                         
288                         if (pid > 0) {
289                                 processIDS.push_back(pid);  //create map from line number to pid so you can append files in correct order later
290                                 process++;
291                         }else if (pid == 0){
292                                 driver(t, randT, namesOfGroupCombos, lines[process]->start, lines[process]->num, sums, scores);
293                                 
294                                 m->mothurOut("Merging results."); m->mothurOutEndLine();
295                                 
296                                 //pass numSeqs to parent
297                                 ofstream out;
298                                 string tempFile = outputDir + toString(getpid()) + ".results.temp";
299                                 m->openOutputFile(tempFile, out);
300                                 out << results.size() << endl;
301                                 for (int i = lines[process]->start; i < (lines[process]->start + lines[process]->num); i++) {  out << results[i] << '\t';  } out << endl;
302                                 out.close();
303                                 
304                                 exit(0);
305                         }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
306                 }
307                 
308                 //force parent to wait until all the processes are done
309                 for (int i=0;i<processors;i++) { 
310                         int temp = processIDS[i];
311                         wait(&temp);
312                 }
313         
314                 //get data created by processes
315                 for (int i=0;i<processors;i++) { 
316                         ifstream in;
317                         string s = outputDir + toString(processIDS[i]) + ".results.temp";
318                         m->openInputFile(s, in);
319                         
320                         vector<double> r;
321                         
322                         //get quantiles
323                         while (!in.eof()) {
324                                 int num;
325                                 in >> num; 
326                                 
327                                 m->gobble(in);
328
329                                 double w; 
330                                 for (int j = 0; j < num; j++) {
331                                         in >> w;
332                                         r.push_back(w);
333                                 }
334                                 m->gobble(in);
335                         }
336                         in.close();
337                         remove(s.c_str());
338         
339                         //save quan in quantiles
340                         for (int j = 0; j < r.size(); j++) {
341                                 //put all values of r into results
342                                 results.push_back(r[j]);   
343                         }
344                 }
345                 
346                 m->mothurOut("DONE."); m->mothurOutEndLine(); m->mothurOutEndLine();
347                 
348                 return 0;
349 #endif          
350         }
351         catch(exception& e) {
352                 m->errorOut(e, "UnifracWeightedCommand", "createProcesses");
353                 exit(1);
354         }
355 }
356
357 /**************************************************************************************************/
358 int UnifracWeightedCommand::driver(Tree* t, Tree* randT, vector< vector<string> > namesOfGroupCombos, int start, int num, vector<double>& sums, vector< vector<double> >& scores) { 
359  try {
360                 int count = 0;
361                 int total = start+num;
362                 int twentyPercent = (total * 0.20);
363
364                 for (int h = start; h < (start+num); h++) {
365                 
366                         if (m->control_pressed) { return 0; }
367                 
368                         //initialize weighted score
369                         string groupA = namesOfGroupCombos[h][0]; 
370                         string groupB = namesOfGroupCombos[h][1];
371                         
372                         //copy T[i]'s info.
373                         randT->getCopy(t);
374                          
375                         //create a random tree with same topology as T[i], but different labels
376                         randT->assembleRandomUnifracTree(groupA, groupB);
377                         
378                         if (m->control_pressed) { delete randT;  return 0;  }
379
380
381                         //get wscore of random tree
382                         EstOutput randomData = weighted->getValues(randT, groupA, groupB, sums);
383                         
384                         if (m->control_pressed) { delete randT;  return 0;  }
385                                                                                 
386                         //save scores
387                         scores[h].push_back(randomData[0]);
388                         
389                         count++;
390
391                         //report progress
392                         if((h) % twentyPercent == 0){   m->mothurOut("Random comparison percentage complete: " + toString(int((h / (float)total) * 100.0))); m->mothurOutEndLine();             }
393                 }
394                 
395                 m->mothurOut("Random comparison percentage complete: 100"); m->mothurOutEndLine();
396                 
397                 return 0;
398
399         }
400         catch(exception& e) {
401                 m->errorOut(e, "UnifracWeightedCommand", "driver");
402                 exit(1);
403         }
404 }
405 /***********************************************************/
406 void UnifracWeightedCommand::printWeightedFile() {
407         try {
408                 vector<double> data;
409                 vector<string> tags;
410                 tags.push_back("Score"); tags.push_back("RandFreq"); tags.push_back("RandCumul");
411                 
412                 for(int a = 0; a < numComp; a++) {
413                         output->initFile(groupComb[a], tags);
414                         //print each line
415                         for (map<float,float>::iterator it = validScores.begin(); it != validScores.end(); it++) { 
416                                 data.push_back(it->first);  data.push_back(rScoreFreq[a][it->first]); data.push_back(rCumul[a][it->first]); 
417                                 output->output(data);
418                                 data.clear();
419                         } 
420                         output->resetFile();
421                 }
422         }
423         catch(exception& e) {
424                 m->errorOut(e, "UnifracWeightedCommand", "printWeightedFile");
425                 exit(1);
426         }
427 }
428
429
430 /***********************************************************/
431 void UnifracWeightedCommand::printWSummaryFile() {
432         try {
433                 //column headers
434                 outSum << "Tree#" << '\t' << "Groups" << '\t' << "WScore" << '\t' << "WSig" <<  endl;
435                 m->mothurOut("Tree#\tGroups\tWScore\tWSig"); m->mothurOutEndLine(); 
436                 
437                 //format output
438                 outSum.setf(ios::fixed, ios::floatfield); outSum.setf(ios::showpoint);
439                 
440                 //print each line
441                 int count = 0;
442                 for (int i = 0; i < T.size(); i++) { 
443                         for (int j = 0; j < numComp; j++) {
444                                 if (random) {
445                                         if (WScoreSig[count] > (1/(float)iters)) {
446                                                 outSum << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << setprecision(itersString.length()) << WScoreSig[count] << endl; 
447                                                 cout << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << setprecision(itersString.length()) << WScoreSig[count] << endl; 
448                                                 m->mothurOutJustToLog(toString(i+1) +"\t" + groupComb[j] +"\t" + toString(utreeScores[count]) +"\t" +  toString(WScoreSig[count])); m->mothurOutEndLine();  
449                                         }else{
450                                                 outSum << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << setprecision(itersString.length()) << "<" << (1/float(iters)) << endl; 
451                                                 cout << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << setprecision(itersString.length()) << "<" << (1/float(iters)) << endl; 
452                                                 m->mothurOutJustToLog(toString(i+1) +"\t" + groupComb[j] +"\t" + toString(utreeScores[count]) +"\t<" +  toString((1/float(iters)))); m->mothurOutEndLine();  
453                                         }
454                                 }else{
455                                         outSum << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << "0.00" << endl; 
456                                         cout << setprecision(6) << i+1 << '\t' << groupComb[j] << '\t' << utreeScores[count] << '\t' << "0.00" << endl; 
457                                         m->mothurOutJustToLog(toString(i+1) +"\t" + groupComb[j] +"\t" + toString(utreeScores[count]) +"\t0.00"); m->mothurOutEndLine(); 
458                                 }
459                                 count++;
460                         }
461                 }
462                 outSum.close();
463         }
464         catch(exception& e) {
465                 m->errorOut(e, "UnifracWeightedCommand", "printWSummaryFile");
466                 exit(1);
467         }
468 }
469 /***********************************************************/
470 void UnifracWeightedCommand::createPhylipFile() {
471         try {
472                 int count = 0;
473                 //for each tree
474                 for (int i = 0; i < T.size(); i++) { 
475                 
476                         string phylipFileName = outputDir + m->getSimpleName(globaldata->getTreeFile())  + toString(i+1) + ".weighted.dist";
477                         outputNames.push_back(phylipFileName);
478                         ofstream out;
479                         m->openOutputFile(phylipFileName, out);
480                         
481                         //output numSeqs
482                         out << globaldata->Groups.size() << endl;
483                         
484                         //make matrix with scores in it
485                         vector< vector<float> > dists;  dists.resize(globaldata->Groups.size());
486                         for (int i = 0; i < globaldata->Groups.size(); i++) {
487                                 dists[i].resize(globaldata->Groups.size(), 0.0);
488                         }
489                         
490                         //flip it so you can print it
491                         for (int r=0; r<globaldata->Groups.size(); r++) { 
492                                 for (int l = r+1; l < globaldata->Groups.size(); l++) {
493                                         dists[r][l] = utreeScores[count];
494                                         dists[l][r] = utreeScores[count];
495                                         count++;
496                                 }
497                         }
498
499                         //output to file
500                         for (int r=0; r<globaldata->Groups.size(); r++) { 
501                                 //output name
502                                 string name = globaldata->Groups[r];
503                                 if (name.length() < 10) { //pad with spaces to make compatible
504                                         while (name.length() < 10) {  name += " ";  }
505                                 }
506                                 out << name << '\t';
507                                 
508                                 //output distances
509                                 for (int l = 0; l < r; l++) {   out  << dists[r][l] << '\t';  }
510                                 out << endl;
511                         }
512                         out.close();
513                 }
514         }
515         catch(exception& e) {
516                 m->errorOut(e, "UnifracWeightedCommand", "createPhylipFile");
517                 exit(1);
518         }
519 }
520 /***********************************************************/
521 int UnifracWeightedCommand::findIndex(float score, int index) {
522         try{
523                 for (int i = 0; i < rScores[index].size(); i++) {
524                         if (rScores[index][i] >= score) {       return i;       }
525                 }
526                 return rScores[index].size();
527         }
528         catch(exception& e) {
529                 m->errorOut(e, "UnifracWeightedCommand", "findIndex");
530                 exit(1);
531         }
532 }
533
534 /***********************************************************/
535
536 void UnifracWeightedCommand::calculateFreqsCumuls() {
537         try {
538                 //clear out old tree values
539                 rScoreFreq.clear();
540                 rScoreFreq.resize(numComp);
541                 rCumul.clear();
542                 rCumul.resize(numComp);
543                 validScores.clear();
544         
545                 //calculate frequency
546                 for (int f = 0; f < numComp; f++) {
547                         for (int i = 0; i < rScores[f].size(); i++) { //looks like 0,0,1,1,1,2,4,7...  you want to make a map that say rScoreFreq[0] = 2, rScoreFreq[1] = 3...
548                                 validScores[rScores[f][i]] = rScores[f][i];
549                                 map<float,float>::iterator it = rScoreFreq[f].find(rScores[f][i]);
550                                 if (it != rScoreFreq[f].end()) {
551                                         rScoreFreq[f][rScores[f][i]]++;
552                                 }else{
553                                         rScoreFreq[f][rScores[f][i]] = 1;
554                                 }
555                         }
556                 }
557                 
558                 //calculate rcumul
559                 for(int a = 0; a < numComp; a++) {
560                         float rcumul = 1.0000;
561                         //this loop fills the cumulative maps and put 0.0000 in the score freq map to make it easier to print.
562                         for (map<float,float>::iterator it = validScores.begin(); it != validScores.end(); it++) {
563                                 //make rscoreFreq map and rCumul
564                                 map<float,float>::iterator it2 = rScoreFreq[a].find(it->first);
565                                 rCumul[a][it->first] = rcumul;
566                                 //get percentage of random trees with that info
567                                 if (it2 != rScoreFreq[a].end()) {  rScoreFreq[a][it->first] /= iters; rcumul-= it2->second;  }
568                                 else { rScoreFreq[a][it->first] = 0.0000; } //no random trees with that score
569                         }
570                 }
571
572         }
573         catch(exception& e) {
574                 m->errorOut(e, "UnifracWeightedCommand", "calculateFreqsCums");
575                 exit(1);
576         }
577 }
578
579 /***********************************************************/
580
581
582
583
584